From 0e3b73c5cf0bf89bb96412d1d88e54bf285d36a0 Mon Sep 17 00:00:00 2001
From: David Majnemer <david.majnemer@gmail.com>
Date: Tue, 24 May 2016 16:53:13 +0000
Subject: [PATCH] [Lex] Support more type-traits in __has_feature

It looks like we forgot to update the __has_feature support when we
added some of the type traits.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270580 91177308-0d34-0410-b5e6-96231b3b80d8
---
 lib/Lex/PPMacroExpansion.cpp           | 13 +++++++++++--
 test/Lexer/has_feature_type_traits.cpp | 20 ++++++++++++++++++++
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index 79ca9ebb706..130744fe2b1 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -1191,8 +1191,10 @@ static bool HasFeature(const Preprocessor &PP, StringRef Feature) {
       .Case("has_nothrow_copy", LangOpts.CPlusPlus)
       .Case("has_nothrow_constructor", LangOpts.CPlusPlus)
       .Case("has_trivial_assign", LangOpts.CPlusPlus)
+      .Case("has_trivial_move_assign", LangOpts.CPlusPlus)
       .Case("has_trivial_copy", LangOpts.CPlusPlus)
       .Case("has_trivial_constructor", LangOpts.CPlusPlus)
+      .Case("has_trivial_move_constructor", LangOpts.CPlusPlus)
       .Case("has_trivial_destructor", LangOpts.CPlusPlus)
       .Case("has_virtual_destructor", LangOpts.CPlusPlus)
       .Case("is_abstract", LangOpts.CPlusPlus)
@@ -1201,14 +1203,21 @@ static bool HasFeature(const Preprocessor &PP, StringRef Feature) {
       .Case("is_class", LangOpts.CPlusPlus)
       .Case("is_constructible", LangOpts.CPlusPlus)
       .Case("is_convertible_to", LangOpts.CPlusPlus)
+      .Case("is_destructible",
+            LangOpts.CPlusPlus &&LangOpts.MicrosoftExt)
       .Case("is_empty", LangOpts.CPlusPlus)
       .Case("is_enum", LangOpts.CPlusPlus)
       .Case("is_final", LangOpts.CPlusPlus)
       .Case("is_literal", LangOpts.CPlusPlus)
-      .Case("is_standard_layout", LangOpts.CPlusPlus)
+      .Case("is_nothrow_assignable", LangOpts.CPlusPlus)
+      .Case("is_nothrow_constructible", LangOpts.CPlusPlus)
+      .Case("is_nothrow_destructible",
+            LangOpts.CPlusPlus && LangOpts.MicrosoftExt)
       .Case("is_pod", LangOpts.CPlusPlus)
       .Case("is_polymorphic", LangOpts.CPlusPlus)
-      .Case("is_sealed", LangOpts.MicrosoftExt)
+      .Case("is_sealed",
+            LangOpts.CPlusPlus && LangOpts.MicrosoftExt)
+      .Case("is_standard_layout", LangOpts.CPlusPlus)
       .Case("is_trivial", LangOpts.CPlusPlus)
       .Case("is_trivially_assignable", LangOpts.CPlusPlus)
       .Case("is_trivially_constructible", LangOpts.CPlusPlus)
diff --git a/test/Lexer/has_feature_type_traits.cpp b/test/Lexer/has_feature_type_traits.cpp
index 6636e7b3963..743d2e24ab0 100644
--- a/test/Lexer/has_feature_type_traits.cpp
+++ b/test/Lexer/has_feature_type_traits.cpp
@@ -20,6 +20,16 @@ int has_trivial_assign();
 #endif
 // CHECK: int has_trivial_assign();
 
+#if __has_feature(has_trivial_move_assign)
+int has_trivial_move_assign();
+#endif
+// CHECK: int has_trivial_move_assign();
+
+#if __has_feature(has_trivial_move_constructor)
+int has_trivial_move_constructor();
+#endif
+// CHECK: int has_trivial_move_constructor();
+
 #if __has_feature(has_trivial_copy)
 int has_trivial_copy();
 #endif
@@ -105,6 +115,16 @@ int is_literal();
 #endif
 // CHECK: int is_literal();
 
+#if __has_feature(is_nothrow_assignable)
+int is_nothrow_assignable();
+#endif
+// CHECK: int is_nothrow_assignable();
+
+#if __has_feature(is_nothrow_constructible)
+int is_nothrow_constructible();
+#endif
+// CHECK: int is_nothrow_constructible();
+
 #if __has_feature(is_standard_layout)
 int is_standard_layout();
 #endif
-- 
GitLab