Author: Kazu Hirata Date: 2022-08-20T22:36:26-07:00 New Revision: c5da37e42d388947a40654b7011f2a820ec51601
URL: https://github.com/llvm/llvm-project/commit/c5da37e42d388947a40654b7011f2a820ec51601 DIFF: https://github.com/llvm/llvm-project/commit/c5da37e42d388947a40654b7011f2a820ec51601.diff LOG: Use std::is_same_v instead of std::is_same (NFC) Added: Modified: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp clang-tools-extra/clangd/support/Context.h clang-tools-extra/clangd/support/Function.h clang/include/clang/AST/Expr.h clang/include/clang/AST/Type.h clang/include/clang/ASTMatchers/ASTMatchersInternal.h clang/include/clang/Basic/Diagnostic.h clang/include/clang/Sema/Overload.h clang/include/clang/Sema/ParsedAttr.h clang/include/clang/Tooling/Transformer/RewriteRule.h clang/lib/AST/Type.cpp clang/lib/Analysis/RetainSummaryManager.cpp clang/lib/CodeGen/CGOpenMPRuntime.h clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Sema/SemaTemplateDeduction.cpp lld/MachO/InputFiles.cpp llvm/include/llvm/ADT/APFloat.h llvm/include/llvm/ADT/ArrayRef.h llvm/include/llvm/ADT/FunctionExtras.h llvm/include/llvm/ADT/STLFunctionalExtras.h llvm/include/llvm/ADT/Sequence.h llvm/include/llvm/ADT/SmallVector.h llvm/include/llvm/ADT/StringRef.h llvm/include/llvm/ADT/iterator.h llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h llvm/include/llvm/IR/Instruction.h llvm/include/llvm/IR/PassManager.h llvm/include/llvm/ProfileData/MemProf.h llvm/include/llvm/Support/AllocatorBase.h llvm/include/llvm/Support/Casting.h llvm/include/llvm/Support/CommandLine.h llvm/include/llvm/Support/FormatProviders.h llvm/include/llvm/Support/FormatVariadicDetails.h llvm/include/llvm/Support/JSON.h llvm/include/llvm/Support/TrailingObjects.h llvm/include/llvm/Support/YAMLTraits.h llvm/lib/Support/ItaniumManglingCanonicalizer.cpp llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h llvm/lib/Target/AMDGPU/GCNIterativeScheduler.cpp llvm/lib/Target/X86/X86ISelLowering.cpp llvm/lib/Transforms/Scalar/NaryReassociate.cpp llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp llvm/utils/TableGen/CodeGenDAGPatterns.h mlir/include/mlir/TableGen/Class.h Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp b/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp index aac017c0725d4..aa86d82b837e5 100644 --- a/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp +++ b/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp @@ -409,7 +409,7 @@ bool eligibleForExtraction(const SelectionTree::Node *N) { return false; // A plain reference to a name (e.g. variable) isn't worth extracting. - // FIXME: really? What if it's e.g. `std::is_same<void, void>::value`? + // FIXME: really? What if it's e.g. `std::is_same_v<void, void>`? if (llvm::isa<DeclRefExpr>(E)) return false; diff --git a/clang-tools-extra/clangd/support/Context.h b/clang-tools-extra/clangd/support/Context.h index a33a9ff8fffa7..f34fe5657a36f 100644 --- a/clang-tools-extra/clangd/support/Context.h +++ b/clang-tools-extra/clangd/support/Context.h @@ -157,7 +157,7 @@ class Context { }; template <class T> class TypedAnyStorage : public Context::AnyStorage { - static_assert(std::is_same<typename std::decay<T>::type, T>::value, + static_assert(std::is_same_v<typename std::decay<T>::type, T>, "Argument to TypedAnyStorage must be decayed"); public: diff --git a/clang-tools-extra/clangd/support/Function.h b/clang-tools-extra/clangd/support/Function.h index dc9216bc53753..2f0e7aace6379 100644 --- a/clang-tools-extra/clangd/support/Function.h +++ b/clang-tools-extra/clangd/support/Function.h @@ -93,7 +93,7 @@ template <typename T> class Event { } private: - static_assert(std::is_same<typename std::decay<T>::type, T>::value, + static_assert(std::is_same_v<typename std::decay<T>::type, T>, "use a plain type: event values are always passed by const&"); std::recursive_mutex ListenersMu; diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h index d8efe663ce8ee..082e20d4e3b11 100644 --- a/clang/include/clang/AST/Expr.h +++ b/clang/include/clang/AST/Expr.h @@ -1032,7 +1032,7 @@ class FullExpr : public Expr { class ConstantExpr final : public FullExpr, private llvm::TrailingObjects<ConstantExpr, APValue, uint64_t> { - static_assert(std::is_same<uint64_t, llvm::APInt::WordType>::value, + static_assert(std::is_same_v<uint64_t, llvm::APInt::WordType>, "ConstantExpr assumes that llvm::APInt::WordType is uint64_t " "for tail-allocated storage"); friend TrailingObjects; diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index ad9835e839a65..728d863ad6662 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -7315,7 +7315,7 @@ inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &PD, // not try to look through a qualified type to get to an array type. template <typename T> using TypeIsArrayType = - std::integral_constant<bool, std::is_same<T, ArrayType>::value || + std::integral_constant<bool, std::is_same_v<T, ArrayType> || std::is_base_of<ArrayType, T>::value>; // Member-template getAs<specific type>'. diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h index 5785a72559987..aca26e9df0ee9 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -579,7 +579,7 @@ class Matcher { template <typename From> Matcher(const Matcher<From> &Other, std::enable_if_t<std::is_base_of<From, T>::value && - !std::is_same<From, T>::value> * = nullptr) + !std::is_same_v<From, T>> * = nullptr) : Implementation(restrictMatcher(Other.Implementation)) { assert(Implementation.getSupportedKind().isSame( ASTNodeKind::getFromNodeKind<T>())); @@ -590,8 +590,8 @@ class Matcher { /// The resulting matcher is not strict, i.e. ignores qualifiers. template <typename TypeT> Matcher(const Matcher<TypeT> &Other, - std::enable_if_t<std::is_same<T, QualType>::value && - std::is_same<TypeT, Type>::value> * = nullptr) + std::enable_if_t<std::is_same_v<T, QualType> && + std::is_same_v<TypeT, Type>> * = nullptr) : Implementation(new TypeToQualType<TypeT>(Other)) {} /// Convert \c this into a \c Matcher<T> by applying dyn_cast<> to the @@ -904,10 +904,10 @@ class has_getDecl { /// PolymorphicMatcher and should be StringRef. template <typename T, typename ArgT> class HasOverloadedOperatorNameMatcher : public SingleNodeMatcherInterface<T> { - static_assert(std::is_same<T, CXXOperatorCallExpr>::value || - std::is_base_of<FunctionDecl, T>::value, + static_assert(std::is_same_v<T, CXXOperatorCallExpr> || + std::is_base_of<FunctionDecl, T>::value, "unsupported class for matcher"); - static_assert(std::is_same<ArgT, std::vector<std::string>>::value, + static_assert(std::is_same_v<ArgT, std::vector<std::string>>, "argument type must be std::vector<std::string>"); public: @@ -988,7 +988,7 @@ Matcher<ObjCMessageExpr> hasAnySelectorFunc( /// not actually used. template <typename T, typename DeclMatcherT> class HasDeclarationMatcher : public MatcherInterface<T> { - static_assert(std::is_same<DeclMatcherT, Matcher<Decl>>::value, + static_assert(std::is_same_v<DeclMatcherT, Matcher<Decl>>, "instantiated with wrong types"); DynTypedMatcher InnerMatcher; @@ -1166,14 +1166,12 @@ class HasDeclarationMatcher : public MatcherInterface<T> { template <typename T> struct IsBaseType { static const bool value = - std::is_same<T, Decl>::value || std::is_same<T, Stmt>::value || - std::is_same<T, QualType>::value || std::is_same<T, Type>::value || - std::is_same<T, TypeLoc>::value || - std::is_same<T, NestedNameSpecifier>::value || - std::is_same<T, NestedNameSpecifierLoc>::value || - std::is_same<T, CXXCtorInitializer>::value || - std::is_same<T, TemplateArgumentLoc>::value || - std::is_same<T, Attr>::value; + std::is_same_v<T, Decl> || std::is_same_v<T, Stmt> || + std::is_same_v<T, QualType> || std::is_same_v<T, Type> || + std::is_same_v<T, TypeLoc> || std::is_same_v<T, NestedNameSpecifier> || + std::is_same_v<T, NestedNameSpecifierLoc> || + std::is_same_v<T, CXXCtorInitializer> || + std::is_same_v<T, TemplateArgumentLoc> || std::is_same_v<T, Attr>; }; template <typename T> const bool IsBaseType<T>::value; @@ -2203,13 +2201,13 @@ inline Optional<StringRef> getOpName(const CXXOperatorCallExpr &Node) { /// PolymorphicMatcher and should be std::vector<std::string>>. template <typename T, typename ArgT = std::vector<std::string>> class HasAnyOperatorNameMatcher : public SingleNodeMatcherInterface<T> { - static_assert(std::is_same<T, BinaryOperator>::value || - std::is_same<T, CXXOperatorCallExpr>::value || - std::is_same<T, CXXRewrittenBinaryOperator>::value || - std::is_same<T, UnaryOperator>::value, + static_assert(std::is_same_v<T, BinaryOperator> || + std::is_same_v<T, CXXOperatorCallExpr> || + std::is_same_v<T, CXXRewrittenBinaryOperator> || + std::is_same_v<T, UnaryOperator>, "Matcher only supports `BinaryOperator`, `UnaryOperator`, " "`CXXOperatorCallExpr` and `CXXRewrittenBinaryOperator`"); - static_assert(std::is_same<ArgT, std::vector<std::string>>::value, + static_assert(std::is_same_v<ArgT, std::vector<std::string>>, "Matcher ArgT must be std::vector<std::string>"); public: diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index 09857da61d326..c4481f38ea1f9 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -1419,8 +1419,7 @@ inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, // We use enable_if here to prevent that this overload is selected for // pointers or other arguments that are implicitly convertible to bool. template <typename T> -inline std::enable_if_t<std::is_same<T, bool>::value, - const StreamingDiagnostic &> +inline std::enable_if_t<std::is_same_v<T, bool>, const StreamingDiagnostic &> operator<<(const StreamingDiagnostic &DB, T I) { DB.AddTaggedVal(I, DiagnosticsEngine::ak_sint); return DB; @@ -1462,9 +1461,8 @@ inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, // other arguments that derive from DeclContext (e.g., RecordDecls) will not // match. template <typename T> -inline std::enable_if_t< - std::is_same<std::remove_const_t<T>, DeclContext>::value, - const StreamingDiagnostic &> +inline std::enable_if_t<std::is_same_v<std::remove_const_t<T>, DeclContext>, + const StreamingDiagnostic &> operator<<(const StreamingDiagnostic &DB, T *DC) { DB.AddTaggedVal(reinterpret_cast<intptr_t>(DC), DiagnosticsEngine::ak_declcontext); diff --git a/clang/include/clang/Sema/Overload.h b/clang/include/clang/Sema/Overload.h index fb4812675d9a3..ac81c8818b370 100644 --- a/clang/include/clang/Sema/Overload.h +++ b/clang/include/clang/Sema/Overload.h @@ -1055,7 +1055,7 @@ class Sema; static_assert(alignof(T) == alignof(void *), "Only works for pointer-aligned types."); static_assert(std::is_trivial<T>::value || - std::is_same<ImplicitConversionSequence, T>::value, + std::is_same_v<ImplicitConversionSequence, T>, "Add destruction logic to OverloadCandidateSet::clear()."); unsigned NBytes = sizeof(T) * N; diff --git a/clang/include/clang/Sema/ParsedAttr.h b/clang/include/clang/Sema/ParsedAttr.h index 1f5237dc4a4d2..0f5e747177af8 100644 --- a/clang/include/clang/Sema/ParsedAttr.h +++ b/clang/include/clang/Sema/ParsedAttr.h @@ -1173,21 +1173,19 @@ inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, /// it explicit is hard. This constructor causes ambiguity with /// DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, SourceRange R). /// We use SFINAE to disable any conversion and remove any ambiguity. -template <typename ACI, - typename std::enable_if_t< - std::is_same<ACI, AttributeCommonInfo>::value, int> = 0> +template <typename ACI, typename std::enable_if_t< + std::is_same_v<ACI, AttributeCommonInfo>, int> = 0> inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, - const ACI &CI) { + const ACI &CI) { DB.AddTaggedVal(reinterpret_cast<uint64_t>(CI.getAttrName()), DiagnosticsEngine::ak_identifierinfo); return DB; } -template <typename ACI, - typename std::enable_if_t< - std::is_same<ACI, AttributeCommonInfo>::value, int> = 0> +template <typename ACI, typename std::enable_if_t< + std::is_same_v<ACI, AttributeCommonInfo>, int> = 0> inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, - const ACI* CI) { + const ACI *CI) { DB.AddTaggedVal(reinterpret_cast<uint64_t>(CI->getAttrName()), DiagnosticsEngine::ak_identifierinfo); return DB; diff --git a/clang/include/clang/Tooling/Transformer/RewriteRule.h b/clang/include/clang/Tooling/Transformer/RewriteRule.h index 4e8537c6c801d..0a933359699f0 100644 --- a/clang/include/clang/Tooling/Transformer/RewriteRule.h +++ b/clang/include/clang/Tooling/Transformer/RewriteRule.h @@ -441,7 +441,7 @@ applyFirst(std::initializer_list<RewriteRuleWith<MetadataT>> Rules) { /// Converts a \c RewriteRuleWith<T> to a \c RewriteRule by stripping off the /// metadata generators. template <int &..., typename MetadataT> -std::enable_if_t<!std::is_same<MetadataT, void>::value, RewriteRule> +std::enable_if_t<!std::is_same_v<MetadataT, void>, RewriteRule> stripMetadata(RewriteRuleWith<MetadataT> Rule) { RewriteRule R; R.Cases = std::move(Rule.Cases); diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index 8534e575b466b..b4fdc59480e09 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -415,7 +415,7 @@ QualType QualType::getSingleStepDesugaredTypeImpl(QualType type, // APInt member. It should be replaced in favor of ASTContext allocation. #define TYPE(CLASS, BASE) \ static_assert(std::is_trivially_destructible<CLASS##Type>::value || \ - std::is_same<CLASS##Type, ConstantArrayType>::value, \ + std::is_same_v<CLASS##Type, ConstantArrayType>, \ #CLASS "Type should be trivially destructible!"); #include "clang/AST/TypeNodes.inc" diff --git a/clang/lib/Analysis/RetainSummaryManager.cpp b/clang/lib/Analysis/RetainSummaryManager.cpp index 5e9c73534aeba..143c037dda9f6 100644 --- a/clang/lib/Analysis/RetainSummaryManager.cpp +++ b/clang/lib/Analysis/RetainSummaryManager.cpp @@ -32,7 +32,7 @@ constexpr static bool isOneOf() { /// rest of varargs. template <class T, class P, class... ToCompare> constexpr static bool isOneOf() { - return std::is_same<T, P>::value || isOneOf<T, ToCompare...>(); + return std::is_same_v<T, P> || isOneOf<T, ToCompare...>(); } namespace { diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h index b95aef68335ed..9e4ab2d0a04d0 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.h +++ b/clang/lib/CodeGen/CGOpenMPRuntime.h @@ -81,8 +81,8 @@ class RegionCodeGenTy final { template <typename Callable> RegionCodeGenTy( Callable &&CodeGen, - std::enable_if_t<!std::is_same<std::remove_reference_t<Callable>, - RegionCodeGenTy>::value> * = nullptr) + std::enable_if_t<!std::is_same_v<std::remove_reference_t<Callable>, + RegionCodeGenTy>> * = nullptr) : CodeGen(reinterpret_cast<intptr_t>(&CodeGen)), Callback(CallbackFn<std::remove_reference_t<Callable>>), PrePostAction(nullptr) {} diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 9731d4006d1e0..79d9dcd5f96f0 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -197,8 +197,7 @@ static void denormalizeSimpleFlag(SmallVectorImpl<const char *> &Args, } template <typename T> static constexpr bool is_uint64_t_convertible() { - return !std::is_same<T, uint64_t>::value && - llvm::is_integral_or_enum<T>::value; + return !std::is_same_v<T, uint64_t> && llvm::is_integral_or_enum<T>::value; } template <typename T, diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 99119bcb2e4e6..9059efcbd8520 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -5411,12 +5411,12 @@ namespace { // specialized than primary" check. struct GetP2 { template <typename T1, typename T2, - std::enable_if_t<std::is_same<T1, T2>::value, bool> = true> + std::enable_if_t<std::is_same_v<T1, T2>, bool> = true> T2 *operator()(T1 *, T2 *P2) { return P2; } template <typename T1, typename T2, - std::enable_if_t<!std::is_same<T1, T2>::value, bool> = true> + std::enable_if_t<!std::is_same_v<T1, T2>, bool> = true> T1 *operator()(T1 *, T2 *) { return nullptr; } @@ -5450,7 +5450,7 @@ static TemplateLikeDecl * getMoreSpecialized(Sema &S, QualType T1, QualType T2, TemplateLikeDecl *P1, PrimaryDel *P2, TemplateDeductionInfo &Info) { constexpr bool IsMoreSpecialThanPrimaryCheck = - !std::is_same<TemplateLikeDecl, PrimaryDel>::value; + !std::is_same_v<TemplateLikeDecl, PrimaryDel>; bool Better1 = isAtLeastAsSpecializedAs(S, T1, T2, P2, Info); if (IsMoreSpecialThanPrimaryCheck && !Better1) diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp index 55d4888f60c2d..25487dd8e8928 100644 --- a/lld/MachO/InputFiles.cpp +++ b/lld/MachO/InputFiles.cpp @@ -416,8 +416,7 @@ void ObjFile::splitEhFrames(ArrayRef<uint8_t> data, Section &ehFrameSection) { template <class T> static Section *findContainingSection(const std::vector<Section *> §ions, T *offset) { - static_assert(std::is_same<uint64_t, T>::value || - std::is_same<uint32_t, T>::value, + static_assert(std::is_same_v<uint64_t, T> || std::is_same_v<uint32_t, T>, "unexpected type for offset"); auto it = std::prev(llvm::upper_bound( sections, *offset, @@ -436,8 +435,7 @@ static Section *findContainingSection(const std::vector<Section *> §ions, template <class T> static InputSection *findContainingSubsection(const Section §ion, T *offset) { - static_assert(std::is_same<uint64_t, T>::value || - std::is_same<uint32_t, T>::value, + static_assert(std::is_same_v<uint64_t, T> || std::is_same_v<uint32_t, T>, "unexpected type for offset"); auto it = std::prev(llvm::upper_bound( section.subsections, *offset, diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h index cdedb6ece9920..dd4d3edcca6d4 100644 --- a/llvm/include/llvm/ADT/APFloat.h +++ b/llvm/include/llvm/ADT/APFloat.h @@ -794,9 +794,9 @@ class APFloat : public APFloatBase { } U; template <typename T> static bool usesLayout(const fltSemantics &Semantics) { - static_assert(std::is_same<T, IEEEFloat>::value || - std::is_same<T, DoubleAPFloat>::value, ""); - if (std::is_same<T, DoubleAPFloat>::value) { + static_assert( + std::is_same_v<T, IEEEFloat> || std::is_same_v<T, DoubleAPFloat>, ""); + if (std::is_same_v<T, DoubleAPFloat>) { return &Semantics == &PPCDoubleDouble(); } return &Semantics != &PPCDoubleDouble(); diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h index acfa324e6b100..baed204a36e66 100644 --- a/llvm/include/llvm/ADT/ArrayRef.h +++ b/llvm/include/llvm/ADT/ArrayRef.h @@ -262,7 +262,7 @@ namespace llvm { /// The declaration here is extra complicated so that "arrayRef = {}" /// continues to select the move assignment operator. template <typename U> - std::enable_if_t<std::is_same<U, T>::value, ArrayRef<T>> & + std::enable_if_t<std::is_same_v<U, T>, ArrayRef<T>> & operator=(U &&Temporary) = delete; /// Disallow accidental assignment from a temporary. @@ -270,7 +270,7 @@ namespace llvm { /// The declaration here is extra complicated so that "arrayRef = {}" /// continues to select the move assignment operator. template <typename U> - std::enable_if_t<std::is_same<U, T>::value, ArrayRef<T>> & + std::enable_if_t<std::is_same_v<U, T>, ArrayRef<T>> & operator=(std::initializer_list<U>) = delete; /// @} diff --git a/llvm/include/llvm/ADT/FunctionExtras.h b/llvm/include/llvm/ADT/FunctionExtras.h index 27fff59115a8d..0b8202e5c8fd3 100644 --- a/llvm/include/llvm/ADT/FunctionExtras.h +++ b/llvm/include/llvm/ADT/FunctionExtras.h @@ -63,7 +63,7 @@ using EnableIfTrivial = std::is_trivially_destructible<T>::value>; template <typename CallableT, typename ThisT> using EnableUnlessSameType = - std::enable_if_t<!std::is_same<remove_cvref_t<CallableT>, ThisT>::value>; + std::enable_if_t<!std::is_same_v<remove_cvref_t<CallableT>, ThisT>>; template <typename CallableT, typename Ret, typename... Params> using EnableIfCallable = std::enable_if_t<std::disjunction< std::is_void<Ret>, diff --git a/llvm/include/llvm/ADT/STLFunctionalExtras.h b/llvm/include/llvm/ADT/STLFunctionalExtras.h index ebe1b1521a5d7..717857c356631 100644 --- a/llvm/include/llvm/ADT/STLFunctionalExtras.h +++ b/llvm/include/llvm/ADT/STLFunctionalExtras.h @@ -54,8 +54,8 @@ class function_ref<Ret(Params...)> { function_ref( Callable &&callable, // This is not the copy-constructor. - std::enable_if_t<!std::is_same<remove_cvref_t<Callable>, - function_ref>::value> * = nullptr, + std::enable_if_t<!std::is_same_v<remove_cvref_t<Callable>, function_ref>> + * = nullptr, // Functor must be callable and return a suitable type. std::enable_if_t<std::is_void<Ret>::value || std::is_convertible<decltype(std::declval<Callable>()( diff --git a/llvm/include/llvm/ADT/Sequence.h b/llvm/include/llvm/ADT/Sequence.h index 96935c291ec1e..88229fec51953 100644 --- a/llvm/include/llvm/ADT/Sequence.h +++ b/llvm/include/llvm/ADT/Sequence.h @@ -289,7 +289,7 @@ template <typename T> struct iota_range { private: static_assert(std::is_integral<T>::value || std::is_enum<T>::value, "T must be an integral or enum type"); - static_assert(std::is_same<T, std::remove_cv_t<T>>::value, + static_assert(std::is_same_v<T, std::remove_cv_t<T>>, "T must not be const nor volatile"); iterator BeginValue; diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h index a29886c38e3f8..264022c2d4813 100644 --- a/llvm/include/llvm/ADT/SmallVector.h +++ b/llvm/include/llvm/ADT/SmallVector.h @@ -193,10 +193,9 @@ class SmallVectorTemplateCommon this->assertSafeToReferenceAfterResize(From, 0); this->assertSafeToReferenceAfterResize(To - 1, 0); } - template < - class ItTy, - std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T *>::value, - bool> = false> + template <class ItTy, + std::enable_if_t<!std::is_same_v<std::remove_const_t<ItTy>, T *>, + bool> = false> void assertSafeToReferenceAfterClear(ItTy, ItTy) {} /// Check whether any part of the range will be invalidated by growing. @@ -206,10 +205,9 @@ class SmallVectorTemplateCommon this->assertSafeToAdd(From, To - From); this->assertSafeToAdd(To - 1, To - From); } - template < - class ItTy, - std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T *>::value, - bool> = false> + template <class ItTy, + std::enable_if_t<!std::is_same_v<std::remove_const_t<ItTy>, T *>, + bool> = false> void assertSafeToAddRange(ItTy, ItTy) {} /// Reserve enough space to add one element, and return the updated element @@ -498,8 +496,8 @@ class SmallVectorTemplateBase<T, true> : public SmallVectorTemplateCommon<T> { template <typename T1, typename T2> static void uninitialized_copy( T1 *I, T1 *E, T2 *Dest, - std::enable_if_t<std::is_same<typename std::remove_const<T1>::type, - T2>::value> * = nullptr) { + std::enable_if_t<std::is_same_v<typename std::remove_const<T1>::type, T2>> + * = nullptr) { // Use memcpy for PODs iterated by pointers (which includes SmallVector // iterators): std::uninitialized_copy optimizes to memmove, but we can // use memcpy here. Note that I and E are iterators and thus might be @@ -756,8 +754,8 @@ class SmallVectorImpl : public SmallVectorTemplateBase<T> { template <class ArgType> iterator insert_one_impl(iterator I, ArgType &&Elt) { // Callers ensure that ArgType is derived from T. static_assert( - std::is_same<std::remove_const_t<std::remove_reference_t<ArgType>>, - T>::value, + std::is_same_v<std::remove_const_t<std::remove_reference_t<ArgType>>, + T>, "ArgType must be derived from T!"); if (I == this->end()) { // Important special case for empty vector. @@ -780,7 +778,7 @@ class SmallVectorImpl : public SmallVectorTemplateBase<T> { // If we just moved the element we're inserting, be sure to update // the reference (never happens if TakesParamByValue). - static_assert(!TakesParamByValue || std::is_same<ArgType, T>::value, + static_assert(!TakesParamByValue || std::is_same_v<ArgType, T>, "ArgType must be 'T' when taking by value!"); if (!TakesParamByValue && this->isReferenceToRange(EltPtr, I, this->end())) ++EltPtr; diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h index 1f7f912607515..c6ec6f45c9d60 100644 --- a/llvm/include/llvm/ADT/StringRef.h +++ b/llvm/include/llvm/ADT/StringRef.h @@ -229,7 +229,7 @@ namespace llvm { /// The declaration here is extra complicated so that `stringRef = {}` /// and `stringRef = "abc"` continue to select the move assignment operator. template <typename T> - std::enable_if_t<std::is_same<T, std::string>::value, StringRef> & + std::enable_if_t<std::is_same_v<T, std::string>, StringRef> & operator=(T &&Str) = delete; /// @} diff --git a/llvm/include/llvm/ADT/iterator.h b/llvm/include/llvm/ADT/iterator.h index 6f0c42fe08bec..a89ce297f7120 100644 --- a/llvm/include/llvm/ADT/iterator.h +++ b/llvm/include/llvm/ADT/iterator.h @@ -225,12 +225,12 @@ template < typename DifferenceTypeT = typename std::iterator_traits<WrappedIteratorT>:: diff erence_type, typename PointerT = std::conditional_t< - std::is_same<T, typename std::iterator_traits< - WrappedIteratorT>::value_type>::value, + std::is_same_v< + T, typename std::iterator_traits<WrappedIteratorT>::value_type>, typename std::iterator_traits<WrappedIteratorT>::pointer, T *>, typename ReferenceT = std::conditional_t< - std::is_same<T, typename std::iterator_traits< - WrappedIteratorT>::value_type>::value, + std::is_same_v< + T, typename std::iterator_traits<WrappedIteratorT>::value_type>, typename std::iterator_traits<WrappedIteratorT>::reference, T &>> class iterator_adaptor_base : public iterator_facade_base<DerivedT, IteratorCategoryT, T, diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h index c388259482088..caf8713d7febd 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h @@ -154,16 +154,13 @@ class SPSArgList<SPSTagT, SPSTagTs...> { template <typename SPSTagT> class SPSSerializationTraits< SPSTagT, SPSTagT, - std::enable_if_t<std::is_same<SPSTagT, bool>::value || - std::is_same<SPSTagT, char>::value || - std::is_same<SPSTagT, int8_t>::value || - std::is_same<SPSTagT, int16_t>::value || - std::is_same<SPSTagT, int32_t>::value || - std::is_same<SPSTagT, int64_t>::value || - std::is_same<SPSTagT, uint8_t>::value || - std::is_same<SPSTagT, uint16_t>::value || - std::is_same<SPSTagT, uint32_t>::value || - std::is_same<SPSTagT, uint64_t>::value>> { + std::enable_if_t< + std::is_same_v<SPSTagT, bool> || std::is_same_v<SPSTagT, char> || + std::is_same_v<SPSTagT, int8_t> || std::is_same_v<SPSTagT, int16_t> || + std::is_same_v<SPSTagT, int32_t> || std::is_same_v<SPSTagT, int64_t> || + std::is_same_v<SPSTagT, uint8_t> || std::is_same_v<SPSTagT, uint16_t> || + std::is_same_v<SPSTagT, uint32_t> || + std::is_same_v<SPSTagT, uint64_t>>> { public: static size_t size(const SPSTagT &Value) { return sizeof(SPSTagT); } diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h index eb3fb084b28b6..21982bff707d8 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h @@ -669,7 +669,7 @@ class WrapperFunctionCall { /// Run call and deserialize result using SPS. template <typename SPSRetT, typename RetT> - std::enable_if_t<!std::is_same<SPSRetT, void>::value, Error> + std::enable_if_t<!std::is_same_v<SPSRetT, void>, Error> runWithSPSRet(RetT &RetVal) const { auto WFR = run(); if (const char *ErrMsg = WFR.getOutOfBandError()) @@ -684,8 +684,7 @@ class WrapperFunctionCall { /// Overload for SPS functions returning void. template <typename SPSRetT> - std::enable_if_t<std::is_same<SPSRetT, void>::value, Error> - runWithSPSRet() const { + std::enable_if_t<std::is_same_v<SPSRetT, void>, Error> runWithSPSRet() const { shared::SPSEmpty E; return runWithSPSRet<shared::SPSEmpty>(E); } diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h index 1044a634408ca..8e3f4d99e5085 100644 --- a/llvm/include/llvm/IR/Instruction.h +++ b/llvm/include/llvm/IR/Instruction.h @@ -821,7 +821,7 @@ class Instruction : public User, template <typename BitfieldElement> typename BitfieldElement::Type getSubclassData() const { static_assert( - std::is_same<BitfieldElement, HasMetadataField>::value || + std::is_same_v<BitfieldElement, HasMetadataField> || !Bitfield::isOverlapping<BitfieldElement, HasMetadataField>(), "Must not overlap with the metadata bit"); return Bitfield::get<BitfieldElement>(getSubclassDataFromValue()); @@ -830,7 +830,7 @@ class Instruction : public User, template <typename BitfieldElement> void setSubclassData(typename BitfieldElement::Type Value) { static_assert( - std::is_same<BitfieldElement, HasMetadataField>::value || + std::is_same_v<BitfieldElement, HasMetadataField> || !Bitfield::isOverlapping<BitfieldElement, HasMetadataField>(), "Must not overlap with the metadata bit"); auto Storage = getSubclassDataFromValue(); diff --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h index fa6be6a2dfb9a..c52470db4b0ba 100644 --- a/llvm/include/llvm/IR/PassManager.h +++ b/llvm/include/llvm/IR/PassManager.h @@ -543,9 +543,8 @@ class PassManager : public PassInfoMixin< } template <typename PassT> - LLVM_ATTRIBUTE_MINSIZE - std::enable_if_t<!std::is_same<PassT, PassManager>::value> - addPass(PassT &&Pass) { + LLVM_ATTRIBUTE_MINSIZE std::enable_if_t<!std::is_same_v<PassT, PassManager>> + addPass(PassT &&Pass) { using PassModelT = detail::PassModel<IRUnitT, PassT, PreservedAnalyses, AnalysisManagerT, ExtraArgTs...>; @@ -561,9 +560,8 @@ class PassManager : public PassInfoMixin< /// implementation complexity and avoid potential invalidation issues that may /// happen with nested pass managers of the same type. template <typename PassT> - LLVM_ATTRIBUTE_MINSIZE - std::enable_if_t<std::is_same<PassT, PassManager>::value> - addPass(PassT &&Pass) { + LLVM_ATTRIBUTE_MINSIZE std::enable_if_t<std::is_same_v<PassT, PassManager>> + addPass(PassT &&Pass) { for (auto &P : Pass.Passes) Passes.push_back(std::move(P)); } diff --git a/llvm/include/llvm/ProfileData/MemProf.h b/llvm/include/llvm/ProfileData/MemProf.h index bcee3b25bf875..925137163c801 100644 --- a/llvm/include/llvm/ProfileData/MemProf.h +++ b/llvm/include/llvm/ProfileData/MemProf.h @@ -190,7 +190,7 @@ struct Frame { // If the type of the GlobalValue::GUID changes, then we need to update // the reader and the writer. - static_assert(std::is_same<GlobalValue::GUID, uint64_t>::value, + static_assert(std::is_same_v<GlobalValue::GUID, uint64_t>, "Expect GUID to be uint64_t."); LE.write<uint64_t>(Function); diff --git a/llvm/include/llvm/Support/AllocatorBase.h b/llvm/include/llvm/Support/AllocatorBase.h index 5d05d3f8777b0..278ec434d384c 100644 --- a/llvm/include/llvm/Support/AllocatorBase.h +++ b/llvm/include/llvm/Support/AllocatorBase.h @@ -72,7 +72,7 @@ template <typename DerivedT> class AllocatorBase { /// Deallocate space for a sequence of objects without constructing them. template <typename T> - std::enable_if_t<!std::is_same<std::remove_cv_t<T>, void>::value, void> + std::enable_if_t<!std::is_same_v<std::remove_cv_t<T>, void>, void> Deallocate(T *Ptr, size_t Num = 1) { Deallocate(static_cast<const void *>(Ptr), Num * sizeof(T), alignof(T)); } diff --git a/llvm/include/llvm/Support/Casting.h b/llvm/include/llvm/Support/Casting.h index cf9c7c0efbf14..2ef5cbc23592d 100644 --- a/llvm/include/llvm/Support/Casting.h +++ b/llvm/include/llvm/Support/Casting.h @@ -231,7 +231,7 @@ struct cast_convert_val<To, FromTy *, FromTy *> { template <class X> struct is_simple_type { static const bool value = - std::is_same<X, typename simplify_type<X>::SimpleType>::value; + std::is_same_v<X, typename simplify_type<X>::SimpleType>; }; // } // namespace detail @@ -319,7 +319,7 @@ namespace detail { /// A helper to derive the type to use with `Self` for cast traits, when the /// provided CRTP derived type is allowed to be void. template <typename OptionalDerived, typename Default> -using SelfType = std::conditional_t<std::is_same<OptionalDerived, void>::value, +using SelfType = std::conditional_t<std::is_same_v<OptionalDerived, void>, Default, OptionalDerived>; } // namespace detail diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h index be1f54cfba368..2fcdc9b9d6a11 100644 --- a/llvm/include/llvm/Support/CommandLine.h +++ b/llvm/include/llvm/Support/CommandLine.h @@ -492,7 +492,7 @@ struct callback_traits<R (C::*)(Args...) const> { using result_type = R; using arg_type = std::tuple_element_t<0, std::tuple<Args...>>; static_assert(sizeof...(Args) == 1, "callback function must have one and only one parameter"); - static_assert(std::is_same<result_type, void>::value, + static_assert(std::is_same_v<result_type, void>, "callback return type must be void"); static_assert(std::is_lvalue_reference<arg_type>::value && std::is_const<std::remove_reference_t<arg_type>>::value, diff --git a/llvm/include/llvm/Support/FormatProviders.h b/llvm/include/llvm/Support/FormatProviders.h index 2bdc316a68a2d..718d3e4be6d42 100644 --- a/llvm/include/llvm/Support/FormatProviders.h +++ b/llvm/include/llvm/Support/FormatProviders.h @@ -35,7 +35,7 @@ struct use_integral_formatter template <typename T> struct use_char_formatter - : public std::integral_constant<bool, std::is_same<T, char>::value> {}; + : public std::integral_constant<bool, std::is_same_v<T, char>> {}; template <typename T> struct is_cstring diff --git a/llvm/include/llvm/Support/FormatVariadicDetails.h b/llvm/include/llvm/Support/FormatVariadicDetails.h index 2204cff13a64d..b5f0f25e9c300 100644 --- a/llvm/include/llvm/Support/FormatVariadicDetails.h +++ b/llvm/include/llvm/Support/FormatVariadicDetails.h @@ -147,7 +147,7 @@ build_format_adapter(T &&Item) { // would be responsible for consuming it. // Make the caller opt into this by calling fmt_consume(). static_assert( - !std::is_same<llvm::Error, std::remove_cv_t<T>>::value, + !std::is_same_v<llvm::Error, std::remove_cv_t<T>>, "llvm::Error-by-value must be wrapped in fmt_consume() for formatv"); return stream_operator_format_adapter<T>(std::forward<T>(Item)); } diff --git a/llvm/include/llvm/Support/JSON.h b/llvm/include/llvm/Support/JSON.h index 0a44aabedae60..a07047fd03ab6 100644 --- a/llvm/include/llvm/Support/JSON.h +++ b/llvm/include/llvm/Support/JSON.h @@ -329,8 +329,7 @@ class Value { Value(std::nullptr_t) : Type(T_Null) {} // Boolean (disallow implicit conversions). // (The last template parameter is a dummy to keep templates distinct.) - template <typename T, - typename = std::enable_if_t<std::is_same<T, bool>::value>, + template <typename T, typename = std::enable_if_t<std::is_same_v<T, bool>>, bool = false> Value(T B) : Type(T_Boolean) { create<bool>(B); @@ -338,7 +337,7 @@ class Value { // Unsigned 64-bit long integers. template <typename T, - typename = std::enable_if_t<std::is_same<T, uint64_t>::value>, + typename = std::enable_if_t<std::is_same_v<T, uint64_t>>, bool = false, bool = false> Value(T V) : Type(T_UINT64) { create<uint64_t>(uint64_t{V}); @@ -347,8 +346,8 @@ class Value { // Integers (except boolean and uint64_t). // Must be non-narrowing convertible to int64_t. template <typename T, typename = std::enable_if_t<std::is_integral<T>::value>, - typename = std::enable_if_t<!std::is_same<T, bool>::value>, - typename = std::enable_if_t<!std::is_same<T, uint64_t>::value>> + typename = std::enable_if_t<!std::is_same_v<T, bool>>, + typename = std::enable_if_t<!std::is_same_v<T, uint64_t>>> Value(T I) : Type(T_Integer) { create<int64_t>(int64_t{I}); } @@ -361,8 +360,8 @@ class Value { } // Serializable types: with a toJSON(const T&)->Value function, found by ADL. template <typename T, - typename = std::enable_if_t<std::is_same< - Value, decltype(toJSON(*(const T *)nullptr))>::value>, + typename = std::enable_if_t< + std::is_same_v<Value, decltype(toJSON(*(const T *)nullptr))>>, Value * = nullptr> Value(const T &V) : Value(toJSON(V)) {} diff --git a/llvm/include/llvm/Support/TrailingObjects.h b/llvm/include/llvm/Support/TrailingObjects.h index f9e711a5dc177..4fa945a165a27 100644 --- a/llvm/include/llvm/Support/TrailingObjects.h +++ b/llvm/include/llvm/Support/TrailingObjects.h @@ -322,7 +322,7 @@ class TrailingObjects : private trailing_objects_internal::TrailingObjectsImpl< /// object. template <typename... Tys> static constexpr std::enable_if_t< - std::is_same<Foo<TrailingTys...>, Foo<Tys...>>::value, size_t> + std::is_same_v<Foo<TrailingTys...>, Foo<Tys...>>, size_t> totalSizeToAlloc(typename trailing_objects_internal::ExtractSecondType< TrailingTys, size_t>::type... Counts) { return sizeof(BaseTy) + ParentType::additionalSizeToAllocImpl(0, Counts...); diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h index 8ade9b15642b5..86dd3dea85cb6 100644 --- a/llvm/include/llvm/Support/YAMLTraits.h +++ b/llvm/include/llvm/Support/YAMLTraits.h @@ -2020,8 +2020,8 @@ template <typename T> struct StdMapStringCustomMappingTraitsImpl { namespace yaml { \ static_assert( \ !std::is_fundamental<TYPE>::value && \ - !std::is_same<TYPE, std::string>::value && \ - !std::is_same<TYPE, llvm::StringRef>::value, \ + !std::is_same_v<TYPE, std::string> && \ + !std::is_same<TYPE, llvm::StringRef>::value, \ "only use LLVM_YAML_IS_SEQUENCE_VECTOR for types you control"); \ template <> struct SequenceElementTraits<TYPE> { \ static const bool flow = FLOW; \ diff --git a/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp b/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp index 52d5de93ff7d7..0c0a740317058 100644 --- a/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp +++ b/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp @@ -93,7 +93,7 @@ class FoldingNodeAllocator { // FIXME: Don't canonicalize forward template references for now, because // they contain state (the resolved template node) that's not known at their // point of creation. - if (std::is_same<T, ForwardTemplateReference>::value) { + if (std::is_same_v<T, ForwardTemplateReference>) { // Note that we don't use if-constexpr here and so we must still write // this code in a generic form. return {new (RawAlloc.Allocate(sizeof(T), alignof(T))) diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp index a206d10caf660..3fe18a7a9b0c8 100644 --- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -959,8 +959,8 @@ class AArch64Operand : public MCParsedAsmOperand { if (!isShiftedImm() && (!isImm() || !isa<MCConstantExpr>(getImm()))) return DiagnosticPredicateTy::NoMatch; - bool IsByte = std::is_same<int8_t, std::make_signed_t<T>>::value || - std::is_same<int8_t, T>::value; + bool IsByte = std::is_same_v<int8_t, std::make_signed_t<T>> || + std::is_same_v<int8_t, T>; if (auto ShiftedImm = getShiftedVal<8>()) if (!(IsByte && ShiftedImm->second) && AArch64_AM::isSVECpyImm<T>(uint64_t(ShiftedImm->first) @@ -977,8 +977,8 @@ class AArch64Operand : public MCParsedAsmOperand { if (!isShiftedImm() && (!isImm() || !isa<MCConstantExpr>(getImm()))) return DiagnosticPredicateTy::NoMatch; - bool IsByte = std::is_same<int8_t, std::make_signed_t<T>>::value || - std::is_same<int8_t, T>::value; + bool IsByte = std::is_same_v<int8_t, std::make_signed_t<T>> || + std::is_same_v<int8_t, T>; if (auto ShiftedImm = getShiftedVal<8>()) if (!(IsByte && ShiftedImm->second) && AArch64_AM::isSVEAddSubImm<T>(ShiftedImm->first diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h index 8765260935910..9405141d5577e 100644 --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h @@ -784,8 +784,8 @@ static inline bool isSVECpyImm(int64_t Imm) { /// Returns true if Imm is valid for ADD/SUB. template <typename T> static inline bool isSVEAddSubImm(int64_t Imm) { - bool IsInt8t = std::is_same<int8_t, std::make_signed_t<T>>::value || - std::is_same<int8_t, T>::value; + bool IsInt8t = std::is_same_v<int8_t, std::make_signed_t<T>> || + std::is_same_v<int8_t, T>; return uint8_t(Imm) == Imm || (!IsInt8t && uint16_t(Imm & ~0xff) == Imm); } diff --git a/llvm/lib/Target/AMDGPU/GCNIterativeScheduler.cpp b/llvm/lib/Target/AMDGPU/GCNIterativeScheduler.cpp index 22b529bee46e4..51493aefc43fe 100644 --- a/llvm/lib/Target/AMDGPU/GCNIterativeScheduler.cpp +++ b/llvm/lib/Target/AMDGPU/GCNIterativeScheduler.cpp @@ -389,7 +389,7 @@ void GCNIterativeScheduler::scheduleRegion(Region &R, Range &&Schedule, // Schedule consisting of MachineInstr* is considered 'detached' // and already interleaved with debug values - if (!std::is_same<decltype(*Schedule.begin()), MachineInstr*>::value) { + if (!std::is_same_v<decltype(*Schedule.begin()), MachineInstr *>) { placeDebugValues(); // Unfortunately placeDebugValues incorrectly modifies RegionEnd, restore // assert(R.End == RegionEnd); diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index e4e235ed09ecb..17b075f1fb83a 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -3543,8 +3543,8 @@ template <typename T> static bool hasCalleePopSRet(const SmallVectorImpl<T> &Args, const X86Subtarget &Subtarget) { // Not C++20 (yet), so no concepts available. - static_assert(std::is_same<T, ISD::OutputArg>::value || - std::is_same<T, ISD::InputArg>::value, + static_assert(std::is_same_v<T, ISD::OutputArg> || + std::is_same_v<T, ISD::InputArg>, "requires ISD::OutputArg or ISD::InputArg"); // Only 32-bit pops the sret. It's a 64-bit world these days, so early-out diff --git a/llvm/lib/Transforms/Scalar/NaryReassociate.cpp b/llvm/lib/Transforms/Scalar/NaryReassociate.cpp index 6dca30d9876e2..ab6c28c803795 100644 --- a/llvm/lib/Transforms/Scalar/NaryReassociate.cpp +++ b/llvm/lib/Transforms/Scalar/NaryReassociate.cpp @@ -576,13 +576,13 @@ NaryReassociatePass::findClosestMatchingDominator(const SCEV *CandidateExpr, } template <typename MaxMinT> static SCEVTypes convertToSCEVype(MaxMinT &MM) { - if (std::is_same<smax_pred_ty, typename MaxMinT::PredType>::value) + if (std::is_same_v<smax_pred_ty, typename MaxMinT::PredType>) return scSMaxExpr; - else if (std::is_same<umax_pred_ty, typename MaxMinT::PredType>::value) + else if (std::is_same_v<umax_pred_ty, typename MaxMinT::PredType>) return scUMaxExpr; - else if (std::is_same<smin_pred_ty, typename MaxMinT::PredType>::value) + else if (std::is_same_v<smin_pred_ty, typename MaxMinT::PredType>) return scSMinExpr; - else if (std::is_same<umin_pred_ty, typename MaxMinT::PredType>::value) + else if (std::is_same_v<umin_pred_ty, typename MaxMinT::PredType>) return scUMinExpr; llvm_unreachable("Can't convert MinMax pattern to SCEV type"); diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 065198ff16dad..d1fa50bb54b41 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -6935,12 +6935,12 @@ namespace { /// value, otherwise. struct ValueSelect { template <typename U> - static typename std::enable_if<std::is_same<Value *, U>::value, Value *>::type + static typename std::enable_if<std::is_same_v<Value *, U>, Value *>::type get(Value *V) { return V; } template <typename U> - static typename std::enable_if<!std::is_same<Value *, U>::value, U>::type + static typename std::enable_if<!std::is_same_v<Value *, U>, U>::type get(Value *) { return U(); } diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.h b/llvm/utils/TableGen/CodeGenDAGPatterns.h index dbdc72f0873a1..c494b35fe1d0e 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.h +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.h @@ -50,10 +50,10 @@ using TreePatternNodePtr = std::shared_ptr<TreePatternNode>; /// To reduce the allocations even further, make MachineValueTypeSet own /// the storage and use std::array as the bit container. struct MachineValueTypeSet { - static_assert(std::is_same<std::underlying_type<MVT::SimpleValueType>::type, - uint8_t>::value, - "Change uint8_t here to the SimpleValueType's type"); - static unsigned constexpr Capacity = std::numeric_limits<uint8_t>::max()+1; + static_assert( + std::is_same_v<std::underlying_type<MVT::SimpleValueType>::type, uint8_t>, + "Change uint8_t here to the SimpleValueType's type"); + static unsigned constexpr Capacity = std::numeric_limits<uint8_t>::max() + 1; using WordType = uint64_t; static unsigned constexpr WordWidth = CHAR_BIT*sizeof(WordType); static unsigned constexpr NumWords = Capacity/WordWidth; diff --git a/mlir/include/mlir/TableGen/Class.h b/mlir/include/mlir/TableGen/Class.h index efcd73ae61de9..37026c017c860 100644 --- a/mlir/include/mlir/TableGen/Class.h +++ b/mlir/include/mlir/TableGen/Class.h @@ -573,8 +573,8 @@ class Class { /// Create a class with a name, and whether it should be declared as a `class` /// or `struct`. Also, prevent this from being mistaken as a move constructor /// candidate. - template <typename NameT, typename = typename std::enable_if_t< - !std::is_same<NameT, Class>::value>> + template <typename NameT, + typename = typename std::enable_if_t<!std::is_same_v<NameT, Class>>> Class(NameT &&name, bool isStruct = false) : className(stringify(std::forward<NameT>(name))), isStruct(isStruct) {} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits