r197764 - Serialize source range info for TypeTraitExpr.
Jordan Rose
jordan_rose at apple.com
Thu Dec 19 17:26:47 PST 2013
Author: jrose
Date: Thu Dec 19 19:26:47 2013
New Revision: 197764
URL: http://llvm.org/viewvc/llvm-project?rev=197764&view=rev
Log:
Serialize source range info for TypeTraitExpr.
This caused some crazy crashes involving std::unordered_map being
deserialized from a PCH file and then template instantiation requiring
an explicit instantiation location; unfortunately I don't really know
how to come up with a minimal test case.
Modified:
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
Modified: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=197764&r1=197763&r2=197764&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Thu Dec 19 19:26:47 2013
@@ -1499,7 +1499,10 @@ void ASTStmtReader::VisitTypeTraitExpr(T
E->TypeTraitExprBits.NumArgs = Record[Idx++];
E->TypeTraitExprBits.Kind = Record[Idx++];
E->TypeTraitExprBits.Value = Record[Idx++];
-
+ SourceRange Range = ReadSourceRange(Record, Idx);
+ E->Loc = Range.getBegin();
+ E->RParenLoc = Range.getEnd();
+
TypeSourceInfo **Args = E->getTypeSourceInfos();
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
Args[I] = GetTypeSourceInfo(Record, Idx);
Modified: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=197764&r1=197763&r2=197764&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Thu Dec 19 19:26:47 2013
@@ -1500,6 +1500,7 @@ void ASTStmtWriter::VisitTypeTraitExpr(T
Record.push_back(E->TypeTraitExprBits.NumArgs);
Record.push_back(E->TypeTraitExprBits.Kind); // FIXME: Stable encoding
Record.push_back(E->TypeTraitExprBits.Value);
+ Writer.AddSourceRange(E->getSourceRange(), Record);
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
Writer.AddTypeSourceInfo(E->getArg(I), Record);
Code = serialization::EXPR_TYPE_TRAIT;
More information about the cfe-commits
mailing list