[RFC 04/12] Add randomize_layout warning for unions
Connor Kuehl via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 8 14:36:43 PST 2019
There is no technical advantage to randomizing the order
fields within unions as they all share the same offset.
Co-authored-by: Cole Nixon <nixontcole at gmail.com>
Co-authored-by: Connor Kuehl <cipkuehl at gmail.com>
Co-authored-by: James Foster <jafosterja at gmail.com>
Co-authored-by: Jeff Takahashi <jeffrey.takahashi at gmail.com>
Co-authored-by: Jordan Cantrell <jordan.cantrell at mail.com>
Co-authored-by: Nikk Forbus <nicholas.forbus at gmail.com>
Co-authored-by: Tim Pugh <nwtpugh at gmail.com>
---
clang/include/clang/Basic/DiagnosticASTKinds.td | 2 ++
1 file changed, 2 insertions(+)
diff --git a/clang/include/clang/Basic/DiagnosticASTKinds.td b/clang/include/clang/Basic/DiagnosticASTKinds.td
index c2a390fa465..406325d3677 100644
--- a/clang/include/clang/Basic/DiagnosticASTKinds.td
+++ b/clang/include/clang/Basic/DiagnosticASTKinds.td
@@ -343,4 +343,6 @@ def warn_padded_struct_size : Warning<
InGroup<Padded>, DefaultIgnore;
def warn_unnecessary_packed : Warning<
"packed attribute is unnecessary for %0">, InGroup<Packed>, DefaultIgnore;
+def warn_randomize_attr_union : Warning<
+ "union declared with 'randomize_layout' attribute">, InGroup<DiagGroup<"randomize-layout">>;
}
--
2.17.1
More information about the cfe-commits
mailing list