]> granicus.if.org Git - clang/commitdiff
[C++11] Replace LLVM-style type traits with C++11 standard ones.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 7 Mar 2014 14:30:23 +0000 (14:30 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 7 Mar 2014 14:30:23 +0000 (14:30 +0000)
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203241 91177308-0d34-0410-b5e6-96231b3b80d8

13 files changed:
include/clang/AST/ASTTypeTraits.h
include/clang/AST/ASTVector.h
include/clang/AST/CanonicalType.h
include/clang/AST/DeclBase.h
include/clang/AST/ExprObjC.h
include/clang/AST/Type.h
include/clang/ASTMatchers/Dynamic/VariantValue.h
include/clang/Analysis/Support/BumpVector.h
include/clang/Basic/Diagnostic.h
include/clang/Basic/PartialDiagnostic.h
lib/AST/Decl.cpp
lib/ASTMatchers/Dynamic/Marshallers.h
lib/CodeGen/EHScopeStack.h

index d7bbdefb22d62addf2d209b4531903d84fe5b9d0..b920767a10a60d21919482469c8e4626446bcdbe 100644 (file)
@@ -297,18 +297,18 @@ private:
 
 template <typename T>
 struct DynTypedNode::BaseConverter<
-    T, typename llvm::enable_if<llvm::is_base_of<
-           Decl, T> >::type> : public DynCastPtrConverter<T, Decl> {};
+    T, typename std::enable_if<std::is_base_of<Decl, T>::value>::type>
+    : public DynCastPtrConverter<T, Decl> {};
 
 template <typename T>
 struct DynTypedNode::BaseConverter<
-    T, typename llvm::enable_if<llvm::is_base_of<
-           Stmt, T> >::type> : public DynCastPtrConverter<T, Stmt> {};
+    T, typename std::enable_if<std::is_base_of<Stmt, T>::value>::type>
+    : public DynCastPtrConverter<T, Stmt> {};
 
 template <typename T>
 struct DynTypedNode::BaseConverter<
-    T, typename llvm::enable_if<llvm::is_base_of<
-           Type, T> >::type> : public DynCastPtrConverter<T, Type> {};
+    T, typename std::enable_if<std::is_base_of<Type, T>::value>::type>
+    : public DynCastPtrConverter<T, Type> {};
 
 template <>
 struct DynTypedNode::BaseConverter<
index be52a85444f93035dc83e4c1c7144312bb6aface..d9d37b19c159db9cef9b988dcd041b74d33c379e 100644 (file)
@@ -53,7 +53,7 @@ public:
   }
 
   ~ASTVector() {
-    if (llvm::is_class<T>::value) {
+    if (std::is_class<T>::value) {
       // Destroy the constructed elements in the vector.
       destroy_range(Begin, End);
     }
@@ -123,7 +123,7 @@ public:
   }
 
   void clear() {
-    if (llvm::is_class<T>::value) {
+    if (std::is_class<T>::value) {
       destroy_range(Begin, End);
     }
     End = Begin;
@@ -368,7 +368,7 @@ void ASTVector<T>::grow(const ASTContext &C, size_t MinSize) {
   T *NewElts = new (C, llvm::alignOf<T>()) T[NewCapacity];
 
   // Copy the elements over.
-  if (llvm::is_class<T>::value) {
+  if (std::is_class<T>::value) {
     std::uninitialized_copy(Begin, End, NewElts);
     // Destroy the original elements.
     destroy_range(Begin, End);
index 4bafe23c203315291c73ab83cb1500bbbd64c66c..7cccef69ddf8872b664ea1e55a48095457808db9 100644 (file)
@@ -17,7 +17,6 @@
 
 #include "clang/AST/Type.h"
 #include "llvm/Support/Casting.h"
-#include "llvm/Support/type_traits.h"
 #include <iterator>
 
 namespace clang {
@@ -60,9 +59,9 @@ public:
 
   /// \brief Converting constructor that permits implicit upcasting of
   /// canonical type pointers.
-  template<typename U>
-  CanQual(const CanQual<U>Other,
-          typename llvm::enable_if<llvm::is_base_of<T, U>, int>::type = 0);
+  template <typename U>
+  CanQual(const CanQual<U> &Other,
+          typename std::enable_if<std::is_base_of<T, U>::value, int>::type = 0);
 
   /// \brief Retrieve the underlying type pointer, which refers to a
   /// canonical type.
index 395fb670266883ecfd71d3b62672d754901c5f53..957e2b719e94cff62a5f8810b8c5ed6dab77cea5 100644 (file)
@@ -1675,7 +1675,7 @@ inline bool Decl::isTemplateParameter() const {
 
 // Specialization selected when ToTy is not a known subclass of DeclContext.
 template <class ToTy,
-          bool IsKnownSubtype = ::llvm::is_base_of< DeclContext, ToTy>::value>
+          bool IsKnownSubtype = ::std::is_base_of<DeclContext, ToTy>::value>
 struct cast_convert_decl_context {
   static const ToTy *doit(const DeclContext *Val) {
     return static_cast<const ToTy*>(Decl::castFromDeclContext(Val));
index 0b11448403704fa267671d5ef6093ff9d1213099..fc78e893e0655cdb6311ed1fd063aed4c8ac68b1 100644 (file)
@@ -215,7 +215,7 @@ struct ObjCDictionaryElement {
 } // end namespace clang
 
 namespace llvm {
-template <> struct isPodLike<clang::ObjCDictionaryElement> : llvm::true_type {};
+template <> struct isPodLike<clang::ObjCDictionaryElement> : std::true_type {};
 }
 
 namespace clang {
index 7205a5de7a96e6125be1a4f6e4a10677731a8a16..3dce45596bd14a15a52aba90fda88a025a253d75 100644 (file)
@@ -31,7 +31,6 @@
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/type_traits.h"
 
 namespace clang {
   enum {
@@ -5173,10 +5172,9 @@ inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
 
 // Helper class template that is used by Type::getAs to ensure that one does
 // not try to look through a qualified type to get to an array type.
-template<typename T,
-         bool isArrayType = (llvm::is_same<T, ArrayType>::value ||
-                             llvm::is_base_of<ArrayType, T>::value)>
-struct ArrayType_cannot_be_used_with_getAs { };
+template <typename T, bool isArrayType = (std::is_same<T, ArrayType>::value ||
+                                          std::is_base_of<ArrayType, T>::value)>
+struct ArrayType_cannot_be_used_with_getAs {};
 
 template<typename T>
 struct ArrayType_cannot_be_used_with_getAs<T, true>;
index 2c80ff6b3e11256a2704dad77f898be5bd7199e3..1b9970dd8f1d3d70b2728a1f91f605a117173363 100644 (file)
@@ -23,7 +23,6 @@
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/Twine.h"
-#include "llvm/Support/type_traits.h"
 #include <vector>
 
 namespace clang {
index 387e7792bd388891a983000eb9a6e5cd37a33c8f..e246712a7e63d20ceb7d786fb0cfe890bb3eacef 100644 (file)
@@ -60,7 +60,7 @@ public:
   }
   
   ~BumpVector() {
-    if (llvm::is_class<T>::value) {
+    if (std::is_class<T>::value) {
       // Destroy the constructed elements in the vector.
       destroy_range(Begin, End);
     }
@@ -130,7 +130,7 @@ public:
   }
   
   void clear() {
-    if (llvm::is_class<T>::value) {
+    if (std::is_class<T>::value) {
       destroy_range(Begin, End);
     }
     End = Begin;
@@ -223,7 +223,7 @@ void BumpVector<T>::grow(BumpVectorContext &C, size_t MinSize) {
   T *NewElts = C.getAllocator().template Allocate<T>(NewCapacity);
   
   // Copy the elements over.
-  if (llvm::is_class<T>::value) {
+  if (std::is_class<T>::value) {
     std::uninitialized_copy(Begin, End, NewElts);
     // Destroy the original elements.
     destroy_range(Begin, End);
index e2dfd8182c9156088c68d63ea13c61c191c55625..e9385223a2531618f8316368a60c4a47ab197f4d 100644 (file)
@@ -21,7 +21,6 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
-#include "llvm/Support/type_traits.h"
 #include <list>
 #include <vector>
 
@@ -1046,8 +1045,8 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
 // match.
 template<typename T>
 inline
-typename llvm::enable_if<llvm::is_same<T, DeclContext>, 
-                         const DiagnosticBuilder &>::type
+typename std::enable_if<std::is_same<T, DeclContext>::value,
+                        const DiagnosticBuilder &>::type
 operator<<(const DiagnosticBuilder &DB, T *DC) {
   DB.AddTaggedVal(reinterpret_cast<intptr_t>(DC),
                   DiagnosticsEngine::ak_declcontext);
index 9be733ae0932731fa0d360c97fad3978d3e268fe..314b9ef180c11b27ec2e98628ada6adb1f2ed35c 100644 (file)
@@ -376,8 +376,8 @@ public:
   // match.
   template<typename T>
   friend inline
-  typename llvm::enable_if<llvm::is_same<T, DeclContext>,
-                           const PartialDiagnostic &>::type
+  typename std::enable_if<std::is_same<T, DeclContext>::value,
+                          const PartialDiagnostic &>::type
   operator<<(const PartialDiagnostic &PD, T *DC) {
     PD.AddTaggedVal(reinterpret_cast<intptr_t>(DC),
                     DiagnosticsEngine::ak_declcontext);
index 6eaf1405501902734df4f70da2015020ba30b8cf..1a8748ccfd0bf47c04ef93410082019d50c99d9b 100644 (file)
@@ -29,7 +29,6 @@
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/type_traits.h"
 #include <algorithm>
 
 using namespace clang;
@@ -158,8 +157,7 @@ static bool usesTypeVisibility(const NamedDecl *D) {
 /// Does the given declaration have member specialization information,
 /// and if so, is it an explicit specialization?
 template <class T> static typename
-llvm::enable_if_c<!llvm::is_base_of<RedeclarableTemplateDecl, T>::value,
-                  bool>::type
+std::enable_if<!std::is_base_of<RedeclarableTemplateDecl, T>::value, bool>::type
 isExplicitMemberSpecialization(const T *D) {
   if (const MemberSpecializationInfo *member =
         D->getMemberSpecializationInfo()) {
index 4409125dc6a70ded8d37ff39913a3d54d5f47945..5884a9421b4678b25bbcb641cebae3f46b97a639 100644 (file)
@@ -25,7 +25,6 @@
 #include "clang/ASTMatchers/Dynamic/VariantValue.h"
 #include "clang/Basic/LLVM.h"
 #include "llvm/ADT/STLExtras.h"
-#include "llvm/Support/type_traits.h"
 #include <string>
 
 namespace clang {
index c34e3b2b25f0450a9b29c88c9d6d7b27864a2e0c..2fc4a48f05e636bd70133a69a044630eec6cfa8d 100644 (file)
@@ -65,9 +65,9 @@ template <class T> struct InvariantValue {
 template <class T> struct DominatingValue : InvariantValue<T> {};
 
 template <class T, bool mightBeInstruction =
-            llvm::is_base_of<llvm::Value, T>::value &&
-            !llvm::is_base_of<llvm::Constant, T>::value &&
-            !llvm::is_base_of<llvm::BasicBlock, T>::value>
+            std::is_base_of<llvm::Value, T>::value &&
+            !std::is_base_of<llvm::Constant, T>::value &&
+            !std::is_base_of<llvm::BasicBlock, T>::value>
 struct DominatingPointer;
 template <class T> struct DominatingPointer<T,false> : InvariantValue<T*> {};
 // template <class T> struct DominatingPointer<T,true> at end of file