This revision was automatically updated to reflect the committed changes.
Closed by commit rL252115: [Lex] Add __has_builtin support for 
__make_integer_seq (authored by majnemer).

Changed prior to commit:
  http://reviews.llvm.org/D14349?vs=39258&id=39294#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14349

Files:
  cfe/trunk/lib/Lex/PPMacroExpansion.cpp
  cfe/trunk/test/SemaCXX/make_integer_seq.cpp

Index: cfe/trunk/test/SemaCXX/make_integer_seq.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/make_integer_seq.cpp
+++ cfe/trunk/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: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
===================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp
+++ cfe/trunk/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());


Index: cfe/trunk/test/SemaCXX/make_integer_seq.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/make_integer_seq.cpp
+++ cfe/trunk/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: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
===================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp
+++ cfe/trunk/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());
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to