[PATCH] D120325: [analyzer] Don't crash if the analyzer-constraint is set to Z3, but llvm is not built with it

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 22 09:30:02 PST 2022


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

Thanks. LGTM.

Besides abusing the `-analyzer-constraints=z3` option we should really have some way displaying whether or not this clang was built w/o Z3.

I'm accepting this, given that you fix the conditional code segment.



================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:918-922
+#if !LLVM_WITH_Z3
+      if (Value == AnalysisConstraints::Z3ConstraintsModel) {
+        Diags.Report(diag::err_analyzer_not_built_with_z3);
+      }
+#endif // LLVM_WITH_Z3
----------------
This define is produced by  the `llvm/include/llvm/Config/llvm-config.h.cmake` cmake configuration file.
> /* Define if we have z3 and want to build it */
> #cmakedefine LLVM_WITH_Z3 ${LLVM_WITH_Z3}

And according to the [[ https://cmake.org/cmake/help/latest/command/configure_file.html | cmake configure_file ]]
`#cmakedefine VAR ...` will be either defined or not defined.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120325



More information about the cfe-commits mailing list