Repository navigation
clang: Only match the attribute name when detecting function attributes. - #3520
Merged
Merged
Conversation
When an attribute comes from a macro, libclang reports an extent that starts at the attribute in the macro definition but ends at the expansion site. Tokenizing that range lexes everything in between, so `has_attrs` saw the `_Noreturn` from an unrelated `#define` and marked a deprecated function as `-> !`. If the macro lives in another file, the range spans two files and tokenizes to nothing, so a real `_Noreturn` behind such a macro was missed. Only look at the first token at the start of the attribute's extent, which is the attribute name and is lexed from the right place either way. Fixes rust-lang#3496
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Rebase of #3516, but without risking a merge commit.
When an attribute comes from a macro, libclang reports an extent that starts at the attribute in the macro definition but ends at the expansion site. Tokenizing that range lexes everything in between, so
has_attrssaw the_Noreturnfrom an unrelated#defineand marked a deprecated function as-> !. If the macro lives in another file, the range spans two files and tokenizes to nothing, so a real_Noreturnbehind such a macro was missed.Only look at the first token at the start of the attribute's extent, which is the attribute name and is lexed from the right place either way.
Fixes #3496