diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-07-26 01:48:59 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-07-26 01:48:59 +0000 |
commit | 29c69db7600f779e60da0e79b7de7bef6ced9131 (patch) | |
tree | 599a1573c7257334fd21b5d30c0eec5fba974258 /clang/lib/Sema/SemaDeclAttr.cpp | |
parent | 06d7bd2e428dfd00f422d439faedcadb517266b6 (diff) | |
download | bcm5719-llvm-29c69db7600f779e60da0e79b7de7bef6ced9131.tar.gz bcm5719-llvm-29c69db7600f779e60da0e79b7de7bef6ced9131.zip |
[Sema] The alignment of an object has an upper bound from the object file format
Don't use the spelling of the alignment attribute to determine whether
or not an alignment amount makes sense.
llvm-svn: 243233
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 64e61b5c388..4f8d7e8e4af 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -2985,7 +2985,7 @@ void Sema::AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, // C11 6.7.5p6: // An alignment specification of zero has no effect. if (!(TmpAttr.isAlignas() && !Alignment)) { - if(!llvm::isPowerOf2_64(Alignment.getZExtValue())) { + if (!llvm::isPowerOf2_64(Alignment.getZExtValue())) { Diag(AttrLoc, diag::err_alignment_not_power_of_two) << E->getSourceRange(); return; @@ -3008,7 +3008,9 @@ void Sema::AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, } // Alignment calculations can wrap around if it's greater than 2**28. - unsigned MaxValidAlignment = TmpAttr.isDeclspec() ? 8192 : 268435456; + unsigned MaxValidAlignment = + Context.getTargetInfo().getTriple().isOSBinFormatCOFF() ? 8192 + : 268435456; if (Alignment.getZExtValue() > MaxValidAlignment) { Diag(AttrLoc, diag::err_attribute_aligned_too_great) << MaxValidAlignment << E->getSourceRange(); |