[cfe-commits] [PATCH] Cleanup of code that should call setContainsUnexpandedParameterPack

Douglas Gregor dgregor at apple.com
Sun Mar 6 09:40:10 PST 2011


On Mar 2, 2011, at 8:01 PM, John Wiegley wrote:

> This patch authored by Eric Niebler <eric at boostpro.com>.
> 
> This is a very minor change to some code that sets
> ExprBits.ContainsUnexpandedParameterPack directly, but should really be
> calling the accessor function setContainsUnexpandedParameterPack.
> 
> John
> 
> Author: Eric Niebler <eric at boostpro.com>
> Date:   Wed Mar 2 22:57:57 2011 -0500
> 
>    Cleanup of code that should call setContainsUnexpandedParameterPack.
> 
> diff --git a/lib/Serialization/ASTReaderStmt.cpp b/lib/Serialization/ASTReaderStmt.cpp
> index 24df03d..886acae 100644
> --- a/lib/Serialization/ASTReaderStmt.cpp
> +++ b/lib/Serialization/ASTReaderStmt.cpp
> @@ -418,7 +418,7 @@ void ASTStmtReader::VisitExpr(Expr *E) {
>   E->setType(Reader.GetType(Record[Idx++]));
>   E->setTypeDependent(Record[Idx++]);
>   E->setValueDependent(Record[Idx++]);
> -  E->ExprBits.ContainsUnexpandedParameterPack = Record[Idx++];
> +  E->setContainsUnexpandedParameterPack(static_cast<bool>(Record[Idx++]));
>   E->setValueKind(static_cast<ExprValueKind>(Record[Idx++]));
>   E->setObjectKind(static_cast<ExprObjectKind>(Record[Idx++]));
>   assert(Idx == NumExprFields && "Incorrect expression field count");

We've actually been going to go the opposite way with this, so that the ASTReader pokes directly at bits in the AST nodes rather than going through mutators, because (1) mutators sometimes have side effects that we can't handle at deserialization time, and (2) we're trying to eliminate unnecessary mutators from the ASTs, since they aren't generally mutable anyway.

	- Doug





More information about the cfe-commits mailing list