[clang] [Clang] [Parser] Fixing all callers of `ParseExternalDeclaration` that didn't parse gnu attributes (PR #117148)

via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 21 05:46:52 PST 2024


================
@@ -267,9 +267,11 @@ void Parser::ParseInnerNamespace(const InnerNamespaceInfoList &InnerNSs,
     while (!tryParseMisplacedModuleImport() && Tok.isNot(tok::r_brace) &&
            Tok.isNot(tok::eof)) {
       ParsedAttributes DeclAttrs(AttrFactory);
-      MaybeParseCXX11Attributes(DeclAttrs);
-      ParsedAttributes EmptyDeclSpecAttrs(AttrFactory);
-      ParseExternalDeclaration(DeclAttrs, EmptyDeclSpecAttrs);
+      ParsedAttributes DeclSpecAttrs(AttrFactory);
+      while (MaybeParseCXX11Attributes(DeclAttrs) ||
+              MaybeParseGNUAttributes(DeclSpecAttrs))
+        ;
----------------
Sirraide wrote:

I’m thinking we might want to factor this out into a separate function since this exact code is now used in, like, 5 different places; maybe call it `MaybeParseCXX11AndGNUAttributes` or sth like that (just calling it `MaybeParseAttributes` would be incorrect because this doesn’t handle Microsoft attributes, so we’re probably stuck w/ the longer name unfortunately...).

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


More information about the cfe-commits mailing list