diff --git a/clang/include/clang/AST/ASTTypeTraits.h b/clang/include/clang/AST/ASTTypeTraits.h --- a/clang/include/clang/AST/ASTTypeTraits.h +++ b/clang/include/clang/AST/ASTTypeTraits.h @@ -465,22 +465,22 @@ template struct DynTypedNode::BaseConverter< - T, typename std::enable_if::value>::type> + T, std::enable_if_t::value>> : public DynCastPtrConverter {}; template struct DynTypedNode::BaseConverter< - T, typename std::enable_if::value>::type> + T, std::enable_if_t::value>> : public DynCastPtrConverter {}; template struct DynTypedNode::BaseConverter< - T, typename std::enable_if::value>::type> + T, std::enable_if_t::value>> : public DynCastPtrConverter {}; template struct DynTypedNode::BaseConverter< - T, typename std::enable_if::value>::type> + T, std::enable_if_t::value>> : public DynCastPtrConverter {}; template <> diff --git a/clang/include/clang/AST/CanonicalType.h b/clang/include/clang/AST/CanonicalType.h --- a/clang/include/clang/AST/CanonicalType.h +++ b/clang/include/clang/AST/CanonicalType.h @@ -74,7 +74,7 @@ /// canonical type pointers. template CanQual(const CanQual &Other, - typename std::enable_if::value, int>::type = 0); + std::enable_if_t::value, int> = 0); /// Retrieve the underlying type pointer, which refers to a /// canonical type. diff --git a/clang/include/clang/AST/DataCollection.h b/clang/include/clang/AST/DataCollection.h --- a/clang/include/clang/AST/DataCollection.h +++ b/clang/include/clang/AST/DataCollection.h @@ -50,10 +50,9 @@ } template -typename std::enable_if< - std::is_integral::value || std::is_enum::value || - std::is_convertible::value // for llvm::hash_code - >::type +std::enable_if_t::value || std::is_enum::value || + std::is_convertible::value // for llvm::hash_code + > addDataToConsumer(T &DataConsumer, Type Data) { DataConsumer.update(StringRef(reinterpret_cast(&Data), sizeof(Data))); } diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h --- a/clang/include/clang/AST/Expr.h +++ b/clang/include/clang/AST/Expr.h @@ -5282,10 +5282,9 @@ template class AssociationTy { friend class GenericSelectionExpr; template friend class AssociationIteratorTy; - using ExprPtrTy = - typename std::conditional::type; - using TSIPtrTy = typename std::conditional::type; + using ExprPtrTy = std::conditional_t; + using TSIPtrTy = + std::conditional_t; ExprPtrTy E; TSIPtrTy TSI; bool Selected; @@ -5327,10 +5326,9 @@ // const Association &Assoc = *It++; // Oops, Assoc is dangling. using BaseTy = typename AssociationIteratorTy::iterator_facade_base; using StmtPtrPtrTy = - typename std::conditional::type; - using TSIPtrPtrTy = - typename std::conditional::type; + std::conditional_t; + using TSIPtrPtrTy = std::conditional_t; StmtPtrPtrTy E; // = nullptr; FIXME: Once support for gcc 4.8 is dropped. TSIPtrPtrTy TSI; // Kept in sync with E. unsigned Offset = 0, SelectedOffset = 0; diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h --- a/clang/include/clang/AST/OpenMPClause.h +++ b/clang/include/clang/AST/OpenMPClause.h @@ -6611,7 +6611,7 @@ template class Ptr, typename RetTy> class OMPClauseVisitorBase { public: -#define PTR(CLASS) typename Ptr::type +#define PTR(CLASS) Ptr #define DISPATCH(CLASS) \ return static_cast(this)->Visit##CLASS(static_cast(S)) @@ -6634,12 +6634,11 @@ #undef DISPATCH }; -template -using const_ptr = typename std::add_pointer::type>; +template using const_ptr = std::add_pointer_t>; -template -class OMPClauseVisitor : - public OMPClauseVisitorBase {}; +template +class OMPClauseVisitor + : public OMPClauseVisitorBase {}; template class ConstOMPClauseVisitor : public OMPClauseVisitorBase {}; diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/include/clang/AST/RecursiveASTVisitor.h @@ -340,11 +340,11 @@ (has_same_member_pointer_type::value \ - ? static_cast::value, \ - Derived &, RecursiveASTVisitor &>::type>(*this) \ + Derived &, RecursiveASTVisitor &>>(*this) \ .Traverse##NAME(static_cast(VAR), QUEUE) \ : getDerived().Traverse##NAME(static_cast(VAR))) diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h --- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -516,8 +516,8 @@ /// Requires \c T to be derived from \c From. template Matcher(const Matcher &Other, - typename std::enable_if::value && - !std::is_same::value>::type * = nullptr) + std::enable_if_t::value && + !std::is_same::value> * = nullptr) : Implementation(restrictMatcher(Other.Implementation)) { assert(Implementation.getSupportedKind().isSame( ast_type_traits::ASTNodeKind::getFromNodeKind())); @@ -528,9 +528,8 @@ /// The resulting matcher is not strict, i.e. ignores qualifiers. template Matcher(const Matcher &Other, - typename std::enable_if< - std::is_same::value && - std::is_same::value>::type* = nullptr) + std::enable_if_t::value && + std::is_same::value> * = nullptr) : Implementation(new TypeToQualType(Other)) {} /// Convert \c this into a \c Matcher by applying dyn_cast<> to the diff --git a/clang/include/clang/Analysis/CFG.h b/clang/include/clang/Analysis/CFG.h --- a/clang/include/clang/Analysis/CFG.h +++ b/clang/include/clang/Analysis/CFG.h @@ -624,10 +624,10 @@ template friend class ElementRefImpl; using CFGBlockPtr = - typename std::conditional::type; + std::conditional_t; - using CFGElementPtr = typename std::conditional::type; + using CFGElementPtr = + std::conditional_t; protected: CFGBlockPtr Parent; @@ -675,15 +675,14 @@ friend class ElementRefIterator; using CFGBlockRef = - typename std::conditional::type; + std::conditional_t; - using UnderlayingIteratorTy = typename std::conditional< + using UnderlayingIteratorTy = std::conditional_t< IsConst, - typename std::conditional::type, - typename std::conditional::type>::type; + std::conditional_t, + std::conditional_t>; using IteratorTraits = typename std::iterator_traits; using ElementRef = typename CFGBlock::ElementRefImpl; diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -1217,9 +1217,7 @@ // We use enable_if here to prevent that this overload is selected for // pointers or other arguments that are implicitly convertible to bool. template -inline -typename std::enable_if::value, - const DiagnosticBuilder &>::type +inline std::enable_if_t::value, const DiagnosticBuilder &> operator<<(const DiagnosticBuilder &DB, T I) { DB.AddTaggedVal(I, DiagnosticsEngine::ak_sint); return DB; @@ -1249,9 +1247,9 @@ // other arguments that derive from DeclContext (e.g., RecordDecls) will not // match. template -inline typename std::enable_if< - std::is_same::type, DeclContext>::value, - const DiagnosticBuilder &>::type +inline std::enable_if_t< + std::is_same, DeclContext>::value, + const DiagnosticBuilder &> operator<<(const DiagnosticBuilder &DB, T *DC) { DB.AddTaggedVal(reinterpret_cast(DC), DiagnosticsEngine::ak_declcontext); diff --git a/clang/include/clang/Basic/PartialDiagnostic.h b/clang/include/clang/Basic/PartialDiagnostic.h --- a/clang/include/clang/Basic/PartialDiagnostic.h +++ b/clang/include/clang/Basic/PartialDiagnostic.h @@ -378,10 +378,9 @@ // so that we only match those arguments that are (statically) DeclContexts; // other arguments that derive from DeclContext (e.g., RecordDecls) will not // match. - template - friend inline - typename std::enable_if::value, - const PartialDiagnostic &>::type + template + friend inline std::enable_if_t::value, + const PartialDiagnostic &> operator<<(const PartialDiagnostic &PD, T *DC) { PD.AddTaggedVal(reinterpret_cast(DC), DiagnosticsEngine::ak_declcontext); diff --git a/clang/include/clang/Tooling/Refactoring/RefactoringOptions.h b/clang/include/clang/Tooling/Refactoring/RefactoringOptions.h --- a/clang/include/clang/Tooling/Refactoring/RefactoringOptions.h +++ b/clang/include/clang/Tooling/Refactoring/RefactoringOptions.h @@ -20,8 +20,8 @@ namespace tooling { /// A refactoring option that stores a value of type \c T. -template ::value>::type> +template ::value>> class OptionalRefactoringOption : public RefactoringOption { public: void passToVisitor(RefactoringOptionVisitor &Visitor) final override { @@ -39,8 +39,8 @@ }; /// A required refactoring option that stores a value of type \c T. -template ::value>::type> +template ::value>> class RequiredRefactoringOption : public OptionalRefactoringOption { public: using ValueType = T; diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -650,7 +650,7 @@ template Error ImportArrayChecked(IIter Ibegin, IIter Iend, OIter Obegin) { - using ItemT = typename std::remove_reference::type; + using ItemT = std::remove_reference_t; for (; Ibegin != Iend; ++Ibegin, ++Obegin) { Expected ToOrErr = import(*Ibegin); if (!ToOrErr) diff --git a/clang/lib/AST/Interp/Boolean.h b/clang/lib/AST/Interp/Boolean.h --- a/clang/lib/AST/Interp/Boolean.h +++ b/clang/lib/AST/Interp/Boolean.h @@ -85,14 +85,13 @@ static Boolean max(unsigned NumBits) { return Boolean(true); } template - static typename std::enable_if::value, Boolean>::type - from(T Value) { + static std::enable_if_t::value, Boolean> from(T Value) { return Boolean(Value != 0); } template - static typename std::enable_if::type from( - Integral Value) { + static std::enable_if_t + from(Integral Value) { return Boolean(!Value.isZero()); } diff --git a/clang/lib/AST/Interp/Integral.h b/clang/lib/AST/Interp/Integral.h --- a/clang/lib/AST/Interp/Integral.h +++ b/clang/lib/AST/Interp/Integral.h @@ -156,13 +156,12 @@ } template - static typename std::enable_if::value, Integral>::type - from(T Value) { + static std::enable_if_t::value, Integral> from(T Value) { return Integral(Value); } template - static typename std::enable_if::type + static std::enable_if_t from(Integral Value) { return Integral(Value.V); } @@ -206,52 +205,52 @@ private: template - static typename std::enable_if::value, bool>::type - CheckAddUB(T A, T B, T &R) { + static std::enable_if_t::value, bool> CheckAddUB(T A, T B, + T &R) { return llvm::AddOverflow(A, B, R); } template - static typename std::enable_if::value, bool>::type - CheckAddUB(T A, T B, T &R) { + static std::enable_if_t::value, bool> CheckAddUB(T A, T B, + T &R) { R = A + B; return false; } template - static typename std::enable_if::value, bool>::type - CheckSubUB(T A, T B, T &R) { + static std::enable_if_t::value, bool> CheckSubUB(T A, T B, + T &R) { return llvm::SubOverflow(A, B, R); } template - static typename std::enable_if::value, bool>::type - CheckSubUB(T A, T B, T &R) { + static std::enable_if_t::value, bool> CheckSubUB(T A, T B, + T &R) { R = A - B; return false; } template - static typename std::enable_if::value, bool>::type - CheckMulUB(T A, T B, T &R) { + static std::enable_if_t::value, bool> CheckMulUB(T A, T B, + T &R) { return llvm::MulOverflow(A, B, R); } template - static typename std::enable_if::value, bool>::type - CheckMulUB(T A, T B, T &R) { + static std::enable_if_t::value, bool> CheckMulUB(T A, T B, + T &R) { R = A * B; return false; } template - static typename std::enable_if::value, bool>::type + static std::enable_if_t::value, bool> CheckRange(int64_t V) { return Min <= V && V <= Max; } template - static typename std::enable_if::value, bool>::type + static std::enable_if_t::value, bool> CheckRange(int64_t V) { return V >= 0 && static_cast(V) <= Max; } diff --git a/clang/lib/AST/Interp/Source.h b/clang/lib/AST/Interp/Source.h --- a/clang/lib/AST/Interp/Source.h +++ b/clang/lib/AST/Interp/Source.h @@ -56,14 +56,14 @@ /// Helper to decode a value or a pointer. template - static typename std::enable_if::value, T>::type + static std::enable_if_t::value, T> ReadHelper(const char *Ptr) { using namespace llvm::support; return endian::read(Ptr); } template - static typename std::enable_if::value, T>::type + static std::enable_if_t::value, T> ReadHelper(const char *Ptr) { using namespace llvm::support; auto Punned = endian::read(Ptr); diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp --- a/clang/lib/Analysis/ThreadSafety.cpp +++ b/clang/lib/Analysis/ThreadSafety.cpp @@ -1249,8 +1249,7 @@ } template -static typename std::enable_if::value, - StringRef>::type +static std::enable_if_t::value, StringRef> ClassifyDiagnostic(const AttrTy *A) { if (const ValueDecl *VD = getValueDecl(A->getArg())) return ClassifyDiagnostic(VD); @@ -1258,8 +1257,7 @@ } template -static typename std::enable_if::value, - StringRef>::type +static std::enable_if_t::value, StringRef> ClassifyDiagnostic(const AttrTy *A) { for (const auto *Arg : A->args()) { if (const ValueDecl *VD = getValueDecl(Arg)) diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h --- a/clang/lib/CodeGen/CGOpenMPRuntime.h +++ b/clang/lib/CodeGen/CGOpenMPRuntime.h @@ -80,11 +80,10 @@ template RegionCodeGenTy( Callable &&CodeGen, - typename std::enable_if< - !std::is_same::type, - RegionCodeGenTy>::value>::type * = nullptr) + std::enable_if_t, + RegionCodeGenTy>::value> * = nullptr) : CodeGen(reinterpret_cast(&CodeGen)), - Callback(CallbackFn::type>), + Callback(CallbackFn>), PrePostAction(nullptr) {} void setAction(PrePostActionTy &Action) const { PrePostAction = &Action; } void operator()(CodeGenFunction &CGF) const; diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -225,8 +225,7 @@ /// A helper function to provide Attribute Location for the Attr types /// AND the ParsedAttr. template -static typename std::enable_if::value, - SourceLocation>::type +static std::enable_if_t::value, SourceLocation> getAttrLoc(const AttrInfo &AL) { return AL.getLocation(); } diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -2747,8 +2747,8 @@ /// Complete template argument deduction for a partial specialization. template -static typename std::enable_if::value, - Sema::TemplateDeductionResult>::type +static std::enable_if_t::value, + Sema::TemplateDeductionResult> FinishTemplateArgumentDeduction( Sema &S, T *Partial, bool IsPartialOrdering, const TemplateArgumentList &TemplateArgs, diff --git a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp --- a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp +++ b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp @@ -51,11 +51,10 @@ } // end of anonymous namespace template -static - typename std::conditional::value, - typename CheckerOrPackageInfoList::const_iterator, - typename CheckerOrPackageInfoList::iterator>::type - binaryFind(CheckerOrPackageInfoList &Collection, StringRef FullName) { +static std::conditional_t::value, + typename CheckerOrPackageInfoList::const_iterator, + typename CheckerOrPackageInfoList::iterator> +binaryFind(CheckerOrPackageInfoList &Collection, StringRef FullName) { using CheckerOrPackage = typename CheckerOrPackageInfoList::value_type; using CheckerOrPackageFullNameLT = FullNameLT; diff --git a/clang/lib/Tooling/ASTDiff/ASTDiff.cpp b/clang/lib/Tooling/ASTDiff/ASTDiff.cpp --- a/clang/lib/Tooling/ASTDiff/ASTDiff.cpp +++ b/clang/lib/Tooling/ASTDiff/ASTDiff.cpp @@ -117,12 +117,12 @@ Impl(SyntaxTree *Parent, Stmt *N, ASTContext &AST); template Impl(SyntaxTree *Parent, - typename std::enable_if::value, T>::type *Node, + std::enable_if_t::value, T> *Node, ASTContext &AST) : Impl(Parent, dyn_cast(Node), AST) {} template Impl(SyntaxTree *Parent, - typename std::enable_if::value, T>::type *Node, + std::enable_if_t::value, T> *Node, ASTContext &AST) : Impl(Parent, dyn_cast(Node), AST) {} diff --git a/clang/unittests/Tooling/ASTSelectionTest.cpp b/clang/unittests/Tooling/ASTSelectionTest.cpp --- a/clang/unittests/Tooling/ASTSelectionTest.cpp +++ b/clang/unittests/Tooling/ASTSelectionTest.cpp @@ -101,22 +101,22 @@ } template -const SelectedASTNode & -checkNode(const SelectedASTNode &StmtNode, SourceSelectionKind SelectionKind, - unsigned NumChildren = 0, - typename std::enable_if::value, T>::type - *StmtOverloadChecker = nullptr) { +const SelectedASTNode &checkNode( + const SelectedASTNode &StmtNode, SourceSelectionKind SelectionKind, + unsigned NumChildren = 0, + std::enable_if_t::value, T> *StmtOverloadChecker = + nullptr) { checkNodeImpl(isa(StmtNode.Node.get()), StmtNode, SelectionKind, NumChildren); return StmtNode; } template -const SelectedASTNode & -checkNode(const SelectedASTNode &DeclNode, SourceSelectionKind SelectionKind, - unsigned NumChildren = 0, StringRef Name = "", - typename std::enable_if::value, T>::type - *DeclOverloadChecker = nullptr) { +const SelectedASTNode &checkNode( + const SelectedASTNode &DeclNode, SourceSelectionKind SelectionKind, + unsigned NumChildren = 0, StringRef Name = "", + std::enable_if_t::value, T> *DeclOverloadChecker = + nullptr) { checkNodeImpl(isa(DeclNode.Node.get()), DeclNode, SelectionKind, NumChildren); if (!Name.empty())