summaryrefslogtreecommitdiff
path: root/absl
diff options
context:
space:
mode:
authorGravatar Chris Kennelly <ckennelly@google.com>2023-03-13 10:10:12 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-03-13 10:11:05 -0700
commit34e29aae4fe9d296d57268809dfb78a34e705233 (patch)
treedf88231b1abea40cd00e03a8ce2e1661afcccd22 /absl
parentd8933b836b1e1aac982b1dd42cc6ac1343a878d5 (diff)
Add ABSL_ATTRIBUTE_NO_UNIQUE_ADDRESS helper.
PiperOrigin-RevId: 516245113 Change-Id: Idaef538c9392decbfdeb3ed3b3c109c795f92f4d
Diffstat (limited to 'absl')
-rw-r--r--absl/base/attributes.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/absl/base/attributes.h b/absl/base/attributes.h
index b7826e77..91bf954b 100644
--- a/absl/base/attributes.h
+++ b/absl/base/attributes.h
@@ -779,4 +779,18 @@
#define ABSL_ATTRIBUTE_TRIVIAL_ABI
#endif
+// ABSL_ATTRIBUTE_NO_UNIQUE_ADDRESS
+//
+// Indicates a data member can be optimized to occupy no space (if it is empty)
+// and/or its tail padding can be used for other members.
+//
+// For code that is assured to only build with C++20 or later, prefer using
+// the standard attribute `[[no_unique_address]]` directly instead of this
+// macro.
+#if ABSL_HAVE_CPP_ATTRIBUTE(no_unique_address)
+#define ABSL_ATTRIBUTE_NO_UNIQUE_ADDRESS [[no_unique_address]]
+#else
+#define ABSL_ATTRIBUTE_NO_UNIQUE_ADDRESS
+#endif
+
#endif // ABSL_BASE_ATTRIBUTES_H_