summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2008-03-22 08:17:17 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2008-03-22 08:17:17 +0000
commit72d5d42dbcf3c8a30dfc75f62934ca9905bd629c (patch)
tree211be9d62d15c93c5cabe46ad65a8455300e6036
parent2fa75184f38e2ad394b18b7c4d108fac205cd815 (diff)
downloadbcm5719-llvm-72d5d42dbcf3c8a30dfc75f62934ca9905bd629c.tar.gz
bcm5719-llvm-72d5d42dbcf3c8a30dfc75f62934ca9905bd629c.zip
Support chained aliases for LLVM IR printing. This fixes PR2145
llvm-svn: 48684
-rw-r--r--llvm/lib/VMCore/AsmWriter.cpp3
-rw-r--r--llvm/test/Feature/aliases.ll2
2 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp
index aba66c85a76..a2de5d99a05 100644
--- a/llvm/lib/VMCore/AsmWriter.cpp
+++ b/llvm/lib/VMCore/AsmWriter.cpp
@@ -1003,6 +1003,9 @@ void AssemblyWriter::printAlias(const GlobalAlias *GA) {
Out << getLLVMName(F->getName(), GlobalPrefix);
else
Out << "@\"\"";
+ } else if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(Aliasee)) {
+ printType(GA->getType());
+ Out << " " << getLLVMName(GA->getName(), GlobalPrefix);
} else {
const ConstantExpr *CE = 0;
if ((CE = dyn_cast<ConstantExpr>(Aliasee)) &&
diff --git a/llvm/test/Feature/aliases.ll b/llvm/test/Feature/aliases.ll
index fc5e7685ca6..d44dff4c43c 100644
--- a/llvm/test/Feature/aliases.ll
+++ b/llvm/test/Feature/aliases.ll
@@ -5,11 +5,13 @@
@bar = external global i32
@foo1 = alias i32* @bar
@foo2 = alias i32* @bar
+@foo3 = alias i32* @foo2
%FunTy = type i32()
declare i32 @foo_f()
@bar_f = alias weak %FunTy* @foo_f
+@bar_ff = alias i32()* @bar_f
@bar_i = alias internal i32* @bar
OpenPOWER on IntegriCloud