aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-10-17 14:55:37 +0000
committerDouglas Gregor <dgregor@apple.com>2011-10-17 14:55:37 +0000
commit05edf668f0984bfa2994ddc8bb7b78d9fb24cf11 (patch)
tree518a104278cc89a71032ba303596fe885ab0f0ed /test
parentc35cba4a54106117a52b267c7040b3bea9a4d18e (diff)
When building a module, use the macro definitions on the command line
as part of the hash rather than ignoring them. This means we'll end up building more module variants (overall), but it allows configuration macros such as NDEBUG to work so long as they're specified via command line. More to come in this space. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142187 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Modules/Inputs/CmdLine.framework/Headers/CmdLine.h6
-rw-r--r--test/Modules/on-demand-build-warnings.m2
-rw-r--r--test/Modules/on-demand-build.m8
-rw-r--r--test/Modules/on-demand-macros.m13
4 files changed, 24 insertions, 5 deletions
diff --git a/test/Modules/Inputs/CmdLine.framework/Headers/CmdLine.h b/test/Modules/Inputs/CmdLine.framework/Headers/CmdLine.h
new file mode 100644
index 0000000000..46b8fc0425
--- /dev/null
+++ b/test/Modules/Inputs/CmdLine.framework/Headers/CmdLine.h
@@ -0,0 +1,6 @@
+#ifdef FOO_RETURNS_INT_PTR
+int *foo(void);
+#else
+float *foo(void);
+#endif
+
diff --git a/test/Modules/on-demand-build-warnings.m b/test/Modules/on-demand-build-warnings.m
index ea531698cf..aa122dbd85 100644
--- a/test/Modules/on-demand-build-warnings.m
+++ b/test/Modules/on-demand-build-warnings.m
@@ -1,5 +1,5 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Wmodule-build -fmodule-cache-path %t -F %S/Inputs -DFOO -verify %s
+// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Wmodule-build -fmodule-cache-path %t -F %S/Inputs -verify %s
__import_module__ Module; // expected-warning{{building module 'Module' from source}}
diff --git a/test/Modules/on-demand-build.m b/test/Modules/on-demand-build.m
index 418e912f63..649caa8a7d 100644
--- a/test/Modules/on-demand-build.m
+++ b/test/Modules/on-demand-build.m
@@ -1,8 +1,8 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -fmodule-cache-path %t -F %S/Inputs -DFOO -verify %s
-// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -x objective-c++ -fmodule-cache-path %t -F %S/Inputs -DFOO -verify %s
-// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -fmodule-cache-path %t -F %S/Inputs -DFOO -verify %s
-
+// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -fmodule-cache-path %t -F %S/Inputs -verify %s
+// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -x objective-c++ -fmodule-cache-path %t -F %S/Inputs -verify %s
+// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -fmodule-cache-path %t -F %S/Inputs -verify %s
+#define FOO
__import_module__ Module;
@interface OtherClass
@end
diff --git a/test/Modules/on-demand-macros.m b/test/Modules/on-demand-macros.m
new file mode 100644
index 0000000000..96abb2331f
--- /dev/null
+++ b/test/Modules/on-demand-macros.m
@@ -0,0 +1,13 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodule-cache-path %t -F %S/Inputs -DFOO_RETURNS_INT_PTR -verify %s
+// RUN: %clang_cc1 -fmodule-cache-path %t -F %S/Inputs -verify %s
+
+__import_module__ CmdLine;
+
+void test() {
+#ifdef FOO_RETURNS_INT_PTR
+ int *ip = foo();
+#else
+ float *fp = foo();
+#endif
+}