[PATCH] D78704: [analyzer][NFC] Add unittest for FalsePositiveRefutationBRVisitor

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 23 05:54:08 PDT 2020


xazax.hun added a comment.

Thanks! Having more tests is always welcome!

I mentioned some nits inline, but I wonder if you actually need to add a new check. Can't you just reuse existing debug checks?
We have the expr inspeciton checker that supports the following functions:

  clang_analyzer_warnIfReached
  clang_analyzer_eval



================
Comment at: clang/unittests/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp:24
+  do                                                                           \
+    if (!LLVM_WITH_Z3)                                                         \
+      return;                                                                  \
----------------
I think this might not be the idiomatic way to skip a test. Consider using ` GTEST_SKIP();`.


================
Comment at: clang/unittests/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp:65
+
+  bool reportIfCanBeZero(const CallEvent &Call, CheckerContext &C,
+                         ProgramStateRef State) const {
----------------
Maybe `reportIfArgCanBeZero`?


================
Comment at: clang/unittests/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp:115
+  llvm::raw_string_ostream OS(Diags);
+  return tooling::runToolOnCodeWithArgs(
+      std::make_unique<TestAction<addFalsePositiveGenerator>>(OS), Code, Args,
----------------
Wasn't `runCheckerOnCodeWithArgs` created for this purpose?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78704





More information about the cfe-commits mailing list