[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


================
@@ -622,9 +624,8 @@ class StdLibraryFunctionsChecker
                                                       Call.getOriginExpr());
     }
 
-    const NoteTag *describe(CheckerContext &C,
-                            StringRef FunctionName) const override {
-      return errno_modeling::getNoteTagForStdMustBeChecked(C, FunctionName);
+    const std::string describe(CheckerContext &C) const {
+      return "This function indicates failure only by setting 'errno'";
----------------
DonatNagyE wrote:

Text formatting remark: the capitalized `This` would be incorrect after a `;` in the case when this errno note is appended after a non-empty "regular" note. If that case can happen, then fix it (e.g. by returning a lowercase string and only capitalizing the "T" when it ends up at the beginning of the sentence) and add a testcase that shows it. Otherwise add a comment (e.g. in this function) that explains why is this message only produced in situations where the "regular" note is empty.

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


More information about the cfe-commits mailing list