Clean the project (#57)
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
namespace clice {
|
||||
|
||||
/// Represents a source location in a file, it is corresponding
|
||||
/// to the `clang::SourceLocation` but decoded.
|
||||
struct SourceLocation {
|
||||
/// The line number (1-based).
|
||||
uint32_t line;
|
||||
|
||||
/// The column number (1-based).
|
||||
uint32_t column;
|
||||
|
||||
/// The file name.
|
||||
std::string filename;
|
||||
};
|
||||
|
||||
/// Describes the context of a header file to uniquely identify its AST.
|
||||
/// A header file may generate different ASTs depending on the inclusion context.
|
||||
/// Even within the same source file, the AST may vary at different locations due
|
||||
/// to preprocessor directives, macro definitions, or other compilation settings.
|
||||
struct HeaderContext {
|
||||
/// The compilation command used to generate the AST for the source file.
|
||||
std::string command;
|
||||
|
||||
/// The inclusion chain of the header file.
|
||||
/// - The first element represents the header file itself.
|
||||
/// - The last element represents the top-level header file included in
|
||||
/// the source file that leads to this header.
|
||||
/// This chain helps reconstruct the inclusion context for the header file.
|
||||
std::vector<SourceLocation> includeChain;
|
||||
};
|
||||
|
||||
} // namespace clice
|
||||
@@ -1,41 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Support/Enum.h"
|
||||
|
||||
namespace clice {
|
||||
|
||||
struct RelationKind : refl::Enum<RelationKind, true, uint32_t> {
|
||||
enum Kind : uint32_t {
|
||||
Invalid,
|
||||
Declaration,
|
||||
Definition,
|
||||
Reference,
|
||||
WeakReference,
|
||||
// Write Relation.
|
||||
Read,
|
||||
Write,
|
||||
Interface,
|
||||
Implementation,
|
||||
/// When target is a type definition of source, source is possible type or constructor.
|
||||
TypeDefinition,
|
||||
|
||||
/// When target is a base class of source.
|
||||
Base,
|
||||
/// When target is a derived class of source.
|
||||
Derived,
|
||||
|
||||
/// When target is a constructor of source.
|
||||
Constructor,
|
||||
/// When target is a destructor of source.
|
||||
Destructor,
|
||||
|
||||
// When target is a caller of source.
|
||||
Caller,
|
||||
// When target is a callee of source.
|
||||
Callee,
|
||||
};
|
||||
|
||||
using Enum::Enum;
|
||||
};
|
||||
|
||||
} // namespace clice
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "llvm/ADT/FunctionExtras.h"
|
||||
#include "AST/SourceLocation.h"
|
||||
#include "clang/Lex/Token.h"
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "llvm/ADT/FunctionExtras.h"
|
||||
|
||||
namespace clice {
|
||||
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Support/Enum.h"
|
||||
#include "clang/AST/Decl.h"
|
||||
|
||||
namespace clice {
|
||||
|
||||
/// In the LSP, there are several different kinds, such as `SemanticTokenType`,
|
||||
/// `CompletionItemKind`, and `SymbolKind`. Unfortunately, these kinds do not cover all the semantic
|
||||
/// information we need. It's also inconsistent that some kinds exist in one category but not in
|
||||
/// another, for example, `Namespace` is present in `SemanticTokenType` but not in
|
||||
/// `CompletionItemKind`. To address this, we define our own `SymbolKind`, which will be used
|
||||
/// consistently across our responses to the client and in the index. Users who prefer to stick to
|
||||
/// standard LSP kinds can map our `SymbolKind` to the corresponding LSP kinds through
|
||||
/// configuration.
|
||||
struct SymbolKind : refl::Enum<SymbolKind, false, uint8_t> {
|
||||
enum Kind : uint8_t {
|
||||
Comment = 0, ///< C/C++ comments.
|
||||
Number, ///< C/C++ number literal.
|
||||
Character, ///< C/C++ character literal.
|
||||
String, ///< C/C++ string literal.
|
||||
Keyword, ///< C/C++ keyword.
|
||||
Directive, ///< C/C++ preprocessor directive, e.g. `#include`.
|
||||
Header, ///< C/C++ header name, e.g. `<iostream>` and `"foo.h"`.
|
||||
Module, ///< C++20 module name.
|
||||
Macro, ///< C/C++ macro.
|
||||
MacroParameter, ///< C/C++ macro parameter.
|
||||
Namespace, ///> C++ namespace.
|
||||
Class, ///> C/C++ class.
|
||||
Struct, ///> C/C++ struct.
|
||||
Union, ///> C/C++ union.
|
||||
Enum, ///> C/C++ enum.
|
||||
Type, ///> C/C++ type alias and C++ template type parameter.
|
||||
Field, ///> C/C++ field.
|
||||
EnumMember, ///> C/C++ enum member.
|
||||
Function, ///> C/C++ function.
|
||||
Method, ///> C++ method.
|
||||
Variable, ///> C/C++ variable, includes C++17 structured bindings.
|
||||
Parameter, ///> C/C++ parameter.
|
||||
Label, ///> C/C++ label.
|
||||
Concept, ///> C++20 concept.
|
||||
Attribute, ///> GNU/MSVC/C++11/C23 attribute.
|
||||
Operator, ///> C/C++ operator.
|
||||
Paren, ///> `(` and `)`.
|
||||
Bracket, ///> `[` and `]`.
|
||||
Brace, ///> `{` and `}`.
|
||||
Angle, ///> `<` and `>`.
|
||||
Conflict, ///> This token have multiple kinds.
|
||||
Invalid,
|
||||
};
|
||||
|
||||
using Enum::Enum;
|
||||
|
||||
constexpr inline static auto InvalidEnum = Kind::Invalid;
|
||||
|
||||
static SymbolKind from(const clang::Decl* decl);
|
||||
|
||||
static SymbolKind from(const clang::tok::TokenKind kind);
|
||||
};
|
||||
|
||||
struct SymbolModifiers : refl::Enum<SymbolModifiers, true, uint32_t> {
|
||||
enum Kind {
|
||||
Declaration = 0,
|
||||
Definition,
|
||||
Reference,
|
||||
};
|
||||
|
||||
using Enum::Enum;
|
||||
};
|
||||
|
||||
} // namespace clice
|
||||
|
||||
Reference in New Issue
Block a user