summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2015-04-21 17:26:18 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2015-04-21 17:26:18 +0000
commitb63f779be4b076e530f9d2f79cdb1d09925356b5 (patch)
treee578738662f9498c869f6aea65bbec92f12adb05 /clang/lib
parent9e9e8b323088eba0f32044b09236e172bd203592 (diff)
downloadbcm5719-llvm-b63f779be4b076e530f9d2f79cdb1d09925356b5.tar.gz
bcm5719-llvm-b63f779be4b076e530f9d2f79cdb1d09925356b5.zip
Fix __alignof__ of global variables on SystemZ
SystemZ prefers to align all global variables to two bytes, which is implemented by setting the TargetInfo member MinGlobalAlign. However, for compatibility with existing compilers this should *not* change the ABI alignment value as retrieved via __alignof__, which it currently does. This patch fixes the issue by having ASTContext::getDeclAlign ignore the MinGlobalAlign setting in the ForAlignof case. Since SystemZ is the only platform setting MinGlobalAlign, this should cause no change for any other target. llvm-svn: 235395
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ASTContext.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 899f8c5ff52..c54a006d26a 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1335,7 +1335,7 @@ CharUnits ASTContext::getDeclAlign(const Decl *D, bool ForAlignof) const {
}
Align = std::max(Align, getPreferredTypeAlign(T.getTypePtr()));
if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
- if (VD->hasGlobalStorage())
+ if (VD->hasGlobalStorage() && !ForAlignof)
Align = std::max(Align, getTargetInfo().getMinGlobalAlign());
}
}
OpenPOWER on IntegriCloud