[lld] 8b1b0d1 - Revert "Use std::is_same_v instead of std::is_same (NFC)"
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 20 23:00:51 PDT 2022
Author: Kazu Hirata
Date: 2022-08-20T23:00:39-07:00
New Revision: 8b1b0d1d81213d10e6add52d93d0afd71baf6a04
URL: https://github.com/llvm/llvm-project/commit/8b1b0d1d81213d10e6add52d93d0afd71baf6a04
DIFF: https://github.com/llvm/llvm-project/commit/8b1b0d1d81213d10e6add52d93d0afd71baf6a04.diff
LOG: Revert "Use std::is_same_v instead of std::is_same (NFC)"
This reverts commit c5da37e42d388947a40654b7011f2a820ec51601.
This patch seems to break builds with some versions of MSVC.
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 aa86d82b837e5..aac017c0725d4 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_v<void, void>`?
+ // FIXME: really? What if it's e.g. `std::is_same<void, void>::value`?
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 f34fe5657a36f..a33a9ff8fffa7 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_v<typename std::decay<T>::type, T>,
+ static_assert(std::is_same<typename std::decay<T>::type, T>::value,
"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 2f0e7aace6379..dc9216bc53753 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_v<typename std::decay<T>::type, T>,
+ static_assert(std::is_same<typename std::decay<T>::type, T>::value,
"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 082e20d4e3b11..d8efe663ce8ee 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_v<uint64_t, llvm::APInt::WordType>,
+ static_assert(std::is_same<uint64_t, llvm::APInt::WordType>::value,
"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 728d863ad6662..ad9835e839a65 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_v<T, ArrayType> ||
+ std::integral_constant<bool, std::is_same<T, ArrayType>::value ||
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 aca26e9df0ee9..5785a72559987 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_v<From, T>> * = nullptr)
+ !std::is_same<From, T>::value> * = 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_v<T, QualType> &&
- std::is_same_v<TypeT, Type>> * = nullptr)
+ std::enable_if_t<std::is_same<T, QualType>::value &&
+ std::is_same<TypeT, Type>::value> * = 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_v<T, CXXOperatorCallExpr> ||
- std::is_base_of<FunctionDecl, T>::value,
+ static_assert(std::is_same<T, CXXOperatorCallExpr>::value ||
+ std::is_base_of<FunctionDecl, T>::value,
"unsupported class for matcher");
- static_assert(std::is_same_v<ArgT, std::vector<std::string>>,
+ static_assert(std::is_same<ArgT, std::vector<std::string>>::value,
"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_v<DeclMatcherT, Matcher<Decl>>,
+ static_assert(std::is_same<DeclMatcherT, Matcher<Decl>>::value,
"instantiated with wrong types");
DynTypedMatcher InnerMatcher;
@@ -1166,12 +1166,14 @@ class HasDeclarationMatcher : public MatcherInterface<T> {
template <typename T>
struct IsBaseType {
static const bool 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>;
+ 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;
};
template <typename T>
const bool IsBaseType<T>::value;
@@ -2201,13 +2203,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_v<T, BinaryOperator> ||
- std::is_same_v<T, CXXOperatorCallExpr> ||
- std::is_same_v<T, CXXRewrittenBinaryOperator> ||
- std::is_same_v<T, UnaryOperator>,
+ 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,
"Matcher only supports `BinaryOperator`, `UnaryOperator`, "
"`CXXOperatorCallExpr` and `CXXRewrittenBinaryOperator`");
- static_assert(std::is_same_v<ArgT, std::vector<std::string>>,
+ static_assert(std::is_same<ArgT, std::vector<std::string>>::value,
"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 c4481f38ea1f9..09857da61d326 100644
--- a/clang/include/clang/Basic/Diagnostic.h
+++ b/clang/include/clang/Basic/Diagnostic.h
@@ -1419,7 +1419,8 @@ 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_v<T, bool>, const StreamingDiagnostic &>
+inline std::enable_if_t<std::is_same<T, bool>::value,
+ const StreamingDiagnostic &>
operator<<(const StreamingDiagnostic &DB, T I) {
DB.AddTaggedVal(I, DiagnosticsEngine::ak_sint);
return DB;
@@ -1461,8 +1462,9 @@ 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_v<std::remove_const_t<T>, DeclContext>,
- const StreamingDiagnostic &>
+inline std::enable_if_t<
+ std::is_same<std::remove_const_t<T>, DeclContext>::value,
+ 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 ac81c8818b370..fb4812675d9a3 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_v<ImplicitConversionSequence, T>,
+ std::is_same<ImplicitConversionSequence, T>::value,
"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 0f5e747177af8..1f5237dc4a4d2 100644
--- a/clang/include/clang/Sema/ParsedAttr.h
+++ b/clang/include/clang/Sema/ParsedAttr.h
@@ -1173,19 +1173,21 @@ 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_v<ACI, AttributeCommonInfo>, int> = 0>
+template <typename ACI,
+ typename std::enable_if_t<
+ std::is_same<ACI, AttributeCommonInfo>::value, 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_v<ACI, AttributeCommonInfo>, int> = 0>
+template <typename ACI,
+ typename std::enable_if_t<
+ std::is_same<ACI, AttributeCommonInfo>::value, 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 0a933359699f0..4e8537c6c801d 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_v<MetadataT, void>, RewriteRule>
+std::enable_if_t<!std::is_same<MetadataT, void>::value, 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 b4fdc59480e09..8534e575b466b 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_v<CLASS##Type, ConstantArrayType>, \
+ std::is_same<CLASS##Type, ConstantArrayType>::value, \
#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 143c037dda9f6..5e9c73534aeba 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_v<T, P> || isOneOf<T, ToCompare...>();
+ return std::is_same<T, P>::value || isOneOf<T, ToCompare...>();
}
namespace {
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h
index 9e4ab2d0a04d0..b95aef68335ed 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_v<std::remove_reference_t<Callable>,
- RegionCodeGenTy>> * = nullptr)
+ std::enable_if_t<!std::is_same<std::remove_reference_t<Callable>,
+ RegionCodeGenTy>::value> * = 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 79d9dcd5f96f0..9731d4006d1e0 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -197,7 +197,8 @@ static void denormalizeSimpleFlag(SmallVectorImpl<const char *> &Args,
}
template <typename T> static constexpr bool is_uint64_t_convertible() {
- return !std::is_same_v<T, uint64_t> && llvm::is_integral_or_enum<T>::value;
+ return !std::is_same<T, uint64_t>::value &&
+ 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 9059efcbd8520..99119bcb2e4e6 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_v<T1, T2>, bool> = true>
+ std::enable_if_t<std::is_same<T1, T2>::value, bool> = true>
T2 *operator()(T1 *, T2 *P2) {
return P2;
}
template <typename T1, typename T2,
- std::enable_if_t<!std::is_same_v<T1, T2>, bool> = true>
+ std::enable_if_t<!std::is_same<T1, T2>::value, 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_v<TemplateLikeDecl, PrimaryDel>;
+ !std::is_same<TemplateLikeDecl, PrimaryDel>::value;
bool Better1 = isAtLeastAsSpecializedAs(S, T1, T2, P2, Info);
if (IsMoreSpecialThanPrimaryCheck && !Better1)
diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index 25487dd8e8928..55d4888f60c2d 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -416,7 +416,8 @@ 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_v<uint64_t, T> || std::is_same_v<uint32_t, T>,
+ static_assert(std::is_same<uint64_t, T>::value ||
+ std::is_same<uint32_t, T>::value,
"unexpected type for offset");
auto it = std::prev(llvm::upper_bound(
sections, *offset,
@@ -435,7 +436,8 @@ static Section *findContainingSection(const std::vector<Section *> §ions,
template <class T>
static InputSection *findContainingSubsection(const Section §ion,
T *offset) {
- static_assert(std::is_same_v<uint64_t, T> || std::is_same_v<uint32_t, T>,
+ static_assert(std::is_same<uint64_t, T>::value ||
+ std::is_same<uint32_t, T>::value,
"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 dd4d3edcca6d4..cdedb6ece9920 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_v<T, IEEEFloat> || std::is_same_v<T, DoubleAPFloat>, "");
- if (std::is_same_v<T, DoubleAPFloat>) {
+ static_assert(std::is_same<T, IEEEFloat>::value ||
+ std::is_same<T, DoubleAPFloat>::value, "");
+ if (std::is_same<T, DoubleAPFloat>::value) {
return &Semantics == &PPCDoubleDouble();
}
return &Semantics != &PPCDoubleDouble();
diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h
index baed204a36e66..acfa324e6b100 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_v<U, T>, ArrayRef<T>> &
+ std::enable_if_t<std::is_same<U, T>::value, 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_v<U, T>, ArrayRef<T>> &
+ std::enable_if_t<std::is_same<U, T>::value, 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 0b8202e5c8fd3..27fff59115a8d 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_v<remove_cvref_t<CallableT>, ThisT>>;
+ std::enable_if_t<!std::is_same<remove_cvref_t<CallableT>, ThisT>::value>;
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 717857c356631..ebe1b1521a5d7 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_v<remove_cvref_t<Callable>, function_ref>>
- * = nullptr,
+ std::enable_if_t<!std::is_same<remove_cvref_t<Callable>,
+ function_ref>::value> * = 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 88229fec51953..96935c291ec1e 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_v<T, std::remove_cv_t<T>>,
+ static_assert(std::is_same<T, std::remove_cv_t<T>>::value,
"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 264022c2d4813..a29886c38e3f8 100644
--- a/llvm/include/llvm/ADT/SmallVector.h
+++ b/llvm/include/llvm/ADT/SmallVector.h
@@ -193,9 +193,10 @@ class SmallVectorTemplateCommon
this->assertSafeToReferenceAfterResize(From, 0);
this->assertSafeToReferenceAfterResize(To - 1, 0);
}
- template <class ItTy,
- std::enable_if_t<!std::is_same_v<std::remove_const_t<ItTy>, T *>,
- bool> = false>
+ template <
+ class ItTy,
+ std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T *>::value,
+ bool> = false>
void assertSafeToReferenceAfterClear(ItTy, ItTy) {}
/// Check whether any part of the range will be invalidated by growing.
@@ -205,9 +206,10 @@ class SmallVectorTemplateCommon
this->assertSafeToAdd(From, To - From);
this->assertSafeToAdd(To - 1, To - From);
}
- template <class ItTy,
- std::enable_if_t<!std::is_same_v<std::remove_const_t<ItTy>, T *>,
- bool> = false>
+ template <
+ class ItTy,
+ std::enable_if_t<!std::is_same<std::remove_const_t<ItTy>, T *>::value,
+ bool> = false>
void assertSafeToAddRange(ItTy, ItTy) {}
/// Reserve enough space to add one element, and return the updated element
@@ -496,8 +498,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_v<typename std::remove_const<T1>::type, T2>>
- * = nullptr) {
+ std::enable_if_t<std::is_same<typename std::remove_const<T1>::type,
+ T2>::value> * = 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
@@ -754,8 +756,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_v<std::remove_const_t<std::remove_reference_t<ArgType>>,
- T>,
+ std::is_same<std::remove_const_t<std::remove_reference_t<ArgType>>,
+ T>::value,
"ArgType must be derived from T!");
if (I == this->end()) { // Important special case for empty vector.
@@ -778,7 +780,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_v<ArgType, T>,
+ static_assert(!TakesParamByValue || std::is_same<ArgType, T>::value,
"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 c6ec6f45c9d60..1f7f912607515 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_v<T, std::string>, StringRef> &
+ std::enable_if_t<std::is_same<T, std::string>::value, StringRef> &
operator=(T &&Str) = delete;
/// @}
diff --git a/llvm/include/llvm/ADT/iterator.h b/llvm/include/llvm/ADT/iterator.h
index a89ce297f7120..6f0c42fe08bec 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_v<
- T, typename std::iterator_traits<WrappedIteratorT>::value_type>,
+ std::is_same<T, typename std::iterator_traits<
+ WrappedIteratorT>::value_type>::value,
typename std::iterator_traits<WrappedIteratorT>::pointer, T *>,
typename ReferenceT = std::conditional_t<
- std::is_same_v<
- T, typename std::iterator_traits<WrappedIteratorT>::value_type>,
+ std::is_same<T, typename std::iterator_traits<
+ WrappedIteratorT>::value_type>::value,
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 caf8713d7febd..c388259482088 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h
@@ -154,13 +154,16 @@ class SPSArgList<SPSTagT, SPSTagTs...> {
template <typename SPSTagT>
class SPSSerializationTraits<
SPSTagT, SPSTagT,
- 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>>> {
+ 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>> {
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 21982bff707d8..eb3fb084b28b6 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_v<SPSRetT, void>, Error>
+ std::enable_if_t<!std::is_same<SPSRetT, void>::value, Error>
runWithSPSRet(RetT &RetVal) const {
auto WFR = run();
if (const char *ErrMsg = WFR.getOutOfBandError())
@@ -684,7 +684,8 @@ class WrapperFunctionCall {
/// Overload for SPS functions returning void.
template <typename SPSRetT>
- std::enable_if_t<std::is_same_v<SPSRetT, void>, Error> runWithSPSRet() const {
+ std::enable_if_t<std::is_same<SPSRetT, void>::value, 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 8e3f4d99e5085..1044a634408ca 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_v<BitfieldElement, HasMetadataField> ||
+ std::is_same<BitfieldElement, HasMetadataField>::value ||
!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_v<BitfieldElement, HasMetadataField> ||
+ std::is_same<BitfieldElement, HasMetadataField>::value ||
!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 c52470db4b0ba..fa6be6a2dfb9a 100644
--- a/llvm/include/llvm/IR/PassManager.h
+++ b/llvm/include/llvm/IR/PassManager.h
@@ -543,8 +543,9 @@ class PassManager : public PassInfoMixin<
}
template <typename PassT>
- LLVM_ATTRIBUTE_MINSIZE std::enable_if_t<!std::is_same_v<PassT, PassManager>>
- addPass(PassT &&Pass) {
+ LLVM_ATTRIBUTE_MINSIZE
+ std::enable_if_t<!std::is_same<PassT, PassManager>::value>
+ addPass(PassT &&Pass) {
using PassModelT =
detail::PassModel<IRUnitT, PassT, PreservedAnalyses, AnalysisManagerT,
ExtraArgTs...>;
@@ -560,8 +561,9 @@ 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_v<PassT, PassManager>>
- addPass(PassT &&Pass) {
+ LLVM_ATTRIBUTE_MINSIZE
+ std::enable_if_t<std::is_same<PassT, PassManager>::value>
+ 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 925137163c801..bcee3b25bf875 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_v<GlobalValue::GUID, uint64_t>,
+ static_assert(std::is_same<GlobalValue::GUID, uint64_t>::value,
"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 278ec434d384c..5d05d3f8777b0 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_v<std::remove_cv_t<T>, void>, void>
+ std::enable_if_t<!std::is_same<std::remove_cv_t<T>, void>::value, 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 2ef5cbc23592d..cf9c7c0efbf14 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_v<X, typename simplify_type<X>::SimpleType>;
+ std::is_same<X, typename simplify_type<X>::SimpleType>::value;
};
// } // 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_v<OptionalDerived, void>,
+using SelfType = std::conditional_t<std::is_same<OptionalDerived, void>::value,
Default, OptionalDerived>;
} // namespace detail
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index 2fcdc9b9d6a11..be1f54cfba368 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_v<result_type, void>,
+ static_assert(std::is_same<result_type, void>::value,
"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 718d3e4be6d42..2bdc316a68a2d 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_v<T, char>> {};
+ : public std::integral_constant<bool, std::is_same<T, char>::value> {};
template <typename T>
struct is_cstring
diff --git a/llvm/include/llvm/Support/FormatVariadicDetails.h b/llvm/include/llvm/Support/FormatVariadicDetails.h
index b5f0f25e9c300..2204cff13a64d 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_v<llvm::Error, std::remove_cv_t<T>>,
+ !std::is_same<llvm::Error, std::remove_cv_t<T>>::value,
"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 a07047fd03ab6..0a44aabedae60 100644
--- a/llvm/include/llvm/Support/JSON.h
+++ b/llvm/include/llvm/Support/JSON.h
@@ -329,7 +329,8 @@ 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_v<T, bool>>,
+ template <typename T,
+ typename = std::enable_if_t<std::is_same<T, bool>::value>,
bool = false>
Value(T B) : Type(T_Boolean) {
create<bool>(B);
@@ -337,7 +338,7 @@ class Value {
// Unsigned 64-bit long integers.
template <typename T,
- typename = std::enable_if_t<std::is_same_v<T, uint64_t>>,
+ typename = std::enable_if_t<std::is_same<T, uint64_t>::value>,
bool = false, bool = false>
Value(T V) : Type(T_UINT64) {
create<uint64_t>(uint64_t{V});
@@ -346,8 +347,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_v<T, bool>>,
- typename = std::enable_if_t<!std::is_same_v<T, uint64_t>>>
+ typename = std::enable_if_t<!std::is_same<T, bool>::value>,
+ typename = std::enable_if_t<!std::is_same<T, uint64_t>::value>>
Value(T I) : Type(T_Integer) {
create<int64_t>(int64_t{I});
}
@@ -360,8 +361,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_v<Value, decltype(toJSON(*(const T *)nullptr))>>,
+ typename = std::enable_if_t<std::is_same<
+ Value, decltype(toJSON(*(const T *)nullptr))>::value>,
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 4fa945a165a27..f9e711a5dc177 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_v<Foo<TrailingTys...>, Foo<Tys...>>, size_t>
+ std::is_same<Foo<TrailingTys...>, Foo<Tys...>>::value, 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 86dd3dea85cb6..8ade9b15642b5 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_v<TYPE, std::string> && \
- !std::is_same<TYPE, llvm::StringRef>::value, \
+ !std::is_same<TYPE, std::string>::value && \
+ !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 0c0a740317058..52d5de93ff7d7 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_v<T, ForwardTemplateReference>) {
+ if (std::is_same<T, ForwardTemplateReference>::value) {
// 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 3fe18a7a9b0c8..a206d10caf660 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_v<int8_t, std::make_signed_t<T>> ||
- std::is_same_v<int8_t, T>;
+ bool IsByte = std::is_same<int8_t, std::make_signed_t<T>>::value ||
+ std::is_same<int8_t, T>::value;
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_v<int8_t, std::make_signed_t<T>> ||
- std::is_same_v<int8_t, T>;
+ bool IsByte = std::is_same<int8_t, std::make_signed_t<T>>::value ||
+ std::is_same<int8_t, T>::value;
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 9405141d5577e..8765260935910 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_v<int8_t, std::make_signed_t<T>> ||
- std::is_same_v<int8_t, T>;
+ bool IsInt8t = std::is_same<int8_t, std::make_signed_t<T>>::value ||
+ std::is_same<int8_t, T>::value;
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 51493aefc43fe..22b529bee46e4 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_v<decltype(*Schedule.begin()), MachineInstr *>) {
+ if (!std::is_same<decltype(*Schedule.begin()), MachineInstr*>::value) {
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 17b075f1fb83a..e4e235ed09ecb 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_v<T, ISD::OutputArg> ||
- std::is_same_v<T, ISD::InputArg>,
+ static_assert(std::is_same<T, ISD::OutputArg>::value ||
+ std::is_same<T, ISD::InputArg>::value,
"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 ab6c28c803795..6dca30d9876e2 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_v<smax_pred_ty, typename MaxMinT::PredType>)
+ if (std::is_same<smax_pred_ty, typename MaxMinT::PredType>::value)
return scSMaxExpr;
- else if (std::is_same_v<umax_pred_ty, typename MaxMinT::PredType>)
+ else if (std::is_same<umax_pred_ty, typename MaxMinT::PredType>::value)
return scUMaxExpr;
- else if (std::is_same_v<smin_pred_ty, typename MaxMinT::PredType>)
+ else if (std::is_same<smin_pred_ty, typename MaxMinT::PredType>::value)
return scSMinExpr;
- else if (std::is_same_v<umin_pred_ty, typename MaxMinT::PredType>)
+ else if (std::is_same<umin_pred_ty, typename MaxMinT::PredType>::value)
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 d1fa50bb54b41..065198ff16dad 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_v<Value *, U>, Value *>::type
+ static typename std::enable_if<std::is_same<Value *, U>::value, Value *>::type
get(Value *V) {
return V;
}
template <typename U>
- static typename std::enable_if<!std::is_same_v<Value *, U>, U>::type
+ static typename std::enable_if<!std::is_same<Value *, U>::value, U>::type
get(Value *) {
return U();
}
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.h b/llvm/utils/TableGen/CodeGenDAGPatterns.h
index c494b35fe1d0e..dbdc72f0873a1 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_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;
+ 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;
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 37026c017c860..efcd73ae61de9 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_v<NameT, Class>>>
+ template <typename NameT, typename = typename std::enable_if_t<
+ !std::is_same<NameT, Class>::value>>
Class(NameT &&name, bool isStruct = false)
: className(stringify(std::forward<NameT>(name))), isStruct(isStruct) {}
More information about the llvm-commits
mailing list