[clang] [clang][analyzer] Add StreamChecker note tags for "indeterminate stream position". (PR #83288)

via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 29 04:17:48 PST 2024


================
@@ -313,6 +232,9 @@ class StreamChecker : public Checker<check::PreCall, eval::Call,
   BugType BT_ResourceLeak{this, "Resource leak", "Stream handling error",
                           /*SuppressOnSink =*/true};
 
+  const char *FeofNote = "Assuming stream reaches end-of-file here";
+  const char *FerrorNote = "Assuming this stream operation fails";
----------------
NagyDonat wrote:

It's a bit strange that these constants are non-static data members of the singleton `StreamChecker` object (so they're accessed through the captured `this` in lambdas); perhaps consider declaring them as static variables.

Independently, consider declaring these string constants as `std::string` because they will be converted to `std::string` when they're used.

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


More information about the cfe-commits mailing list