summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-01-04 21:16:09 +0000
committerDouglas Gregor <dgregor@apple.com>2012-01-04 21:16:09 +0000
commit7f9abbdcc52c17b2b78e69f839387ecf8f279a68 (patch)
treed53022e07010b7474ba9a44bbf7f06ce38b06b97 /clang/test
parent66d9327b80a75bd0b3d3703d803f77a7ce210966 (diff)
downloadbcm5719-llvm-7f9abbdcc52c17b2b78e69f839387ecf8f279a68.tar.gz
bcm5719-llvm-7f9abbdcc52c17b2b78e69f839387ecf8f279a68.zip
Add __has_feature(modules) to indicate when modules are available (in
any language variant), and restrict __has_feature(objc_modules) to mean that we also have the Objective-C @import syntax. I anticipate __has_feature(cxx_modules) and/or __has_feature(c_modules) for when we nail down the module syntax for C/C++. llvm-svn: 147548
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Lexer/has_feature_modules.m16
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/test/Lexer/has_feature_modules.m b/clang/test/Lexer/has_feature_modules.m
index ec4d507fcb5..6cea3246892 100644
--- a/clang/test/Lexer/has_feature_modules.m
+++ b/clang/test/Lexer/has_feature_modules.m
@@ -1,7 +1,12 @@
+// RUN: %clang_cc1 -E -fmodules %s -o - | FileCheck --check-prefix=CHECK-HAS-OBJC-MODULES %s
+// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-OBJC-MODULES %s
+// RUN: %clang_cc1 -E -x c -fmodules %s -o - | FileCheck --check-prefix=CHECK-NO-OBJC-MODULES %s
+
// RUN: %clang_cc1 -E -fmodules %s -o - | FileCheck --check-prefix=CHECK-HAS-MODULES %s
// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-MODULES %s
+// RUN: %clang_cc1 -E -x c -fmodules %s -o - | FileCheck --check-prefix=CHECK-HAS-MODULES %s
-#if __has_feature(objc_modules)
+#if __has_feature(modules)
int has_modules();
#else
int no_modules();
@@ -9,3 +14,12 @@ int no_modules();
// CHECK-HAS-MODULES: has_modules
// CHECK-NO-MODULES: no_modules
+
+#if __has_feature(objc_modules)
+int has_objc_modules();
+#else
+int no_objc_modules();
+#endif
+
+// CHECK-HAS-OBJC-MODULES: has_objc_modules
+// CHECK-NO-OBJC-MODULES: no_objc_modules
OpenPOWER on IntegriCloud