[clang] [clang] Cleanup docs and code for legacy no_sanitize attributes (NFC). (PR #161311)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 30 06:30:27 PDT 2025


================
@@ -6383,11 +6372,32 @@ static void handleNoSanitizeSpecificAttr(Sema &S, Decl *D,
   // getSpelling() or prettyPrint() on the resulting semantic attribute object
   // without failing assertions.
   unsigned TranslatedSpellingIndex = 0;
-  if (AL.isStandardAttributeSyntax())
+  if (NoSanitizeSpecificAttr.isStandardAttributeSyntax())
     TranslatedSpellingIndex = 1;
 
-  AttributeCommonInfo Info = AL;
+  AttributeCommonInfo Info = NoSanitizeSpecificAttr;
   Info.setAttributeSpellingListIndex(TranslatedSpellingIndex);
+  return Info;
+}
+
+static void handleNoSanitizeAddressAttr(Sema &S, Decl *D,
+                                        const ParsedAttr &AL) {
+  StringRef SanitizerName = "address";
+  AttributeCommonInfo Info = getNoSanitizeAttrInfo(AL);
+  D->addAttr(::new (S.Context)
+                 NoSanitizeAttr(S.Context, Info, &SanitizerName, 1));
----------------
erichkeane wrote:

Ooof, I hate everything about how `NoSanitizeAttr` is working here, using these 'fakes' to just handle the front half of parsing.  

I had a big lovely rant here about how much I hate it, until I realize you're not really causing it here (though kinda making it both worse and better?  Who knows which).

*sigh*....

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


More information about the cfe-commits mailing list