[PATCH] D59360: [clang-tidy] Fix more false positives for bugprone-string-integer-assignment

Clement Courbet via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 22 08:27:05 PDT 2019


courbet marked 2 inline comments as done.
courbet added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp:115
+    Expr::EvalResult EvalResult;
+    if (!E->EvaluateAsInt(EvalResult, Ctx, Expr::SE_AllowSideEffects))
+      return false;
----------------
alexfh wrote:
> courbet wrote:
> > alexfh wrote:
> > > I believe you should also check (or assert) that `E` is not instantiation-dependent before running the evaluator.
> > Interesting. AFAICT if I don't check that , I end up warning in the cases when the instantiation does result in a too large constant, which is what we want (the user should add a cast if they want to silence this). 
> IIUC, expression evaluation is just not supposed to be used on instantiation-dependent expressions. I've recently fixed a related crash (https://reviews.llvm.org/rL355401). I guess, there's a similar possibility here.
Thanks for the pointer.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59360/new/

https://reviews.llvm.org/D59360





More information about the cfe-commits mailing list