OSDN Git Service

Return false if the identifier is not in the global module index.
authorVassil Vassilev <v.g.vassilev@gmail.com>
Fri, 19 Jun 2020 07:01:02 +0000 (07:01 +0000)
committerVassil Vassilev <v.g.vassilev@gmail.com>
Mon, 22 Jun 2020 08:03:11 +0000 (08:03 +0000)
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

clang/lib/Serialization/GlobalModuleIndex.cpp

index 958cca7..9192b3b 100644 (file)
@@ -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;