[clang] [clang][analyzer] Improve 'errno' handling in StdLibraryFunctionsChecker. (PR #71392)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 7 08:25:44 PST 2023


================
@@ -1392,15 +1393,19 @@ void StdLibraryFunctionsChecker::checkPostCall(const CallEvent &Call,
     // Still add these note tags, the other checker should add only its
     // specialized note tags. These general note tags are handled always by
     // StdLibraryFunctionsChecker.
+
     ExplodedNode *Pred = Node;
-    if (!Case.getNote().empty()) {
-      const SVal RV = Call.getReturnValue();
-      // If there is a description for this execution branch (summary case),
-      // use it as a note tag.
-      std::string Note =
-          llvm::formatv(Case.getNote().str().c_str(),
-                        cast<NamedDecl>(Call.getDecl())->getDeclName());
-      if (Summary.getInvalidationKd() == EvalCallAsPure) {
+
+    std::string ErrnoNote = Case.getErrnoConstraint().describe(C);
+    std::string Note =
+        llvm::formatv(Case.getNote().str().c_str(),
----------------
DonatNagyE wrote:

It's a pity that `llvm::formatv` doesn't support a StringRef as its first argument...
(No action needed.)

https://github.com/llvm/llvm-project/pull/71392


More information about the cfe-commits mailing list