r203241 - [C++11] Replace LLVM-style type traits with C++11 standard ones.
Benjamin Kramer
benny.kra at googlemail.com
Fri Mar 7 06:30:24 PST 2014
Author: d0k
Date: Fri Mar 7 08:30:23 2014
New Revision: 203241
URL: http://llvm.org/viewvc/llvm-project?rev=203241&view=rev
Log:
[C++11] Replace LLVM-style type traits with C++11 standard ones.
No functionality change.
Modified:
cfe/trunk/include/clang/AST/ASTTypeTraits.h
cfe/trunk/include/clang/AST/ASTVector.h
cfe/trunk/include/clang/AST/CanonicalType.h
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/include/clang/AST/ExprObjC.h
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/include/clang/ASTMatchers/Dynamic/VariantValue.h
cfe/trunk/include/clang/Analysis/Support/BumpVector.h
cfe/trunk/include/clang/Basic/Diagnostic.h
cfe/trunk/include/clang/Basic/PartialDiagnostic.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h
cfe/trunk/lib/CodeGen/EHScopeStack.h
Modified: cfe/trunk/include/clang/AST/ASTTypeTraits.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTTypeTraits.h?rev=203241&r1=203240&r2=203241&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTTypeTraits.h (original)
+++ cfe/trunk/include/clang/AST/ASTTypeTraits.h Fri Mar 7 08:30:23 2014
@@ -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<
Modified: cfe/trunk/include/clang/AST/ASTVector.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTVector.h?rev=203241&r1=203240&r2=203241&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTVector.h (original)
+++ cfe/trunk/include/clang/AST/ASTVector.h Fri Mar 7 08:30:23 2014
@@ -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
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);
Modified: cfe/trunk/include/clang/AST/CanonicalType.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CanonicalType.h?rev=203241&r1=203240&r2=203241&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CanonicalType.h (original)
+++ cfe/trunk/include/clang/AST/CanonicalType.h Fri Mar 7 08:30:23 2014
@@ -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.
Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=203241&r1=203240&r2=203241&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Fri Mar 7 08:30:23 2014
@@ -1675,7 +1675,7 @@ inline bool Decl::isTemplateParameter()
// 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));
Modified: cfe/trunk/include/clang/AST/ExprObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprObjC.h?rev=203241&r1=203240&r2=203241&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprObjC.h (original)
+++ cfe/trunk/include/clang/AST/ExprObjC.h Fri Mar 7 08:30:23 2014
@@ -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 {
Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=203241&r1=203240&r2=203241&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Fri Mar 7 08:30:23 2014
@@ -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
// 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>;
Modified: cfe/trunk/include/clang/ASTMatchers/Dynamic/VariantValue.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/Dynamic/VariantValue.h?rev=203241&r1=203240&r2=203241&view=diff
==============================================================================
--- cfe/trunk/include/clang/ASTMatchers/Dynamic/VariantValue.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/Dynamic/VariantValue.h Fri Mar 7 08:30:23 2014
@@ -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 {
Modified: cfe/trunk/include/clang/Analysis/Support/BumpVector.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Support/BumpVector.h?rev=203241&r1=203240&r2=203241&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/Support/BumpVector.h (original)
+++ cfe/trunk/include/clang/Analysis/Support/BumpVector.h Fri Mar 7 08:30:23 2014
@@ -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(BumpVectorConte
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);
Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=203241&r1=203240&r2=203241&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Fri Mar 7 08:30:23 2014
@@ -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
// 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);
Modified: cfe/trunk/include/clang/Basic/PartialDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/PartialDiagnostic.h?rev=203241&r1=203240&r2=203241&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/PartialDiagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/PartialDiagnostic.h Fri Mar 7 08:30:23 2014
@@ -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);
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=203241&r1=203240&r2=203241&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri Mar 7 08:30:23 2014
@@ -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 Nam
/// 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()) {
Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h?rev=203241&r1=203240&r2=203241&view=diff
==============================================================================
--- cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h Fri Mar 7 08:30:23 2014
@@ -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 {
Modified: cfe/trunk/lib/CodeGen/EHScopeStack.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/EHScopeStack.h?rev=203241&r1=203240&r2=203241&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/EHScopeStack.h (original)
+++ cfe/trunk/lib/CodeGen/EHScopeStack.h Fri Mar 7 08:30:23 2014
@@ -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
More information about the cfe-commits
mailing list