diff options
author | Matt Beaumont-Gay <matthewbg@google.com> | 2011-11-29 22:43:53 +0000 |
---|---|---|
committer | Matt Beaumont-Gay <matthewbg@google.com> | 2011-11-29 22:43:53 +0000 |
commit | c93b489138173d2ea3fc3d1f6f8a52e6b6dd200f (patch) | |
tree | 43004e78ff8f2851aaa9e78b2d1d021b015158fc /clang/lib/Sema/SemaChecking.cpp | |
parent | 70db54f18d179da6fbc0fe2280aaf3688c722f19 (diff) | |
download | bcm5719-llvm-c93b489138173d2ea3fc3d1f6f8a52e6b6dd200f.tar.gz bcm5719-llvm-c93b489138173d2ea3fc3d1f6f8a52e6b6dd200f.zip |
Suppress -Warray-bounds for classes (not just structs) where the last field is
a 1-length character array.
llvm-svn: 145445
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 9dd03133b99..ec36963ed61 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/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; |