]> granicus.if.org Git - clang/commitdiff
Add __has_feature(objc_modules)
authorDouglas Gregor <dgregor@apple.com>
Tue, 3 Jan 2012 21:12:26 +0000 (21:12 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 3 Jan 2012 21:12:26 +0000 (21:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147482 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/PPMacroExpansion.cpp
test/Lexer/has_feature_modules.m [new file with mode: 0644]

index 61d528267271c6d012d0f350eeaf328ae5abb508..e93dc1560d8d4cb28de0bb0d5c6b8f130f9e9d82 100644 (file)
@@ -617,6 +617,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
                  LangOpts.ObjCRuntimeHasWeak)
            .Case("objc_fixed_enum", LangOpts.ObjC2)
            .Case("objc_instancetype", LangOpts.ObjC2)
+           .Case("objc_modules", LangOpts.Modules)
            .Case("objc_nonfragile_abi", LangOpts.ObjCNonFragileABI)
            .Case("objc_weak_class", LangOpts.ObjCNonFragileABI)
            .Case("ownership_holds", true)
diff --git a/test/Lexer/has_feature_modules.m b/test/Lexer/has_feature_modules.m
new file mode 100644 (file)
index 0000000..ec4d507
--- /dev/null
@@ -0,0 +1,11 @@
+// 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
+
+#if __has_feature(objc_modules)
+int has_modules();
+#else
+int no_modules();
+#endif
+
+// CHECK-HAS-MODULES: has_modules
+// CHECK-NO-MODULES: no_modules