]> granicus.if.org Git - clang/commitdiff
Eliminate all but one caller of Decl::getPCHLevel()
authorDouglas Gregor <dgregor@apple.com>
Fri, 9 Sep 2011 23:07:59 +0000 (23:07 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 9 Sep 2011 23:07:59 +0000 (23:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139430 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ASTWriter.cpp
lib/Serialization/ASTWriterDecl.cpp

index 92692f0cd3d9e7c81c7fa8c0ead7e45621086e26..943d17741f8dc97237f2a4507c6de2cb008f845d 100644 (file)
@@ -3140,8 +3140,6 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls,
   for (FirstLatestDeclMap::iterator I = FirstLatestDecls.begin(), 
                                     E = FirstLatestDecls.end(); 
        I != E; ++I) {
-    assert(I->first->getPCHLevel() > I->second->getPCHLevel() &&
-           "Expected first & second to be in different PCHs");
     AddDeclRef(I->first, FirstLatestDeclIDs);
     AddDeclRef(I->second, FirstLatestDeclIDs);
   }
index 1192c308724c3640b6eb3b233a21f7743f711722..381cd126b74bdd7a09585b8c72b7898b1a8123a6 100644 (file)
@@ -1021,7 +1021,7 @@ void ASTDeclWriter::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) {
     // in a chained PCH, keep track of the association with the map so we can
     // update the first decl during AST reading.
     if (First->getMostRecentDeclaration() == D &&
-        First->getPCHLevel() > D->getPCHLevel()) {
+        First->isFromASTFile() && !D->isFromASTFile()) {
       assert(Writer.FirstLatestDecls.find(First)==Writer.FirstLatestDecls.end()
              && "The latest is already set");
       Writer.FirstLatestDecls[First] = D;
@@ -1243,7 +1243,7 @@ void ASTDeclWriter::VisitRedeclarable(Redeclarable<T> *D) {
   // in a chained PCH, keep track of the association with the map so we can
   // update the first decl during AST reading.
   if (ThisDecl != First && First->getMostRecentDeclaration() == ThisDecl &&
-      First->getPCHLevel() > ThisDecl->getPCHLevel()) {
+      First->isFromASTFile() && !ThisDecl->isFromASTFile()) {
     assert(Writer.FirstLatestDecls.find(First) == Writer.FirstLatestDecls.end()
            && "The latest is already set");
     Writer.FirstLatestDecls[First] = ThisDecl;