r252115 - [Lex] Add __has_builtin support for __make_integer_seq
David Majnemer via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 4 17:01:47 PST 2015
Author: majnemer
Date: Wed Nov 4 19:01:47 2015
New Revision: 252115
URL: http://llvm.org/viewvc/llvm-project?rev=252115&view=rev
Log:
[Lex] Add __has_builtin support for __make_integer_seq
Differential Revision: http://reviews.llvm.org/D14349
Modified:
cfe/trunk/lib/Lex/PPMacroExpansion.cpp
cfe/trunk/test/SemaCXX/make_integer_seq.cpp
Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=252115&r1=252114&r2=252115&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Wed Nov 4 19:01:47 2015
@@ -1636,7 +1636,15 @@ void Preprocessor::ExpandBuiltinMacro(To
Value = FeatureII->getTokenID() == tok::identifier;
else if (II == Ident__has_builtin) {
// Check for a builtin is trivial.
- Value = FeatureII->getBuiltinID() != 0;
+ if (FeatureII->getBuiltinID() != 0) {
+ Value = true;
+ } else {
+ const LangOptions &LangOpts = PP.getLangOpts();
+ StringRef Feature = FeatureII->getName();
+ Value = llvm::StringSwitch<bool>(Feature)
+ .Case("__make_integer_seq", LangOpts.CPlusPlus)
+ .Default(false);
+ }
} else if (II == Ident__has_attribute)
Value = hasAttribute(AttrSyntax::GNU, nullptr, FeatureII,
getTargetInfo(), getLangOpts());
Modified: cfe/trunk/test/SemaCXX/make_integer_seq.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/make_integer_seq.cpp?rev=252115&r1=252114&r2=252115&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/make_integer_seq.cpp (original)
+++ cfe/trunk/test/SemaCXX/make_integer_seq.cpp Wed Nov 4 19:01:47 2015
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+static_assert(__has_builtin(__make_integer_seq), "");
+
template <class T, T... I>
struct Seq {
static constexpr T PackSize = sizeof...(I);
More information about the cfe-commits
mailing list