[clang] 46ea465 - Return false if the identifier is not in the global module index.

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 22 01:03:26 PDT 2020


Author: Vassil Vassilev
Date: 2020-06-22T08:03:11Z
New Revision: 46ea465b5b741fb0bf6e2cedd5cd6bf7026cd3c6

URL: https://github.com/llvm/llvm-project/commit/46ea465b5b741fb0bf6e2cedd5cd6bf7026cd3c6
DIFF: https://github.com/llvm/llvm-project/commit/46ea465b5b741fb0bf6e2cedd5cd6bf7026cd3c6.diff

LOG: Return false if the identifier is not in the global module index.

This allows clients to use the idiom:

if (GlobalIndex->lookupIdentifier(Name, FoundModules)) {
  // work on the FoundModules
}

This is also a minor performance improvent for clang.

Differential Revision: https://reviews.llvm.org/D81077

Added: 
    

Modified: 
    clang/lib/Serialization/GlobalModuleIndex.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp
index 958cca734572..9192b3b476bb 100644
--- a/clang/lib/Serialization/GlobalModuleIndex.cpp
+++ b/clang/lib/Serialization/GlobalModuleIndex.cpp
@@ -321,7 +321,7 @@ bool GlobalModuleIndex::lookupIdentifier(StringRef Name, HitSet &Hits) {
     = *static_cast<IdentifierIndexTable *>(IdentifierIndex);
   IdentifierIndexTable::iterator Known = Table.find(Name);
   if (Known == Table.end()) {
-    return true;
+    return false;
   }
 
   SmallVector<unsigned, 2> ModuleIDs = *Known;


        


More information about the cfe-commits mailing list