[cfe-commits] r145990 - in /cfe/trunk: include/clang/AST/Expr.h lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
Ted Kremenek
kremenek at apple.com
Tue Dec 6 16:31:57 PST 2011
Is there a relevant test case?
On Dec 6, 2011, at 3:25 PM, Richard Smith wrote:
> Author: rsmith
> Date: Tue Dec 6 17:25:15 2011
> New Revision: 145990
>
> URL: http://llvm.org/viewvc/llvm-project?rev=145990&view=rev
> Log:
> DeadStoresChecker: when whitelisting dead initializations with constants, look
> for a foldable constant rather than an IR-level constant. This is still far too
> liberal, but is a step in the right direction.
>
> Modified:
> cfe/trunk/include/clang/AST/Expr.h
> cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
>
> Modified: cfe/trunk/include/clang/AST/Expr.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=145990&r1=145989&r2=145990&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/AST/Expr.h (original)
> +++ cfe/trunk/include/clang/AST/Expr.h Tue Dec 6 17:25:15 2011
> @@ -421,8 +421,9 @@
> llvm::APSInt X;
> return isIntegerConstantExpr(X, Ctx, Loc);
> }
> - /// isConstantInitializer - Returns true if this expression is a constant
> - /// initializer, which can be emitted at compile-time.
> +
> + /// isConstantInitializer - Returns true if this expression can be emitted to
> + /// IR as a constant, and thus can be used as a constant initializer in C.
> bool isConstantInitializer(ASTContext &Ctx, bool ForRef) const;
>
> /// EvalStatus is a struct with detailed info about an evaluation in progress.
>
> Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp?rev=145990&r1=145989&r2=145990&view=diff
> ==============================================================================
> --- cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp (original)
> +++ cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp Tue Dec 6 17:25:15 2011
> @@ -274,7 +274,7 @@
> // If x is EVER assigned a new value later, don't issue
> // a warning. This is because such initialization can be
> // due to defensive programming.
> - if (E->isConstantInitializer(Ctx, false))
> + if (E->isEvaluatable(Ctx))
> return;
>
> if (DeclRefExpr *DRE=dyn_cast<DeclRefExpr>(E->IgnoreParenCasts()))
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list