Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 7cdb539

Browse files
committed
[Lex] Add __has_builtin support for __make_integer_seq
Differential Revision: http://reviews.llvm.org/D14349 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252115 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 7261742 commit 7cdb539

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/Lex/PPMacroExpansion.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,15 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
16361636
Value = FeatureII->getTokenID() == tok::identifier;
16371637
else if (II == Ident__has_builtin) {
16381638
// Check for a builtin is trivial.
1639-
Value = FeatureII->getBuiltinID() != 0;
1639+
if (FeatureII->getBuiltinID() != 0) {
1640+
Value = true;
1641+
} else {
1642+
const LangOptions &LangOpts = PP.getLangOpts();
1643+
StringRef Feature = FeatureII->getName();
1644+
Value = llvm::StringSwitch<bool>(Feature)
1645+
.Case("__make_integer_seq", LangOpts.CPlusPlus)
1646+
.Default(false);
1647+
}
16401648
} else if (II == Ident__has_attribute)
16411649
Value = hasAttribute(AttrSyntax::GNU, nullptr, FeatureII,
16421650
getTargetInfo(), getLangOpts());

test/SemaCXX/make_integer_seq.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
22

3+
static_assert(__has_builtin(__make_integer_seq), "");
4+
35
template <class T, T... I>
46
struct Seq {
57
static constexpr T PackSize = sizeof...(I);

0 commit comments

Comments
 (0)