diff options
author | Kristóf Umann <dkszelethus@gmail.com> | 2022-02-22 15:30:47 +0100 |
---|---|---|
committer | Kristóf Umann <dkszelethus@gmail.com> | 2022-02-25 17:51:37 +0100 |
commit | 5048a58a6792ee7432b749a48c937cc9b6a9dc93 (patch) | |
tree | e7789fc27247a8e164351bea8dea4cdb322bddb9 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | c601dfbcc21386adc395016c28f339ecb29a56a2 (diff) | |
download | llvm-5048a58a6792ee7432b749a48c937cc9b6a9dc93.zip llvm-5048a58a6792ee7432b749a48c937cc9b6a9dc93.tar.gz llvm-5048a58a6792ee7432b749a48c937cc9b6a9dc93.tar.bz2 |
[analyzer] Don't crash if the analyzer-constraint is set to Z3, but llvm is not built with it
Exactly what it says on the tin! We had a nasty crash with the following incovation:
$ clang --analyze -Xclang -analyzer-constraints=z3 test.c
fatal error: error in backend: LLVM was not compiled with Z3 support, rebuild with -DLLVM_ENABLE_Z3_SOLVER=ON
... <stack trace> ...
Differential Revision: https://reviews.llvm.org/D120325
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 1014147..5d7c999 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -915,6 +915,11 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name; } else { +#ifndef LLVM_WITH_Z3 + if (Value == AnalysisConstraints::Z3ConstraintsModel) { + Diags.Report(diag::err_analyzer_not_built_with_z3); + } +#endif // LLVM_WITH_Z3 Opts.AnalysisConstraintsOpt = Value; } } |