[PATCH] D153612: [clang][analyzer] Add and change NoteTags in StdLibraryFunctionsChecker.

DonĂ¡t Nagy via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 26 08:55:37 PDT 2023


donat.nagy added a comment.

This is a good and useful commit; but I have some questions connected to the state transition handling code that you had to modify. (The State/ExplodedNode APIs of the engine are really counter-intuitive...  :( )



================
Comment at: clang/lib/StaticAnalyzer/Checkers/ErrnoModeling.cpp:316-319
+      C, (Twine("'errno'") +
+          Twine(" may be undefined after successful call to '") + Twine(Fn) +
+          Twine("'"))
              .str());
----------------
Consider using `llvm:formatv()` here and in other similar messages, it is much less verbose.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:1299
+    // StdLibraryFunctionsChecker.
+    ExplodedNode *Pred = const_cast<ExplodedNode *>(Node);
+    if (!Case.getNote().empty()) {
----------------
Can you explain why is it safe to use `const_cast` here? (I don't see any concrete issue, but the engine has lots of invariants / unwritten rules and I fear that this might break one of them.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153612



More information about the cfe-commits mailing list