[PATCH] D63915: [analyzer] ReturnValueChecker: Model the guaranteed boolean return value of function calls

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 3 11:51:21 PDT 2019


xazax.hun added a comment.

Some nits inline, note that this was just a partial review.



================
Comment at: clang/lib/StaticAnalyzer/Checkers/ReturnValueChecker.cpp:14
+
+#include "clang/Driver/DriverDiagnostic.h"
+#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
----------------
Is DriverDiagnostic used for something?


================
Comment at: clang/lib/StaticAnalyzer/Checkers/ReturnValueChecker.cpp:38
+  // The pairs are in the following form: {{{class, call}}, return value}
+  CallDescriptionMap<bool> CDM = {
+      // These are known in the LLVM project: 'Error()'
----------------
Maybe this map can be const?


================
Comment at: clang/lib/StaticAnalyzer/Checkers/ReturnValueChecker.cpp:65
+  if (const auto *MD = dyn_cast<CXXMethodDecl>(Call.getDecl()))
+    if (const auto *RD = dyn_cast<CXXRecordDecl>(MD->getParent()))
+      Name += RD->getNameAsString() + "::";
----------------
Do you need the cast here?


================
Comment at: clang/lib/StaticAnalyzer/Checkers/ReturnValueChecker.cpp:69
+  Name += Call.getCalleeIdentifier()->getName();
+  return Name;
+}
----------------
`CXXMethodDecl::getQualifiedNameAsString` is not doing what you want here?


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

https://reviews.llvm.org/D63915





More information about the cfe-commits mailing list