diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2013-08-19 23:13:33 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2013-08-19 23:13:33 +0000 |
commit | abd37961d55680e5e946b9e336ce14b4ac56f830 (patch) | |
tree | bc308bdff43b48586c0fdcf1e11aec1fb68247b3 /lib | |
parent | c2d722efbfd4860dcb7a344be2031ec24cb6691f (diff) | |
download | external_llvm-abd37961d55680e5e946b9e336ce14b4ac56f830.zip external_llvm-abd37961d55680e5e946b9e336ce14b4ac56f830.tar.gz external_llvm-abd37961d55680e5e946b9e336ce14b4ac56f830.tar.bz2 |
Introduce non-const overloads for GlobalAlias::{get,resolve}AliasedGlobal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188725 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/IR/Globals.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/IR/Globals.cpp b/lib/IR/Globals.cpp index 6d547f3..da3b02a 100644 --- a/lib/IR/Globals.cpp +++ b/lib/IR/Globals.cpp @@ -229,14 +229,14 @@ void GlobalAlias::setAliasee(Constant *Aliasee) { setOperand(0, Aliasee); } -const GlobalValue *GlobalAlias::getAliasedGlobal() const { - const Constant *C = getAliasee(); +GlobalValue *GlobalAlias::getAliasedGlobal() { + Constant *C = getAliasee(); if (C == 0) return 0; - if (const GlobalValue *GV = dyn_cast<GlobalValue>(C)) + if (GlobalValue *GV = dyn_cast<GlobalValue>(C)) return GV; - const ConstantExpr *CE = cast<ConstantExpr>(C); + ConstantExpr *CE = cast<ConstantExpr>(C); assert((CE->getOpcode() == Instruction::BitCast || CE->getOpcode() == Instruction::GetElementPtr) && "Unsupported aliasee"); @@ -244,18 +244,18 @@ const GlobalValue *GlobalAlias::getAliasedGlobal() const { return cast<GlobalValue>(CE->getOperand(0)); } -const GlobalValue *GlobalAlias::resolveAliasedGlobal(bool stopOnWeak) const { - SmallPtrSet<const GlobalValue*, 3> Visited; +GlobalValue *GlobalAlias::resolveAliasedGlobal(bool stopOnWeak) { + SmallPtrSet<GlobalValue*, 3> Visited; // Check if we need to stop early. if (stopOnWeak && mayBeOverridden()) return this; - const GlobalValue *GV = getAliasedGlobal(); + GlobalValue *GV = getAliasedGlobal(); Visited.insert(GV); // Iterate over aliasing chain, stopping on weak alias if necessary. - while (const GlobalAlias *GA = dyn_cast<GlobalAlias>(GV)) { + while (GlobalAlias *GA = dyn_cast<GlobalAlias>(GV)) { if (stopOnWeak && GA->mayBeOverridden()) break; |