From: Douglas Gregor Date: Tue, 3 Jan 2012 21:12:26 +0000 (+0000) Subject: Add __has_feature(objc_modules) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7fde6518934846808e878cee8798166ae65edcd4;p=clang Add __has_feature(objc_modules) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147482 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index 61d5282672..e93dc1560d 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -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 index 0000000000..ec4d507fcb --- /dev/null +++ b/test/Lexer/has_feature_modules.m @@ -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