diff options
author | Eric Liu <ioeric@google.com> | 2018-07-09 08:44:05 +0000 |
---|---|---|
committer | Eric Liu <ioeric@google.com> | 2018-07-09 08:44:05 +0000 |
commit | 8c97195cc891335316de345689c6b25b9d1eb2fb (patch) | |
tree | d6239356cc0b1cecb4720f345172ef9e0f5f9652 /clang/lib/Index/IndexSymbol.cpp | |
parent | a0010472cac3f8e3d39ec081c421c866e5781738 (diff) | |
download | bcm5719-llvm-8c97195cc891335316de345689c6b25b9d1eb2fb.tar.gz bcm5719-llvm-8c97195cc891335316de345689c6b25b9d1eb2fb.zip |
[Index] Add indexing support for MACROs.
Reviewers: akyrtzi, arphaman, sammccall
Reviewed By: sammccall
Subscribers: malaperle, sammccall, cfe-commits
Differential Revision: https://reviews.llvm.org/D48961
llvm-svn: 336524
Diffstat (limited to 'clang/lib/Index/IndexSymbol.cpp')
-rw-r--r-- | clang/lib/Index/IndexSymbol.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Index/IndexSymbol.cpp b/clang/lib/Index/IndexSymbol.cpp index 733d4dbc2f9..03b55ffe8a4 100644 --- a/clang/lib/Index/IndexSymbol.cpp +++ b/clang/lib/Index/IndexSymbol.cpp @@ -12,6 +12,7 @@ #include "clang/AST/DeclObjC.h" #include "clang/AST/DeclTemplate.h" #include "clang/AST/PrettyPrinter.h" +#include "clang/Lex/MacroInfo.h" using namespace clang; using namespace clang::index; @@ -348,6 +349,15 @@ SymbolInfo index::getSymbolInfo(const Decl *D) { return Info; } +SymbolInfo index::getSymbolInfoForMacro(const MacroInfo &) { + SymbolInfo Info; + Info.Kind = SymbolKind::Macro; + Info.SubKind = SymbolSubKind::None; + Info.Properties = SymbolPropertySet(); + Info.Lang = SymbolLanguage::C; + return Info; +} + bool index::applyForEachSymbolRoleInterruptible(SymbolRoleSet Roles, llvm::function_ref<bool(SymbolRole)> Fn) { #define APPLY_FOR_ROLE(Role) \ @@ -364,6 +374,7 @@ bool index::applyForEachSymbolRoleInterruptible(SymbolRoleSet Roles, APPLY_FOR_ROLE(Dynamic); APPLY_FOR_ROLE(AddressOf); APPLY_FOR_ROLE(Implicit); + APPLY_FOR_ROLE(Undefinition); APPLY_FOR_ROLE(RelationChildOf); APPLY_FOR_ROLE(RelationBaseOf); APPLY_FOR_ROLE(RelationOverrideOf); @@ -405,6 +416,7 @@ void index::printSymbolRoles(SymbolRoleSet Roles, raw_ostream &OS) { case SymbolRole::Dynamic: OS << "Dyn"; break; case SymbolRole::AddressOf: OS << "Addr"; break; case SymbolRole::Implicit: OS << "Impl"; break; + case SymbolRole::Undefinition: OS << "Undef"; break; case SymbolRole::RelationChildOf: OS << "RelChild"; break; case SymbolRole::RelationBaseOf: OS << "RelBase"; break; case SymbolRole::RelationOverrideOf: OS << "RelOver"; break; |