summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2018-04-16 19:42:32 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2018-04-16 19:42:32 +0000
commita3b5f71eaa924f71321fb989d727a3a6365ba557 (patch)
tree3092cd77bd37e5c18b815ad93bdaa2a18908b086 /clang/test
parent1c3bd2ff0c71590ad02c68bf0d4bbd3bbc27837e (diff)
downloadbcm5719-llvm-a3b5f71eaa924f71321fb989d727a3a6365ba557.tar.gz
bcm5719-llvm-a3b5f71eaa924f71321fb989d727a3a6365ba557.zip
Use export_as for autolinking frameworks
framework module SomeKitCore { ... export_as SomeKit } Given the module above, while generting autolink information during codegen, clang should to emit '-framework SomeKitCore' only if SomeKit was not imported in the relevant TU, otherwise it should use '-framework SomeKit' instead. rdar://problem/38269782 llvm-svn: 330152
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Modules/Inputs/exportas-link/OtherKit.framework/Headers/OtherKit.h6
-rw-r--r--clang/test/Modules/Inputs/exportas-link/OtherKit.framework/Modules/module.modulemap5
-rw-r--r--clang/test/Modules/Inputs/exportas-link/SomeKit.framework/Headers/SKWidget.h1
-rw-r--r--clang/test/Modules/Inputs/exportas-link/SomeKit.framework/Headers/SomeKit.h1
-rw-r--r--clang/test/Modules/Inputs/exportas-link/SomeKit.framework/Modules/module.modulemap6
-rw-r--r--clang/test/Modules/Inputs/exportas-link/SomeKit.framework/SomeKit.tbd1
-rw-r--r--clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/Headers/SKWidget.h4
-rw-r--r--clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/Headers/SomeKitCore.h1
-rw-r--r--clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/Modules/module.modulemap7
-rw-r--r--clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/SomeKitCore.tbd1
-rw-r--r--clang/test/Modules/use-exportas-for-link.m44
11 files changed, 77 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/exportas-link/OtherKit.framework/Headers/OtherKit.h b/clang/test/Modules/Inputs/exportas-link/OtherKit.framework/Headers/OtherKit.h
new file mode 100644
index 00000000000..18f0bd555d6
--- /dev/null
+++ b/clang/test/Modules/Inputs/exportas-link/OtherKit.framework/Headers/OtherKit.h
@@ -0,0 +1,6 @@
+#import <SomeKitCore/SomeKitCore.h>
+
+#ifdef F
+#import <SomeKit/SomeKit.h>
+#endif
+
diff --git a/clang/test/Modules/Inputs/exportas-link/OtherKit.framework/Modules/module.modulemap b/clang/test/Modules/Inputs/exportas-link/OtherKit.framework/Modules/module.modulemap
new file mode 100644
index 00000000000..1ce73512180
--- /dev/null
+++ b/clang/test/Modules/Inputs/exportas-link/OtherKit.framework/Modules/module.modulemap
@@ -0,0 +1,5 @@
+
+framework module OtherKit {
+ header "OtherKit.h"
+ export *
+}
diff --git a/clang/test/Modules/Inputs/exportas-link/SomeKit.framework/Headers/SKWidget.h b/clang/test/Modules/Inputs/exportas-link/SomeKit.framework/Headers/SKWidget.h
new file mode 100644
index 00000000000..dd99ff7ed2f
--- /dev/null
+++ b/clang/test/Modules/Inputs/exportas-link/SomeKit.framework/Headers/SKWidget.h
@@ -0,0 +1 @@
+#import <SomeKitCore/SKWidget.h>
diff --git a/clang/test/Modules/Inputs/exportas-link/SomeKit.framework/Headers/SomeKit.h b/clang/test/Modules/Inputs/exportas-link/SomeKit.framework/Headers/SomeKit.h
new file mode 100644
index 00000000000..17a4cc83fdf
--- /dev/null
+++ b/clang/test/Modules/Inputs/exportas-link/SomeKit.framework/Headers/SomeKit.h
@@ -0,0 +1 @@
+#import <SomeKit/SKWidget.h>
diff --git a/clang/test/Modules/Inputs/exportas-link/SomeKit.framework/Modules/module.modulemap b/clang/test/Modules/Inputs/exportas-link/SomeKit.framework/Modules/module.modulemap
new file mode 100644
index 00000000000..ae4b276d47b
--- /dev/null
+++ b/clang/test/Modules/Inputs/exportas-link/SomeKit.framework/Modules/module.modulemap
@@ -0,0 +1,6 @@
+framework module SomeKit {
+ umbrella header "SomeKit.h"
+ module * {
+ export *
+ }
+}
diff --git a/clang/test/Modules/Inputs/exportas-link/SomeKit.framework/SomeKit.tbd b/clang/test/Modules/Inputs/exportas-link/SomeKit.framework/SomeKit.tbd
new file mode 100644
index 00000000000..ab95795b98e
--- /dev/null
+++ b/clang/test/Modules/Inputs/exportas-link/SomeKit.framework/SomeKit.tbd
@@ -0,0 +1 @@
+dummy tbd file
diff --git a/clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/Headers/SKWidget.h b/clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/Headers/SKWidget.h
new file mode 100644
index 00000000000..1fb010cb39a
--- /dev/null
+++ b/clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/Headers/SKWidget.h
@@ -0,0 +1,4 @@
+@interface SKWidget
+- (void)someObjCMethod;
+@end
+
diff --git a/clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/Headers/SomeKitCore.h b/clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/Headers/SomeKitCore.h
new file mode 100644
index 00000000000..dd99ff7ed2f
--- /dev/null
+++ b/clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/Headers/SomeKitCore.h
@@ -0,0 +1 @@
+#import <SomeKitCore/SKWidget.h>
diff --git a/clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/Modules/module.modulemap b/clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/Modules/module.modulemap
new file mode 100644
index 00000000000..30f9770c97c
--- /dev/null
+++ b/clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/Modules/module.modulemap
@@ -0,0 +1,7 @@
+framework module SomeKitCore {
+ umbrella header "SomeKitCore.h"
+ export_as SomeKit
+ module * {
+ export *
+ }
+}
diff --git a/clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/SomeKitCore.tbd b/clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/SomeKitCore.tbd
new file mode 100644
index 00000000000..ab95795b98e
--- /dev/null
+++ b/clang/test/Modules/Inputs/exportas-link/SomeKitCore.framework/SomeKitCore.tbd
@@ -0,0 +1 @@
+dummy tbd file
diff --git a/clang/test/Modules/use-exportas-for-link.m b/clang/test/Modules/use-exportas-for-link.m
new file mode 100644
index 00000000000..69773e6039f
--- /dev/null
+++ b/clang/test/Modules/use-exportas-for-link.m
@@ -0,0 +1,44 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -emit-llvm -o - -fmodules-cache-path=%t -DA -fmodules -fimplicit-module-maps -F %S/Inputs/exportas-link %s | FileCheck --check-prefix=CHECK_A %s
+// CHECK_A: !llvm.linker.options = !{![[MODULE:[0-9]+]]}
+// CHECK_A: ![[MODULE]] = !{!"-framework", !"SomeKit"}
+#ifdef A
+@import SomeKitCore;
+@import SomeKit;
+#endif
+
+// RUN: %clang_cc1 -emit-llvm -o - -fmodules-cache-path=%t -DB -fmodules -fimplicit-module-maps -F %S/Inputs/exportas-link %s | FileCheck --check-prefix=CHECK_B %s
+// CHECK_B: !llvm.linker.options = !{![[MODULE:[0-9]+]]}
+// CHECK_B: ![[MODULE]] = !{!"-framework", !"SomeKit"}
+#ifdef B
+@import SomeKit;
+@import SomeKitCore;
+#endif
+
+// RUN: %clang_cc1 -emit-llvm -o - -fmodules-cache-path=%t -DC -fmodules -fimplicit-module-maps -F %S/Inputs/exportas-link %s | FileCheck --check-prefix=CHECK_C %s
+// CHECK_C: !llvm.linker.options = !{![[MODULE:[0-9]+]]}
+// CHECK_C: ![[MODULE]] = !{!"-framework", !"SomeKitCore"}
+#ifdef C
+@import SomeKitCore;
+#endif
+
+// RUN: %clang_cc1 -emit-llvm -o - -fmodules-cache-path=%t -DD -fmodules -fimplicit-module-maps -F %S/Inputs/exportas-link %s | FileCheck --check-prefix=CHECK_D %s
+// CHECK_D: !llvm.linker.options = !{![[MODULE:[0-9]+]]}
+// CHECK_D: ![[MODULE]] = !{!"-framework", !"SomeKit"}
+#ifdef D
+@import SomeKit;
+#endif
+
+// RUN: %clang_cc1 -emit-llvm -o - -fmodules-cache-path=%t -DE -fmodules -fimplicit-module-maps -F %S/Inputs/exportas-link %s | FileCheck --check-prefix=CHECK_E %s
+// CHECK_E: !llvm.linker.options = !{![[MODULE:[0-9]+]]}
+// CHECK_E: ![[MODULE]] = !{!"-framework", !"SomeKitCore"}
+#ifdef E
+@import OtherKit;
+#endif
+
+// RUN: %clang_cc1 -emit-llvm -o - -fmodules-cache-path=%t -DF -fmodules -fimplicit-module-maps -F %S/Inputs/exportas-link %s | FileCheck --check-prefix=CHECK_F %s
+// CHECK_F: !llvm.linker.options = !{![[MODULE:[0-9]+]]}
+// CHECK_F: ![[MODULE]] = !{!"-framework", !"SomeKit"}
+#ifdef F
+@import OtherKit;
+#endif
OpenPOWER on IntegriCloud