martong marked an inline comment as done.
martong added inline comments.

================
Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:107
+    return makeNonLoc(X.castAs<nonloc::SymbolVal>().getSymbol(), UO_Not,
+                      X.getType(Context));
   default:
----------------
steakhal wrote:
> I'm not sure if we should rely on `SVal::getType()`. I think the calling 
> context should pass the type along here.
Good point. One example where the type of the SVal is different than the type 
of the UnaryExpr is here:
```
void test_x(int x, long y) {
  x = y;  // $x has `long` type
  -x;     // the UnaryExpr `-x` has `int` type
}
```
Note that if we use `support-symbolic-integer-casts=true` then there is no such 
type mismatch because there is in implicit cast modeled at `x = y`, thus $x 
type is correctly `int`.

Anyway, I am going to update evalMinus and evalComplement to take an additional 
QualType parameter.


================
Comment at: clang/lib/StaticAnalyzer/Core/SymbolManager.cpp:73-76
+void UnarySymExpr::dumpToStream(raw_ostream &os) const {
+  os << UnaryOperator::getOpcodeStr(Op);
+  Operand->dumpToStream(os);
+}
----------------
Would be better to add parenthesis around for compound expressions. So 
expressions like -x where x = a + b should look like `-($a + $b)` instead of 
the wrong format `-$a + $b`. I am going to update.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125318

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

Reply via email to