summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-05-06 14:51:36 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-05-06 14:51:36 +0000
commita7d9c69cc86c563e6b47fea749b6af1d77a3b129 (patch)
tree552c298ff293d00c51e5ada9bfaa53361a7a2cbe /llvm/lib/IR
parent484033b188c8a5fc245e3f522133038b6a6cb635 (diff)
downloadbcm5719-llvm-a7d9c69cc86c563e6b47fea749b6af1d77a3b129.tar.gz
bcm5719-llvm-a7d9c69cc86c563e6b47fea749b6af1d77a3b129.zip
Be more strict about not calling setAlignment on global aliases.
The fact that GlobalAlias::setAlignment exists at all is a side effect of how the classes are organized, it should never be used. llvm-svn: 208094
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/Globals.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp
index a6cd03e622a..0b49350e551 100644
--- a/llvm/lib/IR/Globals.cpp
+++ b/llvm/lib/IR/Globals.cpp
@@ -53,15 +53,18 @@ void GlobalValue::destroyConstant() {
/// copyAttributesFrom - copy all additional attributes (those not needed to
/// create a GlobalValue) from the GlobalValue Src to this one.
void GlobalValue::copyAttributesFrom(const GlobalValue *Src) {
- setAlignment(Src->getAlignment());
- setSection(Src->getSection());
+ if (!isa<GlobalAlias>(this)) {
+ setAlignment(Src->getAlignment());
+ setSection(Src->getSection());
+ }
+
setVisibility(Src->getVisibility());
setUnnamedAddr(Src->hasUnnamedAddr());
setDLLStorageClass(Src->getDLLStorageClass());
}
void GlobalValue::setAlignment(unsigned Align) {
- assert((!isa<GlobalAlias>(this) || !Align) &&
+ assert((!isa<GlobalAlias>(this)) &&
"GlobalAlias should not have an alignment!");
assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!");
assert(Align <= MaximumAlignment &&
OpenPOWER on IntegriCloud