[cfe-commits] r138987 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExpr.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Fri Sep 2 04:24:06 PDT 2011


On 02.09.2011 02:47, Richard Trieu wrote:
> Author: rtrieu
> Date: Thu Sep  1 19:47:55 2011
> New Revision: 138987
>
>
> +/// \brief Diagnose invalid operand for address of operations.
> +///
> +/// \param Type The type of operand which cannot have its address taken.
> +/// 0:bit-field 1:vector element 2:property expression 3:register variable

How about just defining an enum for this? Would save on the comments.

>     } else if (op->getObjectKind() == OK_BitField) { // C99 6.5.3.2p1
>       // The operand cannot be a bit-field
> -    S.Diag(OpLoc, diag::err_typecheck_address_of)
> -<<  "bit-field"<<  op->getSourceRange();
> -        return QualType();
> +    diagnoseAddressOfInvalidType(S, OpLoc, op, /*bit-field*/ 0);
> +    return QualType();
Good catch. Even better would be to use the if-chain to just get a 
correct value for the last argument and then have one call to 
diagnoseAddressOfInvalidType and one return statement after the chain, 
if that refactoring isn't too complicated.

Sebastian



More information about the cfe-commits mailing list