From: Argyrios Kyrtzidis Date: Mon, 24 Jun 2013 21:19:12 +0000 (+0000) Subject: [libclang/codecompletion] Make sure the top-level decl hash takes into account Import... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f3ff6a709432e1131ff802d660def2fab2aea58;p=clang [libclang/codecompletion] Make sure the top-level decl hash takes into account ImportDecls. The top-level hash is used to determine if we need to update the global code-completion results. ImportDecls did not affect the hash so a newly introduced ImportDecl would not trigger an update of the global results. rdar://14202797 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184782 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 48cac1357c..364d8f3040 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -884,7 +884,15 @@ void AddTopLevelDeclarationToHash(Decl *D, unsigned &Hash) { Hash = llvm::HashString(NameStr, Hash); } return; - } + } + + if (ImportDecl *ImportD = dyn_cast(D)) { + if (Module *Mod = ImportD->getImportedModule()) { + std::string ModName = Mod->getFullModuleName(); + Hash = llvm::HashString(ModName, Hash); + } + return; + } } class TopLevelDeclTrackerConsumer : public ASTConsumer {