blob: 0c2d0c6ca57617a0a74998be08162dd29905fa15 [file] [log] [blame]
Rafael Espindola0017c5f2010-12-07 15:23:23 +00001// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
Daniel Dunbar829e9882008-08-05 23:31:02 +00002
Mike Stump5e7869f2009-07-21 20:52:43 +00003int x() { return 1; }
Daniel Dunbar829e9882008-08-05 23:31:02 +00004
Chris Lattner3fcc7902010-06-27 01:06:27 +00005// CHECK: ret i32 1
Edward O'Callaghan72af8062009-10-26 20:49:20 +00006
7
Daniel Dunbar829e9882008-08-05 23:31:02 +00008int f() __attribute__((weak, alias("x")));
9
10/* Test that we link to the alias correctly instead of making a new
11 forward definition. */
12int f();
13int h() {
14 return f();
15}
Edward O'Callaghan72af8062009-10-26 20:49:20 +000016
Daniel Dunbar568e3022009-11-11 03:48:26 +000017// CHECK: [[call:%.*]] = call i32 (...)* @f()
Chris Lattner3fcc7902010-06-27 01:06:27 +000018// CHECK: ret i32 [[call]]
Edward O'Callaghan72af8062009-10-26 20:49:20 +000019