r184782 - [libclang/codecompletion] Make sure the top-level decl hash takes into account ImportDecls.

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon Jun 24 14:19:12 PDT 2013


Author: akirtzidis
Date: Mon Jun 24 16:19:12 2013
New Revision: 184782

URL: http://llvm.org/viewvc/llvm-project?rev=184782&view=rev
Log:
[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

Modified:
    cfe/trunk/lib/Frontend/ASTUnit.cpp

Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=184782&r1=184781&r2=184782&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Mon Jun 24 16:19:12 2013
@@ -884,7 +884,15 @@ void AddTopLevelDeclarationToHash(Decl *
       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 {





More information about the cfe-commits mailing list