r300049 - Add support for __builtin_available to __has_builtin
Alex Lorenz via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 12 04:03:26 PDT 2017
Author: arphaman
Date: Wed Apr 12 06:03:25 2017
New Revision: 300049
URL: http://llvm.org/viewvc/llvm-project?rev=300049&view=rev
Log:
Add support for __builtin_available to __has_builtin
rdar://31576715
Modified:
cfe/trunk/lib/Lex/PPMacroExpansion.cpp
cfe/trunk/test/Parser/objc-available.m
Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=300049&r1=300048&r2=300049&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Wed Apr 12 06:03:25 2017
@@ -1746,6 +1746,7 @@ void Preprocessor::ExpandBuiltinMacro(To
return llvm::StringSwitch<bool>(II->getName())
.Case("__make_integer_seq", LangOpts.CPlusPlus)
.Case("__type_pack_element", LangOpts.CPlusPlus)
+ .Case("__builtin_available", true)
.Default(false);
}
});
Modified: cfe/trunk/test/Parser/objc-available.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/objc-available.m?rev=300049&r1=300048&r2=300049&view=diff
==============================================================================
--- cfe/trunk/test/Parser/objc-available.m (original)
+++ cfe/trunk/test/Parser/objc-available.m Wed Apr 12 06:03:25 2017
@@ -20,3 +20,8 @@ void f() {
(void)@available(macos); // expected-error{{expected a version}}
(void)@available; // expected-error{{expected '('}}
}
+
+#if __has_builtin(__builtin_available)
+#error expected
+// expected-error at -1 {{expected}}
+#endif
More information about the cfe-commits
mailing list