]> granicus.if.org Git - clang/commitdiff
Minor simplification, no functionality change.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sun, 12 Jul 2015 23:51:20 +0000 (23:51 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sun, 12 Jul 2015 23:51:20 +0000 (23:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242001 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ASTReader.cpp
lib/Serialization/ASTReaderDecl.cpp

index 80b5c77db0b14b9e14206e41ee0ef31c7f0ddfd8..275dfc5a6082fb5bf372fb93f8ce02a0ec9d5ca4 100644 (file)
@@ -5995,9 +5995,8 @@ bool ASTReader::isDeclIDFromModule(serialization::GlobalDeclID ID,
   if (ID < NUM_PREDEF_DECL_IDS)
     return false;
 
-  GlobalDeclMapType::const_iterator I = GlobalDeclMap.find(ID);
-  assert(I != GlobalDeclMap.end() && "Corrupted global declaration map");
-  return &M == I->second;
+  return ID - NUM_PREDEF_DECL_IDS >= M.BaseDeclID && 
+         ID - NUM_PREDEF_DECL_IDS < M.BaseDeclID + M.LocalNumDecls;
 }
 
 ModuleFile *ASTReader::getOwningModuleFile(const Decl *D) {
index 0c59ba83706683e5cd024482d5c7d3d758601320..1a0c5b58e7f6e3d59bfd6e5144aeef04d9012e86 100644 (file)
@@ -3465,19 +3465,8 @@ namespace {
                            M.RedeclarationsMap + M.LocalNumRedeclarationsInMap, 
                            Compare);
       if (Result == M.RedeclarationsMap + M.LocalNumRedeclarationsInMap ||
-          Result->FirstID != ID) {
-        // If we have a previously-canonical singleton declaration that was 
-        // merged into another redeclaration chain, create a trivial chain
-        // for this single declaration so that it will get wired into the 
-        // complete redeclaration chain.
-        if (GlobalID != CanonID && 
-            GlobalID - NUM_PREDEF_DECL_IDS >= M.BaseDeclID && 
-            GlobalID - NUM_PREDEF_DECL_IDS < M.BaseDeclID + M.LocalNumDecls) {
-          addToChain(Reader.GetDecl(GlobalID));
-        }
-        
+          Result->FirstID != ID)
         return;
-      }
 
       // Dig out all of the redeclarations.
       unsigned Offset = Result->Offset;
@@ -3519,8 +3508,6 @@ namespace {
       // Visit each of the declarations.
       for (unsigned I = 0, N = SearchDecls.size(); I != N; ++I)
         searchForID(M, SearchDecls[I]);
-      // FIXME: If none of the SearchDecls had local IDs in this module, can
-      // we avoid searching any ancestor module files?
       return false;
     }