-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
[Clang] prevent setting default lexical access specifier for missing primary declarations #112424
Open
a-tarasyuk
wants to merge
27
commits into
llvm:main
Choose a base branch
from
a-tarasyuk:fix/112208
base: main
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.
+12
−1
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
a22c6ba
[Clang] prevent setting default lexical access specifier for missing …
a-tarasyuk 83ce02f
prevent assertion failure by handling invalid enum forward declarations
a-tarasyuk 47633cc
Merge branch 'main' into fix/112208
a-tarasyuk 1c95b7f
Merge branch 'main' into fix/112208
a-tarasyuk ca046e4
Merge branch 'main' into fix/112208
a-tarasyuk a17e84b
Merge branch 'main' into fix/112208
a-tarasyuk 59e54ca
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk d3aea99
Merge branch 'main' into fix/112208
a-tarasyuk f1e0357
Merge branch 'main' into fix/112208
a-tarasyuk e473224
Merge branch 'main' into fix/112208
a-tarasyuk 047dada
Merge branch 'main' into fix/112208
a-tarasyuk f3b7b64
Merge branch 'main' into fix/112208
a-tarasyuk 3a3439d
Merge branch 'main' into fix/112208
a-tarasyuk b857a8a
Merge branch 'main' into fix/112208
a-tarasyuk d879fd1
Merge branch 'main' into fix/112208
a-tarasyuk d321cd0
Merge branch 'main' into fix/112208
a-tarasyuk a78331f
Merge branch 'main' into fix/112208
a-tarasyuk f490f77
Merge branch 'main' into fix/112208
a-tarasyuk ef27720
Merge branch 'main' into fix/112208
a-tarasyuk 8d50c3f
Merge branch 'main' into fix/112208
a-tarasyuk 82e3dda
remove redundant Name check
a-tarasyuk 1d1d39c
Merge branch 'fix/112208' of https://github.com/a-tarasyuk/llvm-proje…
a-tarasyuk 05e13d9
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk 5ee7443
Merge branch 'main' into fix/112208
a-tarasyuk 66573ba
Merge branch 'main' into fix/112208
a-tarasyuk dc3da53
Merge branch 'main' into fix/112208
a-tarasyuk fe033be
Merge branch 'main' into fix/112208
a-tarasyuk 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 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 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 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.
@shafik #112208 (comment) when
PrevMemberDecl
exists but isn't equal toLexicalAS
— withAS_none
excludedllvm-project/clang/lib/Sema/SemaAccess.cpp
Line 48 in 0205667
I suppose
AS_none
should be excluded whenPrevMemberDecl
is unknown. What do you think?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 feel like we should be catching this in
Sema::ActOnTag
here:llvm-project/clang/lib/Sema/SemaDecl.cpp
Lines 17938 to 17951 in b497010
It looks like we are not b/c
TUK
isTUK_Declataion
but we should not be forward declaring here either.The current diagnostic does not fit this case though and maybe it has to be tweaked some more.
CC @AaronBallman
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.
Please also add more details to the summary, it is helpful to have some idea what you think the underlying problem is and why this fix is correct before reviewing.
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.
@shafik Thanks for the feedback! I initially considered marking the new declaration invalid based on
TUK_Declaration
, but I wasn’t entirely sure because of its relation to the new declarationllvm-project/clang/lib/Sema/SemaDecl.cpp
Lines 17953 to 17954 in 7be1dc0
I’ve made changes to handle this case based on TUK_Declaration. If we need to add a diagnostic message (something like a general message saying
"enum" cannot appear here
), just let me know and I’ll add it...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.
@shafik could you take a look at the latest changes? thanks
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 think these changes make sense, the diagnostic on forward reference is not great but that feels like a seperate already existing problem and not directly related to the crash.
Please update the summary. I also had one question on why we are checking
Name
as well.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.
@shafik thanks for the feedback. I've checked, and it seems safe to omit
Name
here, so I’ve removed it.