diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2018-09-18 15:02:56 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2018-09-18 15:02:56 +0000 |
commit | 32e5d8626d006337416ae4a4190bd498e8a5478a (patch) | |
tree | 4b582e1928277a1f749a0fe27d0eecec752d4309 /clang/tools/c-index-test/core_main.cpp | |
parent | 9f9cdd41ccb90ed75fa8903307214f16e56ed51a (diff) | |
download | bcm5719-llvm-32e5d8626d006337416ae4a4190bd498e8a5478a.tar.gz bcm5719-llvm-32e5d8626d006337416ae4a4190bd498e8a5478a.zip |
[index] Enhance indexing for module references
* Create a USR for the occurrences of the 'module' symbol kind
* Record module references for each identifier in an import declaration
llvm-svn: 342484
Diffstat (limited to 'clang/tools/c-index-test/core_main.cpp')
-rw-r--r-- | clang/tools/c-index-test/core_main.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/clang/tools/c-index-test/core_main.cpp b/clang/tools/c-index-test/core_main.cpp index 9921a403a4b..b9c0f19a7fc 100644 --- a/clang/tools/c-index-test/core_main.cpp +++ b/clang/tools/c-index-test/core_main.cpp @@ -74,6 +74,7 @@ static cl::opt<std::string> static void printSymbolInfo(SymbolInfo SymInfo, raw_ostream &OS); static void printSymbolNameAndUSR(const Decl *D, ASTContext &Ctx, raw_ostream &OS); +static void printSymbolNameAndUSR(const clang::Module *Mod, raw_ostream &OS); namespace { @@ -132,8 +133,9 @@ public: return true; } - bool handleModuleOccurence(const ImportDecl *ImportD, SymbolRoleSet Roles, - SourceLocation Loc) override { + bool handleModuleOccurence(const ImportDecl *ImportD, + const clang::Module *Mod, + SymbolRoleSet Roles, SourceLocation Loc) override { ASTContext &Ctx = ImportD->getASTContext(); SourceManager &SM = Ctx.getSourceManager(); @@ -146,7 +148,8 @@ public: printSymbolInfo(getSymbolInfo(ImportD), OS); OS << " | "; - OS << ImportD->getImportedModule()->getFullModuleName() << " | "; + printSymbolNameAndUSR(Mod, OS); + OS << " | "; printSymbolRoles(Roles, OS); OS << " |\n"; @@ -308,6 +311,12 @@ static void printSymbolNameAndUSR(const Decl *D, ASTContext &Ctx, } } +static void printSymbolNameAndUSR(const clang::Module *Mod, raw_ostream &OS) { + assert(Mod); + OS << Mod->getFullModuleName() << " | "; + generateFullUSRForModule(Mod, OS); +} + //===----------------------------------------------------------------------===// // Command line processing. //===----------------------------------------------------------------------===// |