Skip to content

[clang][NFC] Run modernize-use-using check over all the code #149934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/lib/APINotes/APINotesFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ inline bool operator==(const SingleDeclTableKey &lhs,

namespace llvm {
template <> struct DenseMapInfo<clang::api_notes::StoredObjCSelector> {
typedef DenseMapInfo<unsigned> UnsignedInfo;
using UnsignedInfo = DenseMapInfo<unsigned>;

static inline clang::api_notes::StoredObjCSelector getEmptyKey() {
return clang::api_notes::StoredObjCSelector{UnsignedInfo::getEmptyKey(),
Expand Down
4 changes: 3 additions & 1 deletion clang/lib/APINotes/APINotesWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ class ContextIDTableInfo {

/// Localized helper to make a type dependent, thwarting template argument
/// deduction.
template <typename T> struct MakeDependent { typedef T Type; };
template <typename T> struct MakeDependent {
using Type = T;
};

/// Retrieve the serialized size of the given VersionTuple, for use in
/// on-disk hash tables.
Expand Down
26 changes: 13 additions & 13 deletions clang/lib/APINotes/APINotesYAMLCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct Param {
StringRef Type;
};

typedef std::vector<Param> ParamsSeq;
using ParamsSeq = std::vector<Param>;
} // namespace

LLVM_YAML_IS_SEQUENCE_VECTOR(Param)
Expand Down Expand Up @@ -131,7 +131,7 @@ template <> struct MappingTraits<Param> {
} // namespace llvm

namespace {
typedef std::vector<NullabilityKind> NullabilitySeq;
using NullabilitySeq = std::vector<NullabilityKind>;

struct AvailabilityItem {
APIAvailability Mode = APIAvailability::Available;
Expand Down Expand Up @@ -165,7 +165,7 @@ struct Method {
StringRef SwiftReturnOwnership;
};

typedef std::vector<Method> MethodsSeq;
using MethodsSeq = std::vector<Method>;
} // namespace

LLVM_YAML_IS_SEQUENCE_VECTOR(Method)
Expand Down Expand Up @@ -216,7 +216,7 @@ struct Property {
StringRef Type;
};

typedef std::vector<Property> PropertiesSeq;
using PropertiesSeq = std::vector<Property>;
} // namespace

LLVM_YAML_IS_SEQUENCE_VECTOR(Property)
Expand Down Expand Up @@ -255,7 +255,7 @@ struct Class {
PropertiesSeq Properties;
};

typedef std::vector<Class> ClassesSeq;
using ClassesSeq = std::vector<Class>;
} // namespace

LLVM_YAML_IS_SEQUENCE_VECTOR(Class)
Expand Down Expand Up @@ -297,7 +297,7 @@ struct Function {
StringRef SwiftReturnOwnership;
};

typedef std::vector<Function> FunctionsSeq;
using FunctionsSeq = std::vector<Function>;
} // namespace

LLVM_YAML_IS_SEQUENCE_VECTOR(Function)
Expand Down Expand Up @@ -334,7 +334,7 @@ struct GlobalVariable {
StringRef Type;
};

typedef std::vector<GlobalVariable> GlobalVariablesSeq;
using GlobalVariablesSeq = std::vector<GlobalVariable>;
} // namespace

LLVM_YAML_IS_SEQUENCE_VECTOR(GlobalVariable)
Expand Down Expand Up @@ -364,7 +364,7 @@ struct EnumConstant {
StringRef SwiftName;
};

typedef std::vector<EnumConstant> EnumConstantsSeq;
using EnumConstantsSeq = std::vector<EnumConstant>;
} // namespace

LLVM_YAML_IS_SEQUENCE_VECTOR(EnumConstant)
Expand Down Expand Up @@ -424,7 +424,7 @@ struct Field {
StringRef Type;
};

typedef std::vector<Field> FieldsSeq;
using FieldsSeq = std::vector<Field>;
} // namespace

LLVM_YAML_IS_SEQUENCE_VECTOR(Field)
Expand All @@ -448,7 +448,7 @@ template <> struct MappingTraits<Field> {

namespace {
struct Tag;
typedef std::vector<Tag> TagsSeq;
using TagsSeq = std::vector<Tag>;

struct Tag {
StringRef Name;
Expand Down Expand Up @@ -527,7 +527,7 @@ struct Typedef {
std::optional<SwiftNewTypeKind> SwiftType;
};

typedef std::vector<Typedef> TypedefsSeq;
using TypedefsSeq = std::vector<Typedef>;
} // namespace

LLVM_YAML_IS_SEQUENCE_VECTOR(Typedef)
Expand Down Expand Up @@ -560,7 +560,7 @@ template <> struct MappingTraits<Typedef> {

namespace {
struct Namespace;
typedef std::vector<Namespace> NamespacesSeq;
using NamespacesSeq = std::vector<Namespace>;

struct TopLevelItems {
ClassesSeq Classes;
Expand Down Expand Up @@ -623,7 +623,7 @@ struct Versioned {
TopLevelItems Items;
};

typedef std::vector<Versioned> VersionedSeq;
using VersionedSeq = std::vector<Versioned>;
} // namespace

LLVM_YAML_IS_SEQUENCE_VECTOR(Versioned)
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/APValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ namespace {
struct APValue::MemberPointerData : MemberPointerBase {
static const unsigned InlinePathSpace =
(DataSize - sizeof(MemberPointerBase)) / sizeof(const CXXRecordDecl*);
typedef const CXXRecordDecl *PathElem;
using PathElem = const CXXRecordDecl *;
union {
PathElem Path[InlinePathSpace];
PathElem *PathPtr;
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/AST/ASTDiagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,8 +985,8 @@ class TemplateDiff {
/// The desugared TemplateArgument should provide the canonical argument
/// for comparisons.
class TSTiterator {
typedef const TemplateArgument& reference;
typedef const TemplateArgument* pointer;
using reference = const TemplateArgument &;
using pointer = const TemplateArgument *;

/// InternalIterator - an iterator that is used to enter a
/// TemplateSpecializationType and read TemplateArguments inside template
Expand Down
6 changes: 3 additions & 3 deletions clang/lib/AST/Expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ std::string PredefinedExpr::ComputeName(PredefinedIdentKind IK,
POut << " &&";
}

typedef SmallVector<const ClassTemplateSpecializationDecl *, 8> SpecsTy;
using SpecsTy = SmallVector<const ClassTemplateSpecializationDecl *, 8>;
SpecsTy Specs;
const DeclContext *Ctx = FD->getDeclContext();
while (isa_and_nonnull<NamedDecl>(Ctx)) {
Expand Down Expand Up @@ -3549,7 +3549,7 @@ bool CallExpr::isCallToStdMove() const {
namespace {
/// Look for any side effects within a Stmt.
class SideEffectFinder : public ConstEvaluatedExprVisitor<SideEffectFinder> {
typedef ConstEvaluatedExprVisitor<SideEffectFinder> Inherited;
using Inherited = ConstEvaluatedExprVisitor<SideEffectFinder>;
const bool IncludePossibleEffects;
bool HasSideEffects;

Expand Down Expand Up @@ -3904,7 +3904,7 @@ namespace {
/// Look for a call to a non-trivial function within an expression.
class NonTrivialCallFinder : public ConstEvaluatedExprVisitor<NonTrivialCallFinder>
{
typedef ConstEvaluatedExprVisitor<NonTrivialCallFinder> Inherited;
using Inherited = ConstEvaluatedExprVisitor<NonTrivialCallFinder>;

bool NonTrivial;

Expand Down
38 changes: 19 additions & 19 deletions clang/lib/AST/ExprConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ namespace {
/// The type of the most derived object referred to by this address.
QualType MostDerivedType;

typedef APValue::LValuePathEntry PathEntry;
using PathEntry = APValue::LValuePathEntry;

/// The entries on the path from the glvalue to the designated subobject.
SmallVector<PathEntry, 8> Entries;
Expand Down Expand Up @@ -571,8 +571,8 @@ namespace {

// Note that we intentionally use std::map here so that references to
// values are stable.
typedef std::pair<const void *, unsigned> MapKeyTy;
typedef std::map<MapKeyTy, APValue> MapTy;
using MapKeyTy = std::pair<const void *, unsigned>;
using MapTy = std::map<MapKeyTy, APValue>;
/// Temporaries - Temporary lvalues materialized within this stack frame.
MapTy Temporaries;

Expand Down Expand Up @@ -1468,9 +1468,9 @@ namespace {
return Success;
}
};
typedef ScopeRAII<ScopeKind::Block> BlockScopeRAII;
typedef ScopeRAII<ScopeKind::FullExpression> FullExpressionRAII;
typedef ScopeRAII<ScopeKind::Call> CallScopeRAII;
using BlockScopeRAII = ScopeRAII<ScopeKind::Block>;
using FullExpressionRAII = ScopeRAII<ScopeKind::FullExpression>;
using CallScopeRAII = ScopeRAII<ScopeKind::Call>;
}

bool SubobjectDesignator::checkSubobject(EvalInfo &Info, const Expr *E,
Expand Down Expand Up @@ -4156,7 +4156,7 @@ struct ExtractSubobjectHandler {
APValue &Result;
const AccessKinds AccessKind;

typedef bool result_type;
using result_type = bool;
bool failed() { return false; }
bool found(APValue &Subobj, QualType SubobjType) {
Result = Subobj;
Expand Down Expand Up @@ -4191,7 +4191,7 @@ struct ModifySubobjectHandler {
APValue &NewVal;
const Expr *E;

typedef bool result_type;
using result_type = bool;
static const AccessKinds AccessKind = AK_Assign;

bool checkConst(QualType QT) {
Expand Down Expand Up @@ -4698,7 +4698,7 @@ struct CompoundAssignSubobjectHandler {

static const AccessKinds AccessKind = AK_Assign;

typedef bool result_type;
using result_type = bool;

bool checkConst(QualType QT) {
// Assigning to a const object has undefined behavior.
Expand Down Expand Up @@ -4845,7 +4845,7 @@ struct IncDecSubobjectHandler {
AccessKinds AccessKind;
APValue *Old;

typedef bool result_type;
using result_type = bool;

bool checkConst(QualType QT) {
// Assigning to a const object has undefined behavior.
Expand Down Expand Up @@ -6070,7 +6070,7 @@ static bool CheckConstexprFunction(EvalInfo &Info, SourceLocation CallLoc,
namespace {
struct CheckDynamicTypeHandler {
AccessKinds AccessKind;
typedef bool result_type;
using result_type = bool;
bool failed() { return false; }
bool found(APValue &Subobj, QualType SubobjType) { return true; }
bool found(APSInt &Value, QualType SubobjType) { return true; }
Expand Down Expand Up @@ -6417,7 +6417,7 @@ struct StartLifetimeOfUnionMemberHandler {
bool Failed = false;
static const AccessKinds AccessKind = AK_Assign;

typedef bool result_type;
using result_type = bool;
bool failed() { return Failed; }
bool found(APValue &Subobj, QualType SubobjType) {
// We are supposed to perform no initialization but begin the lifetime of
Expand Down Expand Up @@ -7135,7 +7135,7 @@ struct DestroyObjectHandler {
const LValue &This;
const AccessKinds AccessKind;

typedef bool result_type;
using result_type = bool;
bool failed() { return false; }
bool found(APValue &Subobj, QualType SubobjType) {
return HandleDestructionImpl(Info, E->getSourceRange(), This, Subobj,
Expand Down Expand Up @@ -8096,8 +8096,8 @@ class ExprEvaluatorBase

protected:
EvalInfo &Info;
typedef ConstStmtVisitor<Derived, bool> StmtVisitorTy;
typedef ExprEvaluatorBase ExprEvaluatorBaseTy;
using StmtVisitorTy = ConstStmtVisitor<Derived, bool>;
using ExprEvaluatorBaseTy = ExprEvaluatorBase;

OptionalDiagnostic CCEDiag(const Expr *E, diag::kind D) {
return Info.CCEDiag(E, D);
Expand Down Expand Up @@ -8750,8 +8750,8 @@ class LValueExprEvaluatorBase
protected:
LValue &Result;
bool InvalidBaseOK;
typedef LValueExprEvaluatorBase LValueExprEvaluatorBaseTy;
typedef ExprEvaluatorBase<Derived> ExprEvaluatorBaseTy;
using LValueExprEvaluatorBaseTy = LValueExprEvaluatorBase;
using ExprEvaluatorBaseTy = ExprEvaluatorBase<Derived>;

bool Success(APValue::LValueBase B) {
Result.set(B);
Expand Down Expand Up @@ -10517,7 +10517,7 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
const AccessKinds AccessKind;
APValue *Value;

typedef bool result_type;
using result_type = bool;
bool failed() { return false; }
bool checkConst(QualType QT) {
if (QT.isConstQualified()) {
Expand Down Expand Up @@ -10656,7 +10656,7 @@ bool MemberPointerExprEvaluator::VisitCastExpr(const CastExpr *E) {
// Base-to-derived member pointer casts store the path in derived-to-base
// order, so iterate backwards. The CXXBaseSpecifier also provides us with
// the wrong end of the derived->base arc, so stagger the path by one class.
typedef std::reverse_iterator<CastExpr::path_const_iterator> ReverseIter;
using ReverseIter = std::reverse_iterator<CastExpr::path_const_iterator>;
for (ReverseIter PathI(E->path_end() - 1), PathE(E->path_begin());
PathI != PathE; ++PathI) {
assert(!(*PathI)->isVirtual() && "memptr cast through vbase");
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/ExternalASTMerger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ template <typename T> struct Source {
template <typename U> operator Source<U>() { return Source<U>(t); }
};

typedef std::pair<Source<NamedDecl *>, ASTImporter *> Candidate;
using Candidate = std::pair<Source<NamedDecl *>, ASTImporter *>;

/// For the given DC, return the DC that is safe to perform lookups on. This is
/// the DC we actually want to work with most of the time.
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/AST/ItaniumMangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static bool isLambda(const NamedDecl *ND) {
static const unsigned UnknownArity = ~0U;

class ItaniumMangleContextImpl : public ItaniumMangleContext {
typedef std::pair<const DeclContext*, IdentifierInfo*> DiscriminatorKeyTy;
using DiscriminatorKeyTy = std::pair<const DeclContext *, IdentifierInfo *>;
llvm::DenseMap<DiscriminatorKeyTy, unsigned> Discriminator;
llvm::DenseMap<const NamedDecl*, unsigned> Uniquifier;
const DiscriminatorOverrideTy DiscriminatorOverride = nullptr;
Expand Down Expand Up @@ -283,7 +283,7 @@ class CXXNameMangler {
// The goal is to annotate against which version of a library an object was
// built and to be able to provide backwards compatibility ("dual abi").
// For more information see docs/ItaniumMangleAbiTags.rst.
typedef SmallVector<StringRef, 4> AbiTagList;
using AbiTagList = SmallVector<StringRef, 4>;

// State to gather all implicit and explicit tags used in a mangled name.
// Must always have an instance of this while emitting any name to keep
Expand Down
10 changes: 5 additions & 5 deletions clang/lib/AST/MicrosoftMangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static const FunctionDecl *getStructor(const NamedDecl *ND) {
/// MicrosoftMangleContextImpl - Overrides the default MangleContext for the
/// Microsoft Visual C++ ABI.
class MicrosoftMangleContextImpl : public MicrosoftMangleContext {
typedef std::pair<const DeclContext *, IdentifierInfo *> DiscriminatorKeyTy;
using DiscriminatorKeyTy = std::pair<const DeclContext *, IdentifierInfo *>;
llvm::DenseMap<DiscriminatorKeyTy, unsigned> Discriminator;
llvm::DenseMap<const NamedDecl *, unsigned> Uniquifier;
llvm::DenseMap<const CXXRecordDecl *, unsigned> LambdaIds;
Expand Down Expand Up @@ -316,19 +316,19 @@ class MicrosoftCXXNameMangler {
const NamedDecl *Structor;
unsigned StructorType;

typedef llvm::SmallVector<std::string, 10> BackRefVec;
using BackRefVec = llvm::SmallVector<std::string, 10>;
BackRefVec NameBackReferences;

typedef llvm::DenseMap<const void *, unsigned> ArgBackRefMap;
using ArgBackRefMap = llvm::DenseMap<const void *, unsigned>;
ArgBackRefMap FunArgBackReferences;
ArgBackRefMap TemplateArgBackReferences;

typedef llvm::DenseMap<const void *, StringRef> TemplateArgStringMap;
using TemplateArgStringMap = llvm::DenseMap<const void *, StringRef>;
TemplateArgStringMap TemplateArgStrings;
llvm::BumpPtrAllocator TemplateArgStringStorageAlloc;
llvm::StringSaver TemplateArgStringStorage;

typedef std::set<std::pair<int, bool>> PassObjectSizeArgsSet;
using PassObjectSizeArgsSet = std::set<std::pair<int, bool>>;
PassObjectSizeArgsSet PassObjectSizeArgs;

ASTContext &getASTContext() const { return Context.getASTContext(); }
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/AST/ODRHash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ namespace {
// Process a Decl pointer. Add* methods call back into ODRHash while Visit*
// methods process the relevant parts of the Decl.
class ODRDeclVisitor : public ConstDeclVisitor<ODRDeclVisitor> {
typedef ConstDeclVisitor<ODRDeclVisitor> Inherited;
using Inherited = ConstDeclVisitor<ODRDeclVisitor>;
llvm::FoldingSetNodeID &ID;
ODRHash &Hash;

Expand Down Expand Up @@ -856,7 +856,7 @@ namespace {
// Process a Type pointer. Add* methods call back into ODRHash while Visit*
// methods process the relevant parts of the Type.
class ODRTypeVisitor : public TypeVisitor<ODRTypeVisitor> {
typedef TypeVisitor<ODRTypeVisitor> Inherited;
using Inherited = TypeVisitor<ODRTypeVisitor>;
llvm::FoldingSetNodeID &ID;
ODRHash &Hash;

Expand Down
Loading
Loading