steakhal accepted this revision.
steakhal added a comment.
This revision is now accepted and ready to land.

> We can't just do that check in `evalCast` because there are many additonal 
> logic before we'd end up in `makeNonLoc`.

I'm not exactly up to date. Could you please extend the summary with an example 
to underpin this statement prior to committing?



================
Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:116-117
   assert(!Loc::isLocType(toTy));
+  if (fromTy == toTy)
+    return operand;
   return nonloc::SymbolVal(SymMgr.getCastSymbol(operand, fromTy, toTy));
----------------
Should we account for qualified types?
If not, could we assert that?


================
Comment at: clang/test/Analysis/symbolcast-floatingpoint.cpp:12-24
+void test_no_redundant_floating_point_cast(int n) {
+
+  double D = n / 30;
+  clang_analyzer_dump(D); // expected-warning{{(double) ((reg_$0<int n>) / 
30)}}
+
+  // There are two cast operations evaluated above:
+  // 1. (n / 30) is cast to a double during the store of `D`.
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128068

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to