[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
Thu Mar 14 06:31:17 PDT 2019


courbet marked 3 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:
> 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). 


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