NoQ added inline comments.

================
Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:728
+    const MemRegion *R = loc.castAs<loc::MemRegionVal>().getRegion();
+    if (const auto *SR = dyn_cast<SymbolicRegion>(R)) {
+      QualType Ty = SR->getSymbol()->getType();
----------------
That's a pretty big "if".

The natural way to handle the opposite case is `TypedRegion::getLocationType()`.

You can probably go with `SVal::getType()` here as it happens to do the right 
thing (treat `Loc` values as if they were pointers). But, again, it's 
speculative.


================
Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:750-751
+  if (RhsBitwidth && LhsBitwidth) {
+    assert(RhsBitwidth == LhsBitwidth &&
+           "RhsLoc bitwidth must be same as LhsLoc bitwidth!");
+    return RhsBitwidth == LhsBitwidth;
----------------
I think this is a good, correct assertion. It is up to the AST to insert 
implicit casts when bit widths don't match (or outright reject the code, I've 
no idea what really happens in such cases, but it's up to the compiler in any 
case).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118050

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

Reply via email to