summaryrefslogtreecommitdiff
path: root/lib/IR
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-02-13 18:26:41 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-02-13 18:26:41 +0000
commit573c0503e3bedf5856e1b94969bfd770a927124e (patch)
tree9a5a315a8b972e4c99c02f2b393ffd84f0778a22 /lib/IR
parentefe40a5a1d45177a6e98b7f910f2a4a9a24e40a3 (diff)
downloadllvm-573c0503e3bedf5856e1b94969bfd770a927124e.tar.gz
llvm-573c0503e3bedf5856e1b94969bfd770a927124e.tar.bz2
llvm-573c0503e3bedf5856e1b94969bfd770a927124e.tar.xz
Check that GlobalAliases don't have section or alignment.
An alias is always in the section of its aliasee and has the same alignment (since it has the same address). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201354 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r--lib/IR/Globals.cpp2
-rw-r--r--lib/IR/Verifier.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/IR/Globals.cpp b/lib/IR/Globals.cpp
index a70ea0f37b..5ad96b2ce3 100644
--- a/lib/IR/Globals.cpp
+++ b/lib/IR/Globals.cpp
@@ -57,6 +57,8 @@ void GlobalValue::copyAttributesFrom(const GlobalValue *Src) {
}
void GlobalValue::setAlignment(unsigned Align) {
+ assert((!isa<GlobalAlias>(this) || !Align) &&
+ "GlobalAlias should not have an alignment!");
assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!");
assert(Align <= MaximumAlignment &&
"Alignment is greater than MaximumAlignment!");
diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp
index f81260960e..73496b4f55 100644
--- a/lib/IR/Verifier.cpp
+++ b/lib/IR/Verifier.cpp
@@ -475,6 +475,8 @@ void Verifier::visitGlobalAlias(const GlobalAlias &GA) {
Assert1(GA.getType() == GA.getAliasee()->getType(),
"Alias and aliasee types should match!", &GA);
Assert1(!GA.hasUnnamedAddr(), "Alias cannot have unnamed_addr!", &GA);
+ Assert1(!GA.hasSection(), "Alias cannot have a section!", &GA);
+ Assert1(!GA.getAlignment(), "Alias connot have an alignment", &GA);
const Constant *Aliasee = GA.getAliasee();