[PATCH] D75842: [Analyzer] Bugfix for CheckerRegistry

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 10 05:12:16 PDT 2020


baloghadamsoftware marked an inline comment as done.
baloghadamsoftware added inline comments.


================
Comment at: clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp:143
+  std::string Diags;
+  EXPECT_TRUE(runCheckerOnCode<addDependentChecker>("void f() {;}", Diags));
+}
----------------
Szelethus wrote:
> I don't think this is checking what you're looking for -- the test should be whether `Diag` is an empty string, while `runCheckerOnCode` returns true when the tool (the static analyzer, in this case) terminates successfully, even if it doesn't work the way we expect it to.
There could be hundreds of alternative approaches, but this test exactly simulates the real-world problem: the checker crashes because it should not be registered. Of course, I tried the test without the bugfix and it fails as it should because the tool terminates unsuccessfully if the prerequisite checker is registered.


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

https://reviews.llvm.org/D75842





More information about the cfe-commits mailing list