aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2023-04-11 17:58:56 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2023-04-13 10:14:49 +0100
commitaec3f951bf368d45b441554dac6e027678f9f3ee (patch)
treef67243737c4be7a12fbe6720871ff6017f7ed6bd /clang/lib/Parse/ParseDecl.cpp
parent265d87e46535bef2b718759ba39bb9fa30b1ef48 (diff)
downloadllvm-aec3f951bf368d45b441554dac6e027678f9f3ee.zip
llvm-aec3f951bf368d45b441554dac6e027678f9f3ee.tar.gz
llvm-aec3f951bf368d45b441554dac6e027678f9f3ee.tar.bz2
[clang] Type safety tweak for AttributeCommonInfo::Form
This patch adds static functions for constructing most AttributeCommonInfo::Forms. Direct construction is only retained where all fields (currently the syntax and spelling) are specified explicitly. This is a wash on its own. The purpose is to allow extra fields to be added to Form without disrupting all callers. In particular, it allows extra information to be stored about keywords without affecting non-keyword uses. No functional change intended. Differential Revision: https://reviews.llvm.org/D148104
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index a61a3ef..1889718 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -214,14 +214,14 @@ void Parser::ParseGNUAttributes(ParsedAttributes &Attrs,
if (Tok.isNot(tok::l_paren)) {
Attrs.addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc, nullptr, 0,
- ParsedAttr::AS_GNU);
+ ParsedAttr::Form::GNU());
continue;
}
// Handle "parameterized" attributes
if (!LateAttrs || !isAttributeLateParsed(*AttrName)) {
ParseGNUAttributeArgs(AttrName, AttrNameLoc, Attrs, &EndLoc, nullptr,
- SourceLocation(), ParsedAttr::AS_GNU, D);
+ SourceLocation(), ParsedAttr::Form::GNU(), D);
continue;
}
@@ -726,14 +726,14 @@ bool Parser::ParseMicrosoftDeclSpecArgs(IdentifierInfo *AttrName,
if (!HasInvalidAccessor)
Attrs.addNewPropertyAttr(AttrName, AttrNameLoc, nullptr, SourceLocation(),
AccessorNames[AK_Get], AccessorNames[AK_Put],
- ParsedAttr::AS_Declspec);
+ ParsedAttr::Form::Declspec());
T.skipToEnd();
return !HasInvalidAccessor;
}
unsigned NumArgs =
ParseAttributeArgsCommon(AttrName, AttrNameLoc, Attrs, nullptr, nullptr,
- SourceLocation(), ParsedAttr::AS_Declspec);
+ SourceLocation(), ParsedAttr::Form::Declspec());
// If this attribute's args were parsed, and it was expected to have
// arguments but none were provided, emit a diagnostic.
@@ -816,7 +816,7 @@ void Parser::ParseMicrosoftDeclSpecs(ParsedAttributes &Attrs) {
if (!AttrHandled)
Attrs.addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc, nullptr, 0,
- ParsedAttr::AS_Declspec);
+ ParsedAttr::Form::Declspec());
}
T.consumeClose();
EndLoc = T.getCloseLocation();