[PATCH] D157762: [WIP] Implement [[msvc::no_unique_address]]

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 12:14:49 PDT 2023


dblaikie added inline comments.


================
Comment at: clang/lib/AST/Decl.cpp:4510-4512
+    for (const FieldDecl *Field : CXXRD->fields())
+      if (Field->getType()->getAsCXXRecordDecl())
+        return false;
----------------
maybe `llvm::any_of`? Not especially shorter, but maybe makes it a smidge easier to read?


================
Comment at: clang/lib/AST/Decl.cpp:4523-4524
 bool FieldDecl::isPotentiallyOverlapping() const {
-  return hasAttr<NoUniqueAddressAttr>() && getType()->getAsCXXRecordDecl();
+  return (hasAttr<NoUniqueAddressAttr>() ||
+          hasAttr<NoUniqueAddressMSVCAttr>()) &&
+         getType()->getAsCXXRecordDecl();
----------------
Having to check both of these in several places seems problematic - can we wrap that up somewhere? (or, maybe ideally, is there a way for `msvc::no_unique_address` to map to the actual NoUniqueAddressAttr as a different spelling of the same thing?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157762



More information about the cfe-commits mailing list