[cfe-commits] r150162 - /cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Wed Feb 8 23:46:54 PST 2012
Author: akirtzidis
Date: Thu Feb 9 01:46:54 2012
New Revision: 150162
URL: http://llvm.org/viewvc/llvm-project?rev=150162&view=rev
Log:
[PCH] Add some comments, per Ted's request.
Modified:
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=150162&r1=150161&r2=150162&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Thu Feb 9 01:46:54 2012
@@ -344,6 +344,8 @@
} 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 @@
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++]);
More information about the cfe-commits
mailing list