[PATCH] Insert poisoned paddings between fields in C++ classes.
Richard Smith
richard at metafoo.co.uk
Thu Oct 16 13:11:21 PDT 2014
LGTM
================
Comment at: include/clang/Basic/DiagnosticFrontendKinds.td:50-56
@@ +49,9 @@
+def remark_sanitize_address_insert_extra_padding_accepted : Remark<
+ "-fsanitize-address-field-padding applied to %0">, BackendInfo,
+ InGroup<SanitizeAddressRemarks>;
+def remark_sanitize_address_insert_extra_padding_rejected : Remark<
+ "-fsanitize-address-field-padding ignored for %0 because it "
+ "%select{is not C++|is packed|is a union|is trivially copyable|"
+ "has trivial destructor|is standard layout|is in a blacklisted file|"
+ "is blacklisted}1">, BackendInfo,
+ InGroup<SanitizeAddressRemarks>;
----------------
I don't think these should be `BackendInfo`, because they're reflecting frontend semantics changes. They should probably be just `ShowInSystemHeader`.
================
Comment at: lib/AST/Decl.cpp:3629-3630
@@ +3628,4 @@
+ int ReasonToReject = -1;
+ if (!CXXRD)
+ ReasonToReject = 0; // is not C++.
+ else if (CXXRD->hasAttr<PackedAttr>())
----------------
It would seem prudent to also test whether the type is in an `extern "C"` linkage specification in C++ here:
if (!CXXRD || CXXRD->isExternCContext())
http://reviews.llvm.org/D5687
More information about the cfe-commits
mailing list