diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -12280,16 +12280,14 @@ llvm_unreachable("Corrupt redecls chain"); } -template ::value, bool> = true> +template , bool> = true> T *getCommonDecl(T *X, T *Y) { return cast_or_null( getCommonDecl(const_cast(cast_or_null(X)), const_cast(cast_or_null(Y)))); } -template ::value, bool> = true> +template , bool> = true> T *getCommonDeclChecked(T *X, T *Y) { return cast(getCommonDecl(const_cast(cast(X)), const_cast(cast(Y)))); 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 @@ -200,8 +200,8 @@ // cast the return value to `T`. template auto import(T *From) - -> std::conditional_t::value, - Expected, Expected> { + -> std::conditional_t, Expected, + Expected> { auto ToOrErr = Importer.Import(From); if (!ToOrErr) return ToOrErr.takeError(); diff --git a/clang/lib/AST/Comment.cpp b/clang/lib/AST/Comment.cpp --- a/clang/lib/AST/Comment.cpp +++ b/clang/lib/AST/Comment.cpp @@ -29,7 +29,7 @@ #undef ABSTRACT_COMMENT // DeclInfo is also allocated with a BumpPtrAllocator. -static_assert(std::is_trivially_destructible::value, +static_assert(std::is_trivially_destructible_v, "DeclInfo should be trivially destructible!"); const char *Comment::getCommentKindName() const { diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -188,8 +188,7 @@ /// Does the given declaration have member specialization information, /// and if so, is it an explicit specialization? template -static std::enable_if_t::value, - bool> +static std::enable_if_t, bool> isExplicitMemberSpecialization(const T *D) { if (const MemberSpecializationInfo *member = D->getMemberSpecializationInfo()) { diff --git a/clang/lib/AST/Interp/Disasm.cpp b/clang/lib/AST/Interp/Disasm.cpp --- a/clang/lib/AST/Interp/Disasm.cpp +++ b/clang/lib/AST/Interp/Disasm.cpp @@ -22,7 +22,7 @@ using namespace clang::interp; template inline T ReadArg(Program &P, CodePtr &OpPC) { - if constexpr (std::is_pointer::value) { + if constexpr (std::is_pointer_v) { uint32_t ID = OpPC.read(); return reinterpret_cast(P.getNativePointer(ID)); } else { diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -727,9 +727,9 @@ // hence strict duck-typing. template ::value || - std::is_base_of::value || - std::is_base_of::value>> + std::is_base_of_v || + std::is_base_of_v || + std::is_base_of_v>> void findConstructionContextsForArguments(CallLikeExpr *E) { for (unsigned i = 0, e = E->getNumArgs(); i != e; ++i) { Expr *Arg = E->getArg(i); diff --git a/clang/lib/Analysis/RetainSummaryManager.cpp b/clang/lib/Analysis/RetainSummaryManager.cpp --- a/clang/lib/Analysis/RetainSummaryManager.cpp +++ b/clang/lib/Analysis/RetainSummaryManager.cpp @@ -32,7 +32,7 @@ /// rest of varargs. template constexpr static bool isOneOf() { - return std::is_same::value || isOneOf(); + return std::is_same_v || isOneOf(); } namespace { diff --git a/clang/lib/Basic/SourceLocation.cpp b/clang/lib/Basic/SourceLocation.cpp --- a/clang/lib/Basic/SourceLocation.cpp +++ b/clang/lib/Basic/SourceLocation.cpp @@ -42,11 +42,11 @@ // SourceLocation //===----------------------------------------------------------------------===// -static_assert(std::is_trivially_destructible::value, +static_assert(std::is_trivially_destructible_v, "SourceLocation must be trivially destructible because it is " "used in unions"); -static_assert(std::is_trivially_destructible::value, +static_assert(std::is_trivially_destructible_v, "SourceRange must be trivially destructible because it is " "used in unions"); diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -199,8 +199,7 @@ } template static constexpr bool is_uint64_t_convertible() { - return !std::is_same::value && - llvm::is_integral_or_enum::value; + return !std::is_same_v && llvm::is_integral_or_enum::value; } template ::value, + static_assert(std::is_trivial_v, "assume trivial copyability if copying into the " "uninitialized array (as opposed to reusing a cached " "MacroArgs)"); @@ -94,7 +94,7 @@ // Run the dtor to deallocate the vectors. this->~MacroArgs(); // Release the memory for the object. - static_assert(std::is_trivially_destructible::value, + static_assert(std::is_trivially_destructible_v, "assume trivially destructible and forego destructors"); free(this); 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 @@ -202,7 +202,7 @@ /// A helper function to provide Attribute Location for the Attr types /// AND the ParsedAttr. template -static std::enable_if_t::value, SourceLocation> +static std::enable_if_t, 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 @@ -5491,12 +5491,12 @@ // specialized than primary" check. struct GetP2 { template ::value, bool> = true> + std::enable_if_t, bool> = true> T2 *operator()(T1 *, T2 *P2) { return P2; } template ::value, bool> = true> + std::enable_if_t, bool> = true> T1 *operator()(T1 *, T2 *) { return nullptr; } @@ -5508,7 +5508,7 @@ TemplateArgumentListAreEqual(ASTContext &Ctx) : Ctx(Ctx) {} template ::value, bool> = true> + std::enable_if_t, bool> = true> bool operator()(T1 *PS1, T2 *PS2) { ArrayRef Args1 = PS1->getTemplateArgs().asArray(), Args2 = PS2->getTemplateArgs().asArray(); @@ -5527,7 +5527,7 @@ } template ::value, bool> = true> + std::enable_if_t, bool> = true> bool operator()(T1 *Spec, T2 *Primary) { ArrayRef Args1 = Spec->getTemplateArgs().asArray(), Args2 = Primary->getInjectedTemplateArgs(); @@ -5576,7 +5576,7 @@ getMoreSpecialized(Sema &S, QualType T1, QualType T2, TemplateLikeDecl *P1, PrimaryDel *P2, TemplateDeductionInfo &Info) { constexpr bool IsMoreSpecialThanPrimaryCheck = - !std::is_same::value; + !std::is_same_v; bool Better1 = isAtLeastAsSpecializedAs(S, T1, T2, P2, Info); if (IsMoreSpecialThanPrimaryCheck && !Better1) diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -912,9 +912,9 @@ // Try to do as much compile time checking as possible. // FIXME: check for invocable instead of function? - static_assert(std::is_function>::value, + static_assert(std::is_function_v>, "Printer is not a function!"); - static_assert(std::is_convertible::value, + static_assert(std::is_convertible_v, "Printer doesn't have the required type!"); if (LCtx && !State->get().isEmpty()) { 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,13 +117,11 @@ Impl(SyntaxTree *Parent, Stmt *N, ASTContext &AST); template Impl(SyntaxTree *Parent, - std::enable_if_t::value, T> *Node, - ASTContext &AST) + std::enable_if_t, T> *Node, ASTContext &AST) : Impl(Parent, dyn_cast(Node), AST) {} template Impl(SyntaxTree *Parent, - std::enable_if_t::value, T> *Node, - ASTContext &AST) + std::enable_if_t, T> *Node, ASTContext &AST) : Impl(Parent, dyn_cast(Node), AST) {} SyntaxTree *Parent; diff --git a/clang/unittests/Lex/HeaderMapTest.cpp b/clang/unittests/Lex/HeaderMapTest.cpp --- a/clang/unittests/Lex/HeaderMapTest.cpp +++ b/clang/unittests/Lex/HeaderMapTest.cpp @@ -115,8 +115,7 @@ TEST(HeaderMapTest, lookupFilenameTruncatedSuffix) { typedef HMapFileMock<2, 64 - sizeof(HMapHeader) - 2 * sizeof(HMapBucket)> FileTy; - static_assert(std::is_standard_layout::value, - "Expected standard layout"); + static_assert(std::is_standard_layout_v, "Expected standard layout"); static_assert(sizeof(FileTy) == 64, "check the math"); PaddedFile P; auto &File = P.File; @@ -151,8 +150,7 @@ TEST(HeaderMapTest, lookupFilenameTruncatedPrefix) { typedef HMapFileMock<2, 64 - sizeof(HMapHeader) - 2 * sizeof(HMapBucket)> FileTy; - static_assert(std::is_standard_layout::value, - "Expected standard layout"); + static_assert(std::is_standard_layout_v, "Expected standard layout"); static_assert(sizeof(FileTy) == 64, "check the math"); PaddedFile P; auto &File = P.File; 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, - std::enable_if_t::value, T> *StmtOverloadChecker = - nullptr) { +const SelectedASTNode & +checkNode(const SelectedASTNode &StmtNode, SourceSelectionKind SelectionKind, + unsigned NumChildren = 0, + std::enable_if_t, 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 = "", - std::enable_if_t::value, T> *DeclOverloadChecker = - nullptr) { +const SelectedASTNode & +checkNode(const SelectedASTNode &DeclNode, SourceSelectionKind SelectionKind, + unsigned NumChildren = 0, StringRef Name = "", + std::enable_if_t, T> *DeclOverloadChecker = + nullptr) { checkNodeImpl(isa(DeclNode.Node.get()), DeclNode, SelectionKind, NumChildren); if (!Name.empty()) diff --git a/clang/unittests/Tooling/Syntax/TreeTest.cpp b/clang/unittests/Tooling/Syntax/TreeTest.cpp --- a/clang/unittests/Tooling/Syntax/TreeTest.cpp +++ b/clang/unittests/Tooling/Syntax/TreeTest.cpp @@ -151,9 +151,8 @@ // FIXME: mutate and observe no invalidation. Mutations are private for now... auto It = Range.begin(); auto CIt = ConstRange.begin(); - static_assert(std::is_same::value, - "mutable range"); - static_assert(std::is_same::value, + static_assert(std::is_same_v, "mutable range"); + static_assert(std::is_same_v, "const range"); for (unsigned I = 0; I < 3; ++I) {