[cfe-commits] r122056 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Index/load-decls.c
Douglas Gregor
dgregor at apple.com
Fri Dec 17 07:36:55 PST 2010
On Dec 17, 2010, at 4:21 AM, Abramo Bagnara wrote:
> Author: abramo
> Date: Fri Dec 17 06:21:11 2010
> New Revision: 122056
>
> URL: http://llvm.org/viewvc/llvm-project?rev=122056&view=rev
> Log:
> Avoid to emit redundant implicit cast for enum constants init expressions.
>
> Modified:
> cfe/trunk/lib/Sema/SemaDecl.cpp
> cfe/trunk/test/Index/load-decls.c
>
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=122056&r1=122055&r2=122056&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Dec 17 06:21:11 2010
> @@ -7745,7 +7745,7 @@
> ECD->setInitVal(InitVal);
>
> // Adjust the Expr initializer and type.
> - if (ECD->getInitExpr())
> + if (ECD->getInitExpr() && NewTy != ECD->getInitExpr()->getType())
Please use Context.hasSameType(NewTy, ECD->getInitExpr()->getType()) to compare types for equality.
- Doug
More information about the cfe-commits
mailing list