]> granicus.if.org Git - clang/commitdiff
[libclang/codecompletion] Make sure the top-level decl hash takes into account Import...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 24 Jun 2013 21:19:12 +0000 (21:19 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 24 Jun 2013 21:19:12 +0000 (21:19 +0000)
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

index 48cac1357c790c6d8aef28e14c258e877240d1b7..364d8f30405d7b42e8e317439ad17f4a2adbda34 100644 (file)
@@ -884,7 +884,15 @@ void AddTopLevelDeclarationToHash(Decl *D, unsigned &Hash) {
       Hash = llvm::HashString(NameStr, Hash);
     }
     return;
-  }  
+  }
+
+  if (ImportDecl *ImportD = dyn_cast<ImportDecl>(D)) {
+    if (Module *Mod = ImportD->getImportedModule()) {
+      std::string ModName = Mod->getFullModuleName();
+      Hash = llvm::HashString(ModName, Hash);
+    }
+    return;
+  }
 }
 
 class TopLevelDeclTrackerConsumer : public ASTConsumer {