[PATCH] D102643: [analyzer][Z3][NFC] Use GTEST_SKIP instead of hacks

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 18 00:16:47 PDT 2021


steakhal updated this revision to Diff 346061.
steakhal added a comment.

now it should build


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

https://reviews.llvm.org/D102643

Files:
  clang/unittests/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp


Index: clang/unittests/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp
===================================================================
--- clang/unittests/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp
+++ clang/unittests/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp
@@ -19,11 +19,10 @@
 #include "llvm/Config/llvm-config.h"
 #include "gtest/gtest.h"
 
-// FIXME: Use GTEST_SKIP() instead if GTest is updated to version 1.10.0
-#ifdef LLVM_WITH_Z3
-#define SKIP_WITHOUT_Z3
-#else
-#define SKIP_WITHOUT_Z3 return
+// LLVM_ENABLE_Z3_SOLVER will define the LLVM_WITH_Z3 to 1 if finds Z3.
+// Otherwise it will be left undefined.
+#ifndef LLVM_WITH_Z3
+#define LLVM_WITH_Z3 0
 #endif
 
 namespace clang {
@@ -109,7 +108,8 @@
     "-Xclang", "-analyzer-config", "-Xclang", "crosscheck-with-z3=true"};
 
 TEST(FalsePositiveRefutationBRVisitor, UnSatInTheMiddleNoReport) {
-  SKIP_WITHOUT_Z3;
+  if (!LLVM_WITH_Z3)
+    GTEST_SKIP() << "Requires the LLVM_ENABLE_Z3_SOLVER cmake option.";
   constexpr auto Code = R"(
      void reachedWithContradiction();
      void reachedWithNoContradiction();
@@ -140,7 +140,8 @@
 }
 
 TEST(FalsePositiveRefutationBRVisitor, UnSatAtErrorNodeWithNewSymbolNoReport) {
-  SKIP_WITHOUT_Z3;
+  if (!LLVM_WITH_Z3)
+    GTEST_SKIP() << "Requires the LLVM_ENABLE_Z3_SOLVER cmake option.";
   constexpr auto Code = R"(
     void reportIfCanBeTrue(bool);
     void reachedWithNoContradiction();
@@ -172,7 +173,8 @@
 
 TEST(FalsePositiveRefutationBRVisitor,
      UnSatAtErrorNodeDueToRefinedConstraintNoReport) {
-  SKIP_WITHOUT_Z3;
+  if (!LLVM_WITH_Z3)
+    GTEST_SKIP() << "Requires the LLVM_ENABLE_Z3_SOLVER cmake option.";
   constexpr auto Code = R"(
     void reportIfCanBeTrue(bool);
     void reachedWithNoContradiction();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102643.346061.patch
Type: text/x-patch
Size: 1784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210518/8b484e60/attachment.bin>


More information about the cfe-commits mailing list