[llvm] Remove redundant typename (NFC) (#166087)

Identified with readability-redundant-typename.
This commit is contained in:
Kazu Hirata 2025-11-02 13:15:16 -08:00 committed by GitHub
parent b6399d1542
commit 707bab651f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 49 additions and 53 deletions

View File

@ -110,8 +110,8 @@ public:
return Data[Itr];
}
using iterator = typename std::vector<double>::iterator;
using const_iterator = typename std::vector<double>::const_iterator;
using iterator = std::vector<double>::iterator;
using const_iterator = std::vector<double>::const_iterator;
iterator begin() { return Data.begin(); }
iterator end() { return Data.end(); }

View File

@ -45,12 +45,12 @@ struct LoopBodyTraits {
class WrappedSuccIterator
: public iterator_adaptor_base<
WrappedSuccIterator, succ_iterator,
typename std::iterator_traits<succ_iterator>::iterator_category,
NodeRef, std::ptrdiff_t, NodeRef *, NodeRef> {
std::iterator_traits<succ_iterator>::iterator_category, NodeRef,
std::ptrdiff_t, NodeRef *, NodeRef> {
using BaseT = iterator_adaptor_base<
WrappedSuccIterator, succ_iterator,
typename std::iterator_traits<succ_iterator>::iterator_category,
NodeRef, std::ptrdiff_t, NodeRef *, NodeRef>;
std::iterator_traits<succ_iterator>::iterator_category, NodeRef,
std::ptrdiff_t, NodeRef *, NodeRef>;
const Loop *L;

View File

@ -1247,7 +1247,7 @@ public:
return DefIterator == Other.DefIterator;
}
typename std::iterator_traits<BaseT>::reference operator*() const {
std::iterator_traits<BaseT>::reference operator*() const {
assert(DefIterator != OriginalAccess->defs_end() &&
"Tried to access past the end of our iterator");
return CurrentPair;

View File

@ -653,7 +653,7 @@ public:
public:
const_iterator() = default;
// Placate MSVC by explicitly scoping 'iterator'.
const_iterator(typename IntrusiveBackList<T>::iterator X) : N(X.N) {}
const_iterator(IntrusiveBackList<T>::iterator X) : N(X.N) {}
explicit const_iterator(const T *N) : N(N) {}
const_iterator &operator++() {

View File

@ -294,7 +294,7 @@ struct RegisterAggr {
ref_iterator ref_begin() const { return ref_iterator(*this, false); }
ref_iterator ref_end() const { return ref_iterator(*this, true); }
using unit_iterator = typename BitVector::const_set_bits_iterator;
using unit_iterator = BitVector::const_set_bits_iterator;
unit_iterator unit_begin() const { return Units.set_bits_begin(); }
unit_iterator unit_end() const { return Units.set_bits_end(); }

View File

@ -67,7 +67,7 @@ public:
/// RegisterRegAlloc's global Registry tracks allocator registration.
template <class T>
MachinePassRegistry<typename RegisterRegAllocBase<T>::FunctionPassCtor>
RegisterRegAllocBase<T>::Registry;
RegisterRegAllocBase<T>::Registry;
} // end namespace llvm

View File

@ -136,8 +136,8 @@ class DWARFUnitVector final : public SmallVector<std::unique_ptr<DWARFUnit>, 1>
public:
using UnitVector = SmallVectorImpl<std::unique_ptr<DWARFUnit>>;
using iterator = typename UnitVector::iterator;
using iterator_range = llvm::iterator_range<typename UnitVector::iterator>;
using iterator = UnitVector::iterator;
using iterator_range = llvm::iterator_range<UnitVector::iterator>;
using compile_unit_range =
decltype(make_filter_range(std::declval<iterator_range>(), isCompileUnit));

View File

@ -32,7 +32,7 @@ struct FileInfoSubstreamHeader;
class DbiModuleSourceFilesIterator
: public iterator_facade_base<DbiModuleSourceFilesIterator,
std::random_access_iterator_tag, StringRef> {
using BaseType = typename DbiModuleSourceFilesIterator::iterator_facade_base;
using BaseType = DbiModuleSourceFilesIterator::iterator_facade_base;
public:
LLVM_ABI DbiModuleSourceFilesIterator(const DbiModuleList &Modules,

View File

@ -100,7 +100,7 @@ public:
class FilteredView {
public:
using Map = StringMap<std::shared_ptr<LibraryInfo>>;
using Iterator = typename Map::const_iterator;
using Iterator = Map::const_iterator;
class FilterIterator {
public:
FilterIterator(Iterator it_, Iterator end_, LibState S, PathType K)

View File

@ -198,8 +198,8 @@ public:
const_iterator end() const { return Sections.end(); }
SmallVectorImpl<const MCSymbol *> &getSymbols() { return Symbols; }
iterator_range<pointee_iterator<
typename SmallVector<const MCSymbol *, 0>::const_iterator>>
iterator_range<
pointee_iterator<SmallVector<const MCSymbol *, 0>::const_iterator>>
symbols() const {
return make_pointee_range(Symbols);
}

View File

@ -535,7 +535,7 @@ struct ConstantPtrAuthKeyType {
unsigned getHash() const { return hash_combine_range(Operands); }
using TypeClass = typename ConstantInfo<ConstantPtrAuth>::TypeClass;
using TypeClass = ConstantInfo<ConstantPtrAuth>::TypeClass;
ConstantPtrAuth *create(TypeClass *Ty) const {
return new ConstantPtrAuth(Operands[0], cast<ConstantInt>(Operands[1]),

View File

@ -2227,7 +2227,7 @@ static std::optional<Instruction *> instCombineSVEPTest(InstCombiner &IC,
return std::nullopt;
}
template <Intrinsic::ID MulOpc, typename Intrinsic::ID FuseOpc>
template <Intrinsic::ID MulOpc, Intrinsic::ID FuseOpc>
static std::optional<Instruction *>
instCombineSVEVectorFuseMulAddSub(InstCombiner &IC, IntrinsicInst &II,
bool MergeIntoAddendOp) {

View File

@ -76,7 +76,7 @@ public:
BlockSet.insert(MBB);
}
ArrayRef<MachineBasicBlock *> getBlocks() const { return Blocks; }
using block_iterator = typename ArrayRef<MachineBasicBlock *>::const_iterator;
using block_iterator = ArrayRef<MachineBasicBlock *>::const_iterator;
block_iterator block_begin() const { return getBlocks().begin(); }
block_iterator block_end() const { return getBlocks().end(); }
inline iterator_range<block_iterator> blocks() const {
@ -96,7 +96,7 @@ public:
void addSubException(std::unique_ptr<WebAssemblyException> E) {
SubExceptions.push_back(std::move(E));
}
using iterator = typename decltype(SubExceptions)::const_iterator;
using iterator = decltype(SubExceptions)::const_iterator;
iterator begin() const { return SubExceptions.begin(); }
iterator end() const { return SubExceptions.end(); }

View File

@ -35,7 +35,7 @@ public:
virtual MachineBasicBlock *getHeader() const = 0;
virtual bool contains(const MachineBasicBlock *MBB) const = 0;
virtual unsigned getNumBlocks() const = 0;
using block_iterator = typename ArrayRef<MachineBasicBlock *>::const_iterator;
using block_iterator = ArrayRef<MachineBasicBlock *>::const_iterator;
virtual iterator_range<block_iterator> blocks() const = 0;
virtual bool isLoop() const = 0;
};

View File

@ -115,9 +115,9 @@ struct MachineGadgetGraph : ImmutableGraph<MachineInstr *, int> {
static constexpr MachineInstr *const ArgNodeSentinel = nullptr;
using GraphT = ImmutableGraph<MachineInstr *, int>;
using Node = typename GraphT::Node;
using Edge = typename GraphT::Edge;
using size_type = typename GraphT::size_type;
using Node = GraphT::Node;
using Edge = GraphT::Edge;
using size_type = GraphT::size_type;
MachineGadgetGraph(std::unique_ptr<Node[]> Nodes,
std::unique_ptr<Edge[]> Edges, size_type NodesSize,
size_type EdgesSize, int NumFences = 0, int NumGadgets = 0)
@ -191,10 +191,10 @@ template <>
struct DOTGraphTraits<MachineGadgetGraph *> : DefaultDOTGraphTraits {
using GraphType = MachineGadgetGraph;
using Traits = llvm::GraphTraits<GraphType *>;
using NodeRef = typename Traits::NodeRef;
using EdgeRef = typename Traits::EdgeRef;
using ChildIteratorType = typename Traits::ChildIteratorType;
using ChildEdgeIteratorType = typename Traits::ChildEdgeIteratorType;
using NodeRef = Traits::NodeRef;
using EdgeRef = Traits::EdgeRef;
using ChildIteratorType = Traits::ChildIteratorType;
using ChildEdgeIteratorType = Traits::ChildEdgeIteratorType;
DOTGraphTraits(bool IsSimple = false) : DefaultDOTGraphTraits(IsSimple) {}
@ -335,7 +335,7 @@ X86LoadValueInjectionLoadHardeningPass::getGadgetGraph(
L.computePhiInfo();
GraphBuilder Builder;
using GraphIter = typename GraphBuilder::BuilderNodeRef;
using GraphIter = GraphBuilder::BuilderNodeRef;
DenseMap<MachineInstr *, GraphIter> NodeMap;
int FenceCount = 0, GadgetCount = 0;
auto MaybeAddNode = [&NodeMap, &Builder](MachineInstr *MI) {

View File

@ -32,7 +32,7 @@ using namespace llvm::MachO;
using namespace llvm::MachO::DylibReader;
using TripleVec = std::vector<Triple>;
static typename TripleVec::iterator emplace(TripleVec &Container, Triple &&T) {
static TripleVec::iterator emplace(TripleVec &Container, Triple &&T) {
auto I = partition_point(Container, [=](const Triple &CT) {
return std::forward_as_tuple(CT.getArch(), CT.getOS(),
CT.getEnvironment()) <

View File

@ -3619,7 +3619,7 @@ struct AAIntraFnReachabilityFunction final
return true;
RQITy StackRQI(A, From, To, ExclusionSet, false);
typename RQITy::Reachable Result;
RQITy::Reachable Result;
if (!NonConstThis->checkQueryCache(A, StackRQI, Result))
return NonConstThis->isReachableImpl(A, StackRQI,
/*IsTemporaryRQI=*/true);
@ -10701,7 +10701,7 @@ struct AAInterFnReachabilityFunction
auto *NonConstThis = const_cast<AAInterFnReachabilityFunction *>(this);
RQITy StackRQI(A, From, To, ExclusionSet, false);
typename RQITy::Reachable Result;
RQITy::Reachable Result;
if (!NonConstThis->checkQueryCache(A, StackRQI, Result))
return NonConstThis->isReachableImpl(A, StackRQI,
/*IsTemporaryRQI=*/true);

View File

@ -1034,11 +1034,11 @@ private:
} // namespace
template <>
struct llvm::DenseMapInfo<typename CallsiteContextGraph<
struct llvm::DenseMapInfo<CallsiteContextGraph<
ModuleCallsiteContextGraph, Function, Instruction *>::CallInfo>
: public DenseMapInfo<std::pair<Instruction *, unsigned>> {};
template <>
struct llvm::DenseMapInfo<typename CallsiteContextGraph<
struct llvm::DenseMapInfo<CallsiteContextGraph<
IndexCallsiteContextGraph, FunctionSummary, IndexCall>::CallInfo>
: public DenseMapInfo<std::pair<IndexCall, unsigned>> {};
template <>

View File

@ -143,8 +143,8 @@ struct SubGraphTraits {
class WrappedSuccIterator
: public iterator_adaptor_base<
WrappedSuccIterator, BaseSuccIterator,
typename std::iterator_traits<BaseSuccIterator>::iterator_category,
NodeRef, std::ptrdiff_t, NodeRef *, NodeRef> {
std::iterator_traits<BaseSuccIterator>::iterator_category, NodeRef,
std::ptrdiff_t, NodeRef *, NodeRef> {
SmallDenseSet<RegionNode *> *Nodes;
public:

View File

@ -89,8 +89,7 @@ class VPlanSlp {
/// Width of the widest combined bundle in bits.
unsigned WidestBundleBits = 0;
using MultiNodeOpTy =
typename std::pair<VPInstruction *, SmallVector<VPValue *, 4>>;
using MultiNodeOpTy = std::pair<VPInstruction *, SmallVector<VPValue *, 4>>;
// Input operand bundles for the current multi node. Each multi node operand
// bundle contains values not matching the multi node's opcode. They will

View File

@ -86,7 +86,7 @@ public:
};
GraphT G;
using VertexIdentifier = typename decltype(G)::VertexIdentifier;
using VertexIdentifier = decltype(G)::VertexIdentifier;
using EdgeIdentifier = decltype(G)::EdgeIdentifier;
/// Use a Map to store the Function stack for each thread whilst building the

View File

@ -18,10 +18,10 @@ using namespace llvm::XCOFF;
TEST(XCOFFObjectFileTest, XCOFFObjectType) {
// Create an arbitrary object of a non-XCOFF type and test that
// dyn_cast<XCOFFObjectFile> returns null for it.
char Buf[sizeof(typename ELF64LE::Ehdr)] = {};
char Buf[sizeof(ELF64LE::Ehdr)] = {};
memcpy(Buf, "\177ELF", 4);
auto *EHdr = reinterpret_cast<typename ELF64LE::Ehdr *>(Buf);
auto *EHdr = reinterpret_cast<ELF64LE::Ehdr *>(Buf);
EHdr->e_ident[llvm::ELF::EI_CLASS] = llvm::ELF::ELFCLASS64;
EHdr->e_ident[llvm::ELF::EI_DATA] = llvm::ELF::ELFDATA2LSB;

View File

@ -23,8 +23,8 @@ struct EAttr {
unsigned EA;
};
typedef Graph<VAttr, EAttr, unsigned> GraphT;
typedef typename GraphT::VertexIdentifier VI;
typedef typename GraphT::EdgeIdentifier EI;
typedef GraphT::VertexIdentifier VI;
typedef GraphT::EdgeIdentifier EI;
// Test Fixture
template <typename T> class GraphTest : public testing::Test {
@ -56,8 +56,8 @@ private:
typedef ::testing::Types<GraphT, const GraphT> GraphTestTypes;
using VVT = typename GraphT::VertexValueType;
using EVT = typename GraphT::EdgeValueType;
using VVT = GraphT::VertexValueType;
using EVT = GraphT::EdgeValueType;
TYPED_TEST_SUITE(GraphTest, GraphTestTypes, );

View File

@ -1651,8 +1651,7 @@ template <> struct llvm::GraphTraits<SubRegIndexCompositionGraph> {
struct ChildIteratorType
: public iterator_adaptor_base<
ChildIteratorType, CompMapIt,
typename std::iterator_traits<CompMapIt>::iterator_category,
NodeRef> {
std::iterator_traits<CompMapIt>::iterator_category, NodeRef> {
ChildIteratorType(CompMapIt I)
: ChildIteratorType::iterator_adaptor_base(I) {}

View File

@ -621,7 +621,7 @@ public:
DefinedInsnVariablesMap::const_iterator defined_insn_vars_end() const {
return InsnVariableIDs.end();
}
iterator_range<typename DefinedInsnVariablesMap::const_iterator>
iterator_range<DefinedInsnVariablesMap::const_iterator>
defined_insn_vars() const {
return make_range(defined_insn_vars_begin(), defined_insn_vars_end());
}
@ -632,8 +632,7 @@ public:
MutatableInsnSet::const_iterator mutatable_insns_end() const {
return MutatableInsns.end();
}
iterator_range<typename MutatableInsnSet::const_iterator>
mutatable_insns() const {
iterator_range<MutatableInsnSet::const_iterator> mutatable_insns() const {
return make_range(mutatable_insns_begin(), mutatable_insns_end());
}
void reserveInsnMatcherForMutation(InstructionMatcher *InsnMatcher) {

View File

@ -174,7 +174,7 @@ bool RegSizeInfoByHwMode::hasStricterSpillThan(
}
void RegSizeInfoByHwMode::writeToStream(raw_ostream &OS) const {
typedef typename decltype(Map)::value_type PairType;
typedef decltype(Map)::value_type PairType;
std::vector<const PairType *> Pairs;
for (const auto &P : Map)
Pairs.push_back(&P);

View File

@ -100,8 +100,7 @@ public:
return RCsWithLargestRegSize[HwMode];
}
iterator_range<typename RegisterClassesTy::const_iterator>
register_classes() const {
iterator_range<RegisterClassesTy::const_iterator> register_classes() const {
return RCs;
}
};