diff options
| author | 2019-06-23 21:36:31 +0000 | |
|---|---|---|
| committer | 2019-06-23 21:36:31 +0000 | |
| commit | 23f101f37937a1bd4a29726cab2f76e0fb038b35 (patch) | |
| tree | f7da7d6b32c2e07114da399150bfa88d72187012 /gnu/llvm/tools/clang/lib/Index/IndexingContext.cpp | |
| parent | sort previous; ok deraadt (diff) | |
| download | wireguard-openbsd-23f101f37937a1bd4a29726cab2f76e0fb038b35.tar.xz wireguard-openbsd-23f101f37937a1bd4a29726cab2f76e0fb038b35.zip | |
Import LLVM 8.0.0 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/tools/clang/lib/Index/IndexingContext.cpp')
| -rw-r--r-- | gnu/llvm/tools/clang/lib/Index/IndexingContext.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/gnu/llvm/tools/clang/lib/Index/IndexingContext.cpp b/gnu/llvm/tools/clang/lib/Index/IndexingContext.cpp index 333f9dc3091..bba6c8390b5 100644 --- a/gnu/llvm/tools/clang/lib/Index/IndexingContext.cpp +++ b/gnu/llvm/tools/clang/lib/Index/IndexingContext.cpp @@ -80,11 +80,27 @@ bool IndexingContext::handleReference(const NamedDecl *D, SourceLocation Loc, RefE, RefD, DC); } +static void reportModuleReferences(const Module *Mod, + ArrayRef<SourceLocation> IdLocs, + const ImportDecl *ImportD, + IndexDataConsumer &DataConsumer) { + if (!Mod) + return; + reportModuleReferences(Mod->Parent, IdLocs.drop_back(), ImportD, + DataConsumer); + DataConsumer.handleModuleOccurence(ImportD, Mod, + (SymbolRoleSet)SymbolRole::Reference, + IdLocs.back()); +} + bool IndexingContext::importedModule(const ImportDecl *ImportD) { + if (ImportD->isInvalidDecl()) + return true; + SourceLocation Loc; auto IdLocs = ImportD->getIdentifierLocs(); if (!IdLocs.empty()) - Loc = IdLocs.front(); + Loc = IdLocs.back(); else Loc = ImportD->getLocation(); @@ -108,11 +124,17 @@ bool IndexingContext::importedModule(const ImportDecl *ImportD) { } } + const Module *Mod = ImportD->getImportedModule(); + if (!ImportD->isImplicit() && Mod->Parent && !IdLocs.empty()) { + reportModuleReferences(Mod->Parent, IdLocs.drop_back(), ImportD, + DataConsumer); + } + SymbolRoleSet Roles = (unsigned)SymbolRole::Declaration; if (ImportD->isImplicit()) Roles |= (unsigned)SymbolRole::Implicit; - return DataConsumer.handleModuleOccurence(ImportD, Roles, Loc); + return DataConsumer.handleModuleOccurence(ImportD, Mod, Roles, Loc); } bool IndexingContext::isTemplateImplicitInstantiation(const Decl *D) { |
