[cfe-commits] r164932 - in /cfe/trunk: lib/Serialization/ASTReader.cpp test/Modules/Inputs/redecl-merge-left.h

Axel Naumann Axel.Naumann at cern.ch
Mon Oct 1 02:51:28 PDT 2012


Author: axel
Date: Mon Oct  1 04:51:27 2012
New Revision: 164932

URL: http://llvm.org/viewvc/llvm-project?rev=164932&view=rev
Log:
The Redeclarable part of named decls is read before their name.
Lookup can nevertheless find them due to the serialized lookup table.
For instance when reading a template decl's templatedDecl, it will search for existing decls that it could be a redeclaration of, and find the half-read template decl.
Thus there is no point in asserting the names of decls.

Modified:
    cfe/trunk/lib/Serialization/ASTReader.cpp
    cfe/trunk/test/Modules/Inputs/redecl-merge-left.h

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=164932&r1=164931&r2=164932&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Mon Oct  1 04:51:27 2012
@@ -4950,8 +4950,10 @@
           continue;
 
         if (ND->getDeclName() != This->Name) {
-          assert(!This->Name.getCXXNameType().isNull() && 
-                 "Name mismatch without a type");
+          // A name might be null because the decl's redeclarable part is
+          // currently read before reading its name. The lookup is triggered by
+          // building that decl (likely indirectly), and so it is later in the
+          // sense of "already existing" and can be ignored here.
           continue;
         }
       

Modified: cfe/trunk/test/Modules/Inputs/redecl-merge-left.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/redecl-merge-left.h?rev=164932&r1=164931&r2=164932&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/redecl-merge-left.h (original)
+++ cfe/trunk/test/Modules/Inputs/redecl-merge-left.h Mon Oct  1 04:51:27 2012
@@ -88,12 +88,14 @@
 public:
   void push_back(int);
 };
-
 namespace N {
-template<typename T> class Set {
-public:
-  void insert(T);
-};
+  template<typename T> class Set;
+}
+namespace N {
+  template<typename T> class Set {
+  public:
+    void insert(T);
+  };
 }
 #endif
 





More information about the cfe-commits mailing list