-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[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
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-clang-modules @llvm/pr-subscribers-clang-analysis Author: Victor Chernyakin (localspook) Changes(Except for the test code.) Patch is 176.05 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/149934.diff 133 Files Affected:
diff --git a/clang/lib/APINotes/APINotesFormat.h b/clang/lib/APINotes/APINotesFormat.h
index bb0c276e74964..1b8f0b34af9fc 100644
--- a/clang/lib/APINotes/APINotesFormat.h
+++ b/clang/lib/APINotes/APINotesFormat.h
@@ -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(),
diff --git a/clang/lib/APINotes/APINotesWriter.cpp b/clang/lib/APINotes/APINotesWriter.cpp
index ffc5473988735..830d04ba1ae7c 100644
--- a/clang/lib/APINotes/APINotesWriter.cpp
+++ b/clang/lib/APINotes/APINotesWriter.cpp
@@ -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.
diff --git a/clang/lib/APINotes/APINotesYAMLCompiler.cpp b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
index 803410c54c646..8085719dd0148 100644
--- a/clang/lib/APINotes/APINotesYAMLCompiler.cpp
+++ b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
@@ -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)
@@ -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;
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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;
@@ -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)
@@ -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;
@@ -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)
diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index ee3dc84479fd9..53975a789f5ed 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -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;
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp
index 2ef0c31ec1bd9..051f9b30a0687 100644
--- a/clang/lib/AST/ASTDiagnostic.cpp
+++ b/clang/lib/AST/ASTDiagnostic.cpp
@@ -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
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 2e1a9a3d9ad63..8981c93b6a62a 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -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)) {
@@ -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;
@@ -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;
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 0d12161756467..6772b1510be8d 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -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;
@@ -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;
@@ -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,
@@ -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;
@@ -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) {
@@ -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.
@@ -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.
@@ -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; }
@@ -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
@@ -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,
@@ -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);
@@ -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);
@@ -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()) {
@@ -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");
diff --git a/clang/lib/AST/ExternalASTMerger.cpp b/clang/lib/AST/ExternalASTMerger.cpp
index 15f8531a3ab05..36d76ce677ff5 100644
--- a/clang/lib/AST/ExternalASTMerger.cpp
+++ b/clang/lib/AST/ExternalASTMerger.cpp
@@ -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.
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index 2a667934dba42..ba467551807f9 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -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;
@@ -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
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp
index bc47e0506add0..99b2433158546 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -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;
@@ -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(); }
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index bd87d4418484b..88d1482e83258 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -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;
@@ -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;
diff --git a/clang/lib/AST/ParentMap.cpp b/clang/lib/AST/ParentMap.cpp
index e62e71bf5a514..dc8b929ff4a73 100644
--- a/clang/lib/AST/ParentMap.cpp
+++ b/clang/lib/AST/ParentMap.cpp
@@ -18,7 +18,7 @@
using namespace clang;
-typedef llvm::DenseMap<Stmt*, Stmt*> MapTy;
+using MapTy = llvm::DenseMap<Stmt *, Stmt *>;
enum OpaqueValueMode {
OV_Transparent,
diff --git a/clang/lib/AST/PrintfFormatString.cpp b/clang/lib/AST/PrintfFormatString.cpp
index bcd44f0a85eed..453f0122f473e 100644
--- a/clang/lib/AST/PrintfFormatString.cpp
+++ b/clang/lib/AST/PrintfFormatString.cpp
@@ -26,8 +26,8 @@ using clang::analyze_printf::PrintfSpecifier;
using namespace clang;
-typedef clang::analyze_format_string::SpecifierResult<PrintfSpecifier>
- PrintfSpecifierResult;
+using PrintfSpecifierResult =
+ clang::analyze_format_string::SpecifierResult<PrintfSpecifier>;
//===----------------------------------------------------------------------===//
// Methods for parsing format strings.
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index 6a74e98dd92d8..9485de987e383 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -109,8 +109,8 @@ class EmptySubobjectMap {
const CXXRecordDecl *Class;
/// EmptyClassOffsets - A map from offsets to empty record decls.
- typedef llvm::TinyPtrVector<const CXXRecordDecl *> ClassVectorTy;
- typedef llvm::DenseMap<CharUnits, ClassVectorTy> EmptyClassOffsetsMapTy;
+ using ClassVectorTy = llvm::TinyPtrVector<const CXXRecordDecl *>;
+ using EmptyClassOffsetsMapTy = llvm::DenseMap<CharUnits, ClassVectorTy>;
EmptyClassOffsetsMapTy EmptyClassOffsets;
/// MaxEmptyClassOffset - The highest offset known to contain an empty
@@ -560,7 +560,7 @@ void EmptySubobjectMap::UpdateEmptyFieldSubobjects(
}
}
-typedef llvm::SmallPtrSet<const CXXRecordDecl*, 4> ClassSetTy;
+using ClassSetTy = llvm::SmallPtrSet<const CXXRecordDecl *, 4>;
class ItaniumRecordLayoutBuilder {
protected:
@@ -660,7 +660,7 @@ class ItaniumRecordLayoutBuilder {
/// field has been handled, if any.
bool HandledFirstNonOverlappingEmptyField;
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
+ using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
/// Bases - base classes and their offsets in the record.
BaseOffsetsMapTy Bases;
@@ -719,8 +719,8 @@ class ItaniumRecordLayoutBuilder {
/// BaseSubobjectInfoAllocator - Allocator for BaseSubobjectInfo objects.
llvm::SpecificBumpPtrAllocator<BaseSubobjectInfo> BaseSubobjectInfoAllocator;
- typedef llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>
- BaseSubobjectInfoMapTy;
+ using BaseSubobjectInfoMapTy =
+ llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>;
/// VirtualBaseInfo - Map from all the (direct or indirect) virtual bases
/// of the class we're laying out to their base subobject info.
@@ -2554,7 +2554,7 @@ struct MicrosoftRecordLayoutBuilder {
CharUnits Size;
CharUnits Alignment;
};
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
+ using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
MicrosoftRecordLayoutBuilder(const ASTContext &Context,
EmptySubobjectMap *EmptySubobjects)
: Context(Context), EmptySubobjects(EmptySubobjects),
diff --git a/clang/lib/...
[truncated]
|
@llvm/pr-subscribers-backend-amdgpu Author: Victor Chernyakin (localspook) Changes(Except for the test code.) Patch is 176.05 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/149934.diff 133 Files Affected:
diff --git a/clang/lib/APINotes/APINotesFormat.h b/clang/lib/APINotes/APINotesFormat.h
index bb0c276e74964..1b8f0b34af9fc 100644
--- a/clang/lib/APINotes/APINotesFormat.h
+++ b/clang/lib/APINotes/APINotesFormat.h
@@ -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(),
diff --git a/clang/lib/APINotes/APINotesWriter.cpp b/clang/lib/APINotes/APINotesWriter.cpp
index ffc5473988735..830d04ba1ae7c 100644
--- a/clang/lib/APINotes/APINotesWriter.cpp
+++ b/clang/lib/APINotes/APINotesWriter.cpp
@@ -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.
diff --git a/clang/lib/APINotes/APINotesYAMLCompiler.cpp b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
index 803410c54c646..8085719dd0148 100644
--- a/clang/lib/APINotes/APINotesYAMLCompiler.cpp
+++ b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
@@ -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)
@@ -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;
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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;
@@ -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)
@@ -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;
@@ -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)
diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index ee3dc84479fd9..53975a789f5ed 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -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;
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp
index 2ef0c31ec1bd9..051f9b30a0687 100644
--- a/clang/lib/AST/ASTDiagnostic.cpp
+++ b/clang/lib/AST/ASTDiagnostic.cpp
@@ -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
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 2e1a9a3d9ad63..8981c93b6a62a 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -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)) {
@@ -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;
@@ -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;
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 0d12161756467..6772b1510be8d 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -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;
@@ -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;
@@ -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,
@@ -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;
@@ -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) {
@@ -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.
@@ -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.
@@ -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; }
@@ -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
@@ -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,
@@ -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);
@@ -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);
@@ -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()) {
@@ -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");
diff --git a/clang/lib/AST/ExternalASTMerger.cpp b/clang/lib/AST/ExternalASTMerger.cpp
index 15f8531a3ab05..36d76ce677ff5 100644
--- a/clang/lib/AST/ExternalASTMerger.cpp
+++ b/clang/lib/AST/ExternalASTMerger.cpp
@@ -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.
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index 2a667934dba42..ba467551807f9 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -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;
@@ -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
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp
index bc47e0506add0..99b2433158546 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -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;
@@ -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(); }
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index bd87d4418484b..88d1482e83258 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -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;
@@ -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;
diff --git a/clang/lib/AST/ParentMap.cpp b/clang/lib/AST/ParentMap.cpp
index e62e71bf5a514..dc8b929ff4a73 100644
--- a/clang/lib/AST/ParentMap.cpp
+++ b/clang/lib/AST/ParentMap.cpp
@@ -18,7 +18,7 @@
using namespace clang;
-typedef llvm::DenseMap<Stmt*, Stmt*> MapTy;
+using MapTy = llvm::DenseMap<Stmt *, Stmt *>;
enum OpaqueValueMode {
OV_Transparent,
diff --git a/clang/lib/AST/PrintfFormatString.cpp b/clang/lib/AST/PrintfFormatString.cpp
index bcd44f0a85eed..453f0122f473e 100644
--- a/clang/lib/AST/PrintfFormatString.cpp
+++ b/clang/lib/AST/PrintfFormatString.cpp
@@ -26,8 +26,8 @@ using clang::analyze_printf::PrintfSpecifier;
using namespace clang;
-typedef clang::analyze_format_string::SpecifierResult<PrintfSpecifier>
- PrintfSpecifierResult;
+using PrintfSpecifierResult =
+ clang::analyze_format_string::SpecifierResult<PrintfSpecifier>;
//===----------------------------------------------------------------------===//
// Methods for parsing format strings.
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index 6a74e98dd92d8..9485de987e383 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -109,8 +109,8 @@ class EmptySubobjectMap {
const CXXRecordDecl *Class;
/// EmptyClassOffsets - A map from offsets to empty record decls.
- typedef llvm::TinyPtrVector<const CXXRecordDecl *> ClassVectorTy;
- typedef llvm::DenseMap<CharUnits, ClassVectorTy> EmptyClassOffsetsMapTy;
+ using ClassVectorTy = llvm::TinyPtrVector<const CXXRecordDecl *>;
+ using EmptyClassOffsetsMapTy = llvm::DenseMap<CharUnits, ClassVectorTy>;
EmptyClassOffsetsMapTy EmptyClassOffsets;
/// MaxEmptyClassOffset - The highest offset known to contain an empty
@@ -560,7 +560,7 @@ void EmptySubobjectMap::UpdateEmptyFieldSubobjects(
}
}
-typedef llvm::SmallPtrSet<const CXXRecordDecl*, 4> ClassSetTy;
+using ClassSetTy = llvm::SmallPtrSet<const CXXRecordDecl *, 4>;
class ItaniumRecordLayoutBuilder {
protected:
@@ -660,7 +660,7 @@ class ItaniumRecordLayoutBuilder {
/// field has been handled, if any.
bool HandledFirstNonOverlappingEmptyField;
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
+ using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
/// Bases - base classes and their offsets in the record.
BaseOffsetsMapTy Bases;
@@ -719,8 +719,8 @@ class ItaniumRecordLayoutBuilder {
/// BaseSubobjectInfoAllocator - Allocator for BaseSubobjectInfo objects.
llvm::SpecificBumpPtrAllocator<BaseSubobjectInfo> BaseSubobjectInfoAllocator;
- typedef llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>
- BaseSubobjectInfoMapTy;
+ using BaseSubobjectInfoMapTy =
+ llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>;
/// VirtualBaseInfo - Map from all the (direct or indirect) virtual bases
/// of the class we're laying out to their base subobject info.
@@ -2554,7 +2554,7 @@ struct MicrosoftRecordLayoutBuilder {
CharUnits Size;
CharUnits Alignment;
};
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
+ using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
MicrosoftRecordLayoutBuilder(const ASTContext &Context,
EmptySubobjectMap *EmptySubobjects)
: Context(Context), EmptySubobjects(EmptySubobjects),
diff --git a/clang/lib/...
[truncated]
|
@llvm/pr-subscribers-clang-format Author: Victor Chernyakin (localspook) Changes(Except for the test code.) Patch is 176.05 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/149934.diff 133 Files Affected:
diff --git a/clang/lib/APINotes/APINotesFormat.h b/clang/lib/APINotes/APINotesFormat.h
index bb0c276e74964..1b8f0b34af9fc 100644
--- a/clang/lib/APINotes/APINotesFormat.h
+++ b/clang/lib/APINotes/APINotesFormat.h
@@ -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(),
diff --git a/clang/lib/APINotes/APINotesWriter.cpp b/clang/lib/APINotes/APINotesWriter.cpp
index ffc5473988735..830d04ba1ae7c 100644
--- a/clang/lib/APINotes/APINotesWriter.cpp
+++ b/clang/lib/APINotes/APINotesWriter.cpp
@@ -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.
diff --git a/clang/lib/APINotes/APINotesYAMLCompiler.cpp b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
index 803410c54c646..8085719dd0148 100644
--- a/clang/lib/APINotes/APINotesYAMLCompiler.cpp
+++ b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
@@ -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)
@@ -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;
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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;
@@ -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)
@@ -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;
@@ -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)
diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index ee3dc84479fd9..53975a789f5ed 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -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;
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp
index 2ef0c31ec1bd9..051f9b30a0687 100644
--- a/clang/lib/AST/ASTDiagnostic.cpp
+++ b/clang/lib/AST/ASTDiagnostic.cpp
@@ -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
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 2e1a9a3d9ad63..8981c93b6a62a 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -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)) {
@@ -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;
@@ -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;
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 0d12161756467..6772b1510be8d 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -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;
@@ -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;
@@ -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,
@@ -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;
@@ -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) {
@@ -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.
@@ -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.
@@ -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; }
@@ -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
@@ -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,
@@ -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);
@@ -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);
@@ -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()) {
@@ -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");
diff --git a/clang/lib/AST/ExternalASTMerger.cpp b/clang/lib/AST/ExternalASTMerger.cpp
index 15f8531a3ab05..36d76ce677ff5 100644
--- a/clang/lib/AST/ExternalASTMerger.cpp
+++ b/clang/lib/AST/ExternalASTMerger.cpp
@@ -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.
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index 2a667934dba42..ba467551807f9 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -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;
@@ -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
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp
index bc47e0506add0..99b2433158546 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -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;
@@ -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(); }
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index bd87d4418484b..88d1482e83258 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -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;
@@ -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;
diff --git a/clang/lib/AST/ParentMap.cpp b/clang/lib/AST/ParentMap.cpp
index e62e71bf5a514..dc8b929ff4a73 100644
--- a/clang/lib/AST/ParentMap.cpp
+++ b/clang/lib/AST/ParentMap.cpp
@@ -18,7 +18,7 @@
using namespace clang;
-typedef llvm::DenseMap<Stmt*, Stmt*> MapTy;
+using MapTy = llvm::DenseMap<Stmt *, Stmt *>;
enum OpaqueValueMode {
OV_Transparent,
diff --git a/clang/lib/AST/PrintfFormatString.cpp b/clang/lib/AST/PrintfFormatString.cpp
index bcd44f0a85eed..453f0122f473e 100644
--- a/clang/lib/AST/PrintfFormatString.cpp
+++ b/clang/lib/AST/PrintfFormatString.cpp
@@ -26,8 +26,8 @@ using clang::analyze_printf::PrintfSpecifier;
using namespace clang;
-typedef clang::analyze_format_string::SpecifierResult<PrintfSpecifier>
- PrintfSpecifierResult;
+using PrintfSpecifierResult =
+ clang::analyze_format_string::SpecifierResult<PrintfSpecifier>;
//===----------------------------------------------------------------------===//
// Methods for parsing format strings.
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index 6a74e98dd92d8..9485de987e383 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -109,8 +109,8 @@ class EmptySubobjectMap {
const CXXRecordDecl *Class;
/// EmptyClassOffsets - A map from offsets to empty record decls.
- typedef llvm::TinyPtrVector<const CXXRecordDecl *> ClassVectorTy;
- typedef llvm::DenseMap<CharUnits, ClassVectorTy> EmptyClassOffsetsMapTy;
+ using ClassVectorTy = llvm::TinyPtrVector<const CXXRecordDecl *>;
+ using EmptyClassOffsetsMapTy = llvm::DenseMap<CharUnits, ClassVectorTy>;
EmptyClassOffsetsMapTy EmptyClassOffsets;
/// MaxEmptyClassOffset - The highest offset known to contain an empty
@@ -560,7 +560,7 @@ void EmptySubobjectMap::UpdateEmptyFieldSubobjects(
}
}
-typedef llvm::SmallPtrSet<const CXXRecordDecl*, 4> ClassSetTy;
+using ClassSetTy = llvm::SmallPtrSet<const CXXRecordDecl *, 4>;
class ItaniumRecordLayoutBuilder {
protected:
@@ -660,7 +660,7 @@ class ItaniumRecordLayoutBuilder {
/// field has been handled, if any.
bool HandledFirstNonOverlappingEmptyField;
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
+ using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
/// Bases - base classes and their offsets in the record.
BaseOffsetsMapTy Bases;
@@ -719,8 +719,8 @@ class ItaniumRecordLayoutBuilder {
/// BaseSubobjectInfoAllocator - Allocator for BaseSubobjectInfo objects.
llvm::SpecificBumpPtrAllocator<BaseSubobjectInfo> BaseSubobjectInfoAllocator;
- typedef llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>
- BaseSubobjectInfoMapTy;
+ using BaseSubobjectInfoMapTy =
+ llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>;
/// VirtualBaseInfo - Map from all the (direct or indirect) virtual bases
/// of the class we're laying out to their base subobject info.
@@ -2554,7 +2554,7 @@ struct MicrosoftRecordLayoutBuilder {
CharUnits Size;
CharUnits Alignment;
};
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
+ using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
MicrosoftRecordLayoutBuilder(const ASTContext &Context,
EmptySubobjectMap *EmptySubobjects)
: Context(Context), EmptySubobjects(EmptySubobjects),
diff --git a/clang/lib/...
[truncated]
|
@llvm/pr-subscribers-hlsl Author: Victor Chernyakin (localspook) Changes(Except for the test code.) Patch is 176.05 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/149934.diff 133 Files Affected:
diff --git a/clang/lib/APINotes/APINotesFormat.h b/clang/lib/APINotes/APINotesFormat.h
index bb0c276e74964..1b8f0b34af9fc 100644
--- a/clang/lib/APINotes/APINotesFormat.h
+++ b/clang/lib/APINotes/APINotesFormat.h
@@ -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(),
diff --git a/clang/lib/APINotes/APINotesWriter.cpp b/clang/lib/APINotes/APINotesWriter.cpp
index ffc5473988735..830d04ba1ae7c 100644
--- a/clang/lib/APINotes/APINotesWriter.cpp
+++ b/clang/lib/APINotes/APINotesWriter.cpp
@@ -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.
diff --git a/clang/lib/APINotes/APINotesYAMLCompiler.cpp b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
index 803410c54c646..8085719dd0148 100644
--- a/clang/lib/APINotes/APINotesYAMLCompiler.cpp
+++ b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
@@ -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)
@@ -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;
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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;
@@ -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)
@@ -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;
@@ -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)
diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index ee3dc84479fd9..53975a789f5ed 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -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;
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp
index 2ef0c31ec1bd9..051f9b30a0687 100644
--- a/clang/lib/AST/ASTDiagnostic.cpp
+++ b/clang/lib/AST/ASTDiagnostic.cpp
@@ -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
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 2e1a9a3d9ad63..8981c93b6a62a 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -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)) {
@@ -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;
@@ -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;
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 0d12161756467..6772b1510be8d 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -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;
@@ -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;
@@ -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,
@@ -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;
@@ -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) {
@@ -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.
@@ -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.
@@ -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; }
@@ -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
@@ -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,
@@ -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);
@@ -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);
@@ -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()) {
@@ -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");
diff --git a/clang/lib/AST/ExternalASTMerger.cpp b/clang/lib/AST/ExternalASTMerger.cpp
index 15f8531a3ab05..36d76ce677ff5 100644
--- a/clang/lib/AST/ExternalASTMerger.cpp
+++ b/clang/lib/AST/ExternalASTMerger.cpp
@@ -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.
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index 2a667934dba42..ba467551807f9 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -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;
@@ -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
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp
index bc47e0506add0..99b2433158546 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -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;
@@ -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(); }
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index bd87d4418484b..88d1482e83258 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -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;
@@ -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;
diff --git a/clang/lib/AST/ParentMap.cpp b/clang/lib/AST/ParentMap.cpp
index e62e71bf5a514..dc8b929ff4a73 100644
--- a/clang/lib/AST/ParentMap.cpp
+++ b/clang/lib/AST/ParentMap.cpp
@@ -18,7 +18,7 @@
using namespace clang;
-typedef llvm::DenseMap<Stmt*, Stmt*> MapTy;
+using MapTy = llvm::DenseMap<Stmt *, Stmt *>;
enum OpaqueValueMode {
OV_Transparent,
diff --git a/clang/lib/AST/PrintfFormatString.cpp b/clang/lib/AST/PrintfFormatString.cpp
index bcd44f0a85eed..453f0122f473e 100644
--- a/clang/lib/AST/PrintfFormatString.cpp
+++ b/clang/lib/AST/PrintfFormatString.cpp
@@ -26,8 +26,8 @@ using clang::analyze_printf::PrintfSpecifier;
using namespace clang;
-typedef clang::analyze_format_string::SpecifierResult<PrintfSpecifier>
- PrintfSpecifierResult;
+using PrintfSpecifierResult =
+ clang::analyze_format_string::SpecifierResult<PrintfSpecifier>;
//===----------------------------------------------------------------------===//
// Methods for parsing format strings.
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index 6a74e98dd92d8..9485de987e383 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -109,8 +109,8 @@ class EmptySubobjectMap {
const CXXRecordDecl *Class;
/// EmptyClassOffsets - A map from offsets to empty record decls.
- typedef llvm::TinyPtrVector<const CXXRecordDecl *> ClassVectorTy;
- typedef llvm::DenseMap<CharUnits, ClassVectorTy> EmptyClassOffsetsMapTy;
+ using ClassVectorTy = llvm::TinyPtrVector<const CXXRecordDecl *>;
+ using EmptyClassOffsetsMapTy = llvm::DenseMap<CharUnits, ClassVectorTy>;
EmptyClassOffsetsMapTy EmptyClassOffsets;
/// MaxEmptyClassOffset - The highest offset known to contain an empty
@@ -560,7 +560,7 @@ void EmptySubobjectMap::UpdateEmptyFieldSubobjects(
}
}
-typedef llvm::SmallPtrSet<const CXXRecordDecl*, 4> ClassSetTy;
+using ClassSetTy = llvm::SmallPtrSet<const CXXRecordDecl *, 4>;
class ItaniumRecordLayoutBuilder {
protected:
@@ -660,7 +660,7 @@ class ItaniumRecordLayoutBuilder {
/// field has been handled, if any.
bool HandledFirstNonOverlappingEmptyField;
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
+ using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
/// Bases - base classes and their offsets in the record.
BaseOffsetsMapTy Bases;
@@ -719,8 +719,8 @@ class ItaniumRecordLayoutBuilder {
/// BaseSubobjectInfoAllocator - Allocator for BaseSubobjectInfo objects.
llvm::SpecificBumpPtrAllocator<BaseSubobjectInfo> BaseSubobjectInfoAllocator;
- typedef llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>
- BaseSubobjectInfoMapTy;
+ using BaseSubobjectInfoMapTy =
+ llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>;
/// VirtualBaseInfo - Map from all the (direct or indirect) virtual bases
/// of the class we're laying out to their base subobject info.
@@ -2554,7 +2554,7 @@ struct MicrosoftRecordLayoutBuilder {
CharUnits Size;
CharUnits Alignment;
};
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
+ using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
MicrosoftRecordLayoutBuilder(const ASTContext &Context,
EmptySubobjectMap *EmptySubobjects)
: Context(Context), EmptySubobjects(EmptySubobjects),
diff --git a/clang/lib/...
[truncated]
|
@llvm/pr-subscribers-clang Author: Victor Chernyakin (localspook) Changes(Except for the test code.) Patch is 176.05 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/149934.diff 133 Files Affected:
diff --git a/clang/lib/APINotes/APINotesFormat.h b/clang/lib/APINotes/APINotesFormat.h
index bb0c276e74964..1b8f0b34af9fc 100644
--- a/clang/lib/APINotes/APINotesFormat.h
+++ b/clang/lib/APINotes/APINotesFormat.h
@@ -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(),
diff --git a/clang/lib/APINotes/APINotesWriter.cpp b/clang/lib/APINotes/APINotesWriter.cpp
index ffc5473988735..830d04ba1ae7c 100644
--- a/clang/lib/APINotes/APINotesWriter.cpp
+++ b/clang/lib/APINotes/APINotesWriter.cpp
@@ -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.
diff --git a/clang/lib/APINotes/APINotesYAMLCompiler.cpp b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
index 803410c54c646..8085719dd0148 100644
--- a/clang/lib/APINotes/APINotesYAMLCompiler.cpp
+++ b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
@@ -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)
@@ -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;
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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;
@@ -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)
@@ -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;
@@ -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)
diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index ee3dc84479fd9..53975a789f5ed 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -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;
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp
index 2ef0c31ec1bd9..051f9b30a0687 100644
--- a/clang/lib/AST/ASTDiagnostic.cpp
+++ b/clang/lib/AST/ASTDiagnostic.cpp
@@ -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
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 2e1a9a3d9ad63..8981c93b6a62a 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -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)) {
@@ -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;
@@ -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;
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 0d12161756467..6772b1510be8d 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -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;
@@ -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;
@@ -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,
@@ -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;
@@ -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) {
@@ -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.
@@ -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.
@@ -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; }
@@ -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
@@ -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,
@@ -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);
@@ -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);
@@ -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()) {
@@ -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");
diff --git a/clang/lib/AST/ExternalASTMerger.cpp b/clang/lib/AST/ExternalASTMerger.cpp
index 15f8531a3ab05..36d76ce677ff5 100644
--- a/clang/lib/AST/ExternalASTMerger.cpp
+++ b/clang/lib/AST/ExternalASTMerger.cpp
@@ -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.
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index 2a667934dba42..ba467551807f9 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -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;
@@ -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
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp
index bc47e0506add0..99b2433158546 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -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;
@@ -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(); }
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index bd87d4418484b..88d1482e83258 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -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;
@@ -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;
diff --git a/clang/lib/AST/ParentMap.cpp b/clang/lib/AST/ParentMap.cpp
index e62e71bf5a514..dc8b929ff4a73 100644
--- a/clang/lib/AST/ParentMap.cpp
+++ b/clang/lib/AST/ParentMap.cpp
@@ -18,7 +18,7 @@
using namespace clang;
-typedef llvm::DenseMap<Stmt*, Stmt*> MapTy;
+using MapTy = llvm::DenseMap<Stmt *, Stmt *>;
enum OpaqueValueMode {
OV_Transparent,
diff --git a/clang/lib/AST/PrintfFormatString.cpp b/clang/lib/AST/PrintfFormatString.cpp
index bcd44f0a85eed..453f0122f473e 100644
--- a/clang/lib/AST/PrintfFormatString.cpp
+++ b/clang/lib/AST/PrintfFormatString.cpp
@@ -26,8 +26,8 @@ using clang::analyze_printf::PrintfSpecifier;
using namespace clang;
-typedef clang::analyze_format_string::SpecifierResult<PrintfSpecifier>
- PrintfSpecifierResult;
+using PrintfSpecifierResult =
+ clang::analyze_format_string::SpecifierResult<PrintfSpecifier>;
//===----------------------------------------------------------------------===//
// Methods for parsing format strings.
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index 6a74e98dd92d8..9485de987e383 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -109,8 +109,8 @@ class EmptySubobjectMap {
const CXXRecordDecl *Class;
/// EmptyClassOffsets - A map from offsets to empty record decls.
- typedef llvm::TinyPtrVector<const CXXRecordDecl *> ClassVectorTy;
- typedef llvm::DenseMap<CharUnits, ClassVectorTy> EmptyClassOffsetsMapTy;
+ using ClassVectorTy = llvm::TinyPtrVector<const CXXRecordDecl *>;
+ using EmptyClassOffsetsMapTy = llvm::DenseMap<CharUnits, ClassVectorTy>;
EmptyClassOffsetsMapTy EmptyClassOffsets;
/// MaxEmptyClassOffset - The highest offset known to contain an empty
@@ -560,7 +560,7 @@ void EmptySubobjectMap::UpdateEmptyFieldSubobjects(
}
}
-typedef llvm::SmallPtrSet<const CXXRecordDecl*, 4> ClassSetTy;
+using ClassSetTy = llvm::SmallPtrSet<const CXXRecordDecl *, 4>;
class ItaniumRecordLayoutBuilder {
protected:
@@ -660,7 +660,7 @@ class ItaniumRecordLayoutBuilder {
/// field has been handled, if any.
bool HandledFirstNonOverlappingEmptyField;
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
+ using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
/// Bases - base classes and their offsets in the record.
BaseOffsetsMapTy Bases;
@@ -719,8 +719,8 @@ class ItaniumRecordLayoutBuilder {
/// BaseSubobjectInfoAllocator - Allocator for BaseSubobjectInfo objects.
llvm::SpecificBumpPtrAllocator<BaseSubobjectInfo> BaseSubobjectInfoAllocator;
- typedef llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>
- BaseSubobjectInfoMapTy;
+ using BaseSubobjectInfoMapTy =
+ llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>;
/// VirtualBaseInfo - Map from all the (direct or indirect) virtual bases
/// of the class we're laying out to their base subobject info.
@@ -2554,7 +2554,7 @@ struct MicrosoftRecordLayoutBuilder {
CharUnits Size;
CharUnits Alignment;
};
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
+ using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
MicrosoftRecordLayoutBuilder(const ASTContext &Context,
EmptySubobjectMap *EmptySubobjects)
: Context(Context), EmptySubobjects(EmptySubobjects),
diff --git a/clang/lib/...
[truncated]
|
@llvm/pr-subscribers-clang-codegen Author: Victor Chernyakin (localspook) Changes(Except for the test code.) Patch is 176.05 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/149934.diff 133 Files Affected:
diff --git a/clang/lib/APINotes/APINotesFormat.h b/clang/lib/APINotes/APINotesFormat.h
index bb0c276e74964..1b8f0b34af9fc 100644
--- a/clang/lib/APINotes/APINotesFormat.h
+++ b/clang/lib/APINotes/APINotesFormat.h
@@ -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(),
diff --git a/clang/lib/APINotes/APINotesWriter.cpp b/clang/lib/APINotes/APINotesWriter.cpp
index ffc5473988735..830d04ba1ae7c 100644
--- a/clang/lib/APINotes/APINotesWriter.cpp
+++ b/clang/lib/APINotes/APINotesWriter.cpp
@@ -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.
diff --git a/clang/lib/APINotes/APINotesYAMLCompiler.cpp b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
index 803410c54c646..8085719dd0148 100644
--- a/clang/lib/APINotes/APINotesYAMLCompiler.cpp
+++ b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
@@ -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)
@@ -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;
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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;
@@ -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)
@@ -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;
@@ -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)
diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index ee3dc84479fd9..53975a789f5ed 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -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;
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp
index 2ef0c31ec1bd9..051f9b30a0687 100644
--- a/clang/lib/AST/ASTDiagnostic.cpp
+++ b/clang/lib/AST/ASTDiagnostic.cpp
@@ -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
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 2e1a9a3d9ad63..8981c93b6a62a 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -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)) {
@@ -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;
@@ -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;
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 0d12161756467..6772b1510be8d 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -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;
@@ -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;
@@ -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,
@@ -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;
@@ -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) {
@@ -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.
@@ -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.
@@ -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; }
@@ -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
@@ -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,
@@ -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);
@@ -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);
@@ -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()) {
@@ -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");
diff --git a/clang/lib/AST/ExternalASTMerger.cpp b/clang/lib/AST/ExternalASTMerger.cpp
index 15f8531a3ab05..36d76ce677ff5 100644
--- a/clang/lib/AST/ExternalASTMerger.cpp
+++ b/clang/lib/AST/ExternalASTMerger.cpp
@@ -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.
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index 2a667934dba42..ba467551807f9 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -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;
@@ -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
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp
index bc47e0506add0..99b2433158546 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -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;
@@ -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(); }
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index bd87d4418484b..88d1482e83258 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -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;
@@ -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;
diff --git a/clang/lib/AST/ParentMap.cpp b/clang/lib/AST/ParentMap.cpp
index e62e71bf5a514..dc8b929ff4a73 100644
--- a/clang/lib/AST/ParentMap.cpp
+++ b/clang/lib/AST/ParentMap.cpp
@@ -18,7 +18,7 @@
using namespace clang;
-typedef llvm::DenseMap<Stmt*, Stmt*> MapTy;
+using MapTy = llvm::DenseMap<Stmt *, Stmt *>;
enum OpaqueValueMode {
OV_Transparent,
diff --git a/clang/lib/AST/PrintfFormatString.cpp b/clang/lib/AST/PrintfFormatString.cpp
index bcd44f0a85eed..453f0122f473e 100644
--- a/clang/lib/AST/PrintfFormatString.cpp
+++ b/clang/lib/AST/PrintfFormatString.cpp
@@ -26,8 +26,8 @@ using clang::analyze_printf::PrintfSpecifier;
using namespace clang;
-typedef clang::analyze_format_string::SpecifierResult<PrintfSpecifier>
- PrintfSpecifierResult;
+using PrintfSpecifierResult =
+ clang::analyze_format_string::SpecifierResult<PrintfSpecifier>;
//===----------------------------------------------------------------------===//
// Methods for parsing format strings.
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index 6a74e98dd92d8..9485de987e383 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -109,8 +109,8 @@ class EmptySubobjectMap {
const CXXRecordDecl *Class;
/// EmptyClassOffsets - A map from offsets to empty record decls.
- typedef llvm::TinyPtrVector<const CXXRecordDecl *> ClassVectorTy;
- typedef llvm::DenseMap<CharUnits, ClassVectorTy> EmptyClassOffsetsMapTy;
+ using ClassVectorTy = llvm::TinyPtrVector<const CXXRecordDecl *>;
+ using EmptyClassOffsetsMapTy = llvm::DenseMap<CharUnits, ClassVectorTy>;
EmptyClassOffsetsMapTy EmptyClassOffsets;
/// MaxEmptyClassOffset - The highest offset known to contain an empty
@@ -560,7 +560,7 @@ void EmptySubobjectMap::UpdateEmptyFieldSubobjects(
}
}
-typedef llvm::SmallPtrSet<const CXXRecordDecl*, 4> ClassSetTy;
+using ClassSetTy = llvm::SmallPtrSet<const CXXRecordDecl *, 4>;
class ItaniumRecordLayoutBuilder {
protected:
@@ -660,7 +660,7 @@ class ItaniumRecordLayoutBuilder {
/// field has been handled, if any.
bool HandledFirstNonOverlappingEmptyField;
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
+ using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
/// Bases - base classes and their offsets in the record.
BaseOffsetsMapTy Bases;
@@ -719,8 +719,8 @@ class ItaniumRecordLayoutBuilder {
/// BaseSubobjectInfoAllocator - Allocator for BaseSubobjectInfo objects.
llvm::SpecificBumpPtrAllocator<BaseSubobjectInfo> BaseSubobjectInfoAllocator;
- typedef llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>
- BaseSubobjectInfoMapTy;
+ using BaseSubobjectInfoMapTy =
+ llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>;
/// VirtualBaseInfo - Map from all the (direct or indirect) virtual bases
/// of the class we're laying out to their base subobject info.
@@ -2554,7 +2554,7 @@ struct MicrosoftRecordLayoutBuilder {
CharUnits Size;
CharUnits Alignment;
};
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
+ using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
MicrosoftRecordLayoutBuilder(const ASTContext &Context,
EmptySubobjectMap *EmptySubobjects)
: Context(Context), EmptySubobjects(EmptySubobjects),
diff --git a/clang/lib/...
[truncated]
|
The LLVM Coding Standards generally discourage large-scale changes like these:
Is there a reason that this wouldn't apply here? |
This change is NFC, but it's not reformatting; it's moving from Edit: to elaborate — as I understand it, mass reformatting is a no-no because of just how disruptive it would be (by this estimate, almost 150 000 lines changed in clang alone). This change is over 2 orders of magnitude smaller. |
I defer to the clang code owners to decide whether they want to take this. That said, I believe this kind of change qualifies as large-scale reformatting, if not literally, then at least in spirit. Additionally, the coding standards don't express a preference for |
As a Clang Static Analyzer maintainer I welcome this change and usually any NFC change that is not a clangformat refactor. I'll have a look once I have some free time. |
(Except for the test code.)