-
Notifications
You must be signed in to change notification settings - Fork 22
fix: support clang-cl #1045
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
Open
K-ballo
wants to merge
22
commits into
cppalliance:develop
Choose a base branch
from
K-ballo:clang-cl
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+460
−64
Open
fix: support clang-cl #1045
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
160ba18
Run tests using clang-cl on windows
K-ballo c148e02
Use clang-cl system includes syntax
K-ballo 754f590
Use clang-cl nostdlibinc option
K-ballo 6f020d2
-
K-ballo 9ed7c65
refactor SingleFileDB
K-ballo 13cc376
-include for clang-cl is spelled /FI
K-ballo 5704a08
revert format on save
K-ballo 5a9d1d6
tweaks
K-ballo 723cfcf
salvage some tests...
K-ballo b1275c5
test -std
K-ballo e38fb10
test defines
K-ballo 635733a
test systemIncludes
K-ballo 4913671
flip
K-ballo 873d59a
unused
K-ballo 6f360ed
default
K-ballo cee4562
test std more
K-ballo 89fc463
separate cases
K-ballo b190535
decide flag spelling once
K-ballo baef4b6
isClangCL
K-ballo c3fa9b7
silence warning
K-ballo 4835c4c
test both clang and clang-cl modes
K-ballo c2b61ad
uh?
K-ballo 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
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
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.
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.
Don't we have a stable equivalent to
latest
in the non-CL version?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.
no https://clang.llvm.org/docs/CommandGuide/clang.html#cmdoption-std
Uh oh!
There was an error while loading. Please reload this page.
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.
Ah... OK. I see. You can calculate it with something like:
It also has the benefit of giving us the same version for CL and non-CL arguments in case the latest happens to have any special meaning.
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.
We have complete control over clang, we can adjust this value manually when bumping llvm. If the target commit hash is exposed (
-DLLVM_COMMIT_HASH=...
) we can even static assert on this, so it doesn't go undetected.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.
Yes. We could. As you noticed, the problem is remembering. MrDocs has dozens, if not hundreds, of moving parts reflecting information back and forth. We always forget to update all these parts because no one remembers to do so. That's why things like the XML generator are broken.
Exactly. For each type of information, we need a strategy that either forces us to review it because it's broken or that does it automatically.
Your solution is in the first category, and I do like it. There's no LLVM_COMMIT_HASH in their headers, but I'm guessing you would end up with something like:
or
I'm OK with some variant of that. All we have to be sure is it's always working. Not something the user can bypass by mistake.
By default, I usually prefer things in the second category whenever possible, but this hasn't been the case for every problem. For instance, if you look at the code I wrote, you'll see that I use
"c++23"
as the baseline. The idea is that there's no cost if we forget to update it, but we wouldn't lose anything in terms of correctness if we did. There's probably some smart solution based on some enum or something somewhere.Anyway, your macro based solution is also fine to me. I'm just explaining the rationale 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.
#1047 says other options are "simpler". Do you mean more robust, instead? Because if they're even simpler than copy/pasting that thing, why not just do it now? Does @mizvekov know of a good solution to this?
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.
I mean simpler. I do agree they're more robust too.
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 they're even simpler than copy/pasting that thing, why not just do it now?
Uh oh!
There was an error while loading. Please reload this page.
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 PR fixes a fundamental bug in the tool, the suggested change introduces an unrelated change of behavior (in a different part of the tool), conflating them under a single PR is a poor engineering practice.
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.
OK. No problem.
My intuition was that
makes the std option vary between "latest" and "c++23" for an arbitrary reason. So this looked like an "unrelated change of behavior" introduced by the PR, even though I don't question your "engineering practices".
To which you would probably respond that the previous behavior (rather than the "expected" behavior) wasn't working anyway, so it can't be a change of behavior.
I'll resolve this conversation then and we can avoid this loop. Could you open an issue for that?