[PATCH] D73229: [analyzer] Improve FuchsiaHandleChecker's diagnostic messages

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 23 08:37:36 PST 2020


NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Nice! These are indeed useful when multiple things can happen. You may also consider adding stack hints a-la `MallocChecker` (i.e., "Returning; handle was closed").



================
Comment at: clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp:322
 
   // Function returns an open handle.
   if (hasFuchsiaAttr<AcquireHandleAttr>(FuncDecl)) {
----------------
I think this commend would have actually made a better note text. Maybe mention the function name as well, "Function foo() returns an open handle".


================
Comment at: clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp:359
+            llvm::raw_string_ostream OS(SBuf);
+            OS << "Handle released at " << ParamDiagIdx
+               << llvm::getOrdinalSuffix(ParamDiagIdx) << " parameter.";
----------------
I think we often use "through" in this context. I.e., "Handle released through 2nd parameter".


================
Comment at: clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp:363
           } else
-            return "";
+            return std::string{};
         });
----------------
What was wrong with good old `""`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73229





More information about the cfe-commits mailing list