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

Nikolas Klauser via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 20 02:36:09 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);
----------------
philnik777 wrote:

I'm not 100% sure what the correct thing to do is. I don't think there's harm in adding the attribute without a string if the arguments are incorrect, since they don't affect what the attribute does in a significant way. OTOH there isn't that much benefit in adding it, since the program is ill-formed anyways. @AaronBallman any thoughts on this?

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

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


More information about the cfe-commits mailing list