]> granicus.if.org Git - clang/commitdiff
[PCH] Add some comments, per Ted's request.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 9 Feb 2012 07:46:54 +0000 (07:46 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 9 Feb 2012 07:46:54 +0000 (07:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150162 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ASTReaderDecl.cpp

index e2f4ae3a9b283a98d41bf0b1135373f707330f34..883edba5e31205d9f602c0c1748c87d4b114a2f1 100644 (file)
@@ -344,6 +344,8 @@ void ASTDeclReader::VisitDecl(Decl *D) {
   } else {
     DeclContext *SemaDC = ReadDeclAs<DeclContext>(Record, Idx);
     DeclContext *LexicalDC = ReadDeclAs<DeclContext>(Record, Idx);
+    // Avoid calling setLexicalDeclContext() directly because it uses
+    // Decl::getASTContext() internally which is unsafe during derialization.
     D->setDeclContextsImpl(SemaDC, LexicalDC, Reader.getContext());
   }
   D->setLocation(Reader.ReadSourceLocation(F, RawLocation));
@@ -351,6 +353,8 @@ void ASTDeclReader::VisitDecl(Decl *D) {
   if (Record[Idx++]) { // hasAttrs
     AttrVec Attrs;
     Reader.ReadAttributes(F, Attrs, Record, Idx);
+    // Avoid calling setAttrs() directly because it uses Decl::getASTContext()
+    // internally which is unsafe during derialization.
     D->setAttrsImpl(Attrs, Reader.getContext());
   }
   D->setImplicit(Record[Idx++]);