[dragonegg] r210207 - Fix alias generation and bring back the tests for it.
Rafael Espindola
rafael.espindola at gmail.com
Wed Jun 4 12:14:06 PDT 2014
Author: rafael
Date: Wed Jun 4 14:14:05 2014
New Revision: 210207
URL: http://llvm.org/viewvc/llvm-project?rev=210207&view=rev
Log:
Fix alias generation and bring back the tests for it.
Added:
dragonegg/trunk/test/validator/c/FunctionAlias.c
- copied, changed from r209078, dragonegg/trunk/test/validator/c/FunctionAlias.c.disabled
dragonegg/trunk/test/validator/c/VariableAlias.c
- copied, changed from r209078, dragonegg/trunk/test/validator/c/VariableAlias.c.disabled
Removed:
dragonegg/trunk/test/validator/c/FunctionAlias.c.disabled
dragonegg/trunk/test/validator/c/VariableAlias.c.disabled
Modified:
dragonegg/trunk/src/Backend.cpp
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=210207&r1=210206&r2=210207&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Wed Jun 4 14:14:05 2014
@@ -983,11 +983,11 @@ static void emit_alias(tree decl, tree t
GlobalValue::LinkageTypes Linkage = GetLinkageForAlias(decl);
if (Linkage != GlobalValue::InternalLinkage && !IsWeakRef) {
- // Create the LLVM alias.
- // FIXME: handle alias to aliases.
- auto *GO = cast<GlobalObject>(Aliasee);
+ auto *GV = cast<GlobalValue>(Aliasee->stripPointerCasts());
+ if (auto *GA = llvm::dyn_cast<GlobalAlias>(GV))
+ GV = cast<GlobalValue>(GA->getAliasee()->stripPointerCasts());
auto *GA = GlobalAlias::create(Aliasee->getType()->getElementType(), 0,
- Linkage, "", GO);
+ Linkage, "", GV);
handleVisibility(decl, GA);
// Associate it with decl instead of V.
Copied: dragonegg/trunk/test/validator/c/FunctionAlias.c (from r209078, dragonegg/trunk/test/validator/c/FunctionAlias.c.disabled)
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/validator/c/FunctionAlias.c?p2=dragonegg/trunk/test/validator/c/FunctionAlias.c&p1=dragonegg/trunk/test/validator/c/FunctionAlias.c.disabled&r1=209078&r2=210207&rev=210207&view=diff
==============================================================================
--- dragonegg/trunk/test/validator/c/FunctionAlias.c.disabled (original)
+++ dragonegg/trunk/test/validator/c/FunctionAlias.c Wed Jun 4 14:14:05 2014
@@ -4,6 +4,6 @@ void qux(void) { }
void foo(void) __attribute__ ((alias ("qux")));
// CHECK: @foo = alias void ()* @qux
void bar(void) __attribute__ ((weak, alias ("foo")));
-// CHECK: @bar = alias weak void ()* @{{foo|qux}}
+// CHECK: @bar = alias weak void ()* @qux
void baz(void) __attribute__ ((alias ("bar")));
-// CHECK: @baz = alias void ()* @bar
+// CHECK: @baz = alias void ()* @qux
Removed: dragonegg/trunk/test/validator/c/FunctionAlias.c.disabled
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/validator/c/FunctionAlias.c.disabled?rev=210206&view=auto
==============================================================================
--- dragonegg/trunk/test/validator/c/FunctionAlias.c.disabled (original)
+++ dragonegg/trunk/test/validator/c/FunctionAlias.c.disabled (removed)
@@ -1,9 +0,0 @@
-// RUN: %dragonegg -S %s -o - | FileCheck %s
-
-void qux(void) { }
-void foo(void) __attribute__ ((alias ("qux")));
-// CHECK: @foo = alias void ()* @qux
-void bar(void) __attribute__ ((weak, alias ("foo")));
-// CHECK: @bar = alias weak void ()* @{{foo|qux}}
-void baz(void) __attribute__ ((alias ("bar")));
-// CHECK: @baz = alias void ()* @bar
Copied: dragonegg/trunk/test/validator/c/VariableAlias.c (from r209078, dragonegg/trunk/test/validator/c/VariableAlias.c.disabled)
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/validator/c/VariableAlias.c?p2=dragonegg/trunk/test/validator/c/VariableAlias.c&p1=dragonegg/trunk/test/validator/c/VariableAlias.c.disabled&r1=209078&r2=210207&rev=210207&view=diff
==============================================================================
--- dragonegg/trunk/test/validator/c/VariableAlias.c.disabled (original)
+++ dragonegg/trunk/test/validator/c/VariableAlias.c Wed Jun 4 14:14:05 2014
@@ -4,6 +4,6 @@ int qux;
extern int foo __attribute__ ((alias ("qux")));
// CHECK: @foo = alias i32* @qux
extern int bar __attribute__ ((weak, alias ("foo")));
-// CHECK: @bar = alias weak i32* @{{foo|qux}}
+// CHECK: @bar = alias weak i32* @qux
extern int baz __attribute__ ((alias ("bar")));
-// CHECK: @baz = alias i32* @bar
+// CHECK: @baz = alias i32* @qux
Removed: dragonegg/trunk/test/validator/c/VariableAlias.c.disabled
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/validator/c/VariableAlias.c.disabled?rev=210206&view=auto
==============================================================================
--- dragonegg/trunk/test/validator/c/VariableAlias.c.disabled (original)
+++ dragonegg/trunk/test/validator/c/VariableAlias.c.disabled (removed)
@@ -1,9 +0,0 @@
-// RUN: %dragonegg -S %s -o - | FileCheck %s
-
-int qux;
-extern int foo __attribute__ ((alias ("qux")));
-// CHECK: @foo = alias i32* @qux
-extern int bar __attribute__ ((weak, alias ("foo")));
-// CHECK: @bar = alias weak i32* @{{foo|qux}}
-extern int baz __attribute__ ((alias ("bar")));
-// CHECK: @baz = alias i32* @bar
More information about the llvm-commits
mailing list