[clang] 5e5a6c5 - Use std::conditional_t (NFC)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 18 10:25:22 PDT 2022
Author: Kazu Hirata
Date: 2022-09-18T10:25:06-07:00
New Revision: 5e5a6c5b076046f546323dad68a3438b0c89a9e9
URL: https://github.com/llvm/llvm-project/commit/5e5a6c5b076046f546323dad68a3438b0c89a9e9
DIFF: https://github.com/llvm/llvm-project/commit/5e5a6c5b076046f546323dad68a3438b0c89a9e9.diff
LOG: Use std::conditional_t (NFC)
Added:
Modified:
clang/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h
llvm/include/llvm/ADT/Bitfields.h
llvm/include/llvm/ADT/DenseMap.h
llvm/include/llvm/ADT/FunctionExtras.h
llvm/lib/Transforms/Vectorize/VPlan.h
mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h b/clang/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h
index e6ebaea5248ad..33194c401ea14 100644
--- a/clang/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h
+++ b/clang/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h
@@ -94,9 +94,9 @@ void visitRefactoringOptions(
/// A type trait that returns true when the given type list has at least one
/// type whose base is the given base type.
template <typename Base, typename First, typename... Rest>
-struct HasBaseOf : std::conditional<HasBaseOf<Base, First>::value ||
- HasBaseOf<Base, Rest...>::value,
- std::true_type, std::false_type>::type {};
+struct HasBaseOf : std::conditional_t<HasBaseOf<Base, First>::value ||
+ HasBaseOf<Base, Rest...>::value,
+ std::true_type, std::false_type> {};
template <typename Base, typename T>
struct HasBaseOf<Base, T> : std::is_base_of<Base, T> {};
@@ -104,9 +104,9 @@ struct HasBaseOf<Base, T> : std::is_base_of<Base, T> {};
/// A type trait that returns true when the given type list contains types that
/// derive from Base.
template <typename Base, typename First, typename... Rest>
-struct AreBaseOf : std::conditional<AreBaseOf<Base, First>::value &&
- AreBaseOf<Base, Rest...>::value,
- std::true_type, std::false_type>::type {};
+struct AreBaseOf : std::conditional_t<AreBaseOf<Base, First>::value &&
+ AreBaseOf<Base, Rest...>::value,
+ std::true_type, std::false_type> {};
template <typename Base, typename T>
struct AreBaseOf<Base, T> : std::is_base_of<Base, T> {};
diff --git a/llvm/include/llvm/ADT/Bitfields.h b/llvm/include/llvm/ADT/Bitfields.h
index 18555e676e9d3..aaf876d896d4c 100644
--- a/llvm/include/llvm/ADT/Bitfields.h
+++ b/llvm/include/llvm/ADT/Bitfields.h
@@ -203,7 +203,7 @@ template <typename T> struct ResolveUnderlyingType<T, false> {
template <> struct ResolveUnderlyingType<bool, false> {
/// In case sizeof(bool) != 1, replace `void` by an additionnal
/// std::conditional.
- using type = std::conditional<sizeof(bool) == 1, uint8_t, void>::type;
+ using type = std::conditional_t<sizeof(bool) == 1, uint8_t, void>;
};
} // namespace bitfields_details
diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h
index c22a1f8a76e0e..7adc6710cfa86 100644
--- a/llvm/include/llvm/ADT/DenseMap.h
+++ b/llvm/include/llvm/ADT/DenseMap.h
@@ -1197,8 +1197,7 @@ class DenseMapIterator : DebugEpochBase::HandleBase {
public:
using
diff erence_type = ptr
diff _t;
- using value_type =
- typename std::conditional<IsConst, const Bucket, Bucket>::type;
+ using value_type = std::conditional_t<IsConst, const Bucket, Bucket>;
using pointer = value_type *;
using reference = value_type &;
using iterator_category = std::forward_iterator_tag;
diff --git a/llvm/include/llvm/ADT/FunctionExtras.h b/llvm/include/llvm/ADT/FunctionExtras.h
index 35e160fc63ad5..8f04277cdf0e5 100644
--- a/llvm/include/llvm/ADT/FunctionExtras.h
+++ b/llvm/include/llvm/ADT/FunctionExtras.h
@@ -99,11 +99,11 @@ template <typename ReturnT, typename... ParamTs> class UniqueFunctionBase {
template <typename T> struct AdjustedParamTBase {
static_assert(!std::is_reference<T>::value,
"references should be handled by template specialization");
- using type = typename std::conditional<
+ using type = std::conditional_t<
llvm::is_trivially_copy_constructible<T>::value &&
llvm::is_trivially_move_constructible<T>::value &&
IsSizeLessThanThresholdT<T>::value,
- T, T &>::type;
+ T, T &>;
};
// This specialization ensures that 'AdjustedParam<V<T>&>' or
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 09429ae599be6..803a376b5bdf7 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -2887,9 +2887,8 @@ class VPBlockUtils {
template <typename BlockTy, typename T>
static auto blocksOnly(const T &Range) {
// Create BaseTy with correct const-ness based on BlockTy.
- using BaseTy =
- typename std::conditional<std::is_const<BlockTy>::value,
- const VPBlockBase, VPBlockBase>::type;
+ using BaseTy = std::conditional_t<std::is_const<BlockTy>::value,
+ const VPBlockBase, VPBlockBase>;
// We need to first create an iterator range over (const) BlocktTy & instead
// of (const) BlockTy * for filter_range to work properly.
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
index e73d5aba9ff51..0f0fd7853138b 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
@@ -205,12 +205,10 @@ static void replaceIndexOpsByInductionVariables(LinalgOp linalgOp,
template <typename LoopTy>
static FailureOr<LinalgLoops> linalgOpToLoopsImpl(PatternRewriter &rewriter,
LinalgOp linalgOp) {
- using LoadOpTy =
- typename std::conditional<std::is_same<LoopTy, AffineForOp>::value,
- AffineLoadOp, memref::LoadOp>::type;
- using StoreOpTy =
- typename std::conditional<std::is_same<LoopTy, AffineForOp>::value,
- AffineStoreOp, memref::StoreOp>::type;
+ using LoadOpTy = std::conditional_t<std::is_same<LoopTy, AffineForOp>::value,
+ AffineLoadOp, memref::LoadOp>;
+ using StoreOpTy = std::conditional_t<std::is_same<LoopTy, AffineForOp>::value,
+ AffineStoreOp, memref::StoreOp>;
// The flattened loopToOperandRangesMaps is expected to be an invertible
// permutation map (which is asserted in the inverse calculation).
More information about the cfe-commits
mailing list