[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 3 10:02:02 PST 2020


NoQ added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:411
+      if (ExplodedNode *N = C.generateErrorNode(State)) {
+        // FIXME Add detailed diagnostic.
+        std::string Msg = "Function argument constraint is not satisfied";
----------------
Yeah, a must-have for this check to be enabled by default would be to be able to provide a specific warning message for every function. I guess we could include them in the summaries as an extra argument of `ArgConstraint`.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:414
+        auto R = std::make_unique<PathSensitiveBugReport>(BT, Msg, N);
+        bugreporter::trackExpressionValue(N, Call.getArgExpr(0), *R);
+        C.emitReport(std::move(R));
----------------
Let's test our notes.

That'll be especially important when we get to non-concrete values, because the visitor might need to be expanded (or we might need a completely new visitor).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73898





More information about the cfe-commits mailing list