]> granicus.if.org Git - clang/commitdiff
Fix reading of UsingDecl from PCH.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 8 Jul 2010 13:09:41 +0000 (13:09 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 8 Jul 2010 13:09:41 +0000 (13:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107871 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclCXX.h
lib/Frontend/PCHReaderDecl.cpp

index 1b7958a5fdfc2a607ab75a8be1aac7945dba3021..41474ab21e32cf49a53edbc49bf07ae3d6d103b0 100644 (file)
@@ -2082,6 +2082,9 @@ public:
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const UsingDecl *D) { return true; }
   static bool classofKind(Kind K) { return K == Using; }
+
+  friend class PCHDeclReader;
+  friend class PCHDeclWriter;
 };
 
 /// UnresolvedUsingValueDecl - Represents a dependent using
index 0233886abe798a832bd4decc005693604a917f6c..e392cd156e2d3a840720ff7d7a30a77f7fc4d76b 100644 (file)
@@ -609,7 +609,9 @@ void PCHDeclReader::VisitUsingDecl(UsingDecl *D) {
   // would avoid existence checks.
   unsigned NumShadows = Record[Idx++];
   for(unsigned I = 0; I != NumShadows; ++I) {
-    D->addShadowDecl(cast<UsingShadowDecl>(Reader.GetDecl(Record[Idx++])));
+    // Avoid invariant checking of UsingDecl::addShadowDecl, the decl may still
+    // be initializing.
+    D->Shadows.insert(cast<UsingShadowDecl>(Reader.GetDecl(Record[Idx++])));
   }
   D->setTypeName(Record[Idx++]);
   NamedDecl *Pattern = cast_or_null<NamedDecl>(Reader.GetDecl(Record[Idx++]));