-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang] Ensure that Attr::Create(Implicit) chooses a valid syntax
The purpose of this patch and follow-on patches is to ensure that AttributeCommonInfos always have a syntax that is appropriate for their kind (i.e. that it matches one of the entries in Attr.td). The attribute-specific Create and CreateImplicit methods had four overloads, based on their tail arguments: (1) no extra arguments (2) an AttributeCommonInfo (3) a SourceRange (4) a SourceRange, a syntax, and (where necessary) a spelling When (4) had a spelling argument, it defaulted to SpellingNotCalculated. One disadvantage of this was that (1) and (3) zero-initialized the syntax field of the AttributeCommonInfo, which corresponds to AS_GNU. But AS_GNU isn't always listed as a possibility in Attr.td. This patch therefore removes (1) and (3) and instead provides the same functionality using default arguments on (4) (a bit like the existing default argument for the spelling). The default syntax is taken from the attribute's first valid spelling. Doing that raises the question: what should happen for attributes like AlignNatural and CUDAInvalidTarget that are only ever created implicitly, and so have no source-code manifestation at all? The patch adds a new AS_Implicit "syntax" for that case. The patch also removes the syntax argument for these attributes, since the syntax must always be AS_Implicit. For similar reasons, the patch removes the syntax argument if there is exactly one valid spelling. Doing this means that AttributeCommonInfo no longer needs the single-argument constructors. It is always given a syntax instead. Differential Revision: https://reviews.llvm.org/D148101
- Loading branch information
1 parent
cafefe0
commit e841d50
Showing
7 changed files
with
45 additions
and
71 deletions.
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
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
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