[PATCH] D125318: [analyzer] Add UnarySymExpr
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 10 21:05:38 PDT 2022
NoQ added a comment.
Looks great!
I suspect you'll catch a few crashes/assertion failures if you run this on real-world code, due to various parts of the static analyzer being startled by the new thing, so I really recommend doing this.
================
Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h:338
+
+ void dumpToStream(raw_ostream &os) const override;
+
----------------
`LLVM_DUMP_METHOD`?
================
Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:104
+ QualType type) {
+ assert(operand);
+ assert(!Loc::isLocType(type));
----------------
steakhal wrote:
> I think we should assert that we expect only `UO_Minus` (-), `UO_Not` (~).
> The rest of the `UO_*` doesn't seem to be relevant anyway: PostInc, PostDec, PreInc, PreDec, AddrOf, Deref, Plus, LNot, Real, Imag, Extension, Coawait.
Actually, let's put such assertion in the constructor. The earlier we catch the problem the better.
================
Comment at: clang/lib/StaticAnalyzer/Core/SymbolManager.cpp:493
+ case SymExpr::UnarySymExprKind:
+ KnownLive = isLive(cast<UnarySymExpr>(sym)->getOperand());
+ break;
----------------
Excellent!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125318/new/
https://reviews.llvm.org/D125318
More information about the cfe-commits
mailing list