[PATCH] D117229: [Analyzer] Produce SymbolCast for pointer to integer cast

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 20 09:14:28 PST 2022


ASDenysPetrov added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:1088
 }
+
+SVal clang::ento::SValBuilder::simplifySymbolCast(nonloc::SymbolVal V,
----------------
Notify the user about the contract.


================
Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:1095-1097
+    auto SV = makeSymbolVal(SE);
+    assert(SV == V);
+    return SV;
----------------
Explain please, why do you need to create a new `SymbolVal` here, but not just returning `V` as long as you know that the type is the same?
And `assert` also seems weird for me. If there's smth obscure that you're trying to handle, please add some explaination comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117229



More information about the cfe-commits mailing list