aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorMatt Beaumont-Gay <matthewbg@google.com>2011-11-29 22:43:53 +0000
committerMatt Beaumont-Gay <matthewbg@google.com>2011-11-29 22:43:53 +0000
commit381711c6e7911d762f81a65e9ef4339a6a3d6524 (patch)
treee85a24c8956386366ab00911d44ee5c2a38cac57 /lib/Sema/SemaChecking.cpp
parent6649014b792f8a4b1bc1e8be8f844a72220af508 (diff)
Suppress -Warray-bounds for classes (not just structs) where the last field is
a 1-length character array. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145445 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r--lib/Sema/SemaChecking.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 9dd03133b9..ec36963ed6 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -4202,8 +4202,11 @@ static bool IsTailPaddedMemberArray(Sema &S, llvm::APInt Size,
return false;
const RecordDecl *RD = dyn_cast<RecordDecl>(FD->getDeclContext());
- if (!RD || !RD->isStruct())
- return false;
+ if (!RD) return false;
+ if (RD->isUnion()) return false;
+ if (const CXXRecordDecl *CRD = dyn_cast<CXXRecordDecl>(RD)) {
+ if (!CRD->isStandardLayout()) return false;
+ }
// See if this is the last field decl in the record.
const Decl *D = FD;