[PATCH] D157572: [clang] Add `[[clang::library_extension]]` attribute

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 10 10:44:06 PDT 2023


cjdb added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:5690-5691
+def warn_unknown_ext : Warning<"Unknown extension kind: %0">;
+def warn_cxx11_ext : Warning<"%0 is a C++11 extension">,
+    InGroup<CXX11>;
+def warn_cxx14_ext : Warning<"%0 is a C++14 extension">,
----------------
We shouldn't need this one, since Clang (almost) doesn't distinguish between C++03 and C++11. To my knowledge, C++03 doesn't even support attributes, so this would be a moot addition.


================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:8227-8229
+  if (llvm::none_of(std::array{"C++11", "C++14", "C++17", "C++20", "C++23",
+                               "C++26", "GNU"},
+                    [&](const char *K) { return K == Kind; })) {
----------------



================
Comment at: clang/test/SemaCXX/attr-library-extension.cpp:9-13
+#ifdef GNUAttr
+#define EXTENSION(name) __attribute__((library_extension(name)))
+#else
+#define EXTENSION(name) [[clang::library_extension(name)]]
+#endif
----------------
I don't think we need to test for both of these: using `[[clang::library_extension]]` directly should suffice.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157572/new/

https://reviews.llvm.org/D157572



More information about the cfe-commits mailing list