-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[analyzer] Fix tests broken by empty %z3_include_dir #146042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the presence of
config.clang_staticanalyzer_z3
imply the presence ofconfig.clang_staticanalyzer_z3_include_dir
?The problem I see here is that the
clang/test/Analysis/z3-crosscheck-max-attempts.cpp
test case would not compile without the necessary Z3 include dir. Soconfig.clang_staticanalyzer_z3
should implyconfig.clang_staticanalyzer_z3_include_dir
. Otherwise theREQUIRES: z3
filter would not cover the test case and still fail. In conclusion, substitutingI_z3_include_dir
to an empty string is not the right solution. It can't be.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I would've assumed, but the build failure reported by @mgorny strongly suggests that this is not always true. My current suspicion is that if Z3 is installed in some standard include directory, then the clang build system autodetects that Z3 is available (it tries to compile a simple C source file, and that experiment succeeds if Z3 is available in the default include path), but somehow doesn't determine Z3_INCLUDE_DIR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you check
llvm/cmake/modules/FindZ3.cmake
, then you can see thatZ3_INCLUDE_DIR
andZ3_LIBRARIES
cmake variables must be defined if Z3 is detected.By judging this section of code from llvm/CMakeLists.txt:
I think
LLVM_WITH_Z3
can only be true ifZ3_FOUND
is true, which is only the case iffind_package(Z3 4.8.9)
find Z3 when executingllvm/cmake/modules/FindZ3.cmake
, which defines theZ3_INCLUDE_DIR
andZ3_LIBRARIES
variables.It has checks that
Z3_INCLUDE_DIR
must exist and contain a file calledz3_version.h
.So in sight of this, I don't think there is anything to be fixed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for researching this!