mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 18:26:05 +00:00

GCC supports: - `namespace <gnu attributes> identifier` - `namespace identifier <gnu attributes>` But clang supports only `namespace identifier <gnu attributes>` and diagnostics for `namespace <gnu attributes> identifier` case looks unclear: Code: ``` namespace __attribute__((visibility("hidden"))) A { } ``` Diags: ``` test.cpp:1:49: error: expected identifier or '{' namespace __attribute__((visibility("hidden"))) A ^ test.cpp:1:49: error: C++ requires a type specifier for all declarations test.cpp:3:2: error: expected ';' after top level declarator } ``` This patch adds support for `namespace <gnu attributes> identifier` and also forbids gnu attributes for nested namespaces (this already done for C++ attributes). Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D121245