[cfe-commits] r147482 - in /cfe/trunk: lib/Lex/PPMacroExpansion.cpp test/Lexer/has_feature_modules.m

Douglas Gregor dgregor at apple.com
Tue Jan 3 13:12:26 PST 2012


Author: dgregor
Date: Tue Jan  3 15:12:26 2012
New Revision: 147482

URL: http://llvm.org/viewvc/llvm-project?rev=147482&view=rev
Log:
Add __has_feature(objc_modules)

Added:
    cfe/trunk/test/Lexer/has_feature_modules.m
Modified:
    cfe/trunk/lib/Lex/PPMacroExpansion.cpp

Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=147482&r1=147481&r2=147482&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Tue Jan  3 15:12:26 2012
@@ -617,6 +617,7 @@
                  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)

Added: cfe/trunk/test/Lexer/has_feature_modules.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/has_feature_modules.m?rev=147482&view=auto
==============================================================================
--- cfe/trunk/test/Lexer/has_feature_modules.m (added)
+++ cfe/trunk/test/Lexer/has_feature_modules.m Tue Jan  3 15:12:26 2012
@@ -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





More information about the cfe-commits mailing list