diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2016-02-29 07:56:07 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2016-02-29 07:56:07 +0000 |
| commit | 113387e08e55e28d0614373e168b5202bc83339a (patch) | |
| tree | 490ad63b80f576122a754da65bca0b7ea3909fdd /clang/lib/Index | |
| parent | a8b51c1e200a8f7f8cb274b5d8d744d94e0fdb59 (diff) | |
| download | bcm5719-llvm-113387e08e55e28d0614373e168b5202bc83339a.tar.gz bcm5719-llvm-113387e08e55e28d0614373e168b5202bc83339a.zip | |
[index] Print and test module import references.
llvm-svn: 262208
Diffstat (limited to 'clang/lib/Index')
| -rw-r--r-- | clang/lib/Index/IndexSymbol.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/Index/IndexingContext.cpp | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Index/IndexSymbol.cpp b/clang/lib/Index/IndexSymbol.cpp index 39812c4fe4f..62e2facde19 100644 --- a/clang/lib/Index/IndexSymbol.cpp +++ b/clang/lib/Index/IndexSymbol.cpp @@ -53,6 +53,9 @@ SymbolInfo index::getSymbolInfo(const Decl *D) { } else { switch (D->getKind()) { + case Decl::Import: + Info.Kind = SymbolKind::Module; + break; case Decl::Typedef: Info.Kind = SymbolKind::Typedef; break; case Decl::Function: diff --git a/clang/lib/Index/IndexingContext.cpp b/clang/lib/Index/IndexingContext.cpp index 9ac22f85e1d..1645a9ab0bd 100644 --- a/clang/lib/Index/IndexingContext.cpp +++ b/clang/lib/Index/IndexingContext.cpp @@ -58,7 +58,12 @@ bool IndexingContext::handleReference(const NamedDecl *D, SourceLocation Loc, } bool IndexingContext::importedModule(const ImportDecl *ImportD) { - SourceLocation Loc = ImportD->getLocation(); + SourceLocation Loc; + auto IdLocs = ImportD->getIdentifierLocs(); + if (!IdLocs.empty()) + Loc = IdLocs.front(); + else + Loc = ImportD->getLocation(); SourceManager &SM = Ctx->getSourceManager(); Loc = SM.getFileLoc(Loc); if (Loc.isInvalid()) @@ -85,7 +90,7 @@ bool IndexingContext::importedModule(const ImportDecl *ImportD) { } } - SymbolRoleSet Roles{}; + SymbolRoleSet Roles = (unsigned)SymbolRole::Reference; if (ImportD->isImplicit()) Roles |= (unsigned)SymbolRole::Implicit; |

