From 1f3ff6a709432e1131ff802d660def2fab2aea58 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Mon, 24 Jun 2013 21:19:12 +0000 Subject: [PATCH] [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 --- lib/Frontend/ASTUnit.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 { -- 2.40.0