2013-01-15 01:21:00 +08:00
|
|
|
// RUN: rm -rf %t
|
2014-01-31 09:06:56 +08:00
|
|
|
// RUN: %clang_cc1 -emit-pch -fmodules-cache-path=%t -fmodules -o %t.pch -I %S/Inputs -x objective-c-header %S/Inputs/autolink-sub3.pch
|
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - -fmodules-cache-path=%t -fmodules -F %S/Inputs -I %S/Inputs -include-pch %t.pch %s | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -emit-llvm -fno-autolink -o - -fmodules-cache-path=%t -fmodules -F %S/Inputs -I %S/Inputs -include-pch %t.pch %s | FileCheck --check-prefix=CHECK-AUTOLINK-DISABLED %s
|
2013-01-15 01:21:00 +08:00
|
|
|
|
|
|
|
@import autolink.sub2;
|
|
|
|
|
|
|
|
int f() {
|
|
|
|
return autolink_sub2();
|
|
|
|
}
|
|
|
|
|
|
|
|
@import autolink;
|
|
|
|
|
|
|
|
int g() {
|
|
|
|
return autolink;
|
|
|
|
}
|
|
|
|
|
2013-01-15 04:53:57 +08:00
|
|
|
@import Module.SubFramework;
|
|
|
|
const char *get_module_subframework() {
|
|
|
|
return module_subframework;
|
|
|
|
}
|
|
|
|
|
2013-01-15 03:00:05 +08:00
|
|
|
@import DependsOnModule.SubFramework;
|
2013-01-15 04:53:57 +08:00
|
|
|
float *get_module_subframework_dep() {
|
2013-01-15 03:00:05 +08:00
|
|
|
return sub_framework;
|
2013-01-15 01:57:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@import NoUmbrella;
|
|
|
|
int use_no_umbrella() {
|
|
|
|
return no_umbrella_A;
|
|
|
|
}
|
|
|
|
|
2014-01-31 09:06:56 +08:00
|
|
|
int use_autolink_sub3() {
|
|
|
|
return autolink_sub3();
|
|
|
|
}
|
|
|
|
|
2013-01-17 09:58:31 +08:00
|
|
|
// NOTE: "autolink_sub" is intentionally not linked.
|
|
|
|
|
2014-06-20 00:10:21 +08:00
|
|
|
// CHECK: !llvm.module.flags = !{{{.*}}}
|
|
|
|
// CHECK: !{{[0-9]+}} = metadata !{i32 6, metadata !"Linker Options", metadata ![[AUTOLINK_OPTIONS:[0-9]+]]}
|
2014-01-31 09:06:56 +08:00
|
|
|
// CHECK: ![[AUTOLINK_OPTIONS]] = metadata !{metadata ![[AUTOLINK_PCH:[0-9]+]], metadata ![[AUTOLINK_FRAMEWORK:[0-9]+]], metadata ![[AUTOLINK:[0-9]+]], metadata ![[DEPENDSONMODULE:[0-9]+]], metadata ![[MODULE:[0-9]+]], metadata ![[NOUMBRELLA:[0-9]+]]}
|
|
|
|
// CHECK: ![[AUTOLINK_PCH]] = metadata !{metadata !"{{(-l|/DEFAULTLIB:)}}autolink_from_pch{{(\.lib)?}}"}
|
Switch autolinking metadata format over to actual linker options, e.g.,
!0 = metadata !{metadata !"-lautolink"}
!1 = metadata !{metadata !"-framework", metadata !"autolink_framework"}
referenced from llvm.module.linkoptions, e.g.,
!llvm.module.linkoptions = !{!0, !1, !2, !3}
This conceptually moves the logic for figuring out the syntax the
linker will accept from LLVM into Clang. Moreover, it makes it easier
to support MSVC's
#pragma comment(linker, "some option")
in the future, should anyone care to do so.
llvm-svn: 172441
2013-01-15 02:28:43 +08:00
|
|
|
// CHECK: ![[AUTOLINK_FRAMEWORK]] = metadata !{metadata !"-framework", metadata !"autolink_framework"}
|
2013-05-24 23:06:56 +08:00
|
|
|
// CHECK: ![[AUTOLINK]] = metadata !{metadata !"{{(-l|/DEFAULTLIB:)}}autolink{{(\.lib)?}}"}
|
2013-01-15 03:00:05 +08:00
|
|
|
// CHECK: ![[DEPENDSONMODULE]] = metadata !{metadata !"-framework", metadata !"DependsOnModule"}
|
Switch autolinking metadata format over to actual linker options, e.g.,
!0 = metadata !{metadata !"-lautolink"}
!1 = metadata !{metadata !"-framework", metadata !"autolink_framework"}
referenced from llvm.module.linkoptions, e.g.,
!llvm.module.linkoptions = !{!0, !1, !2, !3}
This conceptually moves the logic for figuring out the syntax the
linker will accept from LLVM into Clang. Moreover, it makes it easier
to support MSVC's
#pragma comment(linker, "some option")
in the future, should anyone care to do so.
llvm-svn: 172441
2013-01-15 02:28:43 +08:00
|
|
|
// CHECK: ![[MODULE]] = metadata !{metadata !"-framework", metadata !"Module"}
|
|
|
|
// CHECK: ![[NOUMBRELLA]] = metadata !{metadata !"-framework", metadata !"NoUmbrella"}
|
2013-04-17 02:21:19 +08:00
|
|
|
|
|
|
|
// CHECK-AUTOLINK-DISABLED: !llvm.module.flags
|
|
|
|
// CHECK-AUTOLINK-DISABLED-NOT: "Linker Options"
|