[clang] [clang] Update argument checking tablegen code to use a 'full' name (PR #99993)

Mike Rice via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 23 14:27:25 PDT 2024


================
@@ -314,64 +314,92 @@ void Parser::ParseGNUAttributes(ParsedAttributes &Attrs,
 }
 
 /// Determine whether the given attribute has an identifier argument.
-static bool attributeHasIdentifierArg(const IdentifierInfo &II) {
+static bool attributeHasIdentifierArg(const IdentifierInfo &II,
+                                      ParsedAttr::Syntax Syntax,
+                                      IdentifierInfo *ScopeName) {
+  std::string FullName = AttributeCommonInfo::getNormalizedFullNameWithSyntax(
+      &II, ScopeName, Syntax);
 #define CLANG_ATTR_IDENTIFIER_ARG_LIST
-  return llvm::StringSwitch<bool>(normalizeAttrName(II.getName()))
+  return llvm::StringSwitch<bool>(FullName)
----------------
mikerice1969 wrote:

> Can we remove `normalizeAttrName` since this looks like it replaces all of the uses?

There are still two uses of this function. I didn't change the tablegen for the 'LateParsed' uses (CLANG_ATTR_LATE_PARSED_EXPERIMENTAL_EXT_LIST and CLANG_ATTR_LATE_PARSED_LIST) since these only use the GNU syntax so there isn't a problem just using the attribute name. 

We could add "GNU::" to the tablegen for these and then use the new function. Or leave it alone. I don't have a strong preference.

https://github.com/llvm/llvm-project/pull/99993


More information about the cfe-commits mailing list