r197764 - Serialize source range info for TypeTraitExpr.
Alp Toker
alp at nuanti.com
Thu Dec 19 21:39:16 PST 2013
On 20/12/2013 01:26, Jordan Rose wrote:
> 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.
Thanks for the fix. That's a really unfortunate failure mode.
Wonder how many other missing SourceLocations are reducing QoI with PCH
/ modules.
Looking forward to the day we generate the 25KLoc of serializers with a
libclang tablegen plugin.
Alp.
>
> 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;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
--
http://www.nuanti.com
the browser experts
More information about the cfe-commits
mailing list