<div dir="ltr">This breaks the build bots:<div><a href="http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_check/2389/">http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_check/2389/</a><br></div><div><br></div><div>Please fix.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 22, 2015 at 7:00 AM, Vince Harron <span dir="ltr"><<a href="mailto:vince@nethacker.com" target="_blank">vince@nethacker.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: vharron<br>
Date: Sun Mar 22 00:59:59 2015<br>
New Revision: 232905<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=232905&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=232905&view=rev</a><br>
Log:<br>
Reverting r232793 until some new LLDB failures are discussed<br>
<br>
<br>
Modified:<br>
    cfe/trunk/include/clang/AST/DeclBase.h<br>
    cfe/trunk/lib/AST/ASTContext.cpp<br>
    cfe/trunk/lib/AST/DeclBase.cpp<br>
    cfe/trunk/lib/Sema/IdentifierResolver.cpp<br>
    cfe/trunk/lib/Sema/SemaLookup.cpp<br>
    cfe/trunk/lib/Serialization/ASTReader.cpp<br>
    cfe/trunk/test/Modules/cxx-templates.cpp<br>
    cfe/trunk/test/Modules/odr.cpp<br>
    cfe/trunk/test/Modules/redecl-add-after-load.cpp<br>
<br>
Modified: cfe/trunk/include/clang/AST/DeclBase.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=232905&r1=232904&r2=232905&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=232905&r1=232904&r2=232905&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/AST/DeclBase.h (original)<br>
+++ cfe/trunk/include/clang/AST/DeclBase.h Sun Mar 22 00:59:59 2015<br>
@@ -1722,6 +1722,8 @@ private:<br>
   friend class DependentDiagnostic;<br>
   StoredDeclsMap *CreateStoredDeclsMap(ASTContext &C) const;<br>
<br>
+  template<decl_iterator (DeclContext::*Begin)() const,<br>
+           decl_iterator (DeclContext::*End)() const><br>
   void buildLookupImpl(DeclContext *DCtx, bool Internal);<br>
   void makeDeclVisibleInContextWithFlags(NamedDecl *D, bool Internal,<br>
                                          bool Rediscoverable);<br>
<br>
Modified: cfe/trunk/lib/AST/ASTContext.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=232905&r1=232904&r2=232905&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=232905&r1=232904&r2=232905&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/ASTContext.cpp (original)<br>
+++ cfe/trunk/lib/AST/ASTContext.cpp Sun Mar 22 00:59:59 2015<br>
@@ -7946,7 +7946,7 @@ static GVALinkage basicGVALinkageForVari<br>
     while (LexicalContext && !isa<FunctionDecl>(LexicalContext))<br>
       LexicalContext = LexicalContext->getLexicalParent();<br>
<br>
-    // Let the static local variable inherit its linkage from the nearest<br>
+    // Let the static local variable inherit it's linkage from the nearest<br>
     // enclosing function.<br>
     if (LexicalContext)<br>
       StaticLocalLinkage =<br>
<br>
Modified: cfe/trunk/lib/AST/DeclBase.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=232905&r1=232904&r2=232905&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=232905&r1=232904&r2=232905&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/DeclBase.cpp (original)<br>
+++ cfe/trunk/lib/AST/DeclBase.cpp Sun Mar 22 00:59:59 2015<br>
@@ -1263,13 +1263,15 @@ static bool shouldBeHidden(NamedDecl *D)<br>
 StoredDeclsMap *DeclContext::buildLookup() {<br>
   assert(this == getPrimaryContext() && "buildLookup called on non-primary DC");<br>
<br>
+  // FIXME: Should we keep going if hasExternalVisibleStorage?<br>
   if (!LookupPtr.getInt())<br>
     return LookupPtr.getPointer();<br>
<br>
   SmallVector<DeclContext *, 2> Contexts;<br>
   collectAllContexts(Contexts);<br>
   for (unsigned I = 0, N = Contexts.size(); I != N; ++I)<br>
-    buildLookupImpl(Contexts[I], hasExternalVisibleStorage());<br>
+    buildLookupImpl<&DeclContext::decls_begin,<br>
+                    &DeclContext::decls_end>(Contexts[I], false);<br>
<br>
   // We no longer have any lazy decls.<br>
   LookupPtr.setInt(false);<br>
@@ -1280,8 +1282,13 @@ StoredDeclsMap *DeclContext::buildLookup<br>
 /// declarations contained within DCtx, which will either be this<br>
 /// DeclContext, a DeclContext linked to it, or a transparent context<br>
 /// nested within it.<br>
+template<DeclContext::decl_iterator (DeclContext::*Begin)() const,<br>
+         DeclContext::decl_iterator (DeclContext::*End)() const><br>
 void DeclContext::buildLookupImpl(DeclContext *DCtx, bool Internal) {<br>
-  for (Decl *D : DCtx->noload_decls()) {<br>
+  for (decl_iterator I = (DCtx->*Begin)(), E = (DCtx->*End)();<br>
+       I != E; ++I) {<br>
+    Decl *D = *I;<br>
+<br>
     // Insert this declaration into the lookup structure, but only if<br>
     // it's semantically within its decl context. Any other decls which<br>
     // should be found in this context are added eagerly.<br>
@@ -1302,7 +1309,7 @@ void DeclContext::buildLookupImpl(DeclCo<br>
     // context (recursively).<br>
     if (DeclContext *InnerCtx = dyn_cast<DeclContext>(D))<br>
       if (InnerCtx->isTransparentContext() || InnerCtx->isInlineNamespace())<br>
-        buildLookupImpl(InnerCtx, Internal);<br>
+        buildLookupImpl<Begin, End>(InnerCtx, Internal);<br>
   }<br>
 }<br>
<br>
@@ -1381,8 +1388,26 @@ DeclContext::noload_lookup(DeclarationNa<br>
   if (PrimaryContext != this)<br>
     return PrimaryContext->noload_lookup(Name);<br>
<br>
-  // Note that buildLookups does not trigger any deserialization.<br>
-  StoredDeclsMap *Map = buildLookup();<br>
+  StoredDeclsMap *Map = LookupPtr.getPointer();<br>
+  if (LookupPtr.getInt()) {<br>
+    // Carefully build the lookup map, without deserializing anything.<br>
+    SmallVector<DeclContext *, 2> Contexts;<br>
+    collectAllContexts(Contexts);<br>
+    for (unsigned I = 0, N = Contexts.size(); I != N; ++I)<br>
+      buildLookupImpl<&DeclContext::noload_decls_begin,<br>
+                      &DeclContext::noload_decls_end>(Contexts[I], true);<br>
+<br>
+    // We no longer have any lazy decls.<br>
+    LookupPtr.setInt(false);<br>
+<br>
+    // There may now be names for which we have local decls but are<br>
+    // missing the external decls. FIXME: Just set the hasExternalDecls<br>
+    // flag on those names that have external decls.<br>
+    NeedToReconcileExternalVisibleStorage = true;<br>
+<br>
+    Map = LookupPtr.getPointer();<br>
+  }<br>
+<br>
   if (!Map)<br>
     return lookup_result();<br>
<br>
<br>
Modified: cfe/trunk/lib/Sema/IdentifierResolver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/IdentifierResolver.cpp?rev=232905&r1=232904&r2=232905&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/IdentifierResolver.cpp?rev=232905&r1=232904&r2=232905&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/IdentifierResolver.cpp (original)<br>
+++ cfe/trunk/lib/Sema/IdentifierResolver.cpp Sun Mar 22 00:59:59 2015<br>
@@ -98,7 +98,7 @@ bool IdentifierResolver::isDeclInScope(D<br>
                                        bool AllowInlineNamespace) const {<br>
   Ctx = Ctx->getRedeclContext();<br>
<br>
-  if (Ctx->isFunctionOrMethod() || (S && S->isFunctionPrototypeScope())) {<br>
+  if (Ctx->isFunctionOrMethod() || S->isFunctionPrototypeScope()) {<br>
     // Ignore the scopes associated within transparent declaration contexts.<br>
     while (S->getEntity() && S->getEntity()->isTransparentContext())<br>
       S = S->getParent();<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=232905&r1=232904&r2=232905&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=232905&r1=232904&r2=232905&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Sun Mar 22 00:59:59 2015<br>
@@ -3021,45 +3021,17 @@ static void LookupVisibleDecls(DeclConte<br>
   if (Visited.visitedContext(Ctx->getPrimaryContext()))<br>
     return;<br>
<br>
-  // Outside C++, lookup results for the TU live on identifiers.<br>
-  if (isa<TranslationUnitDecl>(Ctx) &&<br>
-      !Result.getSema().getLangOpts().CPlusPlus) {<br>
-    auto &S = Result.getSema();<br>
-    auto &Idents = S.Context.Idents;<br>
-<br>
-    // Ensure all external identifiers are in the identifier table.<br>
-    if (IdentifierInfoLookup *External = Idents.getExternalIdentifierLookup()) {<br>
-      std::unique_ptr<IdentifierIterator> Iter(External->getIdentifiers());<br>
-      for (StringRef Name = Iter->Next(); !Name.empty(); Name = Iter->Next())<br>
-        Idents.get(Name);<br>
-    }<br>
-<br>
-    // Walk all lookup results in the TU for each identifier.<br>
-    for (const auto &Ident : Idents) {<br>
-      for (auto I = S.IdResolver.begin(Ident.getValue()),<br>
-                E = S.IdResolver.end();<br>
-           I != E; ++I) {<br>
-        if (S.IdResolver.isDeclInScope(*I, Ctx)) {<br>
-          if (NamedDecl *ND = Result.getAcceptableDecl(*I)) {<br>
-            Consumer.FoundDecl(ND, Visited.checkHidden(ND), Ctx, InBaseClass);<br>
-            Visited.add(ND);<br>
-          }<br>
-        }<br>
-      }<br>
-    }<br>
-<br>
-    return;<br>
-  }<br>
-<br>
   if (CXXRecordDecl *Class = dyn_cast<CXXRecordDecl>(Ctx))<br>
     Result.getSema().ForceDeclarationOfImplicitMembers(Class);<br>
<br>
   // Enumerate all of the results in this context.<br>
   for (const auto &R : Ctx->lookups()) {<br>
-    for (auto *D : R) {<br>
-      if (auto *ND = Result.getAcceptableDecl(D)) {<br>
-        Consumer.FoundDecl(ND, Visited.checkHidden(ND), Ctx, InBaseClass);<br>
-        Visited.add(ND);<br>
+    for (auto *I : R) {<br>
+      if (NamedDecl *ND = dyn_cast<NamedDecl>(I)) {<br>
+        if ((ND = Result.getAcceptableDecl(ND))) {<br>
+          Consumer.FoundDecl(ND, Visited.checkHidden(ND), Ctx, InBaseClass);<br>
+          Visited.add(ND);<br>
+        }<br>
       }<br>
     }<br>
   }<br>
<br>
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=232905&r1=232904&r2=232905&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=232905&r1=232904&r2=232905&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Sun Mar 22 00:59:59 2015<br>
@@ -2835,8 +2835,6 @@ ASTReader::ReadASTBlock(ModuleFile &F, u<br>
     }<br>
<br>
     case EAGERLY_DESERIALIZED_DECLS:<br>
-      // FIXME: Skip reading this record if our ASTConsumer doesn't care<br>
-      // about "interesting" decls (for instance, if we're building a module).<br>
       for (unsigned I = 0, N = Record.size(); I != N; ++I)<br>
         EagerlyDeserializedDecls.push_back(getGlobalDeclID(F, Record[I]));<br>
       break;<br>
@@ -6834,12 +6832,6 @@ void ASTReader::PassInterestingDeclsToCo<br>
   SaveAndRestore<bool> GuardPassingDeclsToConsumer(PassingDeclsToConsumer,<br>
                                                    true);<br>
<br>
-  // Ensure that we've loaded all potentially-interesting declarations<br>
-  // that need to be eagerly loaded.<br>
-  for (auto ID : EagerlyDeserializedDecls)<br>
-    GetDecl(ID);<br>
-  EagerlyDeserializedDecls.clear();<br>
-<br>
   while (!InterestingDecls.empty()) {<br>
     Decl *D = InterestingDecls.front();<br>
     InterestingDecls.pop_front();<br>
@@ -6858,8 +6850,17 @@ void ASTReader::PassInterestingDeclToCon<br>
 void ASTReader::StartTranslationUnit(ASTConsumer *Consumer) {<br>
   this->Consumer = Consumer;<br>
<br>
-  if (Consumer)<br>
-    PassInterestingDeclsToConsumer();<br>
+  if (!Consumer)<br>
+    return;<br>
+<br>
+  for (unsigned I = 0, N = EagerlyDeserializedDecls.size(); I != N; ++I) {<br>
+    // Force deserialization of this decl, which will cause it to be queued for<br>
+    // passing to the consumer.<br>
+    GetDecl(EagerlyDeserializedDecls[I]);<br>
+  }<br>
+  EagerlyDeserializedDecls.clear();<br>
+<br>
+  PassInterestingDeclsToConsumer();<br>
<br>
   if (DeserializationListener)<br>
     DeserializationListener->ReaderInitialized(this);<br>
<br>
Modified: cfe/trunk/test/Modules/cxx-templates.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/cxx-templates.cpp?rev=232905&r1=232904&r2=232905&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/cxx-templates.cpp?rev=232905&r1=232904&r2=232905&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Modules/cxx-templates.cpp (original)<br>
+++ cfe/trunk/test/Modules/cxx-templates.cpp Sun Mar 22 00:59:59 2015<br>
@@ -1,7 +1,7 @@<br>
 // RUN: rm -rf %t<br>
 // RUN: not %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump-lookups | FileCheck %s --check-prefix=CHECK-GLOBAL<br>
 // RUN: not %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump-lookups -ast-dump-filter N | FileCheck %s --check-prefix=CHECK-NAMESPACE-N<br>
-// RUN: not %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump -ast-dump-filter SomeTemplate | FileCheck %s --check-prefix=CHECK-DUMP<br>
+// RUN: not %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++11 -ast-dump | FileCheck %s --check-prefix=CHECK-DUMP<br>
 // RUN: %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11<br>
 // RUN: %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 -DEARLY_IMPORT<br>
<br>
@@ -125,10 +125,9 @@ void g() {<br>
 static_assert(Outer<int>::Inner<int>::f() == 1, "");<br>
 static_assert(Outer<int>::Inner<int>::g() == 2, "");<br>
<br>
-// FIXME: We're too lazy in merging class definitions to find the definition<br>
-// of this function.<br>
-static_assert(MergeTemplateDefinitions<int>::f() == 1, ""); // expected-error {{constant expression}} expected-note {{undefined}}<br>
-// expected-note@cxx-templates-c.h:10 {{here}}<br>
+#ifndef EARLY_IMPORT<br>
+// FIXME: The textual inclusion above shouldn't cause this to fail!<br>
+static_assert(MergeTemplateDefinitions<int>::f() == 1, "");<br>
 static_assert(MergeTemplateDefinitions<int>::g() == 2, "");<br>
<br>
 RedeclaredAsFriend<int> raf1;<br>
@@ -141,6 +140,7 @@ MergeSpecializations<int[]>::partially_s<br>
 MergeSpecializations<char>::explicitly_specialized_in_a spec_in_a_2;<br>
 MergeSpecializations<double>::explicitly_specialized_in_b spec_in_b_2;<br>
 MergeSpecializations<bool>::explicitly_specialized_in_c spec_in_c_2;<br>
+#endif<br>
<br>
 MergeAnonUnionMember<> maum_main;<br>
 typedef DontWalkPreviousDeclAfterMerging<int> dwpdam_typedef_2;<br>
<br>
Modified: cfe/trunk/test/Modules/odr.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/odr.cpp?rev=232905&r1=232904&r2=232905&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/odr.cpp?rev=232905&r1=232904&r2=232905&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Modules/odr.cpp (original)<br>
+++ cfe/trunk/test/Modules/odr.cpp Sun Mar 22 00:59:59 2015<br>
@@ -15,9 +15,9 @@ bool b = F<int>{0} == F<int>{1};<br>
 int x = f() + g();<br>
<br>
 // expected-note@a.h:5 {{definition has no member 'e2'}}<br>
-// expected-note@b.h:3 {{declaration of 'f' does not match}}<br>
-// expected-note@b.h:1 {{definition has no member 'n'}}<br>
+// expected-note@a.h:3 {{declaration of 'f' does not match}}<br>
+// expected-note@a.h:1 {{definition has no member 'm'}}<br>
<br>
 // expected-error@b.h:5 {{'E::e2' from module 'b' is not present in definition of 'E' in module 'a'}}<br>
-// expected-error@a.h:3 {{'Y::f' from module 'a' is not present in definition of 'Y' in module 'b'}}<br>
-// expected-error@a.h:2 {{'Y::n' from module 'a' is not present in definition of 'Y' in module 'b'}}<br>
+// expected-error@b.h:3 {{'Y::f' from module 'b' is not present in definition of 'Y' in module 'a'}}<br>
+// expected-error@b.h:2 {{'Y::m' from module 'b' is not present in definition of 'Y' in module 'a'}}<br>
<br>
Modified: cfe/trunk/test/Modules/redecl-add-after-load.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/redecl-add-after-load.cpp?rev=232905&r1=232904&r2=232905&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/redecl-add-after-load.cpp?rev=232905&r1=232904&r2=232905&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Modules/redecl-add-after-load.cpp (original)<br>
+++ cfe/trunk/test/Modules/redecl-add-after-load.cpp Sun Mar 22 00:59:59 2015<br>
@@ -29,7 +29,7 @@ struct D {<br>
   static constexpr int function(); // expected-note {{here}}<br>
 };<br>
 typedef D::A DB;<br>
-constexpr int D_test(bool b) { return b ? D::variable : D::function(); } // expected-note {{undefined}}<br>
+constexpr int D_test(bool b) { return b ? D::variable : D::function(); } // expected-note {{subexpression}} expected-note {{undefined}}<br>
 #endif<br>
<br>
 @import redecl_add_after_load;<br>
@@ -54,6 +54,6 @@ constexpr int merged_struct_variable_tes<br>
 constexpr int merged_struct_function_test = D_test(false);<br>
 #ifndef IMPORT_DECLS<br>
 // expected-error@-4 {{incomplete}}<br>
-// @-4: definition of D::variable must be emitted, so it gets imported eagerly<br>
+// expected-error@-4 {{constant}} expected-note@-4 {{in call to}}<br>
 // expected-error@-4 {{constant}} expected-note@-4 {{in call to}}<br>
 #endif<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>