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

Commit

Permalink
[Lex] Add __has_builtin support for __make_integer_seq
Browse files Browse the repository at this point in the history
Differential Revision: http://reviews.llvm.org/D14349

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252115 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
majnemer committed Nov 5, 2015
1 parent 7261742 commit 7cdb539
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/Lex/PPMacroExpansion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,15 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
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());
Expand Down
2 changes: 2 additions & 0 deletions test/SemaCXX/make_integer_seq.cpp
Original file line number Diff line number Diff line change
@@ -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);
Expand Down

0 comments on commit 7cdb539

Please sign in to comment.