[clang] Implement [[msvc::no_unique_address]] (PR #65675)

via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 13 05:46:07 PDT 2023


================
@@ -8368,6 +8368,20 @@ static void handleNoMergeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
   D->addAttr(NoMergeAttr::Create(S.Context, AL));
 }
 
+static void handleNoUniqueAddressAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+  NoUniqueAddressAttr TmpAttr(S.Context, AL);
+  if (S.getLangOpts().MSVCCompat) {
+    if (TmpAttr.isStandard()) {
+      S.Diag(AL.getLoc(), diag::warn_attribute_ignored) << AL;
+      return;
+    }
+  } else if (TmpAttr.isMSVC()) {
----------------
cor3ntin wrote:

```suggestion
  if (S.getLangOpts().MSVCCompat && TmpAttr.isStandard()) {
      S.Diag(AL.getLoc(), diag::warn_attribute_ignored) << AL;
      return;
  } else if (TmpAttr.isMSVC()) {
```

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


More information about the cfe-commits mailing list