[clang] [Clang] Add [[clang::no_specializations]] (PR #101469)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 21 08:06:08 PST 2025


================
@@ -1212,6 +1212,14 @@ static void handlePreferredName(Sema &S, Decl *D, const ParsedAttr &AL) {
         << TT->getDecl();
 }
 
+static void handleNoSpecializations(Sema &S, Decl *D, const ParsedAttr &AL) {
+  StringRef Message;
+  if (AL.getNumArgs() != 0)
+    S.checkStringLiteralArgumentAttr(AL, 0, Message);
----------------
erichkeane wrote:

>P.S. why isn't checkStringLiteralArgumentAttr marked [[nodiscard]]?

Pretty sure this function, or its origin predate `[[nodiscard]]` by a decade or so :)  Also, the use you have is completely reasonable here.  The `Message` argument is left zero-initalized, which is the behavior you want.

I don't see any good reason to change the code here, I think the SA tool isn't really adding value here, and I don't see anything I'd change.

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


More information about the cfe-commits mailing list