summaryrefslogtreecommitdiff
path: root/include/llvm/IR/GlobalValue.h
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 /include/llvm/IR/GlobalValue.h
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 'include/llvm/IR/GlobalValue.h')
-rw-r--r--include/llvm/IR/GlobalValue.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/llvm/IR/GlobalValue.h b/include/llvm/IR/GlobalValue.h
index 5fdf6611e9..f0c80673be 100644
--- a/include/llvm/IR/GlobalValue.h
+++ b/include/llvm/IR/GlobalValue.h
@@ -112,8 +112,12 @@ public:
bool hasSection() const { return !Section.empty(); }
const std::string &getSection() const { return Section; }
- void setSection(StringRef S) { Section = S; }
-
+ void setSection(StringRef S) {
+ assert((getValueID() != Value::GlobalAliasVal || S.empty()) &&
+ "GlobalAlias should not have a section!");
+ Section = S;
+ }
+
/// If the usage is empty (except transitively dead constants), then this
/// global value can be safely deleted since the destructor will
/// delete the dead constants as well.