Skip to content

Commit

Permalink
Serialize source range info for TypeTraitExpr.
Browse files Browse the repository at this point in the history
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197764 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
jrose-apple committed Dec 20, 2013
1 parent 70ec449 commit c3390c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Serialization/ASTReaderStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1499,7 +1499,10 @@ void ASTStmtReader::VisitTypeTraitExpr(TypeTraitExpr *E) {
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);
Expand Down
1 change: 1 addition & 0 deletions lib/Serialization/ASTWriterStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1500,6 +1500,7 @@ void ASTStmtWriter::VisitTypeTraitExpr(TypeTraitExpr *E) {
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;
Expand Down

0 comments on commit c3390c0

Please sign in to comment.