[PATCH] D14349: [Lex] Add __has_builtin support for __make_integer_seq
David Majnemer via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 4 14:29:51 PST 2015
majnemer created this revision.
majnemer added a reviewer: rsmith.
majnemer added a subscriber: cfe-commits.
http://reviews.llvm.org/D14349
Files:
lib/Lex/PPMacroExpansion.cpp
test/SemaCXX/make_integer_seq.cpp
Index: test/SemaCXX/make_integer_seq.cpp
===================================================================
--- test/SemaCXX/make_integer_seq.cpp
+++ test/SemaCXX/make_integer_seq.cpp
@@ -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);
Index: lib/Lex/PPMacroExpansion.cpp
===================================================================
--- lib/Lex/PPMacroExpansion.cpp
+++ lib/Lex/PPMacroExpansion.cpp
@@ -1636,7 +1636,15 @@
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());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14349.39258.patch
Type: text/x-patch
Size: 1317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151104/430c17fe/attachment.bin>
More information about the cfe-commits
mailing list