From 4d160125b63759c95c9ed6f8298494fa2de5f9a3 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Mon, 21 Jul 2025 15:14:17 -0700 Subject: [PATCH 1/2] [clang][NFC] Run `modernize-use-using` check over all the code --- clang/lib/APINotes/APINotesFormat.h | 2 +- clang/lib/APINotes/APINotesWriter.cpp | 4 +- clang/lib/APINotes/APINotesYAMLCompiler.cpp | 26 +++--- clang/lib/AST/APValue.cpp | 2 +- clang/lib/AST/ASTDiagnostic.cpp | 4 +- clang/lib/AST/Expr.cpp | 6 +- clang/lib/AST/ExprConstant.cpp | 38 ++++---- clang/lib/AST/ExternalASTMerger.cpp | 2 +- clang/lib/AST/ItaniumMangle.cpp | 4 +- clang/lib/AST/MicrosoftMangle.cpp | 10 +- clang/lib/AST/ODRHash.cpp | 4 +- clang/lib/AST/ParentMap.cpp | 2 +- clang/lib/AST/PrintfFormatString.cpp | 4 +- clang/lib/AST/RecordLayoutBuilder.cpp | 14 +-- clang/lib/AST/ScanfFormatString.cpp | 4 +- clang/lib/AST/Stmt.cpp | 6 +- clang/lib/AST/VTableBuilder.cpp | 77 ++++++++-------- clang/lib/ASTMatchers/ASTMatchFinder.cpp | 6 +- clang/lib/Analysis/BodyFarm.cpp | 2 +- clang/lib/Analysis/CFGStmtMap.cpp | 2 +- clang/lib/Analysis/ReachableCode.cpp | 4 +- clang/lib/Basic/Targets/PPC.h | 4 +- clang/lib/CodeGen/CGBuilder.h | 6 +- clang/lib/CodeGen/CGCall.h | 4 +- clang/lib/CodeGen/CGClass.cpp | 2 +- clang/lib/CodeGen/CGCleanup.h | 2 +- clang/lib/CodeGen/CGDebugInfo.cpp | 2 +- clang/lib/CodeGen/CGExpr.cpp | 2 +- clang/lib/CodeGen/CGExprCXX.cpp | 16 ++-- clang/lib/CodeGen/CGExprComplex.cpp | 4 +- clang/lib/CodeGen/CGHLSLRuntime.cpp | 2 +- clang/lib/CodeGen/CGNonTrivialStruct.cpp | 2 +- clang/lib/CodeGen/CGObjC.cpp | 9 +- clang/lib/CodeGen/CGObjCGNU.cpp | 11 +-- clang/lib/CodeGen/CGOpenMPRuntime.cpp | 2 +- clang/lib/CodeGen/CGOpenMPRuntime.h | 20 ++-- clang/lib/CodeGen/CGStmtOpenMP.cpp | 7 +- clang/lib/CodeGen/CGVTables.h | 10 +- clang/lib/CodeGen/CodeGenFunction.h | 58 ++++++------ clang/lib/CodeGen/CodeGenModule.h | 21 ++--- clang/lib/CodeGen/CodeGenTypes.h | 2 +- clang/lib/CodeGen/CoverageMappingGen.cpp | 4 +- clang/lib/CodeGen/EHScopeStack.h | 6 +- clang/lib/CodeGen/MicrosoftCXXABI.cpp | 8 +- clang/lib/CodeGen/TargetBuiltins/PPC.cpp | 7 +- clang/lib/CodeGen/TargetInfo.h | 2 +- clang/lib/CodeGen/Targets/XCore.cpp | 2 +- clang/lib/Driver/Driver.cpp | 2 +- clang/lib/Driver/ToolChains/Arch/Mips.h | 2 +- clang/lib/Format/BreakableToken.h | 2 +- clang/lib/Format/Format.cpp | 5 +- clang/lib/Format/QualifierAlignmentFixer.h | 5 +- clang/lib/Format/UnwrappedLineFormatter.cpp | 9 +- clang/lib/Frontend/ASTConsumers.cpp | 2 +- .../lib/Frontend/PrintPreprocessedOutput.cpp | 2 +- .../Frontend/SerializedDiagnosticPrinter.cpp | 12 +-- clang/lib/Index/IndexBody.cpp | 2 +- clang/lib/Index/IndexTypeSourceInfo.cpp | 2 +- clang/lib/Lex/LiteralSupport.cpp | 4 +- clang/lib/Parse/ParsePragma.cpp | 4 +- clang/lib/Sema/AnalysisBasedWarnings.cpp | 26 +++--- clang/lib/Sema/JumpDiagnostics.cpp | 2 +- clang/lib/Sema/Sema.cpp | 5 +- clang/lib/Sema/SemaAPINotes.cpp | 2 +- clang/lib/Sema/SemaAccess.cpp | 2 +- clang/lib/Sema/SemaAttr.cpp | 2 +- clang/lib/Sema/SemaCodeComplete.cpp | 91 +++++++++---------- clang/lib/Sema/SemaDecl.cpp | 10 +- clang/lib/Sema/SemaDeclCXX.cpp | 14 +-- clang/lib/Sema/SemaDeclObjC.cpp | 8 +- clang/lib/Sema/SemaExpr.cpp | 6 +- clang/lib/Sema/SemaExprMember.cpp | 2 +- clang/lib/Sema/SemaExprObjC.cpp | 2 +- clang/lib/Sema/SemaInit.cpp | 4 +- clang/lib/Sema/SemaLookup.cpp | 10 +- clang/lib/Sema/SemaOpenMP.cpp | 2 +- clang/lib/Sema/SemaOverload.cpp | 4 +- clang/lib/Sema/SemaPseudoObject.cpp | 2 +- clang/lib/Sema/SemaStmt.cpp | 18 ++-- clang/lib/Sema/SemaStmtAsm.cpp | 2 +- clang/lib/Sema/SemaStmtAttr.cpp | 2 +- clang/lib/Sema/SemaTemplate.cpp | 6 +- clang/lib/Sema/SemaTemplateDeductionGuide.cpp | 2 +- clang/lib/Sema/SemaTemplateInstantiate.cpp | 6 +- .../lib/Sema/SemaTemplateInstantiateDecl.cpp | 6 +- clang/lib/Sema/SemaTemplateVariadic.cpp | 4 +- clang/lib/Sema/SemaType.cpp | 2 +- clang/lib/Sema/TreeTransform.h | 42 ++++----- clang/lib/Sema/UsedDeclVisitor.h | 2 +- clang/lib/Serialization/GlobalModuleIndex.cpp | 35 ++++--- .../Serialization/TemplateArgumentHasher.cpp | 2 +- .../Checkers/CheckObjCInstMethSignature.cpp | 2 +- .../Checkers/CheckSecuritySyntaxOnly.cpp | 4 +- .../StaticAnalyzer/Checkers/DebugCheckers.cpp | 2 +- .../Checkers/DebugContainerModeling.cpp | 4 +- .../Checkers/DebugIteratorModeling.cpp | 4 +- .../Checkers/DirectIvarAssignment.cpp | 4 +- .../Checkers/ExprInspectionChecker.cpp | 4 +- .../Checkers/IvarInvalidationChecker.cpp | 16 ++-- .../Checkers/MPI-Checker/MPITypes.h | 5 +- .../Checkers/MacOSKeychainAPIChecker.cpp | 4 +- .../Checkers/MacOSXAPIChecker.cpp | 6 +- .../Checkers/MallocSizeofChecker.cpp | 6 +- .../Checkers/NSErrorChecker.cpp | 2 +- .../Checkers/ObjCUnusedIVarsChecker.cpp | 2 +- .../Checkers/PthreadLockChecker.cpp | 6 +- .../Checkers/SimpleStreamChecker.cpp | 2 +- .../Checkers/StdLibraryFunctionsChecker.cpp | 6 +- .../Checkers/UnreachableCodeChecker.cpp | 2 +- .../StaticAnalyzer/Checkers/ValistChecker.cpp | 2 +- .../lib/StaticAnalyzer/Core/BlockCounter.cpp | 2 +- clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 18 ++-- .../lib/StaticAnalyzer/Core/ProgramState.cpp | 4 +- clang/lib/StaticAnalyzer/Core/RegionStore.cpp | 33 ++++--- .../Frontend/AnalysisConsumer.cpp | 2 +- .../clang-fuzzer/handle-llvm/handle_llvm.cpp | 2 +- clang/tools/diagtool/DiagTool.cpp | 2 +- clang/tools/diagtool/DiagnosticNames.h | 14 +-- clang/tools/libclang/CIndex.cpp | 8 +- clang/tools/libclang/CIndexHigh.cpp | 2 +- clang/tools/libclang/CLog.h | 2 +- clang/tools/libclang/CXCursor.cpp | 4 +- clang/tools/libclang/CXCursor.h | 6 +- clang/tools/libclang/CXIndexDataConsumer.h | 12 +-- clang/tools/libclang/CXLoadedDiagnostic.cpp | 2 +- clang/tools/libclang/CursorVisitor.h | 6 +- clang/tools/libclang/Index_Internal.h | 4 +- clang/tools/libclang/Indexing.cpp | 2 +- clang/tools/offload-arch/AMDGPUArchByHIP.cpp | 14 +-- clang/tools/offload-arch/NVPTXArch.cpp | 10 +- clang/utils/TableGen/ClangASTNodesEmitter.cpp | 4 +- clang/utils/TableGen/ClangAttrEmitter.cpp | 4 +- .../TableGen/ClangDiagnosticsEmitter.cpp | 12 +-- 133 files changed, 524 insertions(+), 542 deletions(-) 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 { - typedef DenseMapInfo UnsignedInfo; + using UnsignedInfo = DenseMapInfo; 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 struct MakeDependent { typedef T Type; }; +template 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 ParamsSeq; +using ParamsSeq = std::vector; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(Param) @@ -131,7 +131,7 @@ template <> struct MappingTraits { } // namespace llvm namespace { -typedef std::vector NullabilitySeq; +using NullabilitySeq = std::vector; struct AvailabilityItem { APIAvailability Mode = APIAvailability::Available; @@ -165,7 +165,7 @@ struct Method { StringRef SwiftReturnOwnership; }; -typedef std::vector MethodsSeq; +using MethodsSeq = std::vector; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(Method) @@ -216,7 +216,7 @@ struct Property { StringRef Type; }; -typedef std::vector PropertiesSeq; +using PropertiesSeq = std::vector; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(Property) @@ -255,7 +255,7 @@ struct Class { PropertiesSeq Properties; }; -typedef std::vector ClassesSeq; +using ClassesSeq = std::vector; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(Class) @@ -297,7 +297,7 @@ struct Function { StringRef SwiftReturnOwnership; }; -typedef std::vector FunctionsSeq; +using FunctionsSeq = std::vector; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(Function) @@ -334,7 +334,7 @@ struct GlobalVariable { StringRef Type; }; -typedef std::vector GlobalVariablesSeq; +using GlobalVariablesSeq = std::vector; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(GlobalVariable) @@ -364,7 +364,7 @@ struct EnumConstant { StringRef SwiftName; }; -typedef std::vector EnumConstantsSeq; +using EnumConstantsSeq = std::vector; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(EnumConstant) @@ -424,7 +424,7 @@ struct Field { StringRef Type; }; -typedef std::vector FieldsSeq; +using FieldsSeq = std::vector; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(Field) @@ -448,7 +448,7 @@ template <> struct MappingTraits { namespace { struct Tag; -typedef std::vector TagsSeq; +using TagsSeq = std::vector; struct Tag { StringRef Name; @@ -527,7 +527,7 @@ struct Typedef { std::optional SwiftType; }; -typedef std::vector TypedefsSeq; +using TypedefsSeq = std::vector; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(Typedef) @@ -560,7 +560,7 @@ template <> struct MappingTraits { namespace { struct Namespace; -typedef std::vector NamespacesSeq; +using NamespacesSeq = std::vector; struct TopLevelItems { ClassesSeq Classes; @@ -623,7 +623,7 @@ struct Versioned { TopLevelItems Items; }; -typedef std::vector VersionedSeq; +using VersionedSeq = std::vector; } // 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 SpecsTy; + using SpecsTy = SmallVector; SpecsTy Specs; const DeclContext *Ctx = FD->getDeclContext(); while (isa_and_nonnull(Ctx)) { @@ -3549,7 +3549,7 @@ bool CallExpr::isCallToStdMove() const { namespace { /// Look for any side effects within a Stmt. class SideEffectFinder : public ConstEvaluatedExprVisitor { - typedef ConstEvaluatedExprVisitor Inherited; + using Inherited = ConstEvaluatedExprVisitor; 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 { - typedef ConstEvaluatedExprVisitor Inherited; + using Inherited = ConstEvaluatedExprVisitor; 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 Entries; @@ -571,8 +571,8 @@ namespace { // Note that we intentionally use std::map here so that references to // values are stable. - typedef std::pair MapKeyTy; - typedef std::map MapTy; + using MapKeyTy = std::pair; + using MapTy = std::map; /// Temporaries - Temporary lvalues materialized within this stack frame. MapTy Temporaries; @@ -1468,9 +1468,9 @@ namespace { return Success; } }; - typedef ScopeRAII BlockScopeRAII; - typedef ScopeRAII FullExpressionRAII; - typedef ScopeRAII CallScopeRAII; + using BlockScopeRAII = ScopeRAII; + using FullExpressionRAII = ScopeRAII; + using CallScopeRAII = ScopeRAII; } 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 StmtVisitorTy; - typedef ExprEvaluatorBase ExprEvaluatorBaseTy; + using StmtVisitorTy = ConstStmtVisitor; + 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 ExprEvaluatorBaseTy; + using LValueExprEvaluatorBaseTy = LValueExprEvaluatorBase; + using ExprEvaluatorBaseTy = ExprEvaluatorBase; 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 ReverseIter; + using ReverseIter = std::reverse_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 struct Source { template operator Source() { return Source(t); } }; -typedef std::pair, ASTImporter *> Candidate; +using Candidate = std::pair, 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 DiscriminatorKeyTy; + using DiscriminatorKeyTy = std::pair; llvm::DenseMap Discriminator; llvm::DenseMap 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 AbiTagList; + using AbiTagList = SmallVector; // 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 DiscriminatorKeyTy; + using DiscriminatorKeyTy = std::pair; llvm::DenseMap Discriminator; llvm::DenseMap Uniquifier; llvm::DenseMap LambdaIds; @@ -316,19 +316,19 @@ class MicrosoftCXXNameMangler { const NamedDecl *Structor; unsigned StructorType; - typedef llvm::SmallVector BackRefVec; + using BackRefVec = llvm::SmallVector; BackRefVec NameBackReferences; - typedef llvm::DenseMap ArgBackRefMap; + using ArgBackRefMap = llvm::DenseMap; ArgBackRefMap FunArgBackReferences; ArgBackRefMap TemplateArgBackReferences; - typedef llvm::DenseMap TemplateArgStringMap; + using TemplateArgStringMap = llvm::DenseMap; TemplateArgStringMap TemplateArgStrings; llvm::BumpPtrAllocator TemplateArgStringStorageAlloc; llvm::StringSaver TemplateArgStringStorage; - typedef std::set> PassObjectSizeArgsSet; + using PassObjectSizeArgsSet = std::set>; 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 { - typedef ConstDeclVisitor Inherited; + using Inherited = ConstDeclVisitor; 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 { - typedef TypeVisitor Inherited; + using Inherited = TypeVisitor; 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 MapTy; +using MapTy = llvm::DenseMap; 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 - PrintfSpecifierResult; +using PrintfSpecifierResult = + clang::analyze_format_string::SpecifierResult; //===----------------------------------------------------------------------===// // 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 ClassVectorTy; - typedef llvm::DenseMap EmptyClassOffsetsMapTy; + using ClassVectorTy = llvm::TinyPtrVector; + using EmptyClassOffsetsMapTy = llvm::DenseMap; EmptyClassOffsetsMapTy EmptyClassOffsets; /// MaxEmptyClassOffset - The highest offset known to contain an empty @@ -560,7 +560,7 @@ void EmptySubobjectMap::UpdateEmptyFieldSubobjects( } } -typedef llvm::SmallPtrSet ClassSetTy; +using ClassSetTy = llvm::SmallPtrSet; class ItaniumRecordLayoutBuilder { protected: @@ -660,7 +660,7 @@ class ItaniumRecordLayoutBuilder { /// field has been handled, if any. bool HandledFirstNonOverlappingEmptyField; - typedef llvm::DenseMap BaseOffsetsMapTy; + using BaseOffsetsMapTy = llvm::DenseMap; /// Bases - base classes and their offsets in the record. BaseOffsetsMapTy Bases; @@ -719,8 +719,8 @@ class ItaniumRecordLayoutBuilder { /// BaseSubobjectInfoAllocator - Allocator for BaseSubobjectInfo objects. llvm::SpecificBumpPtrAllocator BaseSubobjectInfoAllocator; - typedef llvm::DenseMap - BaseSubobjectInfoMapTy; + using BaseSubobjectInfoMapTy = + llvm::DenseMap; /// 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 BaseOffsetsMapTy; + using BaseOffsetsMapTy = llvm::DenseMap; MicrosoftRecordLayoutBuilder(const ASTContext &Context, EmptySubobjectMap *EmptySubobjects) : Context(Context), EmptySubobjects(EmptySubobjects), diff --git a/clang/lib/AST/ScanfFormatString.cpp b/clang/lib/AST/ScanfFormatString.cpp index 1227edd47d13d..30a11c9e69e0e 100644 --- a/clang/lib/AST/ScanfFormatString.cpp +++ b/clang/lib/AST/ScanfFormatString.cpp @@ -25,8 +25,8 @@ using clang::analyze_scanf::ScanfSpecifier; using clang::UpdateOnReturn; using namespace clang; -typedef clang::analyze_format_string::SpecifierResult - ScanfSpecifierResult; +using ScanfSpecifierResult = + clang::analyze_format_string::SpecifierResult; static bool ParseScanList(FormatStringHandler &H, ScanfConversionSpecifier &CS, diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index 4fc4a99ad2405..c292a66a33163 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -248,7 +248,7 @@ namespace { // warnings. static good is_good(good) { return good(); } - typedef Stmt::child_range children_t(); + using children_t = Stmt::child_range(); template good implements_children(children_t T::*) { return good(); } @@ -257,14 +257,14 @@ namespace { return bad(); } - typedef SourceLocation getBeginLoc_t() const; + using getBeginLoc_t = SourceLocation() const; template good implements_getBeginLoc(getBeginLoc_t T::*) { return good(); } LLVM_ATTRIBUTE_UNUSED static bad implements_getBeginLoc(getBeginLoc_t Stmt::*) { return bad(); } - typedef SourceLocation getLocEnd_t() const; + using getLocEnd_t = SourceLocation() const; template good implements_getEndLoc(getLocEnd_t T::*) { return good(); } diff --git a/clang/lib/AST/VTableBuilder.cpp b/clang/lib/AST/VTableBuilder.cpp index 0001745a6ff22..6ba80c9922022 100644 --- a/clang/lib/AST/VTableBuilder.cpp +++ b/clang/lib/AST/VTableBuilder.cpp @@ -99,10 +99,9 @@ class FinalOverriders { /// MethodBaseOffsetPairTy - Uniquely identifies a member function /// in a base subobject. - typedef std::pair MethodBaseOffsetPairTy; + using MethodBaseOffsetPairTy = std::pair; - typedef llvm::DenseMap OverridersMapTy; + using OverridersMapTy = llvm::DenseMap; /// OverridersMap - The final overriders for all virtual member functions of /// all the base subobjects of the most derived class. @@ -111,10 +110,10 @@ class FinalOverriders { /// SubobjectsToOffsetsMapTy - A mapping from a base subobject (represented /// as a record decl and a subobject number) and its offsets in the most /// derived class as well as the layout class. - typedef llvm::DenseMap, - CharUnits> SubobjectOffsetMapTy; + using SubobjectOffsetMapTy = + llvm::DenseMap, CharUnits>; - typedef llvm::DenseMap SubobjectCountMapTy; + using SubobjectCountMapTy = llvm::DenseMap; /// ComputeBaseOffsets - Compute the offsets for all base subobjects of the /// given base. @@ -124,7 +123,7 @@ class FinalOverriders { SubobjectOffsetMapTy &SubobjectLayoutClassOffsets, SubobjectCountMapTy &SubobjectCounts); - typedef llvm::SmallPtrSet VisitedVirtualBasesSetTy; + using VisitedVirtualBasesSetTy = llvm::SmallPtrSet; /// dump - dump the final overriders for a base subobject, and all its direct /// and indirect base subobjects. @@ -442,7 +441,7 @@ void FinalOverriders::dump(raw_ostream &Out, BaseSubobject Base, /// VCallOffsetMap - Keeps track of vcall offsets when building a vtable. struct VCallOffsetMap { - typedef std::pair MethodAndOffsetPairTy; + using MethodAndOffsetPairTy = std::pair; /// Offsets - Keeps track of methods and their offsets. // FIXME: This should be a real map and not a vector. @@ -532,8 +531,8 @@ CharUnits VCallOffsetMap::getVCallOffsetOffset(const CXXMethodDecl *MD) { /// VCallAndVBaseOffsetBuilder - Class for building vcall and vbase offsets. class VCallAndVBaseOffsetBuilder { public: - typedef llvm::DenseMap - VBaseOffsetOffsetsMapTy; + using VBaseOffsetOffsetsMapTy = + llvm::DenseMap; private: const ItaniumVTableContext &VTables; @@ -551,7 +550,7 @@ class VCallAndVBaseOffsetBuilder { ASTContext &Context; /// Components - vcall and vbase offset components - typedef SmallVector VTableComponentVectorTy; + using VTableComponentVectorTy = SmallVector; VTableComponentVectorTy Components; /// VisitedVirtualBases - Visited virtual bases. @@ -601,7 +600,7 @@ class VCallAndVBaseOffsetBuilder { } /// Methods for iterating over the components. - typedef VTableComponentVectorTy::const_reverse_iterator const_iterator; + using const_iterator = VTableComponentVectorTy::const_reverse_iterator; const_iterator components_begin() const { return Components.rbegin(); } const_iterator components_end() const { return Components.rend(); } @@ -785,15 +784,15 @@ class ItaniumVTableBuilder { public: /// PrimaryBasesSetVectorTy - A set vector of direct and indirect /// primary bases. - typedef llvm::SmallSetVector - PrimaryBasesSetVectorTy; + using PrimaryBasesSetVectorTy = + llvm::SmallSetVector; - typedef llvm::DenseMap - VBaseOffsetOffsetsMapTy; + using VBaseOffsetOffsetsMapTy = + llvm::DenseMap; - typedef VTableLayout::AddressPointsMapTy AddressPointsMapTy; + using AddressPointsMapTy = VTableLayout::AddressPointsMapTy; - typedef llvm::DenseMap MethodVTableIndicesTy; + using MethodVTableIndicesTy = llvm::DenseMap; private: /// VTables - Global vtable information. @@ -864,7 +863,7 @@ class ItaniumVTableBuilder { MethodInfo(MethodInfo const&) = default; }; - typedef llvm::DenseMap MethodInfoMapTy; + using MethodInfoMapTy = llvm::DenseMap; /// MethodInfoMap - The information for all methods in the vtable we're /// currently building. @@ -874,14 +873,14 @@ class ItaniumVTableBuilder { /// point) where the function pointer for a virtual function is stored. MethodVTableIndicesTy MethodVTableIndices; - typedef llvm::DenseMap VTableThunksMapTy; + using VTableThunksMapTy = llvm::DenseMap; /// VTableThunks - The thunks by vtable index in the vtable currently being /// built. VTableThunksMapTy VTableThunks; - typedef SmallVector ThunkInfoVectorTy; - typedef llvm::DenseMap ThunksMapTy; + using ThunkInfoVectorTy = SmallVector; + using ThunksMapTy = llvm::DenseMap; /// Thunks - A map that contains all the thunks needed for all methods in the /// most derived class for which the vtable is currently being built. @@ -894,7 +893,7 @@ class ItaniumVTableBuilder { /// part of the vtable we're currently building. void ComputeThisAdjustments(); - typedef llvm::SmallPtrSet VisitedVirtualBasesSetTy; + using VisitedVirtualBasesSetTy = llvm::SmallPtrSet; /// PrimaryVirtualBases - All known virtual bases who are a primary base of /// some other base. @@ -1082,7 +1081,7 @@ void ItaniumVTableBuilder::AddThunk(const CXXMethodDecl *MD, ThunksVector.push_back(Thunk); } -typedef llvm::SmallPtrSet OverriddenMethodsSetTy; +using OverriddenMethodsSetTy = llvm::SmallPtrSet; /// Visit all the methods overridden by the given method recursively, /// in a depth-first pre-order. The Visitor's visitor method returns a bool @@ -1444,7 +1443,7 @@ bool ItaniumVTableBuilder::IsOverriderUsed( return OverridesIndirectMethodInBases(Overrider, PrimaryBases); } -typedef llvm::SmallSetVector BasesSetVectorTy; +using BasesSetVectorTy = llvm::SmallSetVector; /// FindNearestOverriddenMethod - Given a method, returns the overridden method /// from the nearest base. Returns null if no method was found. @@ -1518,7 +1517,7 @@ void ItaniumVTableBuilder::AddMethods( llvm_unreachable("Found a duplicate primary base!"); } - typedef llvm::SmallVector NewVirtualFunctionsTy; + using NewVirtualFunctionsTy = llvm::SmallVector; NewVirtualFunctionsTy NewVirtualFunctions; llvm::SmallVector NewImplicitVirtualFunctions; @@ -2512,11 +2511,11 @@ namespace { class VFTableBuilder { public: - typedef llvm::DenseMap - MethodVFTableLocationsTy; + using MethodVFTableLocationsTy = + llvm::DenseMap; - typedef llvm::iterator_range - method_locations_range; + using method_locations_range = + llvm::iterator_range; private: /// VTables - Global vtable information. @@ -2573,20 +2572,20 @@ class VFTableBuilder { UsesExtraSlot(false) {} }; - typedef llvm::DenseMap MethodInfoMapTy; + using MethodInfoMapTy = llvm::DenseMap; /// MethodInfoMap - The information for all methods in the vftable we're /// currently building. MethodInfoMapTy MethodInfoMap; - typedef llvm::DenseMap VTableThunksMapTy; + using VTableThunksMapTy = llvm::DenseMap; /// VTableThunks - The thunks by vftable index in the vftable currently being /// built. VTableThunksMapTy VTableThunks; - typedef SmallVector ThunkInfoVectorTy; - typedef llvm::DenseMap ThunksMapTy; + using ThunkInfoVectorTy = SmallVector; + using ThunksMapTy = llvm::DenseMap; /// Thunks - A map that contains all the thunks needed for all methods in the /// most derived class for which the vftable is currently being built. @@ -3006,9 +3005,9 @@ static void GroupNewVirtualOverloads( // (including overrides, non-virtual methods and any other named decl that // might be nested within the class). // 2) In each group, new overloads appear in the reverse order of declaration. - typedef SmallVector MethodGroup; + using MethodGroup = SmallVector; SmallVector Groups; - typedef llvm::DenseMap VisitedGroupIndicesTy; + using VisitedGroupIndicesTy = llvm::DenseMap; VisitedGroupIndicesTy VisitedGroupIndices; for (const auto *D : RD->decls()) { const auto *ND = dyn_cast(D); @@ -3511,8 +3510,8 @@ static bool rebucketPaths(VPtrInfoVector &Paths) { MicrosoftVTableContext::~MicrosoftVTableContext() {} namespace { -typedef llvm::SetVector, - llvm::DenseSet> FullPathTy; +using FullPathTy = llvm::SetVector, + llvm::DenseSet>; } // This recursive function finds all paths from a subobject centered at @@ -3601,7 +3600,7 @@ static const FullPathTy *selectBestPath(ASTContext &Context, return &FullPaths.front(); const FullPathTy *BestPath = nullptr; - typedef std::set OverriderSetTy; + using OverriderSetTy = std::set; OverriderSetTy LastOverrides; for (const FullPathTy &SpecificPath : FullPaths) { assert(!SpecificPath.empty()); diff --git a/clang/lib/ASTMatchers/ASTMatchFinder.cpp b/clang/lib/ASTMatchers/ASTMatchFinder.cpp index 6d0ba0b7907a1..6468fb6133f26 100644 --- a/clang/lib/ASTMatchers/ASTMatchFinder.cpp +++ b/clang/lib/ASTMatchers/ASTMatchFinder.cpp @@ -34,7 +34,7 @@ namespace ast_matchers { namespace internal { namespace { -typedef MatchFinder::MatchCallback MatchCallback; +using MatchCallback = MatchFinder::MatchCallback; // The maximum number of memoization entries to store. // 10k has been experimentally found to give a good trade-off @@ -90,7 +90,7 @@ struct MemoizedMatchResult { class MatchChildASTVisitor : public RecursiveASTVisitor { public: - typedef RecursiveASTVisitor VisitorBase; + using VisitorBase = RecursiveASTVisitor; // Creates an AST visitor that matches 'matcher' on all children or // descendants of a traversed node. max_depth is the maximum depth @@ -1363,7 +1363,7 @@ class MatchASTVisitor : public RecursiveASTVisitor, CompatibleAliases; // Maps (matcher, node) -> the match result for memoization. - typedef std::map MemoizationMap; + using MemoizationMap = std::map; MemoizationMap ResultCache; }; diff --git a/clang/lib/Analysis/BodyFarm.cpp b/clang/lib/Analysis/BodyFarm.cpp index c5f35b35ad357..cc82b7884fc10 100644 --- a/clang/lib/Analysis/BodyFarm.cpp +++ b/clang/lib/Analysis/BodyFarm.cpp @@ -256,7 +256,7 @@ ValueDecl *ASTMaker::findMemberField(const RecordDecl *RD, StringRef Name) { // Creation functions for faux ASTs. //===----------------------------------------------------------------------===// -typedef Stmt *(*FunctionFarmer)(ASTContext &C, const FunctionDecl *D); +using FunctionFarmer = Stmt *(*)(ASTContext & C, const FunctionDecl *D); static CallExpr *create_call_once_funcptr_call(ASTContext &C, ASTMaker M, const ParmVarDecl *Callback, diff --git a/clang/lib/Analysis/CFGStmtMap.cpp b/clang/lib/Analysis/CFGStmtMap.cpp index 028e62ba89b79..79052d93996dc 100644 --- a/clang/lib/Analysis/CFGStmtMap.cpp +++ b/clang/lib/Analysis/CFGStmtMap.cpp @@ -19,7 +19,7 @@ using namespace clang; -typedef llvm::DenseMap SMap; +using SMap = llvm::DenseMap; static SMap *AsMap(void *m) { return (SMap*) m; } CFGStmtMap::~CFGStmtMap() { delete AsMap(M); } diff --git a/clang/lib/Analysis/ReachableCode.cpp b/clang/lib/Analysis/ReachableCode.cpp index 4a9ab5d9f0f73..c6f2ecf058f48 100644 --- a/clang/lib/Analysis/ReachableCode.cpp +++ b/clang/lib/Analysis/ReachableCode.cpp @@ -397,8 +397,8 @@ namespace { Preprocessor &PP; ASTContext &C; - typedef SmallVector, 12> - DeferredLocsTy; + using DeferredLocsTy = + SmallVector, 12>; DeferredLocsTy DeferredLocs; diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h index 9f3a4cd2da716..39ab1e38351bd 100644 --- a/clang/lib/Basic/Targets/PPC.h +++ b/clang/lib/Basic/Targets/PPC.h @@ -27,7 +27,7 @@ namespace targets { class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo { /// Flags for architecture specific defines. - typedef enum { + using ArchDefineTypes = enum { ArchDefineNone = 0, ArchDefineName = 1 << 0, // is substituted for arch name. ArchDefinePpcgr = 1 << 1, @@ -48,7 +48,7 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo { ArchDefineFuture = 1 << 16, ArchDefineA2 = 1 << 17, ArchDefineE500 = 1 << 18 - } ArchDefineTypes; + }; ArchDefineTypes ArchDefs = ArchDefineNone; static const char *const GCCRegNames[]; diff --git a/clang/lib/CodeGen/CGBuilder.h b/clang/lib/CodeGen/CGBuilder.h index 090f75d3b5d3c..ad2dab46479a8 100644 --- a/clang/lib/CodeGen/CGBuilder.h +++ b/clang/lib/CodeGen/CGBuilder.h @@ -42,10 +42,10 @@ class CGBuilderInserter final : public llvm::IRBuilderDefaultInserter { CodeGenFunction *CGF = nullptr; }; -typedef CGBuilderInserter CGBuilderInserterTy; +using CGBuilderInserterTy = CGBuilderInserter; -typedef llvm::IRBuilder - CGBuilderBaseTy; +using CGBuilderBaseTy = + llvm::IRBuilder; class CGBuilderTy : public CGBuilderBaseTy { friend class Address; diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h index 0b4e3f9cb0365..ae1b620f45306 100644 --- a/clang/lib/CodeGen/CGCall.h +++ b/clang/lib/CodeGen/CGCall.h @@ -329,8 +329,8 @@ class CallArgList : public SmallVector { bool hasWritebacks() const { return !Writebacks.empty(); } - typedef llvm::iterator_range::const_iterator> - writeback_const_range; + using writeback_const_range = + llvm::iterator_range::const_iterator>; writeback_const_range writebacks() const { return writeback_const_range(Writebacks.begin(), Writebacks.end()); diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 4a465e6526da0..efa71a2b47305 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -528,7 +528,7 @@ namespace { /// A visitor which checks whether an initializer uses 'this' in a /// way which requires the vtable to be properly set. struct DynamicThisUseChecker : ConstEvaluatedExprVisitor { - typedef ConstEvaluatedExprVisitor super; + using super = ConstEvaluatedExprVisitor; bool UsesThis; diff --git a/clang/lib/CodeGen/CGCleanup.h b/clang/lib/CodeGen/CGCleanup.h index ba78e5478ac37..bb2c29503affd 100644 --- a/clang/lib/CodeGen/CGCleanup.h +++ b/clang/lib/CodeGen/CGCleanup.h @@ -234,7 +234,7 @@ class EHCatchScope : public EHScope { delete getHandler(I).Block; } - typedef const Handler *iterator; + using iterator = const Handler *; iterator begin() const { return getHandlers(); } iterator end() const { return getHandlers() + getNumHandlers(); } diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index e24c68ed02865..2cfb5e9cdfd76 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -3354,7 +3354,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty, { // Use 'char' for the isClassProperty bit as DenseSet requires space for // empty/tombstone keys in the data type (and bool is too small for that). - typedef std::pair IsClassAndIdent; + using IsClassAndIdent = std::pair; /// List of already emitted properties. Two distinct class and instance /// properties can share the same identifier (but not two instance /// properties or two class properties). diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 85c768807572f..6131f702f481b 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -6620,7 +6620,7 @@ static LValueOrRValue emitPseudoObjectExpr(CodeGenFunction &CGF, // If this is the result expression, we may need to evaluate // directly into the slot. - typedef CodeGenFunction::OpaqueValueMappingData OVMA; + using OVMA = CodeGenFunction::OpaqueValueMappingData; OVMA opaqueData; if (ov == resultExpr && ov->isPRValue() && !forLValue && CodeGenFunction::hasAggregateEvaluationKind(ov->getType())) { diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index 359e30cb8f5cd..9061f3447fe82 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -1435,9 +1435,9 @@ namespace { template class CallDeleteDuringNew final : public EHScopeStack::Cleanup { /// Type used to hold llvm::Value*s. - typedef typename Traits::ValueTy ValueTy; + using ValueTy = typename Traits::ValueTy; /// Type used to hold RValues. - typedef typename Traits::RValueTy RValueTy; + using RValueTy = typename Traits::RValueTy; struct PlacementArg { RValueTy ArgValue; QualType ArgType; @@ -1549,13 +1549,13 @@ static void EnterNewDeleteCleanup(CodeGenFunction &CGF, const CXXNewExpr *E, // dominate and we can do the easier (and more efficient) thing. if (!CGF.isInConditionalBranch()) { struct DirectCleanupTraits { - typedef llvm::Value *ValueTy; - typedef RValue RValueTy; + using ValueTy = llvm::Value *; + using RValueTy = RValue; static RValue get(CodeGenFunction &, ValueTy V) { return RValue::get(V); } static RValue get(CodeGenFunction &, RValueTy V) { return V; } }; - typedef CallDeleteDuringNew DirectCleanup; + using DirectCleanup = CallDeleteDuringNew; DirectCleanup *Cleanup = CGF.EHStack.pushCleanupWithExtra( EHCleanup, E->getNumPlacementArgs(), E->getOperatorDelete(), @@ -1577,13 +1577,13 @@ static void EnterNewDeleteCleanup(CodeGenFunction &CGF, const CXXNewExpr *E, DominatingValue::saved_type SavedTypeIdentity = DominatingValue::save(CGF, TypeIdentity); struct ConditionalCleanupTraits { - typedef DominatingValue::saved_type ValueTy; - typedef DominatingValue::saved_type RValueTy; + using ValueTy = DominatingValue::saved_type; + using RValueTy = DominatingValue::saved_type; static RValue get(CodeGenFunction &CGF, ValueTy V) { return V.restore(CGF); } }; - typedef CallDeleteDuringNew ConditionalCleanup; + using ConditionalCleanup = CallDeleteDuringNew; ConditionalCleanup *Cleanup = CGF.EHStack.pushCleanupWithExtra( diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp index f8a946a76554a..742182b683326 100644 --- a/clang/lib/CodeGen/CGExprComplex.cpp +++ b/clang/lib/CodeGen/CGExprComplex.cpp @@ -31,7 +31,7 @@ namespace llvm { extern cl::opt EnableSingleByteCoverage; } // namespace llvm -typedef CodeGenFunction::ComplexPairTy ComplexPairTy; +using ComplexPairTy = CodeGenFunction::ComplexPairTy; /// Return the complex type that we are meant to emit. static const ComplexType *getComplexType(QualType type) { @@ -1525,7 +1525,7 @@ LValue CodeGenFunction::EmitComplexAssignmentLValue(const BinaryOperator *E) { return LVal; } -typedef ComplexPairTy (ComplexExprEmitter::*CompoundFunc)( +using CompoundFunc = ComplexPairTy (ComplexExprEmitter::*)( const ComplexExprEmitter::BinOpInfo &); static CompoundFunc getComplexOp(BinaryOperatorKind Op) { diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp index a47d1cc22980d..ec4fbc36fc2f8 100644 --- a/clang/lib/CodeGen/CGHLSLRuntime.cpp +++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp @@ -664,7 +664,7 @@ class OpaqueValueVisitor : public RecursiveASTVisitor { void CGHLSLRuntime::emitInitListOpaqueValues(CodeGenFunction &CGF, InitListExpr *E) { - typedef CodeGenFunction::OpaqueValueMappingData OpaqueValueMappingData; + using OpaqueValueMappingData = CodeGenFunction::OpaqueValueMappingData; OpaqueValueVisitor Visitor; Visitor.TraverseStmt(E); for (auto *OVE : Visitor.OVEs) { diff --git a/clang/lib/CodeGen/CGNonTrivialStruct.cpp b/clang/lib/CodeGen/CGNonTrivialStruct.cpp index e0983ef256e71..c5af3526bdc0e 100644 --- a/clang/lib/CodeGen/CGNonTrivialStruct.cpp +++ b/clang/lib/CodeGen/CGNonTrivialStruct.cpp @@ -631,7 +631,7 @@ struct GenDefaultInitialize GenFuncBase, DefaultInitializedTypeVisitor { using Super = DefaultInitializedTypeVisitor; - typedef GenFuncBase GenFuncBaseTy; + using GenFuncBaseTy = GenFuncBase; GenDefaultInitialize(ASTContext &Ctx) : StructVisitor(Ctx) {} diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index 24b6ce7c1c70d..fdc1c42d8a14e 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -33,7 +33,7 @@ using namespace clang; using namespace CodeGen; -typedef llvm::PointerIntPair TryEmitResult; +using TryEmitResult = llvm::PointerIntPair; static TryEmitResult tryEmitARCRetainScalarExpr(CodeGenFunction &CGF, const Expr *e); static RValue AdjustObjCObjectType(CodeGenFunction &CGF, @@ -2996,9 +2996,8 @@ static TryEmitResult tryEmitARCRetainLoadOfScalar(CodeGenFunction &CGF, return tryEmitARCRetainLoadOfScalar(CGF, CGF.EmitLValue(e), type); } -typedef llvm::function_ref - ValueTransform; +using ValueTransform = + llvm::function_ref; /// Insert code immediately after a call. @@ -3188,7 +3187,7 @@ ARCExprEmitter::visitPseudoObjectExpr(const PseudoObjectExpr *E) { // If this semantic expression is an opaque value, bind it // to the result of its source expression. if (const OpaqueValueExpr *ov = dyn_cast(semantic)) { - typedef CodeGenFunction::OpaqueValueMappingData OVMA; + using OVMA = CodeGenFunction::OpaqueValueMappingData; OVMA opaqueData; // If this semantic is the result of the pseudo-object diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index 8acf8d2ddec02..1b13ae71e6e52 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -357,12 +357,11 @@ class CGObjCGNU : public CGObjCRuntime { /// string. Selector references are all done via the module's selector table, /// so we create an alias as a placeholder and then replace it with the real /// value later. - typedef std::pair TypedSelector; + using TypedSelector = std::pair; /// Type of the selector map. This is roughly equivalent to the structure /// used in the GNUstep runtime, which maintains a list of all of the valid /// types for a selector in a table. - typedef llvm::DenseMap > - SelectorMap; + using SelectorMap = llvm::DenseMap>; /// A map from selectors to selector types. This allows us to emit all /// selectors of the same name and type together. SelectorMap SelectorTable; @@ -376,7 +375,7 @@ class CGObjCGNU : public CGObjCRuntime { LazyRuntimeFunction IvarAssignFn, StrongCastAssignFn, MemMoveFn, WeakReadFn, WeakAssignFn, GlobalAssignFn; - typedef std::pair ClassAliasPair; + using ClassAliasPair = std::pair; /// All classes that have aliases set for them. std::vector ClassAliases; @@ -964,8 +963,8 @@ class CGObjCGNUstep2 : public CGObjCGNUstep { /// Generate the name of a symbol for a reference to a class. Accesses to /// classes should be indirected via this. - typedef std::pair> - EarlyInitPair; + using EarlyInitPair = + std::pair>; std::vector EarlyInitList; std::string SymbolForClassRef(StringRef Name, bool isWeak) { diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index ce2dd4d76368a..2b86d80252fe6 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -2845,7 +2845,7 @@ struct PrivateHelpersTy { return !OriginalRef && !PrivateCopy && !PrivateElemInit; } }; -typedef std::pair PrivateDataTy; +using PrivateDataTy = std::pair; } // anonymous namespace static bool isAllocatableDecl(const VarDecl *VD) { diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h index 5be48b439f4fd..68420893b3ffa 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.h +++ b/clang/lib/CodeGen/CGOpenMPRuntime.h @@ -67,7 +67,7 @@ class PrePostActionTy { /// an advanced with possible pre|post-actions in codegen. class RegionCodeGenTy final { intptr_t CodeGen; - typedef void (*CodeGenTy)(intptr_t, CodeGenFunction &, PrePostActionTy &); + using CodeGenTy = void (*)(intptr_t, CodeGenFunction &, PrePostActionTy &); CodeGenTy Callback; mutable PrePostActionTy *PrePostAction; RegionCodeGenTy() = delete; @@ -384,7 +384,7 @@ class CGOpenMPRuntime { protected: /// Map for SourceLocation and OpenMP runtime library debug locations. - typedef llvm::DenseMap OpenMPDebugLocMapTy; + using OpenMPDebugLocMapTy = llvm::DenseMap; OpenMPDebugLocMapTy OpenMPDebugLocMap; /// Stores debug location and ThreadID for the function. struct DebugLocThreadIdTy { @@ -394,18 +394,18 @@ class CGOpenMPRuntime { llvm::AssertingVH ServiceInsertPt = nullptr; }; /// Map of local debug location, ThreadId and functions. - typedef llvm::DenseMap - OpenMPLocThreadIDMapTy; + using OpenMPLocThreadIDMapTy = + llvm::DenseMap; OpenMPLocThreadIDMapTy OpenMPLocThreadIDMap; /// Map of UDRs and corresponding combiner/initializer. - typedef llvm::DenseMap> - UDRMapTy; + using UDRMapTy = + llvm::DenseMap>; UDRMapTy UDRMap; /// Map of functions and locally defined UDRs. - typedef llvm::DenseMap> - FunctionUDRMapTy; + using FunctionUDRMapTy = + llvm::DenseMap>; FunctionUDRMapTy FunctionUDRMap; /// Map from the user-defined mapper declaration to its corresponding /// functions. diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index 5822e0f6db89a..0453980d706e1 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -1539,10 +1539,9 @@ namespace { /// Codegen lambda for appending distribute lower and upper bounds to outlined /// parallel function. This is necessary for combined constructs such as /// 'distribute parallel for' -typedef llvm::function_ref &)> - CodeGenBoundParametersTy; +using CodeGenBoundParametersTy = + llvm::function_ref &)>; } // anonymous namespace static void diff --git a/clang/lib/CodeGen/CGVTables.h b/clang/lib/CodeGen/CGVTables.h index 5c45e355fb145..a929aacdd9a59 100644 --- a/clang/lib/CodeGen/CGVTables.h +++ b/clang/lib/CodeGen/CGVTables.h @@ -35,16 +35,16 @@ class CodeGenVTables { VTableContextBase *VTContext; /// VTableAddressPointsMapTy - Address points for a single vtable. - typedef VTableLayout::AddressPointsMapTy VTableAddressPointsMapTy; + using VTableAddressPointsMapTy = VTableLayout::AddressPointsMapTy; - typedef std::pair BaseSubobjectPairTy; - typedef llvm::DenseMap SubVTTIndicesMapTy; + using BaseSubobjectPairTy = std::pair; + using SubVTTIndicesMapTy = llvm::DenseMap; /// SubVTTIndices - Contains indices into the various sub-VTTs. SubVTTIndicesMapTy SubVTTIndices; - typedef llvm::DenseMap - SecondaryVirtualPointerIndicesMapTy; + using SecondaryVirtualPointerIndicesMapTy = + llvm::DenseMap; /// SecondaryVirtualPointerIndices - Contains the secondary virtual pointer /// indices. diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 6c32c98cec011..60d3f5234f55a 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -119,7 +119,7 @@ enum TypeEvaluationKind { /// Helper class with most of the code for saving a value for a /// conditional expression cleanup. struct DominatingLLVMValue { - typedef llvm::PointerIntPair saved_type; + using saved_type = llvm::PointerIntPair; /// Answer whether the given value needs extra work to be saved. static bool needsSaving(llvm::Value *value) { @@ -142,7 +142,7 @@ struct DominatingLLVMValue { /// A partial specialization of DominatingValue for llvm::Values that /// might be llvm::Instructions. template struct DominatingPointer : DominatingLLVMValue { - typedef T *type; + using type = T *; static type restore(CodeGenFunction &CGF, saved_type value) { return static_cast(DominatingLLVMValue::restore(CGF, value)); } @@ -150,7 +150,7 @@ template struct DominatingPointer : DominatingLLVMValue { /// A specialization of DominatingValue for Address. template <> struct DominatingValue
{ - typedef Address type; + using type = Address; struct saved_type { DominatingLLVMValue::saved_type BasePtr; @@ -180,7 +180,7 @@ template <> struct DominatingValue
{ /// A specialization of DominatingValue for RValue. template <> struct DominatingValue { - typedef RValue type; + using type = RValue; class saved_type { enum Kind { ScalarLiteral, @@ -281,7 +281,7 @@ class CodeGenFunction : public CodeGenTypeCache { // For EH/SEH outlined funclets, this field points to parent's CGF CodeGenFunction *ParentCGF = nullptr; - typedef std::pair ComplexPairTy; + using ComplexPairTy = std::pair; LoopInfoStack LoopStack; CGBuilderTy Builder; @@ -314,23 +314,20 @@ class CodeGenFunction : public CodeGenTypeCache { int ExpectedOMPLoopDepth = 0; // CodeGen lambda for loops and support for ordered clause - typedef llvm::function_ref - CodeGenLoopTy; - typedef llvm::function_ref - CodeGenOrderedTy; + using CodeGenLoopTy = llvm::function_ref; + using CodeGenOrderedTy = llvm::function_ref; // Codegen lambda for loop bounds in worksharing loop constructs - typedef llvm::function_ref( - CodeGenFunction &, const OMPExecutableDirective &S)> - CodeGenLoopBoundsTy; + using CodeGenLoopBoundsTy = llvm::function_ref( + CodeGenFunction &, const OMPExecutableDirective &S)>; // Codegen lambda for loop bounds in dispatch-based loop implementation - typedef llvm::function_ref( - CodeGenFunction &, const OMPExecutableDirective &S, Address LB, - Address UB)> - CodeGenDispatchBoundsTy; + using CodeGenDispatchBoundsTy = + llvm::function_ref( + CodeGenFunction &, const OMPExecutableDirective &S, Address LB, + Address UB)>; /// CGBuilder insert helper. This function is called after an /// instruction is created using Builder. @@ -910,10 +907,10 @@ class CodeGenFunction : public CodeGenTypeCache { return EHStack.pushCleanup(kind, A...); // Stash values in a tuple so we can guarantee the order of saves. - typedef std::tuple::saved_type...> SavedTuple; + using SavedTuple = std::tuple::saved_type...>; SavedTuple Saved{saveValueInCond(A)...}; - typedef EHScopeStack::ConditionalCleanup CleanupType; + using CleanupType = EHScopeStack::ConditionalCleanup; EHStack.pushCleanupTuple(kind, Saved); initFullExprCleanup(); } @@ -930,10 +927,10 @@ class CodeGenFunction : public CodeGenTypeCache { assert(!DominatingValue
::needsSaving(ActiveFlag) && "cleanup active flag should never need saving"); - typedef std::tuple::saved_type...> SavedTuple; + using SavedTuple = std::tuple::saved_type...>; SavedTuple Saved{saveValueInCond(A)...}; - typedef EHScopeStack::ConditionalCleanup CleanupType; + using CleanupType = EHScopeStack::ConditionalCleanup; pushCleanupAfterFullExprWithActiveFlag(Kind, ActiveFlag, Saved); } @@ -1118,7 +1115,7 @@ class CodeGenFunction : public CodeGenTypeCache { void rescopeLabels(); }; - typedef llvm::DenseMap DeclMapTy; + using DeclMapTy = llvm::DenseMap; /// The class used to assign some variables some temporarily addresses. class OMPMapVars { @@ -2194,7 +2191,7 @@ class CodeGenFunction : public CodeGenTypeCache { // Cleanups //===--------------------------------------------------------------------===// - typedef void Destroyer(CodeGenFunction &CGF, Address addr, QualType ty); + using Destroyer = void(CodeGenFunction &CGF, Address addr, QualType ty); void pushIrregularPartialArrayCleanup(llvm::Value *arrayBegin, Address arrayEndPointer, @@ -2446,9 +2443,9 @@ class CodeGenFunction : public CodeGenTypeCache { /// Initialize the vtable pointer of the given subobject. void InitializeVTablePointer(const VPtr &vptr); - typedef llvm::SmallVector VPtrsVector; + using VPtrsVector = llvm::SmallVector; - typedef llvm::SmallPtrSet VisitedVirtualBasesSetTy; + using VisitedVirtualBasesSetTy = llvm::SmallPtrSet; VPtrsVector getVTablePointers(const CXXRecordDecl *VTableClass); void getVTablePointers(BaseSubobject Base, const CXXRecordDecl *NearestVBase, @@ -3384,7 +3381,7 @@ class CodeGenFunction : public CodeGenTypeCache { void EmitScalarInit(const Expr *init, const ValueDecl *D, LValue lvalue, bool capturedByInit); - typedef void SpecialInitFn(CodeGenFunction &Init, const VarDecl &D, + using SpecialInitFn = void(CodeGenFunction &Init, const VarDecl &D, llvm::Value *Address); /// Determine whether the given initializer is trivial in the sense @@ -3822,10 +3819,9 @@ class CodeGenFunction : public CodeGenTypeCache { /// initialized with the value of the original variable, false otherwise. bool EmitOMPLinearClauseInit(const OMPLoopDirective &D); - typedef const llvm::function_ref - TaskGenTy; + using TaskGenTy = const llvm::function_ref; void EmitOMPTaskBasedDirective(const OMPExecutableDirective &S, const OpenMPDirectiveKind CapturedRegion, const RegionCodeGenTy &BodyGen, diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index cb013feb769fc..9af590879ff11 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -341,7 +341,7 @@ class CodeGenModule : public CodeGenTypeCache { llvm::Constant *AssociatedData; }; - typedef std::vector CtorList; + using CtorList = std::vector; private: ASTContext &Context; @@ -506,8 +506,8 @@ class CodeGenModule : public CodeGenTypeCache { /// Map used to track internal linkage functions declared within /// extern "C" regions. - typedef llvm::MapVector StaticExternCMap; + using StaticExternCMap = + llvm::MapVector; StaticExternCMap StaticExternCValues; /// thread_local variables defined or used in this TU. @@ -528,8 +528,8 @@ class CodeGenModule : public CodeGenTypeCache { /// that we don't re-emit the initializer. llvm::DenseMap DelayedCXXInitPosition; - typedef std::pair - GlobalInitData; + using GlobalInitData = + std::pair; // When a tail call is performed on an "undefined" symbol, on PPC without pc // relative feature, the tail call is not allowed. In "EmitCall" for such @@ -553,14 +553,13 @@ class CodeGenModule : public CodeGenTypeCache { /// Global destructor functions and arguments that need to run on termination. /// When UseSinitAndSterm is set, it instead contains sterm finalizer /// functions, which also run on unloading a shared library. - typedef std::tuple - CXXGlobalDtorsOrStermFinalizer_t; + using CXXGlobalDtorsOrStermFinalizer_t = + std::tuple; SmallVector CXXGlobalDtorsOrStermFinalizers; - typedef std::pair - StermFinalizerData; + using StermFinalizerData = + std::pair; struct StermFinalizerPriorityCmp { bool operator()(const StermFinalizerData &LHS, @@ -659,7 +658,7 @@ class CodeGenModule : public CodeGenTypeCache { /// Mapping from canonical types to their metadata identifiers. We need to /// maintain this mapping because identifiers may be formed from distinct /// MDNodes. - typedef llvm::DenseMap MetadataTypeMap; + using MetadataTypeMap = llvm::DenseMap; MetadataTypeMap MetadataIdMap; MetadataTypeMap VirtualMetadataIdMap; MetadataTypeMap GeneralizedMetadataIdMap; diff --git a/clang/lib/CodeGen/CodeGenTypes.h b/clang/lib/CodeGen/CodeGenTypes.h index 29f6f1ec80bc3..b67f40c85cec8 100644 --- a/clang/lib/CodeGen/CodeGenTypes.h +++ b/clang/lib/CodeGen/CodeGenTypes.h @@ -39,7 +39,7 @@ class RecordDecl; class TagDecl; class TargetInfo; class Type; -typedef CanQual CanQualType; +using CanQualType = CanQual; class GlobalDecl; namespace CodeGen { diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index 4aafac349e3e9..24de269079f93 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -269,8 +269,8 @@ class CoverageMappingBuilder { /// It is produced by emitExpansionRegions() and is used in /// emitSourceRegions() to suppress producing code regions if /// the same area is covered by expansion regions. - typedef llvm::SmallSet, 8> - SourceRegionFilter; + using SourceRegionFilter = + llvm::SmallSet, 8>; CoverageMappingBuilder(CoverageMappingModuleGen &CVM, SourceManager &SM, const LangOptions &LangOpts) diff --git a/clang/lib/CodeGen/EHScopeStack.h b/clang/lib/CodeGen/EHScopeStack.h index ed11dc2bb05d7..15e5f5b609df5 100644 --- a/clang/lib/CodeGen/EHScopeStack.h +++ b/clang/lib/CodeGen/EHScopeStack.h @@ -53,8 +53,8 @@ struct BranchFixup { }; template struct InvariantValue { - typedef T type; - typedef T saved_type; + using type = T; + using saved_type = T; static bool needsSaving(type value) { return false; } static saved_type save(CodeGenFunction &CGF, type value) { return value; } static type restore(CodeGenFunction &CGF, saved_type value) { return value; } @@ -206,7 +206,7 @@ class EHScopeStack { /// then restores them and performs the cleanup. template class ConditionalCleanup final : public Cleanup { - typedef std::tuple::saved_type...> SavedTuple; + using SavedTuple = std::tuple::saved_type...>; SavedTuple Saved; template diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp index a181559834296..86015576e7a36 100644 --- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp @@ -804,9 +804,9 @@ class MicrosoftCXXABI : public CGCXXABI { isPermittedToBeHomogeneousAggregate(const CXXRecordDecl *RD) const override; private: - typedef std::pair VFTableIdTy; - typedef llvm::DenseMap VTablesMapTy; - typedef llvm::DenseMap VFTablesMapTy; + using VFTableIdTy = std::pair; + using VTablesMapTy = llvm::DenseMap; + using VFTablesMapTy = llvm::DenseMap; /// All the vftables that have been referenced. VFTablesMapTy VFTablesMap; VTablesMapTy VTablesMap; @@ -1250,7 +1250,7 @@ void MicrosoftCXXABI::initializeHiddenVirtualInheritanceMembers( // Outside the ctors and dtors, the values of vtorDisps are zero. const ASTRecordLayout &Layout = getContext().getASTRecordLayout(RD); - typedef ASTRecordLayout::VBaseOffsetsMapTy VBOffsets; + using VBOffsets = ASTRecordLayout::VBaseOffsetsMapTy; const VBOffsets &VBaseMap = Layout.getVBaseOffsetsMap(); CGBuilderTy &Builder = CGF.Builder; diff --git a/clang/lib/CodeGen/TargetBuiltins/PPC.cpp b/clang/lib/CodeGen/TargetBuiltins/PPC.cpp index 270e9fc976f23..40c17f730a464 100644 --- a/clang/lib/CodeGen/TargetBuiltins/PPC.cpp +++ b/clang/lib/CodeGen/TargetBuiltins/PPC.cpp @@ -145,7 +145,7 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID, StringRef CPUStr = cast(CPUExpr)->getString(); llvm::Triple Triple = getTarget().getTriple(); - typedef std::tuple CPUInfo; + using CPUInfo = std::tuple; auto [LinuxSupportMethod, LinuxIDValue, AIXSupportMethod, AIXIDValue] = static_cast(StringSwitch(CPUStr) @@ -183,9 +183,8 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID, const Expr *CPUExpr = E->getArg(0)->IgnoreParenCasts(); StringRef CPUStr = cast(CPUExpr)->getString(); if (Triple.isOSAIX()) { - typedef std::tuple - CPUSupportType; + using CPUSupportType = std::tuple; auto [SupportMethod, FieldIdx, Mask, CompOp, Value] = static_cast(StringSwitch(CPUStr) #define PPC_AIX_FEATURE(NAME, DESC, SUPPORT_METHOD, INDEX, MASK, COMP_OP, \ diff --git a/clang/lib/CodeGen/TargetInfo.h b/clang/lib/CodeGen/TargetInfo.h index d0edae1295094..cd6e213f6f326 100644 --- a/clang/lib/CodeGen/TargetInfo.h +++ b/clang/lib/CodeGen/TargetInfo.h @@ -364,7 +364,7 @@ class TargetCodeGenInfo { /// Interface class for filling custom fields of a block literal for OpenCL. class TargetOpenCLBlockHelper { public: - typedef std::pair ValueTy; + using ValueTy = std::pair; TargetOpenCLBlockHelper() {} virtual ~TargetOpenCLBlockHelper() {} /// Get the custom field types for OpenCL blocks. diff --git a/clang/lib/CodeGen/Targets/XCore.cpp b/clang/lib/CodeGen/Targets/XCore.cpp index b7824bde5f55a..4d55fd027f5cf 100644 --- a/clang/lib/CodeGen/Targets/XCore.cpp +++ b/clang/lib/CodeGen/Targets/XCore.cpp @@ -20,7 +20,7 @@ namespace { /// A SmallStringEnc instance is used to build up the TypeString by passing /// it by reference between functions that append to it. -typedef llvm::SmallString<128> SmallStringEnc; +using SmallStringEnc = llvm::SmallString<128>; /// TypeStringCache caches the meta encodings of Types. /// diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index ec1135eecd401..2907d7a159833 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -3160,7 +3160,7 @@ class OffloadingActionBuilder final { /// Builder interface. It doesn't build anything or keep any state. class DeviceActionBuilder { public: - typedef const llvm::SmallVectorImpl PhasesTy; + using PhasesTy = const llvm::SmallVectorImpl; enum ActionBuilderReturnCode { // The builder acted successfully on the current action. diff --git a/clang/lib/Driver/ToolChains/Arch/Mips.h b/clang/lib/Driver/ToolChains/Arch/Mips.h index 058e82b09831a..6015cc44c6460 100644 --- a/clang/lib/Driver/ToolChains/Arch/Mips.h +++ b/clang/lib/Driver/ToolChains/Arch/Mips.h @@ -21,7 +21,7 @@ namespace driver { namespace tools { namespace mips { -typedef enum { Legacy = 1, Std2008 = 2 } IEEE754Standard; +using IEEE754Standard = enum { Legacy = 1, Std2008 = 2 }; enum class FloatABI { Invalid, diff --git a/clang/lib/Format/BreakableToken.h b/clang/lib/Format/BreakableToken.h index 45c00b35fd01e..865d6d296350f 100644 --- a/clang/lib/Format/BreakableToken.h +++ b/clang/lib/Format/BreakableToken.h @@ -86,7 +86,7 @@ struct FormatStyle; class BreakableToken { public: /// Contains starting character index and length of split. - typedef std::pair Split; + using Split = std::pair; virtual ~BreakableToken() {} diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 62feb3db0ed5e..db8e9f7e50761 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -3848,9 +3848,8 @@ reformat(const FormatStyle &Style, StringRef Code, if (!Env) return {}; - typedef std::function( - const Environment &)> - AnalyzerPass; + using AnalyzerPass = std::function( + const Environment &)>; SmallVector Passes; diff --git a/clang/lib/Format/QualifierAlignmentFixer.h b/clang/lib/Format/QualifierAlignmentFixer.h index a0a0d597ebf30..c8b328a2e9fcb 100644 --- a/clang/lib/Format/QualifierAlignmentFixer.h +++ b/clang/lib/Format/QualifierAlignmentFixer.h @@ -20,9 +20,8 @@ namespace clang { namespace format { -typedef std::function( - const Environment &)> - AnalyzerPass; +using AnalyzerPass = std::function( + const Environment &)>; void addQualifierAlignmentFixerPasses(const FormatStyle &Style, SmallVectorImpl &Passes); diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp index 0adf7ee9ed543..12fb1dccb4053 100644 --- a/clang/lib/Format/UnwrappedLineFormatter.cpp +++ b/clang/lib/Format/UnwrappedLineFormatter.cpp @@ -1240,7 +1240,7 @@ class OptimizingLineFormatter : public LineFormatter { /// In case of equal penalties, we want to prefer states that were inserted /// first. During state generation we make sure that we insert states first /// that break the line as late as possible. - typedef std::pair OrderedPenalty; + using OrderedPenalty = std::pair; /// An edge in the solution space from \c Previous->State to \c State, /// inserting a newline dependent on the \c NewLine. @@ -1254,12 +1254,11 @@ class OptimizingLineFormatter : public LineFormatter { /// An item in the prioritized BFS search queue. The \c StateNode's /// \c State has the given \c OrderedPenalty. - typedef std::pair QueueItem; + using QueueItem = std::pair; /// The BFS queue type. - typedef std::priority_queue, - std::greater> - QueueType; + using QueueType = std::priority_queue, + std::greater>; /// Analyze the entire solution space starting from \p InitialState. /// diff --git a/clang/lib/Frontend/ASTConsumers.cpp b/clang/lib/Frontend/ASTConsumers.cpp index ab8a35a189250..1f53f57e92964 100644 --- a/clang/lib/Frontend/ASTConsumers.cpp +++ b/clang/lib/Frontend/ASTConsumers.cpp @@ -27,7 +27,7 @@ using namespace clang; namespace { class ASTPrinter : public ASTConsumer, public RecursiveASTVisitor { - typedef RecursiveASTVisitor base; + using base = RecursiveASTVisitor; public: enum Kind { DumpFull, Dump, Print, None }; diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index 9e046633328d7..0235f4a4e91b7 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -1034,7 +1034,7 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok, } } -typedef std::pair id_macro_pair; +using id_macro_pair = std::pair; static int MacroIDCompare(const id_macro_pair *LHS, const id_macro_pair *RHS) { return LHS->first->getName().compare(RHS->first->getName()); } diff --git a/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp b/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp index 23a1f909e2a37..e33091f514ab0 100644 --- a/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp @@ -44,9 +44,9 @@ class AbbreviationMap { } }; -typedef SmallVector RecordData; -typedef SmallVectorImpl RecordDataImpl; -typedef ArrayRef RecordDataRef; +using RecordData = SmallVector; +using RecordDataImpl = SmallVectorImpl; +using RecordDataRef = ArrayRef; class SDiagsWriter; @@ -81,7 +81,7 @@ class SDiagsRenderer : public DiagnosticNoteRenderer { DiagnosticsEngine::Level Level) override; }; -typedef llvm::DenseMap AbbrevLookup; +using AbbrevLookup = llvm::DenseMap; class SDiagsMerger : SerializedDiagnosticReader { SDiagsWriter &Writer; @@ -270,8 +270,8 @@ class SDiagsWriter : public DiagnosticConsumer { /// The collection of files used. llvm::DenseMap Files; - typedef llvm::DenseMap > - DiagFlagsTy; + using DiagFlagsTy = + llvm::DenseMap>; /// Map for uniquing strings. DiagFlagsTy DiagFlags; diff --git a/clang/lib/Index/IndexBody.cpp b/clang/lib/Index/IndexBody.cpp index 1979117d4695c..b89ecd624d825 100644 --- a/clang/lib/Index/IndexBody.cpp +++ b/clang/lib/Index/IndexBody.cpp @@ -26,7 +26,7 @@ class BodyIndexer : public RecursiveASTVisitor { const DeclContext *ParentDC; SmallVector StmtStack; - typedef RecursiveASTVisitor base; + using base = RecursiveASTVisitor; Stmt *getParentStmt() const { return StmtStack.size() < 2 ? nullptr : StmtStack.end()[-2]; diff --git a/clang/lib/Index/IndexTypeSourceInfo.cpp b/clang/lib/Index/IndexTypeSourceInfo.cpp index adc33b3abd822..90166af8f4323 100644 --- a/clang/lib/Index/IndexTypeSourceInfo.cpp +++ b/clang/lib/Index/IndexTypeSourceInfo.cpp @@ -26,7 +26,7 @@ class TypeIndexer : public RecursiveASTVisitor { bool IsBase; SmallVector Relations; - typedef RecursiveASTVisitor base; + using base = RecursiveASTVisitor; public: TypeIndexer(IndexingContext &indexCtx, const NamedDecl *parent, diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp index a62508e3e27bf..154ed0063d8cd 100644 --- a/clang/lib/Lex/LiteralSupport.cpp +++ b/clang/lib/Lex/LiteralSupport.cpp @@ -756,7 +756,7 @@ static void EncodeUCNEscape(const char *ThisTokBegin, const char *&ThisTokBuf, FullSourceLoc Loc, unsigned CharByteWidth, DiagnosticsEngine *Diags, const LangOptions &Features) { - typedef uint32_t UTF32; + using UTF32 = uint32_t; UTF32 UcnVal = 0; unsigned short UcnLen = 0; if (!ProcessUCNEscape(ThisTokBegin, ThisTokBuf, ThisTokEnd, UcnVal, UcnLen, @@ -805,7 +805,7 @@ static void EncodeUCNEscape(const char *ThisTokBegin, const char *&ThisTokBuf, // The conversion below was inspired by: // http://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.c // First, we determine how many bytes the result will require. - typedef uint8_t UTF8; + using UTF8 = uint8_t; unsigned short bytesToWrite = 0; if (UcnVal < (UTF32)0x80) diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp index 98933811265e8..1b8334592e404 100644 --- a/clang/lib/Parse/ParsePragma.cpp +++ b/clang/lib/Parse/ParsePragma.cpp @@ -954,7 +954,7 @@ namespace { enum OpenCLExtState : char { Disable, Enable, Begin, End }; - typedef std::pair OpenCLExtData; + using OpenCLExtData = std::pair; } void Parser::HandlePragmaOpenCLExtension() { @@ -1028,7 +1028,7 @@ void Parser::HandlePragmaMSPragma() { // Figure out which #pragma we're dealing with. The switch has no default // because lex shouldn't emit the annotation token for unrecognized pragmas. - typedef bool (Parser::*PragmaHandler)(StringRef, SourceLocation); + using PragmaHandler = bool (Parser::*)(StringRef, SourceLocation); PragmaHandler Handler = llvm::StringSwitch(PragmaName) .Case("data_seg", &Parser::HandlePragmaMSSegment) diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp index d1400cbfc884d..d2eae7f9535bf 100644 --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -888,7 +888,7 @@ class ContainsReference : public ConstEvaluatedExprVisitor { const DeclRefExpr *Needle; public: - typedef ConstEvaluatedExprVisitor Inherited; + using Inherited = ConstEvaluatedExprVisitor; ContainsReference(ASTContext &Context, const DeclRefExpr *Needle) : Inherited(Context), FoundReference(false), Needle(Needle) {} @@ -1221,7 +1221,7 @@ class FallthroughMapper : public DynamicRecursiveASTVisitor { (void)Found; } - typedef llvm::SmallPtrSet AttrStmts; + using AttrStmts = llvm::SmallPtrSet; const AttrStmts &getFallthroughStmts() const { return FallthroughStmts; } @@ -1509,11 +1509,11 @@ static void diagnoseRepeatedUseOfWeak(Sema &S, const sema::FunctionScopeInfo *CurFn, const Decl *D, const ParentMap &PM) { - typedef sema::FunctionScopeInfo::WeakObjectProfileTy WeakObjectProfileTy; - typedef sema::FunctionScopeInfo::WeakObjectUseMap WeakObjectUseMap; - typedef sema::FunctionScopeInfo::WeakUseVector WeakUseVector; - typedef std::pair - StmtUsesPair; + using WeakObjectProfileTy = sema::FunctionScopeInfo::WeakObjectProfileTy; + using WeakObjectUseMap = sema::FunctionScopeInfo::WeakObjectUseMap; + using WeakUseVector = sema::FunctionScopeInfo::WeakUseVector; + using StmtUsesPair = + std::pair; ASTContext &Ctx = S.getASTContext(); @@ -1663,9 +1663,9 @@ static void diagnoseRepeatedUseOfWeak(Sema &S, namespace clang { namespace { -typedef SmallVector OptionalNotes; -typedef std::pair DelayedDiag; -typedef std::list DiagList; +using OptionalNotes = SmallVector; +using DelayedDiag = std::pair; +using DiagList = std::list; struct SortDiagBySourceLocation { SourceManager &SM; @@ -1683,12 +1683,12 @@ struct SortDiagBySourceLocation { namespace { class UninitValsDiagReporter : public UninitVariablesHandler { Sema &S; - typedef SmallVector UsesVec; - typedef llvm::PointerIntPair MappedType; + using UsesVec = SmallVector; + using MappedType = llvm::PointerIntPair; // Prefer using MapVector to DenseMap, so that iteration order will be // the same as insertion order. This is needed to obtain a deterministic // order of diagnostics when calling flushDiagnostics(). - typedef llvm::MapVector UsesMap; + using UsesMap = llvm::MapVector; UsesMap uses; public: diff --git a/clang/lib/Sema/JumpDiagnostics.cpp b/clang/lib/Sema/JumpDiagnostics.cpp index 36704c3826dfd..3e6813ffbe1d4 100644 --- a/clang/lib/Sema/JumpDiagnostics.cpp +++ b/clang/lib/Sema/JumpDiagnostics.cpp @@ -136,7 +136,7 @@ unsigned JumpScopeChecker::GetDeepestCommonScope(unsigned A, unsigned B) { return A; } -typedef std::pair ScopePair; +using ScopePair = std::pair; /// GetDiagForGotoScopeDecl - If this decl induces a new goto scope, return a /// diagnostic that should be emitted if control goes over it. If not, return 0. diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 56608e990fd50..28b0d8d6b33d0 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -1069,8 +1069,7 @@ void Sema::LoadExternalWeakUndeclaredIdentifiers() { (void)WeakUndeclaredIdentifiers[WeakID.first].insert(WeakID.second); } - -typedef llvm::DenseMap RecordCompleteMap; +using RecordCompleteMap = llvm::DenseMap; /// Returns true, if all methods and nested classes of the given /// CXXRecordDecl are defined in this translation unit. @@ -1832,7 +1831,7 @@ namespace { class DeferredDiagnosticsEmitter : public UsedDeclVisitor { public: - typedef UsedDeclVisitor Inherited; + using Inherited = UsedDeclVisitor; // Whether the function is already in the current use-path. llvm::SmallPtrSet, 4> InUsePath; diff --git a/clang/lib/Sema/SemaAPINotes.cpp b/clang/lib/Sema/SemaAPINotes.cpp index 044abb0ee08a8..ed2203f000974 100644 --- a/clang/lib/Sema/SemaAPINotes.cpp +++ b/clang/lib/Sema/SemaAPINotes.cpp @@ -521,7 +521,7 @@ static void ProcessAPINotes(Sema &S, ObjCPropertyDecl *D, } namespace { -typedef llvm::PointerUnion FunctionOrMethod; +using FunctionOrMethod = llvm::PointerUnion; } /// Process API notes for a function or method. diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp index 83a07a23f3414..55b7bf169ea0d 100644 --- a/clang/lib/Sema/SemaAccess.cpp +++ b/clang/lib/Sema/SemaAccess.cpp @@ -145,7 +145,7 @@ struct EffectiveContext { return Inner; } - typedef SmallVectorImpl::const_iterator record_iterator; + using record_iterator = SmallVectorImpl::const_iterator; DeclContext *Inner; SmallVector Functions; diff --git a/clang/lib/Sema/SemaAttr.cpp b/clang/lib/Sema/SemaAttr.cpp index 3eed6ad7fe6b3..c5492c4c30e05 100644 --- a/clang/lib/Sema/SemaAttr.cpp +++ b/clang/lib/Sema/SemaAttr.cpp @@ -1327,7 +1327,7 @@ void Sema::AddImplicitMSFunctionNoBuiltinAttr(FunctionDecl *FD) { FD->addAttr(NoBuiltinAttr::CreateImplicit(Context, V.data(), V.size())); } -typedef std::vector > VisStack; +using VisStack = std::vector>; enum : unsigned { NoVisibility = ~0U }; void Sema::AddPushedVisibilityAttribute(Decl *D) { diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index a43ac9eb7610d..742606db63e0c 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -74,9 +74,9 @@ class ResultBuilder { /// name-lookup routines to specify which declarations should be included in /// the result set (when it returns true) and which declarations should be /// filtered out (returns false). - typedef bool (ResultBuilder::*LookupFilter)(const NamedDecl *) const; + using LookupFilter = bool (ResultBuilder::*)(const NamedDecl *) const; - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; private: /// The actual results we have found. @@ -87,13 +87,13 @@ class ResultBuilder { /// the result set twice. llvm::SmallPtrSet AllDeclsFound; - typedef std::pair DeclIndexPair; + using DeclIndexPair = std::pair; /// An entry in the shadow map, which is optimized to store /// a single (declaration, index) mapping (the common case) but /// can also store a list of (declaration, index) mappings. class ShadowMapEntry { - typedef SmallVector DeclIndexPairVector; + using DeclIndexPairVector = SmallVector; /// Contains either the solitary NamedDecl * or a vector /// of (declaration, index) pairs. @@ -153,7 +153,7 @@ class ResultBuilder { /// A mapping from declaration names to the declarations that have /// this name within a particular scope and their index within the list of /// results. - typedef llvm::DenseMap ShadowMap; + using ShadowMap = llvm::DenseMap; /// The semantic analysis object for which results are being /// produced. @@ -639,10 +639,10 @@ class ResultBuilder::ShadowMapEntry::iterator { unsigned SingleDeclIndex; public: - typedef DeclIndexPair value_type; - typedef value_type reference; - typedef std::ptrdiff_t difference_type; - typedef std::input_iterator_tag iterator_category; + using value_type = DeclIndexPair; + using reference = value_type; + using difference_type = std::ptrdiff_t; + using iterator_category = std::input_iterator_tag; class pointer { DeclIndexPair Value; @@ -1788,7 +1788,7 @@ class CodeCompletionDeclConsumer : public VisibleDeclConsumer { /// Add type specifiers for the current language as keyword results. static void AddTypeSpecifierResults(const LangOptions &LangOpts, ResultBuilder &Results) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; Results.AddResult(Result("short", CCP_Type)); Results.AddResult(Result("long", CCP_Type)); Results.AddResult(Result("signed", CCP_Type)); @@ -1873,7 +1873,7 @@ static void AddTypeSpecifierResults(const LangOptions &LangOpts, static void AddStorageSpecifiers(SemaCodeCompletion::ParserCompletionContext CCC, const LangOptions &LangOpts, ResultBuilder &Results) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; // Note: we don't suggest either "auto" or "register", because both // are pointless as storage specifiers. Elsewhere, we suggest "auto" // in C++0x as a type specifier. @@ -1902,7 +1902,7 @@ AddStorageSpecifiers(SemaCodeCompletion::ParserCompletionContext CCC, static void AddFunctionSpecifiers(SemaCodeCompletion::ParserCompletionContext CCC, const LangOptions &LangOpts, ResultBuilder &Results) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; switch (CCC) { case SemaCodeCompletion::PCC_Class: case SemaCodeCompletion::PCC_MemberTemplate: @@ -2148,7 +2148,7 @@ AddOrdinaryNameResults(SemaCodeCompletion::ParserCompletionContext CCC, CodeCompletionAllocator &Allocator = Results.getAllocator(); CodeCompletionBuilder Builder(Allocator, Results.getCodeCompletionTUInfo()); - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; switch (CCC) { case SemaCodeCompletion::PCC_Namespace: if (SemaRef.getLangOpts().CPlusPlus) { @@ -4358,7 +4358,7 @@ CXCursorKind clang::getCursorKindForDecl(const Decl *D) { static void AddMacroResults(Preprocessor &PP, ResultBuilder &Results, bool LoadExternal, bool IncludeUndefined, bool TargetTypeIsPointer = false) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; Results.EnterNewScope(); @@ -4383,7 +4383,7 @@ static void AddMacroResults(Preprocessor &PP, ResultBuilder &Results, static void AddPrettyFunctionResults(const LangOptions &LangOpts, ResultBuilder &Results) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; Results.EnterNewScope(); @@ -4532,7 +4532,7 @@ static void MaybeAddOverrideCalls(Sema &S, DeclContext *InContext, void SemaCodeCompletion::CodeCompleteModuleImport(SourceLocation ImportLoc, ModuleIdPath Path) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), CodeCompletionContext::CCC_Other); @@ -4540,7 +4540,7 @@ void SemaCodeCompletion::CodeCompleteModuleImport(SourceLocation ImportLoc, CodeCompletionAllocator &Allocator = Results.getAllocator(); CodeCompletionBuilder Builder(Allocator, Results.getCodeCompletionTUInfo()); - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; if (Path.empty()) { // Enumerate all top-level modules. SmallVector Modules; @@ -4675,7 +4675,7 @@ AddClassMessageCompletions(Sema &SemaRef, Scope *S, ParsedType Receiver, void SemaCodeCompletion::CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, bool AllowNonIdentifiers, bool AllowNestedNameSpecifiers) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; ResultBuilder Results( SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), @@ -5098,7 +5098,7 @@ void SemaCodeCompletion::CodeCompletePostfixExpression(Scope *S, ExprResult E, /// The set of properties that have already been added, referenced by /// property name. -typedef llvm::SmallPtrSet AddedPropertiesSet; +using AddedPropertiesSet = llvm::SmallPtrSet; /// Retrieve the container definition, if any? static ObjCContainerDecl *getContainerDef(ObjCContainerDecl *Container) { @@ -5163,7 +5163,7 @@ AddObjCProperties(const CodeCompletionContext &CCContext, AddedPropertiesSet &AddedProperties, ResultBuilder &Results, bool IsBaseExprStatement = false, bool IsClassProperty = false, bool InOriginalClass = true) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; // Retrieve the definition. Container = getContainerDef(Container); @@ -6244,7 +6244,7 @@ static bool anyNullArguments(ArrayRef Args) { return false; } -typedef CodeCompleteConsumer::OverloadCandidate ResultCandidate; +using ResultCandidate = CodeCompleteConsumer::OverloadCandidate; static void mergeCandidatesWithResults( Sema &SemaRef, SmallVectorImpl &Results, @@ -7058,7 +7058,7 @@ void SemaCodeCompletion::CodeCompleteOperatorName(Scope *S) { if (!CodeCompleter) return; - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), CodeCompletionContext::CCC_Type, @@ -7349,7 +7349,7 @@ void SemaCodeCompletion::CodeCompleteAfterFunctionEquals(Declarator &D) { static void AddObjCImplementationResults(const LangOptions &LangOpts, ResultBuilder &Results, bool NeedAt) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; // Since we have an implementation, we can end it. Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt, "end"))); @@ -7372,7 +7372,7 @@ static void AddObjCImplementationResults(const LangOptions &LangOpts, static void AddObjCInterfaceResults(const LangOptions &LangOpts, ResultBuilder &Results, bool NeedAt) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; // Since we have an interface or protocol, we can end it. Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt, "end"))); @@ -7390,7 +7390,7 @@ static void AddObjCInterfaceResults(const LangOptions &LangOpts, } static void AddObjCTopLevelResults(ResultBuilder &Results, bool NeedAt) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; CodeCompletionBuilder Builder(Results.getAllocator(), Results.getCodeCompletionTUInfo()); @@ -7458,7 +7458,7 @@ void SemaCodeCompletion::CodeCompleteObjCAtDirective(Scope *S) { } static void AddObjCExpressionResults(ResultBuilder &Results, bool NeedAt) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; CodeCompletionBuilder Builder(Results.getAllocator(), Results.getCodeCompletionTUInfo()); @@ -7523,7 +7523,7 @@ static void AddObjCExpressionResults(ResultBuilder &Results, bool NeedAt) { } static void AddObjCStatementResults(ResultBuilder &Results, bool NeedAt) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; CodeCompletionBuilder Builder(Results.getAllocator(), Results.getCodeCompletionTUInfo()); @@ -7570,7 +7570,7 @@ static void AddObjCStatementResults(ResultBuilder &Results, bool NeedAt) { static void AddObjCVisibilityResults(const LangOptions &LangOpts, ResultBuilder &Results, bool NeedAt) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt, "private"))); Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt, "protected"))); Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt, "public"))); @@ -7767,7 +7767,7 @@ static bool isAcceptableObjCMethod(ObjCMethodDecl *Method, /// A set of selectors, which is used to avoid introducing multiple /// completions with the same selector into the result set. -typedef llvm::SmallPtrSet VisitedSelectorSet; +using VisitedSelectorSet = llvm::SmallPtrSet; /// Add all of the Objective-C methods in the given Objective-C /// container to the set of results. @@ -7796,7 +7796,7 @@ static void AddObjCMethods(ObjCContainerDecl *Container, VisitedSelectorSet &Selectors, bool AllowSameLength, ResultBuilder &Results, bool InOriginalClass = true, bool IsRootClass = false) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; Container = getContainerDef(Container); ObjCInterfaceDecl *IFace = dyn_cast(Container); IsRootClass = IsRootClass || (IFace && !IFace->getSuperClass()); @@ -8205,7 +8205,7 @@ AddSuperSendCompletion(Sema &S, bool NeedSuperKeyword, } void SemaCodeCompletion::CodeCompleteObjCMessageReceiver(Scope *S) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; ResultBuilder Results( SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), @@ -8309,7 +8309,7 @@ void SemaCodeCompletion::CodeCompleteObjCSuperMessage( /// send, determine the preferred type (if any) for that argument expression. static QualType getPreferredArgumentTypeForMessageSend(ResultBuilder &Results, unsigned NumSelIdents) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; ASTContext &Context = Results.getSema().Context; QualType PreferredType; @@ -8344,7 +8344,7 @@ AddClassMessageCompletions(Sema &SemaRef, Scope *S, ParsedType Receiver, ArrayRef SelIdents, bool AtArgumentExpression, bool IsSuper, ResultBuilder &Results) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; ObjCInterfaceDecl *CDecl = nullptr; // If the given name refers to an interface type, retrieve the @@ -8453,7 +8453,7 @@ void SemaCodeCompletion::CodeCompleteObjCClassMessage( void SemaCodeCompletion::CodeCompleteObjCInstanceMessage( Scope *S, Expr *RecExpr, ArrayRef SelIdents, bool AtArgumentExpression, ObjCInterfaceDecl *Super) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; ASTContext &Context = getASTContext(); // If necessary, apply function/array conversion to the receiver. @@ -8690,7 +8690,7 @@ void SemaCodeCompletion::CodeCompleteObjCSelector( static void AddProtocolResults(DeclContext *Ctx, DeclContext *CurContext, bool OnlyForwardDeclarations, ResultBuilder &Results) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; for (const auto *D : Ctx->decls()) { // Record any protocols we find. @@ -8757,7 +8757,7 @@ static void AddInterfaceResults(DeclContext *Ctx, DeclContext *CurContext, bool OnlyForwardDeclarations, bool OnlyUnimplemented, ResultBuilder &Results) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; for (const auto *D : Ctx->decls()) { // Record any interfaces we find. @@ -8855,7 +8855,7 @@ void SemaCodeCompletion::CodeCompleteObjCImplementationDecl(Scope *S) { void SemaCodeCompletion::CodeCompleteObjCInterfaceCategory( Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), @@ -8890,7 +8890,7 @@ void SemaCodeCompletion::CodeCompleteObjCInterfaceCategory( void SemaCodeCompletion::CodeCompleteObjCImplementationCategory( Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; // Find the corresponding interface. If we couldn't find the interface, the // program itself is ill-formed. However, we'll try to be helpful still by @@ -8969,7 +8969,7 @@ void SemaCodeCompletion::CodeCompleteObjCPropertyDefinition(Scope *S) { void SemaCodeCompletion::CodeCompleteObjCPropertySynthesizeIvar( Scope *S, IdentifierInfo *PropertyName) { - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), CodeCompletionContext::CCC_Other); @@ -9040,7 +9040,7 @@ void SemaCodeCompletion::CodeCompleteObjCPropertySynthesizeIvar( // Create ivar result _propName, that the user can use to synthesize // an ivar of the appropriate type. unsigned Priority = CCP_MemberDeclaration + 1; - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; CodeCompletionAllocator &Allocator = Results.getAllocator(); CodeCompletionBuilder Builder(Allocator, Results.getCodeCompletionTUInfo(), Priority, CXAvailability_Available); @@ -9062,9 +9062,8 @@ void SemaCodeCompletion::CodeCompleteObjCPropertySynthesizeIvar( // Mapping from selectors to the methods that implement that selector, along // with the "in original class" flag. -typedef llvm::DenseMap> - KnownMethodsMap; +using KnownMethodsMap = + llvm::DenseMap>; /// Find all of the methods that reside in the given container /// (and its superclasses, protocols, etc.) that meet the given @@ -9195,7 +9194,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, PrintingPolicy Policy = getCompletionPrintingPolicy(Results.getSema()); // Builder that will create each code completion. - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; CodeCompletionAllocator &Allocator = Results.getAllocator(); CodeCompletionBuilder Builder(Allocator, Results.getCodeCompletionTUInfo()); @@ -9839,7 +9838,7 @@ void SemaCodeCompletion::CodeCompleteObjCMethodDecl( KnownMethods); // Add declarations or definitions for each of the known methods. - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), CodeCompletionContext::CCC_Other); @@ -9991,7 +9990,7 @@ void SemaCodeCompletion::CodeCompleteObjCMethodDeclSelector( } // Build the set of methods we can see. - typedef CodeCompletionResult Result; + using Result = CodeCompletionResult; ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), CodeCompletionContext::CCC_Other); diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 14403e65e8f42..9a7bde67f441e 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -12664,7 +12664,7 @@ namespace { llvm::SmallVector InitFieldIndex; public: - typedef EvaluatedExprVisitor Inherited; + using Inherited = EvaluatedExprVisitor; SelfReferenceChecker(Sema &S, Decl *OrigDecl) : Inherited(S.Context), S(S), OrigDecl(OrigDecl) { @@ -20268,13 +20268,13 @@ static void CheckForDuplicateEnumValues(Sema &S, ArrayRef Elements, if (S.Diags.isIgnored(diag::warn_duplicate_enum_values, Enum->getLocation())) return; - typedef SmallVector ECDVector; - typedef SmallVector, 3> DuplicatesVector; + using ECDVector = SmallVector; + using DuplicatesVector = SmallVector, 3>; - typedef llvm::PointerUnion DeclOrVector; + using DeclOrVector = llvm::PointerUnion; // DenseMaps cannot contain the all ones int64_t value, so use unordered_map. - typedef std::unordered_map ValueToVectorMap; + using ValueToVectorMap = std::unordered_map; // Use int64_t as a key to avoid needing special handling for map keys. auto EnumConstantToKey = [](const EnumConstantDecl *D) { diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index f5b4614576086..8b8931628e831 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -2898,7 +2898,7 @@ BaseResult Sema::ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange, /// Use small set to collect indirect bases. As this is only used /// locally, there's no need to abstract the small size parameter. -typedef llvm::SmallPtrSet IndirectBaseSet; +using IndirectBaseSet = llvm::SmallPtrSet; /// Recursively add the bases of Type. Don't add Type itself. static void @@ -3742,7 +3742,7 @@ namespace { llvm::SmallVector InitFieldIndex; public: - typedef EvaluatedExprVisitor Inherited; + using Inherited = EvaluatedExprVisitor; UninitializedFieldVisitor(Sema &S, llvm::SmallPtrSetImpl &Decls, llvm::SmallPtrSetImpl &BaseClasses) @@ -5787,8 +5787,8 @@ bool CheckRedundantInit(Sema &S, return true; } -typedef std::pair UnionEntry; -typedef llvm::DenseMap RedundantUnionMap; +using UnionEntry = std::pair; +using RedundantUnionMap = llvm::DenseMap; bool CheckRedundantUnionInit(Sema &S, CXXCtorInitializer *Init, @@ -9387,7 +9387,7 @@ struct SpecialMemberVisitor { } /// A base or member subobject. - typedef llvm::PointerUnion Subobject; + using Subobject = llvm::PointerUnion; /// Get the location to use for a subobject in diagnostics. static SourceLocation getSubobjectLoc(Subobject Subobj) { @@ -10121,7 +10121,7 @@ static CXXConstructorDecl *findUserDeclaredCtor(CXXRecordDecl *RD) { return CI; // Look for constructor templates. - typedef CXXRecordDecl::specific_decl_iterator tmpl_iter; + using tmpl_iter = CXXRecordDecl::specific_decl_iterator; for (tmpl_iter TI(RD->decls_begin()), TE(RD->decls_end()); TI != TE; ++TI) { if (CXXConstructorDecl *CD = dyn_cast(TI->getTemplatedDecl())) @@ -15483,7 +15483,7 @@ static void checkMoveAssignmentForRepeatedMove(Sema &S, CXXRecordDecl *Class, return; llvm::SmallVector Worklist; - typedef llvm::DenseMap VBaseMap; + using VBaseMap = llvm::DenseMap; VBaseMap VBases; for (auto &BI : Class->bases()) { diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index bbd104909956f..5aab9165d99db 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -1551,7 +1551,7 @@ void SemaObjC::actOnObjCTypeArgsOrProtocolQualifiers( // Objective-C class names. The latter is technically ill-formed, // but is probably something like \c NSArray missing the // \c*. - typedef llvm::PointerUnion TypeOrClassDecl; + using TypeOrClassDecl = llvm::PointerUnion; SmallVector typeDecls; unsigned numTypeDeclsResolved = 0; for (unsigned i = 0, n = identifiers.size(); i != n; ++i) { @@ -2688,8 +2688,8 @@ void SemaObjC::WarnExactTypedMethods(ObjCMethodDecl *ImpMethodDecl, /// we used an immutable set to keep the table then it wouldn't add significant /// memory cost and it would be handy for lookups. -typedef llvm::DenseSet ProtocolNameSet; -typedef std::unique_ptr LazyProtocolNameSet; +using ProtocolNameSet = llvm::DenseSet; +using LazyProtocolNameSet = std::unique_ptr; static void findProtocolsWithExplicitImpls(const ObjCProtocolDecl *PDecl, ProtocolNameSet &PNS) { @@ -4325,7 +4325,7 @@ class OverrideSearch { } } - typedef decltype(Overridden)::iterator iterator; + using iterator = decltype(Overridden)::iterator; iterator begin() const { return Overridden.begin(); } iterator end() const { return Overridden.end(); } diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 45c7178c6965d..fd14866978c39 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1298,7 +1298,7 @@ static bool unsupportedTypeConversion(const Sema &S, QualType LHSType, return true; } -typedef ExprResult PerformCastFn(Sema &S, Expr *operand, QualType toType); +using PerformCastFn = ExprResult(Sema &S, Expr *operand, QualType toType); namespace { /// These helper callbacks are placed in an anonymous namespace to @@ -17486,7 +17486,7 @@ namespace { // Handle the case where we conclude a expression which we speculatively // considered to be unevaluated is actually evaluated. class TransformToPE : public TreeTransform { - typedef TreeTransform BaseTransform; + using BaseTransform = TreeTransform; public: TransformToPE(Sema &SemaRef) : BaseTransform(SemaRef) { } @@ -20354,7 +20354,7 @@ namespace { /// potentially-evaluated subexpressions as "referenced". class EvaluatedExprMarker : public UsedDeclVisitor { public: - typedef UsedDeclVisitor Inherited; + using Inherited = UsedDeclVisitor; bool SkipLocalVariables; ArrayRef StopAt; diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp index 5dca509d46fdb..c6fc59719c9e0 100644 --- a/clang/lib/Sema/SemaExprMember.cpp +++ b/clang/lib/Sema/SemaExprMember.cpp @@ -25,7 +25,7 @@ using namespace clang; using namespace sema; -typedef llvm::SmallPtrSet BaseSet; +using BaseSet = llvm::SmallPtrSet; /// Determines if the given class is provably not derived from all of /// the prospective base classes. diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index e0662d82914f4..dd01c0957373f 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -3533,7 +3533,7 @@ namespace { /// A checker which white-lists certain expressions whose conversion /// to or from retainable type would otherwise be forbidden in ARC. class ARCCastChecker : public StmtVisitor { - typedef StmtVisitor super; + using super = StmtVisitor; ASTContext &Context; ARCConversionTypeClass SourceClass; diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 1c6f292454ed6..d65bf1eb4acba 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -2659,7 +2659,7 @@ static void ExpandAnonymousFieldDesignator(Sema &SemaRef, DesignatedInitExpr *DIE, unsigned DesigIdx, IndirectFieldDecl *IndirectField) { - typedef DesignatedInitExpr::Designator Designator; + using Designator = DesignatedInitExpr::Designator; // Build the replacement designators. SmallVector Replacements; @@ -3558,7 +3558,7 @@ ExprResult Sema::ActOnDesignatedInitializer(Designation &Desig, SourceLocation EqualOrColonLoc, bool GNUSyntax, ExprResult Init) { - typedef DesignatedInitExpr::Designator ASTDesignator; + using ASTDesignator = DesignatedInitExpr::Designator; bool Invalid = false; SmallVector Designators; diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 8bde18f64f80b..e05ca6e6d6551 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -97,7 +97,7 @@ namespace { class UnqualUsingDirectiveSet { Sema &SemaRef; - typedef SmallVector ListTy; + using ListTy = SmallVector; ListTy list; llvm::SmallPtrSet visited; @@ -195,7 +195,7 @@ namespace { void done() { llvm::sort(list, UnqualUsingEntry::Comparator()); } - typedef ListTy::const_iterator const_iterator; + using const_iterator = ListTy::const_iterator; const_iterator begin() const { return list.begin(); } const_iterator end() const { return list.end(); } @@ -4004,12 +4004,12 @@ class VisibleDeclsRecord { /// An entry in the shadow map, which is optimized to store a /// single declaration (the common case) but can also store a list /// of declarations. - typedef llvm::TinyPtrVector ShadowMapEntry; + using ShadowMapEntry = llvm::TinyPtrVector; private: /// A mapping from declaration names to the declarations that have /// this name within a particular scope. - typedef llvm::DenseMap ShadowMap; + using ShadowMap = llvm::DenseMap; /// A list of shadow maps, which is used to model name hiding. std::list ShadowMaps; @@ -4047,7 +4047,7 @@ class VisibleDeclsRecord { class ShadowContextRAII { VisibleDeclsRecord &Visible; - typedef VisibleDeclsRecord::ShadowMap ShadowMap; + using ShadowMap = VisibleDeclsRecord::ShadowMap; public: ShadowContextRAII(VisibleDeclsRecord &Visible) : Visible(Visible) { diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 4ecc9b0d4c5c8..bc8dc83e489cf 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -18430,7 +18430,7 @@ namespace { // Transform MemberExpression for specified FieldDecl of current class to // DeclRefExpr to specified OMPCapturedExprDecl. class TransformExprToCaptures : public TreeTransform { - typedef TreeTransform BaseTransform; + using BaseTransform = TreeTransform; ValueDecl *Field = nullptr; DeclRefExpr *CapturedExpr = nullptr; diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 5dd5b495480d9..7533519380dca 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -8822,7 +8822,7 @@ namespace { /// enumeration types. class BuiltinCandidateTypeSet { /// TypeSet - A set of types. - typedef llvm::SmallSetVector TypeSet; + using TypeSet = llvm::SmallSetVector; /// PointerTypes - The set of pointer types that will be used in the /// built-in candidates. @@ -8871,7 +8871,7 @@ class BuiltinCandidateTypeSet { public: /// iterator - Iterates through the types that are part of the set. - typedef TypeSet::iterator iterator; + using iterator = TypeSet::iterator; BuiltinCandidateTypeSet(Sema &SemaRef) : HasNonRecordTypes(false), diff --git a/clang/lib/Sema/SemaPseudoObject.cpp b/clang/lib/Sema/SemaPseudoObject.cpp index 66736670984ef..4c8f659b3fcc4 100644 --- a/clang/lib/Sema/SemaPseudoObject.cpp +++ b/clang/lib/Sema/SemaPseudoObject.cpp @@ -46,7 +46,7 @@ namespace { struct Rebuilder { Sema &S; unsigned MSPropertySubscriptCount; - typedef llvm::function_ref SpecificRebuilderRefTy; + using SpecificRebuilderRefTy = llvm::function_ref; const SpecificRebuilderRefTy &SpecificCallback; Rebuilder(Sema &S, const SpecificRebuilderRefTy &SpecificCallback) : S(S), MSPropertySubscriptCount(0), diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index f85826aecadf3..d16ef2102c413 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -945,7 +945,7 @@ bool Sema::checkMustTailAttr(const Stmt *St, const Attr &MTA) { namespace { class CommaVisitor : public EvaluatedExprVisitor { - typedef EvaluatedExprVisitor Inherited; + using Inherited = EvaluatedExprVisitor; Sema &SemaRef; public: CommaVisitor(Sema &SemaRef) : Inherited(SemaRef.Context), SemaRef(SemaRef) {} @@ -1240,7 +1240,7 @@ static void checkCaseValue(Sema &S, SourceLocation Loc, const llvm::APSInt &Val, } } -typedef SmallVector, 64> EnumValsTy; +using EnumValsTy = SmallVector, 64>; /// Returns true if we should emit a diagnostic about this case expression not /// being a part of the enum used in the switch controlling expression. @@ -1360,11 +1360,11 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, // Accumulate all of the case values in a vector so that we can sort them // and detect duplicates. This vector contains the APInt for the case after // it has been converted to the condition type. - typedef SmallVector, 64> CaseValsTy; + using CaseValsTy = SmallVector, 64>; CaseValsTy CaseVals; // Keep track of any GNU case ranges we see. The APSInt is the low value. - typedef std::vector > CaseRangesTy; + using CaseRangesTy = std::vector>; CaseRangesTy CaseRanges; DefaultStmt *TheDefaultStmt = nullptr; @@ -1771,8 +1771,8 @@ Sema::DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, return; } - typedef SmallVector, 64> - EnumValsTy; + using EnumValsTy = + SmallVector, 64>; EnumValsTy EnumVals; // Gather all enum values, set their type and sort them, @@ -1872,7 +1872,7 @@ namespace { SmallVectorImpl &Ranges; bool Simple; public: - typedef EvaluatedExprVisitor Inherited; + using Inherited = EvaluatedExprVisitor; DeclExtractor(Sema &S, DeclSetVector &Decls, SmallVectorImpl &Ranges) : @@ -1953,7 +1953,7 @@ namespace { bool FoundDecl; public: - typedef EvaluatedExprVisitor Inherited; + using Inherited = EvaluatedExprVisitor; DeclMatcher(Sema &S, DeclSetVector &Decls, Stmt *Statement) : Inherited(S.Context), Decls(Decls), FoundDecl(false) { @@ -2129,7 +2129,7 @@ namespace { Visit(Body); } - typedef ConstEvaluatedExprVisitor Inherited; + using Inherited = ConstEvaluatedExprVisitor; void VisitContinueStmt(const ContinueStmt* E) { ContinueLoc = E->getContinueLoc(); diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp index 4507a21a4c111..dded368c2c06c 100644 --- a/clang/lib/Sema/SemaStmtAsm.cpp +++ b/clang/lib/Sema/SemaStmtAsm.cpp @@ -757,7 +757,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, targetDiag(ConstraintLoc, diag::error_inoutput_conflict_with_clobber); // Check for duplicate asm operand name between input, output and label lists. - typedef std::pair NamedOperand; + using NamedOperand = std::pair; SmallVector NamedOperandList; for (unsigned i = 0, e = NumOutputs + NumInputs + NumLabels; i != e; ++i) if (Names[i]) diff --git a/clang/lib/Sema/SemaStmtAttr.cpp b/clang/lib/Sema/SemaStmtAttr.cpp index 857d46af9ada9..16501b46d7125 100644 --- a/clang/lib/Sema/SemaStmtAttr.cpp +++ b/clang/lib/Sema/SemaStmtAttr.cpp @@ -194,7 +194,7 @@ class CallExprFinder : public ConstEvaluatedExprVisitor { std::vector CallExprs; public: - typedef ConstEvaluatedExprVisitor Inherited; + using Inherited = ConstEvaluatedExprVisitor; CallExprFinder(Sema &S, const Stmt *St) : Inherited(S.Context) { Visit(St); } diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 698d1270be634..ad29e1d83c164 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -4546,7 +4546,7 @@ Sema::CheckVarTemplateId(VarTemplateDecl *Template, SourceLocation TemplateLoc, VarDecl *InstantiationPattern = Template->getTemplatedDecl(); const TemplateArgumentList *PartialSpecArgs = nullptr; bool AmbiguousPartialSpec = false; - typedef PartialSpecMatchResult MatchResult; + using MatchResult = PartialSpecMatchResult; SmallVector Matched; SourceLocation PointOfInstantiation = TemplateNameLoc; TemplateSpecCandidateSet FailedCandidates(PointOfInstantiation, @@ -6024,7 +6024,7 @@ namespace { Sema &S; SourceRange SR; - typedef TypeVisitor inherited; + using inherited = TypeVisitor; public: UnnamedLocalNoLinkageFinder(Sema &S, SourceRange SR) : S(S), SR(SR) { } @@ -11207,7 +11207,7 @@ namespace { DeclarationName Entity; public: - typedef TreeTransform inherited; + using inherited = TreeTransform; CurrentInstantiationRebuilder(Sema &SemaRef, SourceLocation Loc, diff --git a/clang/lib/Sema/SemaTemplateDeductionGuide.cpp b/clang/lib/Sema/SemaTemplateDeductionGuide.cpp index 9be1c9c356cb2..a8440b80589b5 100644 --- a/clang/lib/Sema/SemaTemplateDeductionGuide.cpp +++ b/clang/lib/Sema/SemaTemplateDeductionGuide.cpp @@ -64,7 +64,7 @@ class ExtractTypeForDeductionGuide std::optional TypedefNameInstantiator; public: - typedef TreeTransform Base; + using Base = TreeTransform; ExtractTypeForDeductionGuide( Sema &SemaRef, llvm::SmallVectorImpl &MaterializedTypedefs, diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 20bac0e56b195..a737429a70e07 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -1401,7 +1401,7 @@ namespace { bool maybeInstantiateFunctionParameterToScope(ParmVarDecl *OldParm); public: - typedef TreeTransform inherited; + using inherited = TreeTransform; TemplateInstantiator(Sema &SemaRef, const MultiLevelTemplateArgumentList &TemplateArgs, @@ -2518,7 +2518,7 @@ TemplateInstantiator::TransformFunctionParmPackExpr(FunctionParmPackExpr *E) { ExprResult TemplateInstantiator::TransformFunctionParmPackRefExpr(DeclRefExpr *E, ValueDecl *PD) { - typedef LocalInstantiationScope::DeclArgumentPack DeclArgumentPack; + using DeclArgumentPack = LocalInstantiationScope::DeclArgumentPack; llvm::PointerUnion *Found = getSema().CurrentInstantiationScope->findInstantiationOf(PD); assert(Found && "no instantiation for parameter pack"); @@ -4029,7 +4029,7 @@ static ActionResult getPatternForClassTemplateSpecialization( // matching the template arguments of the class template // specialization with the template argument lists of the partial // specializations. - typedef PartialSpecMatchResult MatchResult; + using MatchResult = PartialSpecMatchResult; SmallVector Matched, ExtraMatched; SmallVector PartialSpecs; Template->getPartialSpecializations(PartialSpecs); diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index e2c3cdcd536bc..cb153aa1d2008 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -4729,7 +4729,7 @@ TemplateDeclInstantiator::SubstTemplateParams(TemplateParameterList *L) { bool Invalid = false; unsigned N = L->size(); - typedef SmallVector ParamVector; + using ParamVector = SmallVector; ParamVector Params; Params.reserve(N); for (auto &P : *L) { @@ -5310,7 +5310,7 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New, // further errors in the declaration itself. // // FIXME: This is a hack. - typedef Sema::CodeSynthesisContext ActiveInstType; + using ActiveInstType = Sema::CodeSynthesisContext; ActiveInstType &ActiveInst = SemaRef.CodeSynthesisContexts.back(); if (ActiveInst.Kind == ActiveInstType::ExplicitTemplateArgumentSubstitution || ActiveInst.Kind == ActiveInstType::DeducedTemplateArgumentSubstitution) { @@ -6806,7 +6806,7 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, assert(ArgPackSubstIndex && "found declaration pack but not pack expanding"); - typedef LocalInstantiationScope::DeclArgumentPack DeclArgumentPack; + using DeclArgumentPack = LocalInstantiationScope::DeclArgumentPack; return cast( (*cast(*Found))[*ArgPackSubstIndex]); } diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp index 572dbf2e7393f..d67901f0af5b8 100644 --- a/clang/lib/Sema/SemaTemplateVariadic.cpp +++ b/clang/lib/Sema/SemaTemplateVariadic.cpp @@ -759,7 +759,7 @@ bool Sema::CheckParameterPacksForExpansion( bool HaveFirstPack = false; UnsignedOrNone NumPartialExpansions = std::nullopt; SourceLocation PartiallySubstitutedPackLoc; - typedef LocalInstantiationScope::DeclArgumentPack DeclArgumentPack; + using DeclArgumentPack = LocalInstantiationScope::DeclArgumentPack; for (UnexpandedParameterPack ParmPack : Unexpanded) { // Compute the depth and index for this parameter pack. @@ -957,7 +957,7 @@ UnsignedOrNone Sema::getNumArgumentsInExpansionFromUnexpanded( NamedDecl *ND = cast(Unexpanded[I].first); if (isa(ND)) { // Function parameter pack or init-capture pack. - typedef LocalInstantiationScope::DeclArgumentPack DeclArgumentPack; + using DeclArgumentPack = LocalInstantiationScope::DeclArgumentPack; llvm::PointerUnion *Instantiation = CurrentInstantiationScope->findInstantiationOf( diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 7dbd4bb0ed125..586d830825e67 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -816,7 +816,7 @@ static void diagnoseAndRemoveTypeQualifiers(Sema &S, const DeclSpec &DS, unsigned DiagID) { // If this occurs outside a template instantiation, warn the user about // it; they probably didn't mean to specify a redundant qualifier. - typedef std::pair QualLoc; + using QualLoc = std::pair; for (QualLoc Qual : {QualLoc(DeclSpec::TQ_const, DS.getConstSpecLoc()), QualLoc(DeclSpec::TQ_restrict, DS.getRestrictSpecLoc()), QualLoc(DeclSpec::TQ_volatile, DS.getVolatileSpecLoc()), diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index c7428d1a02345..a5a58582516dd 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -4975,11 +4975,11 @@ class TemplateArgumentLocInventIterator { InputIterator Iter; public: - typedef TemplateArgumentLoc value_type; - typedef TemplateArgumentLoc reference; - typedef typename std::iterator_traits::difference_type - difference_type; - typedef std::input_iterator_tag iterator_category; + using value_type = TemplateArgumentLoc; + using reference = TemplateArgumentLoc; + using difference_type = + typename std::iterator_traits::difference_type; + using iterator_category = std::input_iterator_tag; class pointer { TemplateArgumentLoc Arg; @@ -5039,9 +5039,9 @@ bool TreeTransform::TransformTemplateArguments( // FIXME: We could do much better if we could guarantee that the // TemplateArgumentLocInfo for the pack expansion would be usable for // all of the template arguments in the argument pack. - typedef TemplateArgumentLocInventIterator - PackLocIterator; + using PackLocIterator = + TemplateArgumentLocInventIterator; if (TransformTemplateArguments(PackLocIterator(*this, In.getArgument().pack_begin()), PackLocIterator(*this, @@ -7262,10 +7262,10 @@ QualType TreeTransform::TransformPredefinedSugarType( unsigned Index; public: - typedef TemplateArgumentLoc value_type; - typedef TemplateArgumentLoc reference; - typedef int difference_type; - typedef std::input_iterator_tag iterator_category; + using value_type = TemplateArgumentLoc; + using reference = TemplateArgumentLoc; + using difference_type = int; + using iterator_category = std::input_iterator_tag; class pointer { TemplateArgumentLoc Arg; @@ -7337,7 +7337,7 @@ QualType TreeTransform::TransformAutoType(TypeLocBuilder &TLB, NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc()); NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc()); - typedef TemplateArgumentLocContainerIterator ArgIterator; + using ArgIterator = TemplateArgumentLocContainerIterator; if (getDerived().TransformTemplateArguments( ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()), NewTemplateArgs)) @@ -7394,8 +7394,8 @@ QualType TreeTransform::TransformTemplateSpecializationType( TemplateArgumentListInfo NewTemplateArgs; NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc()); NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc()); - typedef TemplateArgumentLocContainerIterator - ArgIterator; + using ArgIterator = + TemplateArgumentLocContainerIterator; if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()), NewTemplateArgs)) @@ -7451,8 +7451,8 @@ QualType TreeTransform::TransformDependentTemplateSpecializationType( TemplateArgumentListInfo NewTemplateArgs; NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc()); NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc()); - typedef TemplateArgumentLocContainerIterator< - DependentTemplateSpecializationTypeLoc> ArgIterator; + using ArgIterator = TemplateArgumentLocContainerIterator< + DependentTemplateSpecializationTypeLoc>; if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()), NewTemplateArgs)) @@ -13070,7 +13070,7 @@ TreeTransform::TransformOffsetOfExpr(OffsetOfExpr *E) { // the fields again. However, __builtin_offsetof is rare enough in // template code that we don't care. bool ExprChanged = false; - typedef Sema::OffsetOfComponent Component; + using Component = Sema::OffsetOfComponent; SmallVector Components; for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) { const OffsetOfNode &ON = E->getComponent(I); @@ -15403,7 +15403,7 @@ ExprResult TreeTransform::TransformLambdaExpr(LambdaExpr *E) { // Transform any init-capture expressions before entering the scope of the // lambda body, because they are not semantically within that scope. - typedef std::pair InitCaptureInfoTy; + using InitCaptureInfoTy = std::pair; struct TransformedInitCapture { // The location of the ... if the result is retaining a pack expansion. SourceLocation EllipsisLoc; @@ -16203,8 +16203,8 @@ TreeTransform::TransformSizeOfPackExpr(SizeOfPackExpr *E) { E->getPackLoc()); { TemporaryBase Rebase(*this, E->getPackLoc(), getBaseEntity()); - typedef TemplateArgumentLocInventIterator< - Derived, const TemplateArgument*> PackLocIterator; + using PackLocIterator = + TemplateArgumentLocInventIterator; if (TransformTemplateArguments(PackLocIterator(*this, PackArgs.begin()), PackLocIterator(*this, PackArgs.end()), TransformedPackArgs, /*Uneval*/true)) diff --git a/clang/lib/Sema/UsedDeclVisitor.h b/clang/lib/Sema/UsedDeclVisitor.h index 580d702f96fe5..95073fc7f3ab7 100644 --- a/clang/lib/Sema/UsedDeclVisitor.h +++ b/clang/lib/Sema/UsedDeclVisitor.h @@ -23,7 +23,7 @@ class UsedDeclVisitor : public EvaluatedExprVisitor { Sema &S; public: - typedef EvaluatedExprVisitor Inherited; + using Inherited = EvaluatedExprVisitor; UsedDeclVisitor(Sema &S) : Inherited(S.Context), S(S) {} diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp index 1e2272c48bd04..49af1f23c87fb 100644 --- a/clang/lib/Serialization/GlobalModuleIndex.cpp +++ b/clang/lib/Serialization/GlobalModuleIndex.cpp @@ -71,11 +71,11 @@ namespace { /// table. class IdentifierIndexReaderTrait { public: - typedef StringRef external_key_type; - typedef StringRef internal_key_type; - typedef SmallVector data_type; - typedef unsigned hash_value_type; - typedef unsigned offset_type; + using external_key_type = StringRef; + using internal_key_type = StringRef; + using data_type = SmallVector; + using hash_value_type = unsigned; + using offset_type = unsigned; static bool EqualKey(const internal_key_type& a, const internal_key_type& b) { return a == b; @@ -119,9 +119,8 @@ class IdentifierIndexReaderTrait { } }; -typedef llvm::OnDiskIterableChainedHashTable - IdentifierIndexTable; - +using IdentifierIndexTable = + llvm::OnDiskIterableChainedHashTable; } GlobalModuleIndex::GlobalModuleIndex( @@ -419,7 +418,7 @@ namespace { /// Mapping from identifiers to the list of module file IDs that /// consider this identifier to be interesting. - typedef llvm::StringMap > InterestingIdentifierMap; + using InterestingIdentifierMap = llvm::StringMap>; /// A mapping from all interesting identifiers to the set of module /// files in which those identifiers are considered interesting. @@ -501,7 +500,7 @@ namespace { public: /// The identifier and whether it is "interesting". - typedef std::pair data_type; + using data_type = std::pair; data_type ReadData(const internal_key_type& k, const unsigned char* d, @@ -672,8 +671,8 @@ llvm::Error GlobalModuleIndexBuilder::loadModuleFile(FileEntryRef File) { // Handle the identifier table if (State == ASTBlock && Code == IDENTIFIER_TABLE && Record[0] > 0) { - typedef llvm::OnDiskIterableChainedHashTable< - InterestingASTIdentifierLookupTrait> InterestingIdentifierTable; + using InterestingIdentifierTable = llvm::OnDiskIterableChainedHashTable< + InterestingASTIdentifierLookupTrait>; std::unique_ptr Table( InterestingIdentifierTable::Create( (const unsigned char *)Blob.data() + Record[0], @@ -710,12 +709,12 @@ namespace { /// table. class IdentifierIndexWriterTrait { public: - typedef StringRef key_type; - typedef StringRef key_type_ref; - typedef SmallVector data_type; - typedef const SmallVector &data_type_ref; - typedef unsigned hash_value_type; - typedef unsigned offset_type; + using key_type = StringRef; + using key_type_ref = StringRef; + using data_type = SmallVector; + using data_type_ref = const SmallVector &; + using hash_value_type = unsigned; + using offset_type = unsigned; static hash_value_type ComputeHash(key_type_ref Key) { return llvm::djbHash(Key); diff --git a/clang/lib/Serialization/TemplateArgumentHasher.cpp b/clang/lib/Serialization/TemplateArgumentHasher.cpp index c56138e8893c1..0209780862a08 100644 --- a/clang/lib/Serialization/TemplateArgumentHasher.cpp +++ b/clang/lib/Serialization/TemplateArgumentHasher.cpp @@ -218,7 +218,7 @@ void TemplateArgumentHasher::AddQualType(QualType T) { // while Visit* methods process the relevant parts of the Type. // Any unhandled type will make the hash computation bail out. class TypeVisitorHelper : public TypeVisitor { - typedef TypeVisitor Inherited; + using Inherited = TypeVisitor; llvm::FoldingSetNodeID &ID; TemplateArgumentHasher &Hash; diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp index c8fe5c2ccf384..9eaeaa37d8c94 100644 --- a/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp @@ -86,7 +86,7 @@ static void CheckObjCInstMethSignature(const ObjCImplementationDecl *ID, ASTContext &Ctx = BR.getContext(); // Build a DenseMap of the methods for quick querying. - typedef llvm::DenseMap MapTy; + using MapTy = llvm::DenseMap; MapTy IMeths; unsigned NumMethods = 0; diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp index 17af1aebd6d2a..5afe7d93b86f3 100644 --- a/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp @@ -94,8 +94,8 @@ class WalkAST : public StmtVisitor { // Helpers. bool checkCall_strCommon(const CallExpr *CE, const FunctionDecl *FD); - typedef void (WalkAST::*FnCheck)(const CallExpr *, const FunctionDecl *); - typedef void (WalkAST::*MsgCheck)(const ObjCMessageExpr *); + using FnCheck = void (WalkAST::*)(const CallExpr *, const FunctionDecl *); + using MsgCheck = void (WalkAST::*)(const ObjCMessageExpr *); // Checker-specific methods. void checkLoopConditionForFloat(const ForStmt *FS); diff --git a/clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp b/clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp index 04bbe85473c0e..61b7edf26b5d0 100644 --- a/clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp @@ -257,7 +257,7 @@ bool ento::shouldRegisterCallGraphDumper(const CheckerManager &mgr) { namespace { class ConfigDumper : public Checker< check::EndOfTranslationUnit > { - typedef AnalyzerOptions::ConfigTable Table; + using Table = AnalyzerOptions::ConfigTable; static int compareEntry(const Table::MapEntryTy *const *LHS, const Table::MapEntryTy *const *RHS) { diff --git a/clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp b/clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp index d3830a01dd0cb..3227166e22773 100644 --- a/clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp @@ -38,8 +38,8 @@ class DebugContainerModeling void analyzerContainerEnd(const CallExpr *CE, CheckerContext &C) const; ExplodedNode *reportDebugMsg(llvm::StringRef Msg, CheckerContext &C) const; - typedef void (DebugContainerModeling::*FnCheck)(const CallExpr *, - CheckerContext &) const; + using FnCheck = void (DebugContainerModeling::*)(const CallExpr *, + CheckerContext &) const; CallDescriptionMap Callbacks = { {{CDM::SimpleFunc, {"clang_analyzer_container_begin"}, 1}, diff --git a/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp b/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp index 203743dacda63..1df77647a4bdc 100644 --- a/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp @@ -39,8 +39,8 @@ class DebugIteratorModeling void analyzerIteratorValidity(const CallExpr *CE, CheckerContext &C) const; ExplodedNode *reportDebugMsg(llvm::StringRef Msg, CheckerContext &C) const; - typedef void (DebugIteratorModeling::*FnCheck)(const CallExpr *, - CheckerContext &) const; + using FnCheck = void (DebugIteratorModeling::*)(const CallExpr *, + CheckerContext &) const; CallDescriptionMap Callbacks = { {{CDM::SimpleFunc, {"clang_analyzer_iterator_position"}, 1}, diff --git a/clang/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp b/clang/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp index fc174e29be470..9c3d447c3498e 100644 --- a/clang/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp @@ -51,8 +51,8 @@ static bool DefaultMethodFilter(const ObjCMethodDecl *M) { class DirectIvarAssignment : public Checker > { - typedef llvm::DenseMap IvarToPropertyMapTy; + using IvarToPropertyMapTy = + llvm::DenseMap; /// A helper class, which walks the AST and locates all assignments to ivars /// in the given function. diff --git a/clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp index 6035e2d34c2b3..2b79aa2b298af 100644 --- a/clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp @@ -54,8 +54,8 @@ class ExprInspectionChecker void analyzerExpress(const CallExpr *CE, CheckerContext &C) const; void analyzerIsTainted(const CallExpr *CE, CheckerContext &C) const; - typedef void (ExprInspectionChecker::*FnCheck)(const CallExpr *, - CheckerContext &C) const; + using FnCheck = void (ExprInspectionChecker::*)(const CallExpr *, + CheckerContext &C) const; // Optional parameter `ExprVal` for expression value to be marked interesting. ExplodedNode *reportBug(llvm::StringRef Msg, CheckerContext &C, diff --git a/clang/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp index 2f971fb05cc3b..c0755c0b0b29c 100644 --- a/clang/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp @@ -53,13 +53,13 @@ struct ChecksFilter { }; class IvarInvalidationCheckerImpl { - typedef llvm::SmallSetVector MethodSet; - typedef llvm::DenseMap MethToIvarMapTy; - typedef llvm::DenseMap PropToIvarMapTy; - typedef llvm::DenseMap IvarToPropMapTy; + using MethodSet = llvm::SmallSetVector; + using MethToIvarMapTy = + llvm::DenseMap; + using PropToIvarMapTy = + llvm::DenseMap; + using IvarToPropMapTy = + llvm::DenseMap; struct InvalidationInfo { /// Has the ivar been invalidated? @@ -90,7 +90,7 @@ class IvarInvalidationCheckerImpl { } }; - typedef llvm::DenseMap IvarSet; + using IvarSet = llvm::DenseMap; /// Statement visitor, which walks the method body and flags the ivars /// referenced in it (either directly or via property). diff --git a/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPITypes.h b/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPITypes.h index fe0fb2a4d0e72..bee3663c318fc 100644 --- a/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPITypes.h +++ b/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPITypes.h @@ -46,9 +46,8 @@ class Request { // operations. A custom map implementation is used, in order to make it // available in an arbitrary amount of translation units. struct RequestMap {}; -typedef llvm::ImmutableMap - RequestMapImpl; +using RequestMapImpl = llvm::ImmutableMap; } // end of namespace: mpi diff --git a/clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp index 4f829a1dda09f..2da80bc1d7b7e 100644 --- a/clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp @@ -71,8 +71,8 @@ class MacOSKeychainAPIChecker : public Checker, const char *NL, const char *Sep) const override; private: - typedef std::pair AllocationPair; - typedef SmallVector AllocationPairVec; + using AllocationPair = std::pair; + using AllocationPairVec = SmallVector; enum APIKind { /// Denotes functions tracked by this checker. diff --git a/clang/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp index 40985f426bdc2..76c829af38e06 100644 --- a/clang/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp @@ -40,9 +40,9 @@ class MacOSXAPIChecker : public Checker< check::PreStmt > { void CheckDispatchOnce(CheckerContext &C, const CallExpr *CE, StringRef FName) const; - typedef void (MacOSXAPIChecker::*SubChecker)(CheckerContext &, - const CallExpr *, - StringRef FName) const; + using SubChecker = void (MacOSXAPIChecker::*)(CheckerContext &, + const CallExpr *, + StringRef FName) const; }; } //end anonymous namespace diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp index f84d45214f6fe..23455b1135275 100644 --- a/clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp @@ -26,8 +26,8 @@ using namespace ento; namespace { -typedef std::pair TypeCallPair; -typedef llvm::PointerUnion ExprParent; +using TypeCallPair = std::pair; +using ExprParent = llvm::PointerUnion; class CastedAllocFinder : public ConstStmtVisitor { @@ -47,7 +47,7 @@ class CastedAllocFinder ExplicitCastType(ExplicitCastType), AllocCall(AllocCall) {} }; - typedef std::vector CallVec; + using CallVec = std::vector; CallVec Calls; CastedAllocFinder(ASTContext *Ctx) : diff --git a/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp index 15fd9a0b76cc3..cd240d821b48e 100644 --- a/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp @@ -177,7 +177,7 @@ class NSOrCFErrorDerefChecker }; } -typedef llvm::ImmutableMap ErrorOutFlag; +using ErrorOutFlag = llvm::ImmutableMap; REGISTER_TRAIT_WITH_PROGRAMSTATE(NSErrorOut, ErrorOutFlag) REGISTER_TRAIT_WITH_PROGRAMSTATE(CFErrorOut, ErrorOutFlag) diff --git a/clang/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp index a2af7b17c67fd..3873a82ad4e3c 100644 --- a/clang/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp @@ -27,7 +27,7 @@ using namespace clang; using namespace ento; enum IVarState { Unused, Used }; -typedef llvm::DenseMap IvarUsageMap; +using IvarUsageMap = llvm::DenseMap; static void Scan(IvarUsageMap& M, const Stmt *S) { if (!S) diff --git a/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp index 86530086ff1b2..5b1770c4d89de 100644 --- a/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp @@ -82,9 +82,9 @@ class PthreadLockChecker : public Checker PThreadCallbacks = { // Init. {{CDM::CLibrary, {"pthread_mutex_init"}, 2}, diff --git a/clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp index 5152624d00f46..cdcec88792862 100644 --- a/clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp @@ -26,7 +26,7 @@ using namespace clang; using namespace ento; namespace { -typedef SmallVector SymbolVector; +using SymbolVector = SmallVector; struct StreamState { private: diff --git a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp index 52b3d1e95942c..a9f0028675ea3 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp @@ -91,16 +91,16 @@ class StdLibraryFunctionsChecker /// The universal integral type to use in value range descriptions. /// Unsigned to make sure overflows are well-defined. - typedef uint64_t RangeInt; + using RangeInt = uint64_t; /// Describes a single range constraint. Eg. {{0, 1}, {3, 4}} is /// a non-negative integer, which less than 5 and not equal to 2. - typedef std::vector> IntRangeVector; + using IntRangeVector = std::vector>; /// A reference to an argument or return value by its number. /// ArgNo in CallExpr and CallEvent is defined as Unsigned, but /// obviously uint32_t should be enough for all practical purposes. - typedef uint32_t ArgNo; + using ArgNo = uint32_t; /// Special argument number for specifying the return value. static const ArgNo Ret; diff --git a/clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp index ff7615212d34d..4b3a0e1c139f0 100644 --- a/clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp @@ -35,7 +35,7 @@ class UnreachableCodeChecker : public Checker { void checkEndAnalysis(ExplodedGraph &G, BugReporter &B, ExprEngine &Eng) const; private: - typedef llvm::SmallSet CFGBlocksSet; + using CFGBlocksSet = llvm::SmallSet; static inline const Stmt *getUnreachableStmt(const CFGBlock *CB); static void FindUnreachableEntryPoints(const CFGBlock *CB, diff --git a/clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp index bd2f88c7b1bcc..c04b674da5645 100644 --- a/clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp @@ -25,7 +25,7 @@ using namespace ento; REGISTER_SET_WITH_PROGRAMSTATE(InitializedVALists, const MemRegion *) namespace { -typedef SmallVector RegionVector; +using RegionVector = SmallVector; class ValistChecker : public Checker, check::DeadSymbols> { diff --git a/clang/lib/StaticAnalyzer/Core/BlockCounter.cpp b/clang/lib/StaticAnalyzer/Core/BlockCounter.cpp index e7ac6f1cfa001..f5574f14b375e 100644 --- a/clang/lib/StaticAnalyzer/Core/BlockCounter.cpp +++ b/clang/lib/StaticAnalyzer/Core/BlockCounter.cpp @@ -44,7 +44,7 @@ class CountKey { } -typedef llvm::ImmutableMap CountMap; +using CountMap = llvm::ImmutableMap; static inline CountMap GetMap(void *D) { return CountMap(static_cast(D)); diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index d87484470f8b5..51391352230ef 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -183,8 +183,8 @@ class ConstructedObjectKey { }; } // namespace -typedef llvm::ImmutableMap - ObjectsUnderConstructionMap; +using ObjectsUnderConstructionMap = + llvm::ImmutableMap; REGISTER_TRAIT_WITH_PROGRAMSTATE(ObjectsUnderConstruction, ObjectsUnderConstructionMap) @@ -194,22 +194,20 @@ REGISTER_TRAIT_WITH_PROGRAMSTATE(ObjectsUnderConstruction, // memory region, which is important for multi-dimensional arrays. E.g:: int // arr[2][2]; assume arr[1][1] will be the next element under construction, so // the index is 3. -typedef llvm::ImmutableMap< - std::pair, unsigned> - IndexOfElementToConstructMap; +using IndexOfElementToConstructMap = llvm::ImmutableMap< + std::pair, unsigned>; REGISTER_TRAIT_WITH_PROGRAMSTATE(IndexOfElementToConstruct, IndexOfElementToConstructMap) // This trait is responsible for holding our pending ArrayInitLoopExprs. // It pairs the LocationContext and the initializer CXXConstructExpr with // the size of the array that's being copy initialized. -typedef llvm::ImmutableMap< - std::pair, unsigned> - PendingInitLoopMap; +using PendingInitLoopMap = llvm::ImmutableMap< + std::pair, unsigned>; REGISTER_TRAIT_WITH_PROGRAMSTATE(PendingInitLoop, PendingInitLoopMap) -typedef llvm::ImmutableMap - PendingArrayDestructionMap; +using PendingArrayDestructionMap = + llvm::ImmutableMap; REGISTER_TRAIT_WITH_PROGRAMSTATE(PendingArrayDestruction, PendingArrayDestructionMap) diff --git a/clang/lib/StaticAnalyzer/Core/ProgramState.cpp b/clang/lib/StaticAnalyzer/Core/ProgramState.cpp index c4790b0284281..72d8113441424 100644 --- a/clang/lib/StaticAnalyzer/Core/ProgramState.cpp +++ b/clang/lib/StaticAnalyzer/Core/ProgramState.cpp @@ -144,8 +144,8 @@ ProgramState::bindDefaultZero(SVal loc, const LocationContext *LCtx) const { return Mgr.getOwningEngine().processRegionChange(State, R, LCtx); } -typedef ArrayRef RegionList; -typedef ArrayRef ValueList; +using RegionList = ArrayRef; +using ValueList = ArrayRef; ProgramStateRef ProgramState::invalidateRegions( RegionList Regions, ConstCFGElementRef Elem, unsigned Count, diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp index 388034b087789..a89a8f7b6de10 100644 --- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -152,12 +152,11 @@ void BindingKey::dump() const { llvm::errs() << *this; } // Actual Store type. //===----------------------------------------------------------------------===// -typedef llvm::ImmutableMap ClusterBindings; -typedef llvm::ImmutableMapRef ClusterBindingsRef; -typedef std::pair BindingPair; +using ClusterBindings = llvm::ImmutableMap; +using ClusterBindingsRef = llvm::ImmutableMapRef; +using BindingPair = std::pair; -typedef llvm::ImmutableMap - RegionBindings; +using RegionBindings = llvm::ImmutableMap; namespace { class RegionBindingsRef : public llvm::ImmutableMapRef - ParentTy; + using ParentTy = llvm::ImmutableMapRef; RegionBindingsRef(ClusterBindings::Factory &CBFactory, const RegionBindings::TreeTy *T, @@ -396,8 +394,8 @@ class LimitedRegionBindingsRef : public RegionBindingsRef { std::optional BindingsLeft; }; -typedef const RegionBindingsRef& RegionBindingsConstRef; -typedef const LimitedRegionBindingsRef &LimitedRegionBindingsConstRef; +using RegionBindingsConstRef = const RegionBindingsRef &; +using LimitedRegionBindingsConstRef = const LimitedRegionBindingsRef &; std::optional RegionBindingsRef::getDirectBinding(const MemRegion *R) const { @@ -474,10 +472,11 @@ class RegionStoreManager : public StoreManager { RegionBindings::Factory RBFactory; mutable ClusterBindings::Factory CBFactory; - typedef std::vector SValListTy; + using SValListTy = std::vector; + private: - typedef llvm::DenseMap LazyBindingsMapTy; + using LazyBindingsMapTy = + llvm::DenseMap; LazyBindingsMapTy LazyBindingsMap; /// The largest number of fields a struct can have and still be @@ -860,9 +859,9 @@ enum GlobalsFilterKind { template class ClusterAnalysis { protected: - typedef llvm::DenseMap ClusterMap; - typedef const MemRegion * WorkListElement; - typedef SmallVector WorkList; + using ClusterMap = llvm::DenseMap; + using WorkListElement = const MemRegion *; + using WorkList = SmallVector; llvm::SmallPtrSet Visited; @@ -972,7 +971,7 @@ static inline bool isUnionField(const FieldRegion *FR) { return FR->getDecl()->getParent()->isUnion(); } -typedef SmallVector FieldVector; +using FieldVector = SmallVector; static void getSymbolicOffsetFields(BindingKey K, FieldVector &Fields) { assert(K.hasSymbolicOffset() && "Not implemented for concrete offset keys"); @@ -1729,7 +1728,7 @@ RegionStoreManager::findLazyBinding(RegionBindingsConstRef B, return std::make_pair(V->getStore(), V->getRegion()); } - typedef std::pair StoreRegionPair; + using StoreRegionPair = std::pair; StoreRegionPair Result = StoreRegionPair(); if (const ElementRegion *ER = dyn_cast(R)) { diff --git a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index 53466e7a75b0f..f9adfff13a0b4 100644 --- a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -72,7 +72,7 @@ class AnalysisConsumer : public AnalysisASTConsumer, AM_Syntax = 0x1, AM_Path = 0x2 }; - typedef unsigned AnalysisMode; + using AnalysisMode = unsigned; /// Mode of the analyzes while recursively visiting Decls. AnalysisMode RecVisitorMode; diff --git a/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp b/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp index 798b34b3ef0af..321e7a9bc0802 100644 --- a/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp +++ b/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp @@ -45,7 +45,7 @@ using namespace llvm; // Define a type for the functions that are compiled and executed -typedef void (*LLVMFunc)(int*, int*, int*, int); +using LLVMFunc = void (*)(int *, int *, int *, int); // Helper function to parse command line args and find the optimization level static CodeGenOptLevel getOptLevel(const std::vector &ExtraArgs) { diff --git a/clang/tools/diagtool/DiagTool.cpp b/clang/tools/diagtool/DiagTool.cpp index 384eef560c6ca..29064acefc9f0 100644 --- a/clang/tools/diagtool/DiagTool.cpp +++ b/clang/tools/diagtool/DiagTool.cpp @@ -22,7 +22,7 @@ DiagTool::DiagTool(llvm::StringRef toolCmd, llvm::StringRef toolDesc) DiagTool::~DiagTool() {} -typedef llvm::StringMap ToolMap; +using ToolMap = llvm::StringMap; static inline ToolMap *getTools(void *v) { return static_cast(v); } DiagTools::DiagTools() : tools(new ToolMap()) {} diff --git a/clang/tools/diagtool/DiagnosticNames.h b/clang/tools/diagtool/DiagnosticNames.h index f541e88577cc5..6cc366a2695f4 100644 --- a/clang/tools/diagtool/DiagnosticNames.h +++ b/clang/tools/diagtool/DiagnosticNames.h @@ -54,11 +54,11 @@ namespace diagtool { } public: - typedef RecordType value_type; - typedef const value_type & reference; - typedef const value_type * pointer; - typedef std::forward_iterator_tag iterator_category; - typedef std::ptrdiff_t difference_type; + using value_type = RecordType; + using reference = const value_type &; + using pointer = const value_type *; + using iterator_category = std::forward_iterator_tag; + using difference_type = std::ptrdiff_t; inline reference operator*() const; inline pointer operator->() const { @@ -85,12 +85,12 @@ namespace diagtool { } }; - typedef group_iterator subgroup_iterator; + using subgroup_iterator = group_iterator; subgroup_iterator subgroup_begin() const; subgroup_iterator subgroup_end() const; llvm::iterator_range subgroups() const; - typedef group_iterator diagnostics_iterator; + using diagnostics_iterator = group_iterator; diagnostics_iterator diagnostics_begin() const; diagnostics_iterator diagnostics_end() const; llvm::iterator_range diagnostics() const; diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 9412d9735ef82..9431cfba3c35b 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -4024,7 +4024,7 @@ bool CursorVisitor::Visit(const Attr *A) { } namespace { -typedef SmallVector RefNamePieces; +using RefNamePieces = SmallVector; RefNamePieces buildPieces(unsigned NameFlags, bool IsMemberRefExpr, const DeclarationNameInfo &NI, SourceRange QLoc, const SourceRange *TemplateArgsLoc = nullptr) { @@ -5277,13 +5277,13 @@ static enum CXChildVisitResult visitWithBlock(CXCursor cursor, CXCursor parent, #else // If we are compiled with a compiler that doesn't have native blocks support, // define and call the block manually, so the -typedef struct _CXChildVisitResult { +using CXCursorVisitorBlock = struct _CXChildVisitResult { void *isa; int flags; int reserved; enum CXChildVisitResult (*invoke)(struct _CXChildVisitResult *, CXCursor, CXCursor); -} * CXCursorVisitorBlock; +} *; static enum CXChildVisitResult visitWithBlock(CXCursor cursor, CXCursor parent, CXClientData client_data) { @@ -9646,7 +9646,7 @@ CXType clang_getIBOutletCollectionType(CXCursor C) { // Inspecting memory usage. //===----------------------------------------------------------------------===// -typedef std::vector MemUsageEntries; +using MemUsageEntries = std::vector; static inline void createCXTUResourceUsageEntry(MemUsageEntries &entries, enum CXTUResourceUsageKind k, diff --git a/clang/tools/libclang/CIndexHigh.cpp b/clang/tools/libclang/CIndexHigh.cpp index 1f6d3b9dcfe31..d15dc8120916b 100644 --- a/clang/tools/libclang/CIndexHigh.cpp +++ b/clang/tools/libclang/CIndexHigh.cpp @@ -50,7 +50,7 @@ struct FindFileIdRefVisitData { int SelectorIdIdx; CXCursorAndRangeVisitor visitor; - typedef SmallVector TopMethodsTy; + using TopMethodsTy = SmallVector; TopMethodsTy TopMethods; FindFileIdRefVisitData(CXTranslationUnit TU, FileID FID, diff --git a/clang/tools/libclang/CLog.h b/clang/tools/libclang/CLog.h index 6ce43a01ee8f2..eb62e7c4a40a1 100644 --- a/clang/tools/libclang/CLog.h +++ b/clang/tools/libclang/CLog.h @@ -27,7 +27,7 @@ namespace clang { namespace cxindex { class Logger; -typedef IntrusiveRefCntPtr LogRef; +using LogRef = IntrusiveRefCntPtr; /// Collects logging output and writes it to stderr when it's destructed. /// Common use case: diff --git a/clang/tools/libclang/CXCursor.cpp b/clang/tools/libclang/CXCursor.cpp index a6301daa672c3..b250680338574 100644 --- a/clang/tools/libclang/CXCursor.cpp +++ b/clang/tools/libclang/CXCursor.cpp @@ -1598,7 +1598,7 @@ unsigned long long clang_Cursor_getTemplateArgumentUnsignedValue(CXCursor C, // CXCursorSet. //===----------------------------------------------------------------------===// -typedef llvm::DenseMap CXCursorSet_Impl; +using CXCursorSet_Impl = llvm::DenseMap; static inline CXCursorSet packCXCursorSet(CXCursorSet_Impl *setImpl) { return (CXCursorSet)setImpl; @@ -1688,7 +1688,7 @@ CXCompletionString clang_getCursorCompletionString(CXCursor cursor) { namespace { struct OverridenCursorsPool { - typedef SmallVector CursorVec; + using CursorVec = SmallVector; std::vector AllCursors; std::vector AvailableCursors; diff --git a/clang/tools/libclang/CXCursor.h b/clang/tools/libclang/CXCursor.h index 1e4c0a05c9ef7..2cad07ae94a81 100644 --- a/clang/tools/libclang/CXCursor.h +++ b/clang/tools/libclang/CXCursor.h @@ -225,9 +225,9 @@ CXCursor MakeCursorOverloadedDeclRef(TemplateName Template, CXTranslationUnit TU); /// Internal storage for an overloaded declaration reference cursor; -typedef llvm::PointerUnion - OverloadedDeclRefStorage; +using OverloadedDeclRefStorage = + llvm::PointerUnion; /// Unpack an overloaded declaration reference into an expression, /// declaration, or template name along with the source location. diff --git a/clang/tools/libclang/CXIndexDataConsumer.h b/clang/tools/libclang/CXIndexDataConsumer.h index 54a3add3a9c8d..409212e8ce329 100644 --- a/clang/tools/libclang/CXIndexDataConsumer.h +++ b/clang/tools/libclang/CXIndexDataConsumer.h @@ -278,17 +278,17 @@ class CXIndexDataConsumer : public index::IndexDataConsumer { IndexerCallbacks &CB; unsigned IndexOptions; CXTranslationUnit CXTU; - - typedef llvm::DenseMap FileMapTy; - typedef llvm::DenseMap - ContainerMapTy; - typedef llvm::DenseMap EntityMapTy; + + using FileMapTy = llvm::DenseMap; + using ContainerMapTy = + llvm::DenseMap; + using EntityMapTy = llvm::DenseMap; FileMapTy FileMap; ContainerMapTy ContainerMap; EntityMapTy EntityMap; - typedef std::pair RefFileOccurrence; + using RefFileOccurrence = std::pair; llvm::DenseSet RefFileOccurrences; llvm::BumpPtrAllocator StrScratch; diff --git a/clang/tools/libclang/CXLoadedDiagnostic.cpp b/clang/tools/libclang/CXLoadedDiagnostic.cpp index ed89a6a7754da..4fff36d6c6080 100644 --- a/clang/tools/libclang/CXLoadedDiagnostic.cpp +++ b/clang/tools/libclang/CXLoadedDiagnostic.cpp @@ -30,7 +30,7 @@ using namespace clang; // Extend CXDiagnosticSetImpl which contains strings for diagnostics. //===----------------------------------------------------------------------===// -typedef llvm::DenseMap Strings; +using Strings = llvm::DenseMap; namespace { class CXLoadedDiagnosticSetImpl : public CXDiagnosticSetImpl { diff --git a/clang/tools/libclang/CursorVisitor.h b/clang/tools/libclang/CursorVisitor.h index 949b73908c315..2246708794f52 100644 --- a/clang/tools/libclang/CursorVisitor.h +++ b/clang/tools/libclang/CursorVisitor.h @@ -64,7 +64,7 @@ class VisitorJob { const CXCursor &getParent() const { return parent; } }; -typedef SmallVector VisitorWorkList; +using VisitorWorkList = SmallVector; // Cursor visitor. class CursorVisitor : public DeclVisitor, @@ -72,8 +72,8 @@ class CursorVisitor : public DeclVisitor, public: /// Callback called after child nodes of a cursor have been visited. /// Return true to break visitation or false to continue. - typedef bool (*PostChildrenVisitorTy)(CXCursor cursor, - CXClientData client_data); + using PostChildrenVisitorTy = bool (*)(CXCursor cursor, + CXClientData client_data); private: /// The translation unit we are traversing. diff --git a/clang/tools/libclang/Index_Internal.h b/clang/tools/libclang/Index_Internal.h index d28438770e7d3..5457ea526028f 100644 --- a/clang/tools/libclang/Index_Internal.h +++ b/clang/tools/libclang/Index_Internal.h @@ -29,13 +29,13 @@ #define INVOKE_BLOCK2(block, arg1, arg2) block->invoke(block, arg1, arg2) -typedef struct _CXCursorAndRangeVisitorBlock { +using CXCursorAndRangeVisitorBlock = struct _CXCursorAndRangeVisitorBlock { void *isa; int flags; int reserved; enum CXVisitorResult (*invoke)(_CXCursorAndRangeVisitorBlock *, CXCursor, CXSourceRange); -} *CXCursorAndRangeVisitorBlock; +} *; #endif // !__has_feature(blocks) diff --git a/clang/tools/libclang/Indexing.cpp b/clang/tools/libclang/Indexing.cpp index 32a7147af3382..a65f66f99e070 100644 --- a/clang/tools/libclang/Indexing.cpp +++ b/clang/tools/libclang/Indexing.cpp @@ -526,7 +526,7 @@ static CXErrorCode clang_indexSourceFile_Impl( if (CInvok->getFrontendOpts().Inputs.empty()) return CXError_Failure; - typedef SmallVector, 8> MemBufferOwner; + using MemBufferOwner = SmallVector, 8>; std::unique_ptr BufOwner(new MemBufferOwner); // Recover resources if we crash before exiting this method. diff --git a/clang/tools/offload-arch/AMDGPUArchByHIP.cpp b/clang/tools/offload-arch/AMDGPUArchByHIP.cpp index 02431bf909d6d..04d7f292c06ad 100644 --- a/clang/tools/offload-arch/AMDGPUArchByHIP.cpp +++ b/clang/tools/offload-arch/AMDGPUArchByHIP.cpp @@ -32,19 +32,19 @@ using namespace llvm; -typedef struct { +using hipDeviceProp_t = struct { char padding[396]; char gcnArchName[256]; char padding2[1024]; -} hipDeviceProp_t; +}; -typedef enum { +using hipError_t = enum { hipSuccess = 0, -} hipError_t; +}; -typedef hipError_t (*hipGetDeviceCount_t)(int *); -typedef hipError_t (*hipDeviceGet_t)(int *, int); -typedef hipError_t (*hipGetDeviceProperties_t)(hipDeviceProp_t *, int); +using hipGetDeviceCount_t = hipError_t (*)(int *); +using hipDeviceGet_t = hipError_t (*)(int *, int); +using hipGetDeviceProperties_t = hipError_t (*)(hipDeviceProp_t *, int); extern cl::opt Verbose; diff --git a/clang/tools/offload-arch/NVPTXArch.cpp b/clang/tools/offload-arch/NVPTXArch.cpp index c7b7fcdf80500..2d4cccdf1d2bd 100644 --- a/clang/tools/offload-arch/NVPTXArch.cpp +++ b/clang/tools/offload-arch/NVPTXArch.cpp @@ -21,17 +21,17 @@ using namespace llvm; -typedef enum cudaError_enum { +using CUresult = enum cudaError_enum { CUDA_SUCCESS = 0, CUDA_ERROR_NO_DEVICE = 100, -} CUresult; +}; -typedef enum CUdevice_attribute_enum { +using CUdevice_attribute = enum CUdevice_attribute_enum { CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = 76, -} CUdevice_attribute; +}; -typedef uint32_t CUdevice; +using CUdevice = uint32_t; CUresult (*cuInit)(unsigned int); CUresult (*cuDeviceGetCount)(int *); diff --git a/clang/utils/TableGen/ClangASTNodesEmitter.cpp b/clang/utils/TableGen/ClangASTNodesEmitter.cpp index 5971b0012305d..07980cf72baff 100644 --- a/clang/utils/TableGen/ClangASTNodesEmitter.cpp +++ b/clang/utils/TableGen/ClangASTNodesEmitter.cpp @@ -29,8 +29,8 @@ using namespace clang::tblgen; namespace { class ClangASTNodesEmitter { // A map from a node to each of its derived nodes. - typedef std::multimap ChildMap; - typedef ChildMap::const_iterator ChildIterator; + using ChildMap = std::multimap; + using ChildIterator = ChildMap::const_iterator; std::set PrioritizedClasses; const RecordKeeper &Records; diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp index d63e79a5f5155..0199b14d29584 100644 --- a/clang/utils/TableGen/ClangAttrEmitter.cpp +++ b/clang/utils/TableGen/ClangAttrEmitter.cpp @@ -186,7 +186,7 @@ static StringRef NormalizeGNUAttrSpelling(StringRef AttrSpelling) { return AttrSpelling; } -typedef std::vector> ParsedAttrMap; +using ParsedAttrMap = std::vector>; static ParsedAttrMap getParsedAttrList(const RecordKeeper &Records, ParsedAttrMap *Dupes = nullptr, @@ -1774,7 +1774,7 @@ SpellingNamesAreCommon(const std::vector& Spellings) { return true; } -typedef std::map SemanticSpellingMap; +using SemanticSpellingMap = std::map; static std::string CreateSemanticSpellings(const std::vector &Spellings, SemanticSpellingMap &Map) { diff --git a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp index 17078e2bc1505..017957bb8b436 100644 --- a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp +++ b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -118,7 +118,7 @@ namespace { return CategoryIDs[CategoryString]; } - typedef std::vector::const_iterator const_iterator; + using const_iterator = std::vector::const_iterator; const_iterator begin() const { return CategoryStrings.begin(); } const_iterator end() const { return CategoryStrings.end(); } }; @@ -232,14 +232,14 @@ static void groupDiagnostics(ArrayRef Diags, // Infer members of -Wpedantic. //===----------------------------------------------------------------------===// -typedef std::vector RecordVec; -typedef DenseSet RecordSet; -typedef PointerUnion VecOrSet; +using RecordVec = std::vector; +using RecordSet = DenseSet; +using VecOrSet = PointerUnion; namespace { class InferPedantic { - typedef DenseMap>> - GMap; + using GMap = + DenseMap>>; DiagGroupParentMap &DiagGroupParents; ArrayRef Diags; From 2e7c5bebe209d61a2e7a327798c8796975adc2df Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Wed, 30 Jul 2025 04:57:53 -0700 Subject: [PATCH 2/2] Limit to Analysis and StaticAnalyzer --- clang/lib/APINotes/APINotesFormat.h | 2 +- clang/lib/APINotes/APINotesWriter.cpp | 4 +- clang/lib/APINotes/APINotesYAMLCompiler.cpp | 26 +++--- clang/lib/AST/APValue.cpp | 2 +- clang/lib/AST/ASTDiagnostic.cpp | 4 +- clang/lib/AST/Expr.cpp | 6 +- clang/lib/AST/ExprConstant.cpp | 38 ++++---- clang/lib/AST/ExternalASTMerger.cpp | 2 +- clang/lib/AST/ItaniumMangle.cpp | 4 +- clang/lib/AST/MicrosoftMangle.cpp | 10 +- clang/lib/AST/ODRHash.cpp | 4 +- clang/lib/AST/ParentMap.cpp | 2 +- clang/lib/AST/PrintfFormatString.cpp | 4 +- clang/lib/AST/RecordLayoutBuilder.cpp | 14 +-- clang/lib/AST/ScanfFormatString.cpp | 4 +- clang/lib/AST/Stmt.cpp | 6 +- clang/lib/AST/VTableBuilder.cpp | 77 ++++++++-------- clang/lib/ASTMatchers/ASTMatchFinder.cpp | 6 +- clang/lib/Basic/Targets/PPC.h | 4 +- clang/lib/CodeGen/CGBuilder.h | 6 +- clang/lib/CodeGen/CGCall.h | 4 +- clang/lib/CodeGen/CGClass.cpp | 2 +- clang/lib/CodeGen/CGCleanup.h | 2 +- clang/lib/CodeGen/CGDebugInfo.cpp | 2 +- clang/lib/CodeGen/CGExpr.cpp | 2 +- clang/lib/CodeGen/CGExprCXX.cpp | 16 ++-- clang/lib/CodeGen/CGExprComplex.cpp | 4 +- clang/lib/CodeGen/CGHLSLRuntime.cpp | 2 +- clang/lib/CodeGen/CGNonTrivialStruct.cpp | 2 +- clang/lib/CodeGen/CGObjC.cpp | 9 +- clang/lib/CodeGen/CGObjCGNU.cpp | 11 ++- clang/lib/CodeGen/CGOpenMPRuntime.cpp | 2 +- clang/lib/CodeGen/CGOpenMPRuntime.h | 20 ++-- clang/lib/CodeGen/CGStmtOpenMP.cpp | 7 +- clang/lib/CodeGen/CGVTables.h | 10 +- clang/lib/CodeGen/CodeGenFunction.h | 58 ++++++------ clang/lib/CodeGen/CodeGenModule.h | 21 +++-- clang/lib/CodeGen/CodeGenTypes.h | 2 +- clang/lib/CodeGen/CoverageMappingGen.cpp | 4 +- clang/lib/CodeGen/EHScopeStack.h | 6 +- clang/lib/CodeGen/MicrosoftCXXABI.cpp | 8 +- clang/lib/CodeGen/TargetBuiltins/PPC.cpp | 7 +- clang/lib/CodeGen/TargetInfo.h | 2 +- clang/lib/CodeGen/Targets/XCore.cpp | 2 +- clang/lib/Driver/Driver.cpp | 2 +- clang/lib/Driver/ToolChains/Arch/Mips.h | 2 +- clang/lib/Format/BreakableToken.h | 2 +- clang/lib/Format/Format.cpp | 5 +- clang/lib/Format/QualifierAlignmentFixer.h | 5 +- clang/lib/Format/UnwrappedLineFormatter.cpp | 9 +- clang/lib/Frontend/ASTConsumers.cpp | 2 +- .../lib/Frontend/PrintPreprocessedOutput.cpp | 2 +- .../Frontend/SerializedDiagnosticPrinter.cpp | 12 +-- clang/lib/Index/IndexBody.cpp | 2 +- clang/lib/Index/IndexTypeSourceInfo.cpp | 2 +- clang/lib/Lex/LiteralSupport.cpp | 4 +- clang/lib/Parse/ParsePragma.cpp | 4 +- clang/lib/Sema/AnalysisBasedWarnings.cpp | 26 +++--- clang/lib/Sema/JumpDiagnostics.cpp | 2 +- clang/lib/Sema/Sema.cpp | 5 +- clang/lib/Sema/SemaAPINotes.cpp | 2 +- clang/lib/Sema/SemaAccess.cpp | 2 +- clang/lib/Sema/SemaAttr.cpp | 2 +- clang/lib/Sema/SemaCodeComplete.cpp | 91 ++++++++++--------- clang/lib/Sema/SemaDecl.cpp | 10 +- clang/lib/Sema/SemaDeclCXX.cpp | 14 +-- clang/lib/Sema/SemaDeclObjC.cpp | 8 +- clang/lib/Sema/SemaExpr.cpp | 6 +- clang/lib/Sema/SemaExprMember.cpp | 2 +- clang/lib/Sema/SemaExprObjC.cpp | 2 +- clang/lib/Sema/SemaInit.cpp | 4 +- clang/lib/Sema/SemaLookup.cpp | 10 +- clang/lib/Sema/SemaOpenMP.cpp | 2 +- clang/lib/Sema/SemaOverload.cpp | 4 +- clang/lib/Sema/SemaPseudoObject.cpp | 2 +- clang/lib/Sema/SemaStmt.cpp | 18 ++-- clang/lib/Sema/SemaStmtAsm.cpp | 2 +- clang/lib/Sema/SemaStmtAttr.cpp | 2 +- clang/lib/Sema/SemaTemplate.cpp | 6 +- clang/lib/Sema/SemaTemplateDeductionGuide.cpp | 2 +- clang/lib/Sema/SemaTemplateInstantiate.cpp | 6 +- .../lib/Sema/SemaTemplateInstantiateDecl.cpp | 6 +- clang/lib/Sema/SemaTemplateVariadic.cpp | 4 +- clang/lib/Sema/SemaType.cpp | 2 +- clang/lib/Sema/TreeTransform.h | 42 ++++----- clang/lib/Sema/UsedDeclVisitor.h | 2 +- clang/lib/Serialization/GlobalModuleIndex.cpp | 35 +++---- .../Serialization/TemplateArgumentHasher.cpp | 2 +- .../clang-fuzzer/handle-llvm/handle_llvm.cpp | 2 +- clang/tools/diagtool/DiagTool.cpp | 2 +- clang/tools/diagtool/DiagnosticNames.h | 14 +-- clang/tools/libclang/CIndex.cpp | 8 +- clang/tools/libclang/CIndexHigh.cpp | 2 +- clang/tools/libclang/CLog.h | 2 +- clang/tools/libclang/CXCursor.cpp | 4 +- clang/tools/libclang/CXCursor.h | 6 +- clang/tools/libclang/CXIndexDataConsumer.h | 12 +-- clang/tools/libclang/CXLoadedDiagnostic.cpp | 2 +- clang/tools/libclang/CursorVisitor.h | 6 +- clang/tools/libclang/Index_Internal.h | 4 +- clang/tools/libclang/Indexing.cpp | 2 +- clang/tools/offload-arch/AMDGPUArchByHIP.cpp | 14 +-- clang/tools/offload-arch/NVPTXArch.cpp | 10 +- clang/utils/TableGen/ClangASTNodesEmitter.cpp | 4 +- clang/utils/TableGen/ClangAttrEmitter.cpp | 4 +- .../TableGen/ClangDiagnosticsEmitter.cpp | 12 +-- 106 files changed, 465 insertions(+), 451 deletions(-) diff --git a/clang/lib/APINotes/APINotesFormat.h b/clang/lib/APINotes/APINotesFormat.h index 1b8f0b34af9fc..bb0c276e74964 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 { - using UnsignedInfo = DenseMapInfo; + typedef DenseMapInfo UnsignedInfo; 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 830d04ba1ae7c..ffc5473988735 100644 --- a/clang/lib/APINotes/APINotesWriter.cpp +++ b/clang/lib/APINotes/APINotesWriter.cpp @@ -384,9 +384,7 @@ class ContextIDTableInfo { /// Localized helper to make a type dependent, thwarting template argument /// deduction. -template struct MakeDependent { - using Type = T; -}; +template struct MakeDependent { typedef T Type; }; /// 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 8085719dd0148..803410c54c646 100644 --- a/clang/lib/APINotes/APINotesYAMLCompiler.cpp +++ b/clang/lib/APINotes/APINotesYAMLCompiler.cpp @@ -77,7 +77,7 @@ struct Param { StringRef Type; }; -using ParamsSeq = std::vector; +typedef std::vector ParamsSeq; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(Param) @@ -131,7 +131,7 @@ template <> struct MappingTraits { } // namespace llvm namespace { -using NullabilitySeq = std::vector; +typedef std::vector NullabilitySeq; struct AvailabilityItem { APIAvailability Mode = APIAvailability::Available; @@ -165,7 +165,7 @@ struct Method { StringRef SwiftReturnOwnership; }; -using MethodsSeq = std::vector; +typedef std::vector MethodsSeq; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(Method) @@ -216,7 +216,7 @@ struct Property { StringRef Type; }; -using PropertiesSeq = std::vector; +typedef std::vector PropertiesSeq; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(Property) @@ -255,7 +255,7 @@ struct Class { PropertiesSeq Properties; }; -using ClassesSeq = std::vector; +typedef std::vector ClassesSeq; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(Class) @@ -297,7 +297,7 @@ struct Function { StringRef SwiftReturnOwnership; }; -using FunctionsSeq = std::vector; +typedef std::vector FunctionsSeq; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(Function) @@ -334,7 +334,7 @@ struct GlobalVariable { StringRef Type; }; -using GlobalVariablesSeq = std::vector; +typedef std::vector GlobalVariablesSeq; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(GlobalVariable) @@ -364,7 +364,7 @@ struct EnumConstant { StringRef SwiftName; }; -using EnumConstantsSeq = std::vector; +typedef std::vector EnumConstantsSeq; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(EnumConstant) @@ -424,7 +424,7 @@ struct Field { StringRef Type; }; -using FieldsSeq = std::vector; +typedef std::vector FieldsSeq; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(Field) @@ -448,7 +448,7 @@ template <> struct MappingTraits { namespace { struct Tag; -using TagsSeq = std::vector; +typedef std::vector TagsSeq; struct Tag { StringRef Name; @@ -527,7 +527,7 @@ struct Typedef { std::optional SwiftType; }; -using TypedefsSeq = std::vector; +typedef std::vector TypedefsSeq; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(Typedef) @@ -560,7 +560,7 @@ template <> struct MappingTraits { namespace { struct Namespace; -using NamespacesSeq = std::vector; +typedef std::vector NamespacesSeq; struct TopLevelItems { ClassesSeq Classes; @@ -623,7 +623,7 @@ struct Versioned { TopLevelItems Items; }; -using VersionedSeq = std::vector; +typedef std::vector VersionedSeq; } // namespace LLVM_YAML_IS_SEQUENCE_VECTOR(Versioned) diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp index 53975a789f5ed..ee3dc84479fd9 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*); - using PathElem = const CXXRecordDecl *; + typedef const CXXRecordDecl *PathElem; union { PathElem Path[InlinePathSpace]; PathElem *PathPtr; diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp index 051f9b30a0687..2ef0c31ec1bd9 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 { - using reference = const TemplateArgument &; - using pointer = const TemplateArgument *; + typedef const TemplateArgument& reference; + typedef const TemplateArgument* pointer; /// 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 8981c93b6a62a..2e1a9a3d9ad63 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -835,7 +835,7 @@ std::string PredefinedExpr::ComputeName(PredefinedIdentKind IK, POut << " &&"; } - using SpecsTy = SmallVector; + typedef SmallVector SpecsTy; SpecsTy Specs; const DeclContext *Ctx = FD->getDeclContext(); while (isa_and_nonnull(Ctx)) { @@ -3549,7 +3549,7 @@ bool CallExpr::isCallToStdMove() const { namespace { /// Look for any side effects within a Stmt. class SideEffectFinder : public ConstEvaluatedExprVisitor { - using Inherited = ConstEvaluatedExprVisitor; + typedef ConstEvaluatedExprVisitor Inherited; 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 { - using Inherited = ConstEvaluatedExprVisitor; + typedef ConstEvaluatedExprVisitor Inherited; bool NonTrivial; diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 6772b1510be8d..0d12161756467 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; - using PathEntry = APValue::LValuePathEntry; + typedef APValue::LValuePathEntry PathEntry; /// The entries on the path from the glvalue to the designated subobject. SmallVector Entries; @@ -571,8 +571,8 @@ namespace { // Note that we intentionally use std::map here so that references to // values are stable. - using MapKeyTy = std::pair; - using MapTy = std::map; + typedef std::pair MapKeyTy; + typedef std::map MapTy; /// Temporaries - Temporary lvalues materialized within this stack frame. MapTy Temporaries; @@ -1468,9 +1468,9 @@ namespace { return Success; } }; - using BlockScopeRAII = ScopeRAII; - using FullExpressionRAII = ScopeRAII; - using CallScopeRAII = ScopeRAII; + typedef ScopeRAII BlockScopeRAII; + typedef ScopeRAII FullExpressionRAII; + typedef ScopeRAII CallScopeRAII; } bool SubobjectDesignator::checkSubobject(EvalInfo &Info, const Expr *E, @@ -4156,7 +4156,7 @@ struct ExtractSubobjectHandler { APValue &Result; const AccessKinds AccessKind; - using result_type = bool; + typedef bool result_type; bool failed() { return false; } bool found(APValue &Subobj, QualType SubobjType) { Result = Subobj; @@ -4191,7 +4191,7 @@ struct ModifySubobjectHandler { APValue &NewVal; const Expr *E; - using result_type = bool; + typedef bool result_type; static const AccessKinds AccessKind = AK_Assign; bool checkConst(QualType QT) { @@ -4698,7 +4698,7 @@ struct CompoundAssignSubobjectHandler { static const AccessKinds AccessKind = AK_Assign; - using result_type = bool; + typedef bool result_type; bool checkConst(QualType QT) { // Assigning to a const object has undefined behavior. @@ -4845,7 +4845,7 @@ struct IncDecSubobjectHandler { AccessKinds AccessKind; APValue *Old; - using result_type = bool; + typedef bool result_type; 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; - using result_type = bool; + typedef bool result_type; 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; - using result_type = bool; + typedef bool result_type; 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; - using result_type = bool; + typedef bool result_type; 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; - using StmtVisitorTy = ConstStmtVisitor; - using ExprEvaluatorBaseTy = ExprEvaluatorBase; + typedef ConstStmtVisitor StmtVisitorTy; + typedef ExprEvaluatorBase ExprEvaluatorBaseTy; OptionalDiagnostic CCEDiag(const Expr *E, diag::kind D) { return Info.CCEDiag(E, D); @@ -8750,8 +8750,8 @@ class LValueExprEvaluatorBase protected: LValue &Result; bool InvalidBaseOK; - using LValueExprEvaluatorBaseTy = LValueExprEvaluatorBase; - using ExprEvaluatorBaseTy = ExprEvaluatorBase; + typedef LValueExprEvaluatorBase LValueExprEvaluatorBaseTy; + typedef ExprEvaluatorBase ExprEvaluatorBaseTy; bool Success(APValue::LValueBase B) { Result.set(B); @@ -10517,7 +10517,7 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) { const AccessKinds AccessKind; APValue *Value; - using result_type = bool; + typedef bool result_type; 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. - using ReverseIter = std::reverse_iterator; + typedef std::reverse_iterator ReverseIter; 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 36d76ce677ff5..15f8531a3ab05 100644 --- a/clang/lib/AST/ExternalASTMerger.cpp +++ b/clang/lib/AST/ExternalASTMerger.cpp @@ -31,7 +31,7 @@ template struct Source { template operator Source() { return Source(t); } }; -using Candidate = std::pair, ASTImporter *>; +typedef std::pair, ASTImporter *> Candidate; /// 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 ba467551807f9..2a667934dba42 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 { - using DiscriminatorKeyTy = std::pair; + typedef std::pair DiscriminatorKeyTy; llvm::DenseMap Discriminator; llvm::DenseMap 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. - using AbiTagList = SmallVector; + typedef SmallVector AbiTagList; // 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 99b2433158546..bc47e0506add0 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 { - using DiscriminatorKeyTy = std::pair; + typedef std::pair DiscriminatorKeyTy; llvm::DenseMap Discriminator; llvm::DenseMap Uniquifier; llvm::DenseMap LambdaIds; @@ -316,19 +316,19 @@ class MicrosoftCXXNameMangler { const NamedDecl *Structor; unsigned StructorType; - using BackRefVec = llvm::SmallVector; + typedef llvm::SmallVector BackRefVec; BackRefVec NameBackReferences; - using ArgBackRefMap = llvm::DenseMap; + typedef llvm::DenseMap ArgBackRefMap; ArgBackRefMap FunArgBackReferences; ArgBackRefMap TemplateArgBackReferences; - using TemplateArgStringMap = llvm::DenseMap; + typedef llvm::DenseMap TemplateArgStringMap; TemplateArgStringMap TemplateArgStrings; llvm::BumpPtrAllocator TemplateArgStringStorageAlloc; llvm::StringSaver TemplateArgStringStorage; - using PassObjectSizeArgsSet = std::set>; + typedef std::set> PassObjectSizeArgsSet; PassObjectSizeArgsSet PassObjectSizeArgs; ASTContext &getASTContext() const { return Context.getASTContext(); } diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp index 88d1482e83258..bd87d4418484b 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 { - using Inherited = ConstDeclVisitor; + typedef ConstDeclVisitor Inherited; 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 { - using Inherited = TypeVisitor; + typedef TypeVisitor Inherited; llvm::FoldingSetNodeID &ID; ODRHash &Hash; diff --git a/clang/lib/AST/ParentMap.cpp b/clang/lib/AST/ParentMap.cpp index dc8b929ff4a73..e62e71bf5a514 100644 --- a/clang/lib/AST/ParentMap.cpp +++ b/clang/lib/AST/ParentMap.cpp @@ -18,7 +18,7 @@ using namespace clang; -using MapTy = llvm::DenseMap; +typedef llvm::DenseMap MapTy; enum OpaqueValueMode { OV_Transparent, diff --git a/clang/lib/AST/PrintfFormatString.cpp b/clang/lib/AST/PrintfFormatString.cpp index 453f0122f473e..bcd44f0a85eed 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; -using PrintfSpecifierResult = - clang::analyze_format_string::SpecifierResult; +typedef clang::analyze_format_string::SpecifierResult + PrintfSpecifierResult; //===----------------------------------------------------------------------===// // Methods for parsing format strings. diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp index 9485de987e383..6a74e98dd92d8 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. - using ClassVectorTy = llvm::TinyPtrVector; - using EmptyClassOffsetsMapTy = llvm::DenseMap; + typedef llvm::TinyPtrVector ClassVectorTy; + typedef llvm::DenseMap EmptyClassOffsetsMapTy; EmptyClassOffsetsMapTy EmptyClassOffsets; /// MaxEmptyClassOffset - The highest offset known to contain an empty @@ -560,7 +560,7 @@ void EmptySubobjectMap::UpdateEmptyFieldSubobjects( } } -using ClassSetTy = llvm::SmallPtrSet; +typedef llvm::SmallPtrSet ClassSetTy; class ItaniumRecordLayoutBuilder { protected: @@ -660,7 +660,7 @@ class ItaniumRecordLayoutBuilder { /// field has been handled, if any. bool HandledFirstNonOverlappingEmptyField; - using BaseOffsetsMapTy = llvm::DenseMap; + typedef llvm::DenseMap BaseOffsetsMapTy; /// Bases - base classes and their offsets in the record. BaseOffsetsMapTy Bases; @@ -719,8 +719,8 @@ class ItaniumRecordLayoutBuilder { /// BaseSubobjectInfoAllocator - Allocator for BaseSubobjectInfo objects. llvm::SpecificBumpPtrAllocator BaseSubobjectInfoAllocator; - using BaseSubobjectInfoMapTy = - llvm::DenseMap; + typedef llvm::DenseMap + BaseSubobjectInfoMapTy; /// 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; }; - using BaseOffsetsMapTy = llvm::DenseMap; + typedef llvm::DenseMap BaseOffsetsMapTy; MicrosoftRecordLayoutBuilder(const ASTContext &Context, EmptySubobjectMap *EmptySubobjects) : Context(Context), EmptySubobjects(EmptySubobjects), diff --git a/clang/lib/AST/ScanfFormatString.cpp b/clang/lib/AST/ScanfFormatString.cpp index 30a11c9e69e0e..1227edd47d13d 100644 --- a/clang/lib/AST/ScanfFormatString.cpp +++ b/clang/lib/AST/ScanfFormatString.cpp @@ -25,8 +25,8 @@ using clang::analyze_scanf::ScanfSpecifier; using clang::UpdateOnReturn; using namespace clang; -using ScanfSpecifierResult = - clang::analyze_format_string::SpecifierResult; +typedef clang::analyze_format_string::SpecifierResult + ScanfSpecifierResult; static bool ParseScanList(FormatStringHandler &H, ScanfConversionSpecifier &CS, diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index c292a66a33163..4fc4a99ad2405 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -248,7 +248,7 @@ namespace { // warnings. static good is_good(good) { return good(); } - using children_t = Stmt::child_range(); + typedef Stmt::child_range children_t(); template good implements_children(children_t T::*) { return good(); } @@ -257,14 +257,14 @@ namespace { return bad(); } - using getBeginLoc_t = SourceLocation() const; + typedef SourceLocation getBeginLoc_t() const; template good implements_getBeginLoc(getBeginLoc_t T::*) { return good(); } LLVM_ATTRIBUTE_UNUSED static bad implements_getBeginLoc(getBeginLoc_t Stmt::*) { return bad(); } - using getLocEnd_t = SourceLocation() const; + typedef SourceLocation getLocEnd_t() const; template good implements_getEndLoc(getLocEnd_t T::*) { return good(); } diff --git a/clang/lib/AST/VTableBuilder.cpp b/clang/lib/AST/VTableBuilder.cpp index 6ba80c9922022..0001745a6ff22 100644 --- a/clang/lib/AST/VTableBuilder.cpp +++ b/clang/lib/AST/VTableBuilder.cpp @@ -99,9 +99,10 @@ class FinalOverriders { /// MethodBaseOffsetPairTy - Uniquely identifies a member function /// in a base subobject. - using MethodBaseOffsetPairTy = std::pair; + typedef std::pair MethodBaseOffsetPairTy; - using OverridersMapTy = llvm::DenseMap; + typedef llvm::DenseMap OverridersMapTy; /// OverridersMap - The final overriders for all virtual member functions of /// all the base subobjects of the most derived class. @@ -110,10 +111,10 @@ class FinalOverriders { /// SubobjectsToOffsetsMapTy - A mapping from a base subobject (represented /// as a record decl and a subobject number) and its offsets in the most /// derived class as well as the layout class. - using SubobjectOffsetMapTy = - llvm::DenseMap, CharUnits>; + typedef llvm::DenseMap, + CharUnits> SubobjectOffsetMapTy; - using SubobjectCountMapTy = llvm::DenseMap; + typedef llvm::DenseMap SubobjectCountMapTy; /// ComputeBaseOffsets - Compute the offsets for all base subobjects of the /// given base. @@ -123,7 +124,7 @@ class FinalOverriders { SubobjectOffsetMapTy &SubobjectLayoutClassOffsets, SubobjectCountMapTy &SubobjectCounts); - using VisitedVirtualBasesSetTy = llvm::SmallPtrSet; + typedef llvm::SmallPtrSet VisitedVirtualBasesSetTy; /// dump - dump the final overriders for a base subobject, and all its direct /// and indirect base subobjects. @@ -441,7 +442,7 @@ void FinalOverriders::dump(raw_ostream &Out, BaseSubobject Base, /// VCallOffsetMap - Keeps track of vcall offsets when building a vtable. struct VCallOffsetMap { - using MethodAndOffsetPairTy = std::pair; + typedef std::pair MethodAndOffsetPairTy; /// Offsets - Keeps track of methods and their offsets. // FIXME: This should be a real map and not a vector. @@ -531,8 +532,8 @@ CharUnits VCallOffsetMap::getVCallOffsetOffset(const CXXMethodDecl *MD) { /// VCallAndVBaseOffsetBuilder - Class for building vcall and vbase offsets. class VCallAndVBaseOffsetBuilder { public: - using VBaseOffsetOffsetsMapTy = - llvm::DenseMap; + typedef llvm::DenseMap + VBaseOffsetOffsetsMapTy; private: const ItaniumVTableContext &VTables; @@ -550,7 +551,7 @@ class VCallAndVBaseOffsetBuilder { ASTContext &Context; /// Components - vcall and vbase offset components - using VTableComponentVectorTy = SmallVector; + typedef SmallVector VTableComponentVectorTy; VTableComponentVectorTy Components; /// VisitedVirtualBases - Visited virtual bases. @@ -600,7 +601,7 @@ class VCallAndVBaseOffsetBuilder { } /// Methods for iterating over the components. - using const_iterator = VTableComponentVectorTy::const_reverse_iterator; + typedef VTableComponentVectorTy::const_reverse_iterator const_iterator; const_iterator components_begin() const { return Components.rbegin(); } const_iterator components_end() const { return Components.rend(); } @@ -784,15 +785,15 @@ class ItaniumVTableBuilder { public: /// PrimaryBasesSetVectorTy - A set vector of direct and indirect /// primary bases. - using PrimaryBasesSetVectorTy = - llvm::SmallSetVector; + typedef llvm::SmallSetVector + PrimaryBasesSetVectorTy; - using VBaseOffsetOffsetsMapTy = - llvm::DenseMap; + typedef llvm::DenseMap + VBaseOffsetOffsetsMapTy; - using AddressPointsMapTy = VTableLayout::AddressPointsMapTy; + typedef VTableLayout::AddressPointsMapTy AddressPointsMapTy; - using MethodVTableIndicesTy = llvm::DenseMap; + typedef llvm::DenseMap MethodVTableIndicesTy; private: /// VTables - Global vtable information. @@ -863,7 +864,7 @@ class ItaniumVTableBuilder { MethodInfo(MethodInfo const&) = default; }; - using MethodInfoMapTy = llvm::DenseMap; + typedef llvm::DenseMap MethodInfoMapTy; /// MethodInfoMap - The information for all methods in the vtable we're /// currently building. @@ -873,14 +874,14 @@ class ItaniumVTableBuilder { /// point) where the function pointer for a virtual function is stored. MethodVTableIndicesTy MethodVTableIndices; - using VTableThunksMapTy = llvm::DenseMap; + typedef llvm::DenseMap VTableThunksMapTy; /// VTableThunks - The thunks by vtable index in the vtable currently being /// built. VTableThunksMapTy VTableThunks; - using ThunkInfoVectorTy = SmallVector; - using ThunksMapTy = llvm::DenseMap; + typedef SmallVector ThunkInfoVectorTy; + typedef llvm::DenseMap ThunksMapTy; /// Thunks - A map that contains all the thunks needed for all methods in the /// most derived class for which the vtable is currently being built. @@ -893,7 +894,7 @@ class ItaniumVTableBuilder { /// part of the vtable we're currently building. void ComputeThisAdjustments(); - using VisitedVirtualBasesSetTy = llvm::SmallPtrSet; + typedef llvm::SmallPtrSet VisitedVirtualBasesSetTy; /// PrimaryVirtualBases - All known virtual bases who are a primary base of /// some other base. @@ -1081,7 +1082,7 @@ void ItaniumVTableBuilder::AddThunk(const CXXMethodDecl *MD, ThunksVector.push_back(Thunk); } -using OverriddenMethodsSetTy = llvm::SmallPtrSet; +typedef llvm::SmallPtrSet OverriddenMethodsSetTy; /// Visit all the methods overridden by the given method recursively, /// in a depth-first pre-order. The Visitor's visitor method returns a bool @@ -1443,7 +1444,7 @@ bool ItaniumVTableBuilder::IsOverriderUsed( return OverridesIndirectMethodInBases(Overrider, PrimaryBases); } -using BasesSetVectorTy = llvm::SmallSetVector; +typedef llvm::SmallSetVector BasesSetVectorTy; /// FindNearestOverriddenMethod - Given a method, returns the overridden method /// from the nearest base. Returns null if no method was found. @@ -1517,7 +1518,7 @@ void ItaniumVTableBuilder::AddMethods( llvm_unreachable("Found a duplicate primary base!"); } - using NewVirtualFunctionsTy = llvm::SmallVector; + typedef llvm::SmallVector NewVirtualFunctionsTy; NewVirtualFunctionsTy NewVirtualFunctions; llvm::SmallVector NewImplicitVirtualFunctions; @@ -2511,11 +2512,11 @@ namespace { class VFTableBuilder { public: - using MethodVFTableLocationsTy = - llvm::DenseMap; + typedef llvm::DenseMap + MethodVFTableLocationsTy; - using method_locations_range = - llvm::iterator_range; + typedef llvm::iterator_range + method_locations_range; private: /// VTables - Global vtable information. @@ -2572,20 +2573,20 @@ class VFTableBuilder { UsesExtraSlot(false) {} }; - using MethodInfoMapTy = llvm::DenseMap; + typedef llvm::DenseMap MethodInfoMapTy; /// MethodInfoMap - The information for all methods in the vftable we're /// currently building. MethodInfoMapTy MethodInfoMap; - using VTableThunksMapTy = llvm::DenseMap; + typedef llvm::DenseMap VTableThunksMapTy; /// VTableThunks - The thunks by vftable index in the vftable currently being /// built. VTableThunksMapTy VTableThunks; - using ThunkInfoVectorTy = SmallVector; - using ThunksMapTy = llvm::DenseMap; + typedef SmallVector ThunkInfoVectorTy; + typedef llvm::DenseMap ThunksMapTy; /// Thunks - A map that contains all the thunks needed for all methods in the /// most derived class for which the vftable is currently being built. @@ -3005,9 +3006,9 @@ static void GroupNewVirtualOverloads( // (including overrides, non-virtual methods and any other named decl that // might be nested within the class). // 2) In each group, new overloads appear in the reverse order of declaration. - using MethodGroup = SmallVector; + typedef SmallVector MethodGroup; SmallVector Groups; - using VisitedGroupIndicesTy = llvm::DenseMap; + typedef llvm::DenseMap VisitedGroupIndicesTy; VisitedGroupIndicesTy VisitedGroupIndices; for (const auto *D : RD->decls()) { const auto *ND = dyn_cast(D); @@ -3510,8 +3511,8 @@ static bool rebucketPaths(VPtrInfoVector &Paths) { MicrosoftVTableContext::~MicrosoftVTableContext() {} namespace { -using FullPathTy = llvm::SetVector, - llvm::DenseSet>; +typedef llvm::SetVector, + llvm::DenseSet> FullPathTy; } // This recursive function finds all paths from a subobject centered at @@ -3600,7 +3601,7 @@ static const FullPathTy *selectBestPath(ASTContext &Context, return &FullPaths.front(); const FullPathTy *BestPath = nullptr; - using OverriderSetTy = std::set; + typedef std::set OverriderSetTy; OverriderSetTy LastOverrides; for (const FullPathTy &SpecificPath : FullPaths) { assert(!SpecificPath.empty()); diff --git a/clang/lib/ASTMatchers/ASTMatchFinder.cpp b/clang/lib/ASTMatchers/ASTMatchFinder.cpp index 6468fb6133f26..6d0ba0b7907a1 100644 --- a/clang/lib/ASTMatchers/ASTMatchFinder.cpp +++ b/clang/lib/ASTMatchers/ASTMatchFinder.cpp @@ -34,7 +34,7 @@ namespace ast_matchers { namespace internal { namespace { -using MatchCallback = MatchFinder::MatchCallback; +typedef MatchFinder::MatchCallback MatchCallback; // The maximum number of memoization entries to store. // 10k has been experimentally found to give a good trade-off @@ -90,7 +90,7 @@ struct MemoizedMatchResult { class MatchChildASTVisitor : public RecursiveASTVisitor { public: - using VisitorBase = RecursiveASTVisitor; + typedef RecursiveASTVisitor VisitorBase; // Creates an AST visitor that matches 'matcher' on all children or // descendants of a traversed node. max_depth is the maximum depth @@ -1363,7 +1363,7 @@ class MatchASTVisitor : public RecursiveASTVisitor, CompatibleAliases; // Maps (matcher, node) -> the match result for memoization. - using MemoizationMap = std::map; + typedef std::map MemoizationMap; MemoizationMap ResultCache; }; diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h index 39ab1e38351bd..9f3a4cd2da716 100644 --- a/clang/lib/Basic/Targets/PPC.h +++ b/clang/lib/Basic/Targets/PPC.h @@ -27,7 +27,7 @@ namespace targets { class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo { /// Flags for architecture specific defines. - using ArchDefineTypes = enum { + typedef enum { ArchDefineNone = 0, ArchDefineName = 1 << 0, // is substituted for arch name. ArchDefinePpcgr = 1 << 1, @@ -48,7 +48,7 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo { ArchDefineFuture = 1 << 16, ArchDefineA2 = 1 << 17, ArchDefineE500 = 1 << 18 - }; + } ArchDefineTypes; ArchDefineTypes ArchDefs = ArchDefineNone; static const char *const GCCRegNames[]; diff --git a/clang/lib/CodeGen/CGBuilder.h b/clang/lib/CodeGen/CGBuilder.h index ad2dab46479a8..090f75d3b5d3c 100644 --- a/clang/lib/CodeGen/CGBuilder.h +++ b/clang/lib/CodeGen/CGBuilder.h @@ -42,10 +42,10 @@ class CGBuilderInserter final : public llvm::IRBuilderDefaultInserter { CodeGenFunction *CGF = nullptr; }; -using CGBuilderInserterTy = CGBuilderInserter; +typedef CGBuilderInserter CGBuilderInserterTy; -using CGBuilderBaseTy = - llvm::IRBuilder; +typedef llvm::IRBuilder + CGBuilderBaseTy; class CGBuilderTy : public CGBuilderBaseTy { friend class Address; diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h index ae1b620f45306..0b4e3f9cb0365 100644 --- a/clang/lib/CodeGen/CGCall.h +++ b/clang/lib/CodeGen/CGCall.h @@ -329,8 +329,8 @@ class CallArgList : public SmallVector { bool hasWritebacks() const { return !Writebacks.empty(); } - using writeback_const_range = - llvm::iterator_range::const_iterator>; + typedef llvm::iterator_range::const_iterator> + writeback_const_range; writeback_const_range writebacks() const { return writeback_const_range(Writebacks.begin(), Writebacks.end()); diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index efa71a2b47305..4a465e6526da0 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -528,7 +528,7 @@ namespace { /// A visitor which checks whether an initializer uses 'this' in a /// way which requires the vtable to be properly set. struct DynamicThisUseChecker : ConstEvaluatedExprVisitor { - using super = ConstEvaluatedExprVisitor; + typedef ConstEvaluatedExprVisitor super; bool UsesThis; diff --git a/clang/lib/CodeGen/CGCleanup.h b/clang/lib/CodeGen/CGCleanup.h index bb2c29503affd..ba78e5478ac37 100644 --- a/clang/lib/CodeGen/CGCleanup.h +++ b/clang/lib/CodeGen/CGCleanup.h @@ -234,7 +234,7 @@ class EHCatchScope : public EHScope { delete getHandler(I).Block; } - using iterator = const Handler *; + typedef const Handler *iterator; iterator begin() const { return getHandlers(); } iterator end() const { return getHandlers() + getNumHandlers(); } diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 2cfb5e9cdfd76..e24c68ed02865 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -3354,7 +3354,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty, { // Use 'char' for the isClassProperty bit as DenseSet requires space for // empty/tombstone keys in the data type (and bool is too small for that). - using IsClassAndIdent = std::pair; + typedef std::pair IsClassAndIdent; /// List of already emitted properties. Two distinct class and instance /// properties can share the same identifier (but not two instance /// properties or two class properties). diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 6131f702f481b..85c768807572f 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -6620,7 +6620,7 @@ static LValueOrRValue emitPseudoObjectExpr(CodeGenFunction &CGF, // If this is the result expression, we may need to evaluate // directly into the slot. - using OVMA = CodeGenFunction::OpaqueValueMappingData; + typedef CodeGenFunction::OpaqueValueMappingData OVMA; OVMA opaqueData; if (ov == resultExpr && ov->isPRValue() && !forLValue && CodeGenFunction::hasAggregateEvaluationKind(ov->getType())) { diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index 9061f3447fe82..359e30cb8f5cd 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -1435,9 +1435,9 @@ namespace { template class CallDeleteDuringNew final : public EHScopeStack::Cleanup { /// Type used to hold llvm::Value*s. - using ValueTy = typename Traits::ValueTy; + typedef typename Traits::ValueTy ValueTy; /// Type used to hold RValues. - using RValueTy = typename Traits::RValueTy; + typedef typename Traits::RValueTy RValueTy; struct PlacementArg { RValueTy ArgValue; QualType ArgType; @@ -1549,13 +1549,13 @@ static void EnterNewDeleteCleanup(CodeGenFunction &CGF, const CXXNewExpr *E, // dominate and we can do the easier (and more efficient) thing. if (!CGF.isInConditionalBranch()) { struct DirectCleanupTraits { - using ValueTy = llvm::Value *; - using RValueTy = RValue; + typedef llvm::Value *ValueTy; + typedef RValue RValueTy; static RValue get(CodeGenFunction &, ValueTy V) { return RValue::get(V); } static RValue get(CodeGenFunction &, RValueTy V) { return V; } }; - using DirectCleanup = CallDeleteDuringNew; + typedef CallDeleteDuringNew DirectCleanup; DirectCleanup *Cleanup = CGF.EHStack.pushCleanupWithExtra( EHCleanup, E->getNumPlacementArgs(), E->getOperatorDelete(), @@ -1577,13 +1577,13 @@ static void EnterNewDeleteCleanup(CodeGenFunction &CGF, const CXXNewExpr *E, DominatingValue::saved_type SavedTypeIdentity = DominatingValue::save(CGF, TypeIdentity); struct ConditionalCleanupTraits { - using ValueTy = DominatingValue::saved_type; - using RValueTy = DominatingValue::saved_type; + typedef DominatingValue::saved_type ValueTy; + typedef DominatingValue::saved_type RValueTy; static RValue get(CodeGenFunction &CGF, ValueTy V) { return V.restore(CGF); } }; - using ConditionalCleanup = CallDeleteDuringNew; + typedef CallDeleteDuringNew ConditionalCleanup; ConditionalCleanup *Cleanup = CGF.EHStack.pushCleanupWithExtra( diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp index 742182b683326..f8a946a76554a 100644 --- a/clang/lib/CodeGen/CGExprComplex.cpp +++ b/clang/lib/CodeGen/CGExprComplex.cpp @@ -31,7 +31,7 @@ namespace llvm { extern cl::opt EnableSingleByteCoverage; } // namespace llvm -using ComplexPairTy = CodeGenFunction::ComplexPairTy; +typedef CodeGenFunction::ComplexPairTy ComplexPairTy; /// Return the complex type that we are meant to emit. static const ComplexType *getComplexType(QualType type) { @@ -1525,7 +1525,7 @@ LValue CodeGenFunction::EmitComplexAssignmentLValue(const BinaryOperator *E) { return LVal; } -using CompoundFunc = ComplexPairTy (ComplexExprEmitter::*)( +typedef ComplexPairTy (ComplexExprEmitter::*CompoundFunc)( const ComplexExprEmitter::BinOpInfo &); static CompoundFunc getComplexOp(BinaryOperatorKind Op) { diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp index ec4fbc36fc2f8..a47d1cc22980d 100644 --- a/clang/lib/CodeGen/CGHLSLRuntime.cpp +++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp @@ -664,7 +664,7 @@ class OpaqueValueVisitor : public RecursiveASTVisitor { void CGHLSLRuntime::emitInitListOpaqueValues(CodeGenFunction &CGF, InitListExpr *E) { - using OpaqueValueMappingData = CodeGenFunction::OpaqueValueMappingData; + typedef CodeGenFunction::OpaqueValueMappingData OpaqueValueMappingData; OpaqueValueVisitor Visitor; Visitor.TraverseStmt(E); for (auto *OVE : Visitor.OVEs) { diff --git a/clang/lib/CodeGen/CGNonTrivialStruct.cpp b/clang/lib/CodeGen/CGNonTrivialStruct.cpp index c5af3526bdc0e..e0983ef256e71 100644 --- a/clang/lib/CodeGen/CGNonTrivialStruct.cpp +++ b/clang/lib/CodeGen/CGNonTrivialStruct.cpp @@ -631,7 +631,7 @@ struct GenDefaultInitialize GenFuncBase, DefaultInitializedTypeVisitor { using Super = DefaultInitializedTypeVisitor; - using GenFuncBaseTy = GenFuncBase; + typedef GenFuncBase GenFuncBaseTy; GenDefaultInitialize(ASTContext &Ctx) : StructVisitor(Ctx) {} diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index fdc1c42d8a14e..24b6ce7c1c70d 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -33,7 +33,7 @@ using namespace clang; using namespace CodeGen; -using TryEmitResult = llvm::PointerIntPair; +typedef llvm::PointerIntPair TryEmitResult; static TryEmitResult tryEmitARCRetainScalarExpr(CodeGenFunction &CGF, const Expr *e); static RValue AdjustObjCObjectType(CodeGenFunction &CGF, @@ -2996,8 +2996,9 @@ static TryEmitResult tryEmitARCRetainLoadOfScalar(CodeGenFunction &CGF, return tryEmitARCRetainLoadOfScalar(CGF, CGF.EmitLValue(e), type); } -using ValueTransform = - llvm::function_ref; +typedef llvm::function_ref + ValueTransform; /// Insert code immediately after a call. @@ -3187,7 +3188,7 @@ ARCExprEmitter::visitPseudoObjectExpr(const PseudoObjectExpr *E) { // If this semantic expression is an opaque value, bind it // to the result of its source expression. if (const OpaqueValueExpr *ov = dyn_cast(semantic)) { - using OVMA = CodeGenFunction::OpaqueValueMappingData; + typedef CodeGenFunction::OpaqueValueMappingData OVMA; OVMA opaqueData; // If this semantic is the result of the pseudo-object diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index 1b13ae71e6e52..8acf8d2ddec02 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -357,11 +357,12 @@ class CGObjCGNU : public CGObjCRuntime { /// string. Selector references are all done via the module's selector table, /// so we create an alias as a placeholder and then replace it with the real /// value later. - using TypedSelector = std::pair; + typedef std::pair TypedSelector; /// Type of the selector map. This is roughly equivalent to the structure /// used in the GNUstep runtime, which maintains a list of all of the valid /// types for a selector in a table. - using SelectorMap = llvm::DenseMap>; + typedef llvm::DenseMap > + SelectorMap; /// A map from selectors to selector types. This allows us to emit all /// selectors of the same name and type together. SelectorMap SelectorTable; @@ -375,7 +376,7 @@ class CGObjCGNU : public CGObjCRuntime { LazyRuntimeFunction IvarAssignFn, StrongCastAssignFn, MemMoveFn, WeakReadFn, WeakAssignFn, GlobalAssignFn; - using ClassAliasPair = std::pair; + typedef std::pair ClassAliasPair; /// All classes that have aliases set for them. std::vector ClassAliases; @@ -963,8 +964,8 @@ class CGObjCGNUstep2 : public CGObjCGNUstep { /// Generate the name of a symbol for a reference to a class. Accesses to /// classes should be indirected via this. - using EarlyInitPair = - std::pair>; + typedef std::pair> + EarlyInitPair; std::vector EarlyInitList; std::string SymbolForClassRef(StringRef Name, bool isWeak) { diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 2b86d80252fe6..ce2dd4d76368a 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -2845,7 +2845,7 @@ struct PrivateHelpersTy { return !OriginalRef && !PrivateCopy && !PrivateElemInit; } }; -using PrivateDataTy = std::pair; +typedef std::pair PrivateDataTy; } // anonymous namespace static bool isAllocatableDecl(const VarDecl *VD) { diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h index 68420893b3ffa..5be48b439f4fd 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.h +++ b/clang/lib/CodeGen/CGOpenMPRuntime.h @@ -67,7 +67,7 @@ class PrePostActionTy { /// an advanced with possible pre|post-actions in codegen. class RegionCodeGenTy final { intptr_t CodeGen; - using CodeGenTy = void (*)(intptr_t, CodeGenFunction &, PrePostActionTy &); + typedef void (*CodeGenTy)(intptr_t, CodeGenFunction &, PrePostActionTy &); CodeGenTy Callback; mutable PrePostActionTy *PrePostAction; RegionCodeGenTy() = delete; @@ -384,7 +384,7 @@ class CGOpenMPRuntime { protected: /// Map for SourceLocation and OpenMP runtime library debug locations. - using OpenMPDebugLocMapTy = llvm::DenseMap; + typedef llvm::DenseMap OpenMPDebugLocMapTy; OpenMPDebugLocMapTy OpenMPDebugLocMap; /// Stores debug location and ThreadID for the function. struct DebugLocThreadIdTy { @@ -394,18 +394,18 @@ class CGOpenMPRuntime { llvm::AssertingVH ServiceInsertPt = nullptr; }; /// Map of local debug location, ThreadId and functions. - using OpenMPLocThreadIDMapTy = - llvm::DenseMap; + typedef llvm::DenseMap + OpenMPLocThreadIDMapTy; OpenMPLocThreadIDMapTy OpenMPLocThreadIDMap; /// Map of UDRs and corresponding combiner/initializer. - using UDRMapTy = - llvm::DenseMap>; + typedef llvm::DenseMap> + UDRMapTy; UDRMapTy UDRMap; /// Map of functions and locally defined UDRs. - using FunctionUDRMapTy = - llvm::DenseMap>; + typedef llvm::DenseMap> + FunctionUDRMapTy; FunctionUDRMapTy FunctionUDRMap; /// Map from the user-defined mapper declaration to its corresponding /// functions. diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index 0453980d706e1..5822e0f6db89a 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -1539,9 +1539,10 @@ namespace { /// Codegen lambda for appending distribute lower and upper bounds to outlined /// parallel function. This is necessary for combined constructs such as /// 'distribute parallel for' -using CodeGenBoundParametersTy = - llvm::function_ref &)>; +typedef llvm::function_ref &)> + CodeGenBoundParametersTy; } // anonymous namespace static void diff --git a/clang/lib/CodeGen/CGVTables.h b/clang/lib/CodeGen/CGVTables.h index a929aacdd9a59..5c45e355fb145 100644 --- a/clang/lib/CodeGen/CGVTables.h +++ b/clang/lib/CodeGen/CGVTables.h @@ -35,16 +35,16 @@ class CodeGenVTables { VTableContextBase *VTContext; /// VTableAddressPointsMapTy - Address points for a single vtable. - using VTableAddressPointsMapTy = VTableLayout::AddressPointsMapTy; + typedef VTableLayout::AddressPointsMapTy VTableAddressPointsMapTy; - using BaseSubobjectPairTy = std::pair; - using SubVTTIndicesMapTy = llvm::DenseMap; + typedef std::pair BaseSubobjectPairTy; + typedef llvm::DenseMap SubVTTIndicesMapTy; /// SubVTTIndices - Contains indices into the various sub-VTTs. SubVTTIndicesMapTy SubVTTIndices; - using SecondaryVirtualPointerIndicesMapTy = - llvm::DenseMap; + typedef llvm::DenseMap + SecondaryVirtualPointerIndicesMapTy; /// SecondaryVirtualPointerIndices - Contains the secondary virtual pointer /// indices. diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 60d3f5234f55a..6c32c98cec011 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -119,7 +119,7 @@ enum TypeEvaluationKind { /// Helper class with most of the code for saving a value for a /// conditional expression cleanup. struct DominatingLLVMValue { - using saved_type = llvm::PointerIntPair; + typedef llvm::PointerIntPair saved_type; /// Answer whether the given value needs extra work to be saved. static bool needsSaving(llvm::Value *value) { @@ -142,7 +142,7 @@ struct DominatingLLVMValue { /// A partial specialization of DominatingValue for llvm::Values that /// might be llvm::Instructions. template struct DominatingPointer : DominatingLLVMValue { - using type = T *; + typedef T *type; static type restore(CodeGenFunction &CGF, saved_type value) { return static_cast(DominatingLLVMValue::restore(CGF, value)); } @@ -150,7 +150,7 @@ template struct DominatingPointer : DominatingLLVMValue { /// A specialization of DominatingValue for Address. template <> struct DominatingValue
{ - using type = Address; + typedef Address type; struct saved_type { DominatingLLVMValue::saved_type BasePtr; @@ -180,7 +180,7 @@ template <> struct DominatingValue
{ /// A specialization of DominatingValue for RValue. template <> struct DominatingValue { - using type = RValue; + typedef RValue type; class saved_type { enum Kind { ScalarLiteral, @@ -281,7 +281,7 @@ class CodeGenFunction : public CodeGenTypeCache { // For EH/SEH outlined funclets, this field points to parent's CGF CodeGenFunction *ParentCGF = nullptr; - using ComplexPairTy = std::pair; + typedef std::pair ComplexPairTy; LoopInfoStack LoopStack; CGBuilderTy Builder; @@ -314,20 +314,23 @@ class CodeGenFunction : public CodeGenTypeCache { int ExpectedOMPLoopDepth = 0; // CodeGen lambda for loops and support for ordered clause - using CodeGenLoopTy = llvm::function_ref; - using CodeGenOrderedTy = llvm::function_ref; + typedef llvm::function_ref + CodeGenLoopTy; + typedef llvm::function_ref + CodeGenOrderedTy; // Codegen lambda for loop bounds in worksharing loop constructs - using CodeGenLoopBoundsTy = llvm::function_ref( - CodeGenFunction &, const OMPExecutableDirective &S)>; + typedef llvm::function_ref( + CodeGenFunction &, const OMPExecutableDirective &S)> + CodeGenLoopBoundsTy; // Codegen lambda for loop bounds in dispatch-based loop implementation - using CodeGenDispatchBoundsTy = - llvm::function_ref( - CodeGenFunction &, const OMPExecutableDirective &S, Address LB, - Address UB)>; + typedef llvm::function_ref( + CodeGenFunction &, const OMPExecutableDirective &S, Address LB, + Address UB)> + CodeGenDispatchBoundsTy; /// CGBuilder insert helper. This function is called after an /// instruction is created using Builder. @@ -907,10 +910,10 @@ class CodeGenFunction : public CodeGenTypeCache { return EHStack.pushCleanup(kind, A...); // Stash values in a tuple so we can guarantee the order of saves. - using SavedTuple = std::tuple::saved_type...>; + typedef std::tuple::saved_type...> SavedTuple; SavedTuple Saved{saveValueInCond(A)...}; - using CleanupType = EHScopeStack::ConditionalCleanup; + typedef EHScopeStack::ConditionalCleanup CleanupType; EHStack.pushCleanupTuple(kind, Saved); initFullExprCleanup(); } @@ -927,10 +930,10 @@ class CodeGenFunction : public CodeGenTypeCache { assert(!DominatingValue
::needsSaving(ActiveFlag) && "cleanup active flag should never need saving"); - using SavedTuple = std::tuple::saved_type...>; + typedef std::tuple::saved_type...> SavedTuple; SavedTuple Saved{saveValueInCond(A)...}; - using CleanupType = EHScopeStack::ConditionalCleanup; + typedef EHScopeStack::ConditionalCleanup CleanupType; pushCleanupAfterFullExprWithActiveFlag(Kind, ActiveFlag, Saved); } @@ -1115,7 +1118,7 @@ class CodeGenFunction : public CodeGenTypeCache { void rescopeLabels(); }; - using DeclMapTy = llvm::DenseMap; + typedef llvm::DenseMap DeclMapTy; /// The class used to assign some variables some temporarily addresses. class OMPMapVars { @@ -2191,7 +2194,7 @@ class CodeGenFunction : public CodeGenTypeCache { // Cleanups //===--------------------------------------------------------------------===// - using Destroyer = void(CodeGenFunction &CGF, Address addr, QualType ty); + typedef void Destroyer(CodeGenFunction &CGF, Address addr, QualType ty); void pushIrregularPartialArrayCleanup(llvm::Value *arrayBegin, Address arrayEndPointer, @@ -2443,9 +2446,9 @@ class CodeGenFunction : public CodeGenTypeCache { /// Initialize the vtable pointer of the given subobject. void InitializeVTablePointer(const VPtr &vptr); - using VPtrsVector = llvm::SmallVector; + typedef llvm::SmallVector VPtrsVector; - using VisitedVirtualBasesSetTy = llvm::SmallPtrSet; + typedef llvm::SmallPtrSet VisitedVirtualBasesSetTy; VPtrsVector getVTablePointers(const CXXRecordDecl *VTableClass); void getVTablePointers(BaseSubobject Base, const CXXRecordDecl *NearestVBase, @@ -3381,7 +3384,7 @@ class CodeGenFunction : public CodeGenTypeCache { void EmitScalarInit(const Expr *init, const ValueDecl *D, LValue lvalue, bool capturedByInit); - using SpecialInitFn = void(CodeGenFunction &Init, const VarDecl &D, + typedef void SpecialInitFn(CodeGenFunction &Init, const VarDecl &D, llvm::Value *Address); /// Determine whether the given initializer is trivial in the sense @@ -3819,9 +3822,10 @@ class CodeGenFunction : public CodeGenTypeCache { /// initialized with the value of the original variable, false otherwise. bool EmitOMPLinearClauseInit(const OMPLoopDirective &D); - using TaskGenTy = const llvm::function_ref; + typedef const llvm::function_ref + TaskGenTy; void EmitOMPTaskBasedDirective(const OMPExecutableDirective &S, const OpenMPDirectiveKind CapturedRegion, const RegionCodeGenTy &BodyGen, diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 9af590879ff11..cb013feb769fc 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -341,7 +341,7 @@ class CodeGenModule : public CodeGenTypeCache { llvm::Constant *AssociatedData; }; - using CtorList = std::vector; + typedef std::vector CtorList; private: ASTContext &Context; @@ -506,8 +506,8 @@ class CodeGenModule : public CodeGenTypeCache { /// Map used to track internal linkage functions declared within /// extern "C" regions. - using StaticExternCMap = - llvm::MapVector; + typedef llvm::MapVector StaticExternCMap; StaticExternCMap StaticExternCValues; /// thread_local variables defined or used in this TU. @@ -528,8 +528,8 @@ class CodeGenModule : public CodeGenTypeCache { /// that we don't re-emit the initializer. llvm::DenseMap DelayedCXXInitPosition; - using GlobalInitData = - std::pair; + typedef std::pair + GlobalInitData; // When a tail call is performed on an "undefined" symbol, on PPC without pc // relative feature, the tail call is not allowed. In "EmitCall" for such @@ -553,13 +553,14 @@ class CodeGenModule : public CodeGenTypeCache { /// Global destructor functions and arguments that need to run on termination. /// When UseSinitAndSterm is set, it instead contains sterm finalizer /// functions, which also run on unloading a shared library. - using CXXGlobalDtorsOrStermFinalizer_t = - std::tuple; + typedef std::tuple + CXXGlobalDtorsOrStermFinalizer_t; SmallVector CXXGlobalDtorsOrStermFinalizers; - using StermFinalizerData = - std::pair; + typedef std::pair + StermFinalizerData; struct StermFinalizerPriorityCmp { bool operator()(const StermFinalizerData &LHS, @@ -658,7 +659,7 @@ class CodeGenModule : public CodeGenTypeCache { /// Mapping from canonical types to their metadata identifiers. We need to /// maintain this mapping because identifiers may be formed from distinct /// MDNodes. - using MetadataTypeMap = llvm::DenseMap; + typedef llvm::DenseMap MetadataTypeMap; MetadataTypeMap MetadataIdMap; MetadataTypeMap VirtualMetadataIdMap; MetadataTypeMap GeneralizedMetadataIdMap; diff --git a/clang/lib/CodeGen/CodeGenTypes.h b/clang/lib/CodeGen/CodeGenTypes.h index b67f40c85cec8..29f6f1ec80bc3 100644 --- a/clang/lib/CodeGen/CodeGenTypes.h +++ b/clang/lib/CodeGen/CodeGenTypes.h @@ -39,7 +39,7 @@ class RecordDecl; class TagDecl; class TargetInfo; class Type; -using CanQualType = CanQual; +typedef CanQual CanQualType; class GlobalDecl; namespace CodeGen { diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index 24de269079f93..4aafac349e3e9 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -269,8 +269,8 @@ class CoverageMappingBuilder { /// It is produced by emitExpansionRegions() and is used in /// emitSourceRegions() to suppress producing code regions if /// the same area is covered by expansion regions. - using SourceRegionFilter = - llvm::SmallSet, 8>; + typedef llvm::SmallSet, 8> + SourceRegionFilter; CoverageMappingBuilder(CoverageMappingModuleGen &CVM, SourceManager &SM, const LangOptions &LangOpts) diff --git a/clang/lib/CodeGen/EHScopeStack.h b/clang/lib/CodeGen/EHScopeStack.h index 15e5f5b609df5..ed11dc2bb05d7 100644 --- a/clang/lib/CodeGen/EHScopeStack.h +++ b/clang/lib/CodeGen/EHScopeStack.h @@ -53,8 +53,8 @@ struct BranchFixup { }; template struct InvariantValue { - using type = T; - using saved_type = T; + typedef T type; + typedef T saved_type; static bool needsSaving(type value) { return false; } static saved_type save(CodeGenFunction &CGF, type value) { return value; } static type restore(CodeGenFunction &CGF, saved_type value) { return value; } @@ -206,7 +206,7 @@ class EHScopeStack { /// then restores them and performs the cleanup. template class ConditionalCleanup final : public Cleanup { - using SavedTuple = std::tuple::saved_type...>; + typedef std::tuple::saved_type...> SavedTuple; SavedTuple Saved; template diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp index 86015576e7a36..a181559834296 100644 --- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp @@ -804,9 +804,9 @@ class MicrosoftCXXABI : public CGCXXABI { isPermittedToBeHomogeneousAggregate(const CXXRecordDecl *RD) const override; private: - using VFTableIdTy = std::pair; - using VTablesMapTy = llvm::DenseMap; - using VFTablesMapTy = llvm::DenseMap; + typedef std::pair VFTableIdTy; + typedef llvm::DenseMap VTablesMapTy; + typedef llvm::DenseMap VFTablesMapTy; /// All the vftables that have been referenced. VFTablesMapTy VFTablesMap; VTablesMapTy VTablesMap; @@ -1250,7 +1250,7 @@ void MicrosoftCXXABI::initializeHiddenVirtualInheritanceMembers( // Outside the ctors and dtors, the values of vtorDisps are zero. const ASTRecordLayout &Layout = getContext().getASTRecordLayout(RD); - using VBOffsets = ASTRecordLayout::VBaseOffsetsMapTy; + typedef ASTRecordLayout::VBaseOffsetsMapTy VBOffsets; const VBOffsets &VBaseMap = Layout.getVBaseOffsetsMap(); CGBuilderTy &Builder = CGF.Builder; diff --git a/clang/lib/CodeGen/TargetBuiltins/PPC.cpp b/clang/lib/CodeGen/TargetBuiltins/PPC.cpp index 40c17f730a464..270e9fc976f23 100644 --- a/clang/lib/CodeGen/TargetBuiltins/PPC.cpp +++ b/clang/lib/CodeGen/TargetBuiltins/PPC.cpp @@ -145,7 +145,7 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID, StringRef CPUStr = cast(CPUExpr)->getString(); llvm::Triple Triple = getTarget().getTriple(); - using CPUInfo = std::tuple; + typedef std::tuple CPUInfo; auto [LinuxSupportMethod, LinuxIDValue, AIXSupportMethod, AIXIDValue] = static_cast(StringSwitch(CPUStr) @@ -183,8 +183,9 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID, const Expr *CPUExpr = E->getArg(0)->IgnoreParenCasts(); StringRef CPUStr = cast(CPUExpr)->getString(); if (Triple.isOSAIX()) { - using CPUSupportType = std::tuple; + typedef std::tuple + CPUSupportType; auto [SupportMethod, FieldIdx, Mask, CompOp, Value] = static_cast(StringSwitch(CPUStr) #define PPC_AIX_FEATURE(NAME, DESC, SUPPORT_METHOD, INDEX, MASK, COMP_OP, \ diff --git a/clang/lib/CodeGen/TargetInfo.h b/clang/lib/CodeGen/TargetInfo.h index cd6e213f6f326..d0edae1295094 100644 --- a/clang/lib/CodeGen/TargetInfo.h +++ b/clang/lib/CodeGen/TargetInfo.h @@ -364,7 +364,7 @@ class TargetCodeGenInfo { /// Interface class for filling custom fields of a block literal for OpenCL. class TargetOpenCLBlockHelper { public: - using ValueTy = std::pair; + typedef std::pair ValueTy; TargetOpenCLBlockHelper() {} virtual ~TargetOpenCLBlockHelper() {} /// Get the custom field types for OpenCL blocks. diff --git a/clang/lib/CodeGen/Targets/XCore.cpp b/clang/lib/CodeGen/Targets/XCore.cpp index 4d55fd027f5cf..b7824bde5f55a 100644 --- a/clang/lib/CodeGen/Targets/XCore.cpp +++ b/clang/lib/CodeGen/Targets/XCore.cpp @@ -20,7 +20,7 @@ namespace { /// A SmallStringEnc instance is used to build up the TypeString by passing /// it by reference between functions that append to it. -using SmallStringEnc = llvm::SmallString<128>; +typedef llvm::SmallString<128> SmallStringEnc; /// TypeStringCache caches the meta encodings of Types. /// diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 2907d7a159833..ec1135eecd401 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -3160,7 +3160,7 @@ class OffloadingActionBuilder final { /// Builder interface. It doesn't build anything or keep any state. class DeviceActionBuilder { public: - using PhasesTy = const llvm::SmallVectorImpl; + typedef const llvm::SmallVectorImpl PhasesTy; enum ActionBuilderReturnCode { // The builder acted successfully on the current action. diff --git a/clang/lib/Driver/ToolChains/Arch/Mips.h b/clang/lib/Driver/ToolChains/Arch/Mips.h index 6015cc44c6460..058e82b09831a 100644 --- a/clang/lib/Driver/ToolChains/Arch/Mips.h +++ b/clang/lib/Driver/ToolChains/Arch/Mips.h @@ -21,7 +21,7 @@ namespace driver { namespace tools { namespace mips { -using IEEE754Standard = enum { Legacy = 1, Std2008 = 2 }; +typedef enum { Legacy = 1, Std2008 = 2 } IEEE754Standard; enum class FloatABI { Invalid, diff --git a/clang/lib/Format/BreakableToken.h b/clang/lib/Format/BreakableToken.h index 865d6d296350f..45c00b35fd01e 100644 --- a/clang/lib/Format/BreakableToken.h +++ b/clang/lib/Format/BreakableToken.h @@ -86,7 +86,7 @@ struct FormatStyle; class BreakableToken { public: /// Contains starting character index and length of split. - using Split = std::pair; + typedef std::pair Split; virtual ~BreakableToken() {} diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index db8e9f7e50761..62feb3db0ed5e 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -3848,8 +3848,9 @@ reformat(const FormatStyle &Style, StringRef Code, if (!Env) return {}; - using AnalyzerPass = std::function( - const Environment &)>; + typedef std::function( + const Environment &)> + AnalyzerPass; SmallVector Passes; diff --git a/clang/lib/Format/QualifierAlignmentFixer.h b/clang/lib/Format/QualifierAlignmentFixer.h index c8b328a2e9fcb..a0a0d597ebf30 100644 --- a/clang/lib/Format/QualifierAlignmentFixer.h +++ b/clang/lib/Format/QualifierAlignmentFixer.h @@ -20,8 +20,9 @@ namespace clang { namespace format { -using AnalyzerPass = std::function( - const Environment &)>; +typedef std::function( + const Environment &)> + AnalyzerPass; void addQualifierAlignmentFixerPasses(const FormatStyle &Style, SmallVectorImpl &Passes); diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp index 12fb1dccb4053..0adf7ee9ed543 100644 --- a/clang/lib/Format/UnwrappedLineFormatter.cpp +++ b/clang/lib/Format/UnwrappedLineFormatter.cpp @@ -1240,7 +1240,7 @@ class OptimizingLineFormatter : public LineFormatter { /// In case of equal penalties, we want to prefer states that were inserted /// first. During state generation we make sure that we insert states first /// that break the line as late as possible. - using OrderedPenalty = std::pair; + typedef std::pair OrderedPenalty; /// An edge in the solution space from \c Previous->State to \c State, /// inserting a newline dependent on the \c NewLine. @@ -1254,11 +1254,12 @@ class OptimizingLineFormatter : public LineFormatter { /// An item in the prioritized BFS search queue. The \c StateNode's /// \c State has the given \c OrderedPenalty. - using QueueItem = std::pair; + typedef std::pair QueueItem; /// The BFS queue type. - using QueueType = std::priority_queue, - std::greater>; + typedef std::priority_queue, + std::greater> + QueueType; /// Analyze the entire solution space starting from \p InitialState. /// diff --git a/clang/lib/Frontend/ASTConsumers.cpp b/clang/lib/Frontend/ASTConsumers.cpp index 1f53f57e92964..ab8a35a189250 100644 --- a/clang/lib/Frontend/ASTConsumers.cpp +++ b/clang/lib/Frontend/ASTConsumers.cpp @@ -27,7 +27,7 @@ using namespace clang; namespace { class ASTPrinter : public ASTConsumer, public RecursiveASTVisitor { - using base = RecursiveASTVisitor; + typedef RecursiveASTVisitor base; public: enum Kind { DumpFull, Dump, Print, None }; diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index 0235f4a4e91b7..9e046633328d7 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -1034,7 +1034,7 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok, } } -using id_macro_pair = std::pair; +typedef std::pair id_macro_pair; static int MacroIDCompare(const id_macro_pair *LHS, const id_macro_pair *RHS) { return LHS->first->getName().compare(RHS->first->getName()); } diff --git a/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp b/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp index e33091f514ab0..23a1f909e2a37 100644 --- a/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp @@ -44,9 +44,9 @@ class AbbreviationMap { } }; -using RecordData = SmallVector; -using RecordDataImpl = SmallVectorImpl; -using RecordDataRef = ArrayRef; +typedef SmallVector RecordData; +typedef SmallVectorImpl RecordDataImpl; +typedef ArrayRef RecordDataRef; class SDiagsWriter; @@ -81,7 +81,7 @@ class SDiagsRenderer : public DiagnosticNoteRenderer { DiagnosticsEngine::Level Level) override; }; -using AbbrevLookup = llvm::DenseMap; +typedef llvm::DenseMap AbbrevLookup; class SDiagsMerger : SerializedDiagnosticReader { SDiagsWriter &Writer; @@ -270,8 +270,8 @@ class SDiagsWriter : public DiagnosticConsumer { /// The collection of files used. llvm::DenseMap Files; - using DiagFlagsTy = - llvm::DenseMap>; + typedef llvm::DenseMap > + DiagFlagsTy; /// Map for uniquing strings. DiagFlagsTy DiagFlags; diff --git a/clang/lib/Index/IndexBody.cpp b/clang/lib/Index/IndexBody.cpp index b89ecd624d825..1979117d4695c 100644 --- a/clang/lib/Index/IndexBody.cpp +++ b/clang/lib/Index/IndexBody.cpp @@ -26,7 +26,7 @@ class BodyIndexer : public RecursiveASTVisitor { const DeclContext *ParentDC; SmallVector StmtStack; - using base = RecursiveASTVisitor; + typedef RecursiveASTVisitor base; Stmt *getParentStmt() const { return StmtStack.size() < 2 ? nullptr : StmtStack.end()[-2]; diff --git a/clang/lib/Index/IndexTypeSourceInfo.cpp b/clang/lib/Index/IndexTypeSourceInfo.cpp index 90166af8f4323..adc33b3abd822 100644 --- a/clang/lib/Index/IndexTypeSourceInfo.cpp +++ b/clang/lib/Index/IndexTypeSourceInfo.cpp @@ -26,7 +26,7 @@ class TypeIndexer : public RecursiveASTVisitor { bool IsBase; SmallVector Relations; - using base = RecursiveASTVisitor; + typedef RecursiveASTVisitor base; public: TypeIndexer(IndexingContext &indexCtx, const NamedDecl *parent, diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp index 154ed0063d8cd..a62508e3e27bf 100644 --- a/clang/lib/Lex/LiteralSupport.cpp +++ b/clang/lib/Lex/LiteralSupport.cpp @@ -756,7 +756,7 @@ static void EncodeUCNEscape(const char *ThisTokBegin, const char *&ThisTokBuf, FullSourceLoc Loc, unsigned CharByteWidth, DiagnosticsEngine *Diags, const LangOptions &Features) { - using UTF32 = uint32_t; + typedef uint32_t UTF32; UTF32 UcnVal = 0; unsigned short UcnLen = 0; if (!ProcessUCNEscape(ThisTokBegin, ThisTokBuf, ThisTokEnd, UcnVal, UcnLen, @@ -805,7 +805,7 @@ static void EncodeUCNEscape(const char *ThisTokBegin, const char *&ThisTokBuf, // The conversion below was inspired by: // http://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.c // First, we determine how many bytes the result will require. - using UTF8 = uint8_t; + typedef uint8_t UTF8; unsigned short bytesToWrite = 0; if (UcnVal < (UTF32)0x80) diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp index 1b8334592e404..98933811265e8 100644 --- a/clang/lib/Parse/ParsePragma.cpp +++ b/clang/lib/Parse/ParsePragma.cpp @@ -954,7 +954,7 @@ namespace { enum OpenCLExtState : char { Disable, Enable, Begin, End }; - using OpenCLExtData = std::pair; + typedef std::pair OpenCLExtData; } void Parser::HandlePragmaOpenCLExtension() { @@ -1028,7 +1028,7 @@ void Parser::HandlePragmaMSPragma() { // Figure out which #pragma we're dealing with. The switch has no default // because lex shouldn't emit the annotation token for unrecognized pragmas. - using PragmaHandler = bool (Parser::*)(StringRef, SourceLocation); + typedef bool (Parser::*PragmaHandler)(StringRef, SourceLocation); PragmaHandler Handler = llvm::StringSwitch(PragmaName) .Case("data_seg", &Parser::HandlePragmaMSSegment) diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp index d2eae7f9535bf..d1400cbfc884d 100644 --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -888,7 +888,7 @@ class ContainsReference : public ConstEvaluatedExprVisitor { const DeclRefExpr *Needle; public: - using Inherited = ConstEvaluatedExprVisitor; + typedef ConstEvaluatedExprVisitor Inherited; ContainsReference(ASTContext &Context, const DeclRefExpr *Needle) : Inherited(Context), FoundReference(false), Needle(Needle) {} @@ -1221,7 +1221,7 @@ class FallthroughMapper : public DynamicRecursiveASTVisitor { (void)Found; } - using AttrStmts = llvm::SmallPtrSet; + typedef llvm::SmallPtrSet AttrStmts; const AttrStmts &getFallthroughStmts() const { return FallthroughStmts; } @@ -1509,11 +1509,11 @@ static void diagnoseRepeatedUseOfWeak(Sema &S, const sema::FunctionScopeInfo *CurFn, const Decl *D, const ParentMap &PM) { - using WeakObjectProfileTy = sema::FunctionScopeInfo::WeakObjectProfileTy; - using WeakObjectUseMap = sema::FunctionScopeInfo::WeakObjectUseMap; - using WeakUseVector = sema::FunctionScopeInfo::WeakUseVector; - using StmtUsesPair = - std::pair; + typedef sema::FunctionScopeInfo::WeakObjectProfileTy WeakObjectProfileTy; + typedef sema::FunctionScopeInfo::WeakObjectUseMap WeakObjectUseMap; + typedef sema::FunctionScopeInfo::WeakUseVector WeakUseVector; + typedef std::pair + StmtUsesPair; ASTContext &Ctx = S.getASTContext(); @@ -1663,9 +1663,9 @@ static void diagnoseRepeatedUseOfWeak(Sema &S, namespace clang { namespace { -using OptionalNotes = SmallVector; -using DelayedDiag = std::pair; -using DiagList = std::list; +typedef SmallVector OptionalNotes; +typedef std::pair DelayedDiag; +typedef std::list DiagList; struct SortDiagBySourceLocation { SourceManager &SM; @@ -1683,12 +1683,12 @@ struct SortDiagBySourceLocation { namespace { class UninitValsDiagReporter : public UninitVariablesHandler { Sema &S; - using UsesVec = SmallVector; - using MappedType = llvm::PointerIntPair; + typedef SmallVector UsesVec; + typedef llvm::PointerIntPair MappedType; // Prefer using MapVector to DenseMap, so that iteration order will be // the same as insertion order. This is needed to obtain a deterministic // order of diagnostics when calling flushDiagnostics(). - using UsesMap = llvm::MapVector; + typedef llvm::MapVector UsesMap; UsesMap uses; public: diff --git a/clang/lib/Sema/JumpDiagnostics.cpp b/clang/lib/Sema/JumpDiagnostics.cpp index 3e6813ffbe1d4..36704c3826dfd 100644 --- a/clang/lib/Sema/JumpDiagnostics.cpp +++ b/clang/lib/Sema/JumpDiagnostics.cpp @@ -136,7 +136,7 @@ unsigned JumpScopeChecker::GetDeepestCommonScope(unsigned A, unsigned B) { return A; } -using ScopePair = std::pair; +typedef std::pair ScopePair; /// GetDiagForGotoScopeDecl - If this decl induces a new goto scope, return a /// diagnostic that should be emitted if control goes over it. If not, return 0. diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 28b0d8d6b33d0..56608e990fd50 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -1069,7 +1069,8 @@ void Sema::LoadExternalWeakUndeclaredIdentifiers() { (void)WeakUndeclaredIdentifiers[WeakID.first].insert(WeakID.second); } -using RecordCompleteMap = llvm::DenseMap; + +typedef llvm::DenseMap RecordCompleteMap; /// Returns true, if all methods and nested classes of the given /// CXXRecordDecl are defined in this translation unit. @@ -1831,7 +1832,7 @@ namespace { class DeferredDiagnosticsEmitter : public UsedDeclVisitor { public: - using Inherited = UsedDeclVisitor; + typedef UsedDeclVisitor Inherited; // Whether the function is already in the current use-path. llvm::SmallPtrSet, 4> InUsePath; diff --git a/clang/lib/Sema/SemaAPINotes.cpp b/clang/lib/Sema/SemaAPINotes.cpp index ed2203f000974..044abb0ee08a8 100644 --- a/clang/lib/Sema/SemaAPINotes.cpp +++ b/clang/lib/Sema/SemaAPINotes.cpp @@ -521,7 +521,7 @@ static void ProcessAPINotes(Sema &S, ObjCPropertyDecl *D, } namespace { -using FunctionOrMethod = llvm::PointerUnion; +typedef llvm::PointerUnion FunctionOrMethod; } /// Process API notes for a function or method. diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp index 55b7bf169ea0d..83a07a23f3414 100644 --- a/clang/lib/Sema/SemaAccess.cpp +++ b/clang/lib/Sema/SemaAccess.cpp @@ -145,7 +145,7 @@ struct EffectiveContext { return Inner; } - using record_iterator = SmallVectorImpl::const_iterator; + typedef SmallVectorImpl::const_iterator record_iterator; DeclContext *Inner; SmallVector Functions; diff --git a/clang/lib/Sema/SemaAttr.cpp b/clang/lib/Sema/SemaAttr.cpp index c5492c4c30e05..3eed6ad7fe6b3 100644 --- a/clang/lib/Sema/SemaAttr.cpp +++ b/clang/lib/Sema/SemaAttr.cpp @@ -1327,7 +1327,7 @@ void Sema::AddImplicitMSFunctionNoBuiltinAttr(FunctionDecl *FD) { FD->addAttr(NoBuiltinAttr::CreateImplicit(Context, V.data(), V.size())); } -using VisStack = std::vector>; +typedef std::vector > VisStack; enum : unsigned { NoVisibility = ~0U }; void Sema::AddPushedVisibilityAttribute(Decl *D) { diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 742606db63e0c..a43ac9eb7610d 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -74,9 +74,9 @@ class ResultBuilder { /// name-lookup routines to specify which declarations should be included in /// the result set (when it returns true) and which declarations should be /// filtered out (returns false). - using LookupFilter = bool (ResultBuilder::*)(const NamedDecl *) const; + typedef bool (ResultBuilder::*LookupFilter)(const NamedDecl *) const; - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; private: /// The actual results we have found. @@ -87,13 +87,13 @@ class ResultBuilder { /// the result set twice. llvm::SmallPtrSet AllDeclsFound; - using DeclIndexPair = std::pair; + typedef std::pair DeclIndexPair; /// An entry in the shadow map, which is optimized to store /// a single (declaration, index) mapping (the common case) but /// can also store a list of (declaration, index) mappings. class ShadowMapEntry { - using DeclIndexPairVector = SmallVector; + typedef SmallVector DeclIndexPairVector; /// Contains either the solitary NamedDecl * or a vector /// of (declaration, index) pairs. @@ -153,7 +153,7 @@ class ResultBuilder { /// A mapping from declaration names to the declarations that have /// this name within a particular scope and their index within the list of /// results. - using ShadowMap = llvm::DenseMap; + typedef llvm::DenseMap ShadowMap; /// The semantic analysis object for which results are being /// produced. @@ -639,10 +639,10 @@ class ResultBuilder::ShadowMapEntry::iterator { unsigned SingleDeclIndex; public: - using value_type = DeclIndexPair; - using reference = value_type; - using difference_type = std::ptrdiff_t; - using iterator_category = std::input_iterator_tag; + typedef DeclIndexPair value_type; + typedef value_type reference; + typedef std::ptrdiff_t difference_type; + typedef std::input_iterator_tag iterator_category; class pointer { DeclIndexPair Value; @@ -1788,7 +1788,7 @@ class CodeCompletionDeclConsumer : public VisibleDeclConsumer { /// Add type specifiers for the current language as keyword results. static void AddTypeSpecifierResults(const LangOptions &LangOpts, ResultBuilder &Results) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; Results.AddResult(Result("short", CCP_Type)); Results.AddResult(Result("long", CCP_Type)); Results.AddResult(Result("signed", CCP_Type)); @@ -1873,7 +1873,7 @@ static void AddTypeSpecifierResults(const LangOptions &LangOpts, static void AddStorageSpecifiers(SemaCodeCompletion::ParserCompletionContext CCC, const LangOptions &LangOpts, ResultBuilder &Results) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; // Note: we don't suggest either "auto" or "register", because both // are pointless as storage specifiers. Elsewhere, we suggest "auto" // in C++0x as a type specifier. @@ -1902,7 +1902,7 @@ AddStorageSpecifiers(SemaCodeCompletion::ParserCompletionContext CCC, static void AddFunctionSpecifiers(SemaCodeCompletion::ParserCompletionContext CCC, const LangOptions &LangOpts, ResultBuilder &Results) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; switch (CCC) { case SemaCodeCompletion::PCC_Class: case SemaCodeCompletion::PCC_MemberTemplate: @@ -2148,7 +2148,7 @@ AddOrdinaryNameResults(SemaCodeCompletion::ParserCompletionContext CCC, CodeCompletionAllocator &Allocator = Results.getAllocator(); CodeCompletionBuilder Builder(Allocator, Results.getCodeCompletionTUInfo()); - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; switch (CCC) { case SemaCodeCompletion::PCC_Namespace: if (SemaRef.getLangOpts().CPlusPlus) { @@ -4358,7 +4358,7 @@ CXCursorKind clang::getCursorKindForDecl(const Decl *D) { static void AddMacroResults(Preprocessor &PP, ResultBuilder &Results, bool LoadExternal, bool IncludeUndefined, bool TargetTypeIsPointer = false) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; Results.EnterNewScope(); @@ -4383,7 +4383,7 @@ static void AddMacroResults(Preprocessor &PP, ResultBuilder &Results, static void AddPrettyFunctionResults(const LangOptions &LangOpts, ResultBuilder &Results) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; Results.EnterNewScope(); @@ -4532,7 +4532,7 @@ static void MaybeAddOverrideCalls(Sema &S, DeclContext *InContext, void SemaCodeCompletion::CodeCompleteModuleImport(SourceLocation ImportLoc, ModuleIdPath Path) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), CodeCompletionContext::CCC_Other); @@ -4540,7 +4540,7 @@ void SemaCodeCompletion::CodeCompleteModuleImport(SourceLocation ImportLoc, CodeCompletionAllocator &Allocator = Results.getAllocator(); CodeCompletionBuilder Builder(Allocator, Results.getCodeCompletionTUInfo()); - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; if (Path.empty()) { // Enumerate all top-level modules. SmallVector Modules; @@ -4675,7 +4675,7 @@ AddClassMessageCompletions(Sema &SemaRef, Scope *S, ParsedType Receiver, void SemaCodeCompletion::CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, bool AllowNonIdentifiers, bool AllowNestedNameSpecifiers) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; ResultBuilder Results( SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), @@ -5098,7 +5098,7 @@ void SemaCodeCompletion::CodeCompletePostfixExpression(Scope *S, ExprResult E, /// The set of properties that have already been added, referenced by /// property name. -using AddedPropertiesSet = llvm::SmallPtrSet; +typedef llvm::SmallPtrSet AddedPropertiesSet; /// Retrieve the container definition, if any? static ObjCContainerDecl *getContainerDef(ObjCContainerDecl *Container) { @@ -5163,7 +5163,7 @@ AddObjCProperties(const CodeCompletionContext &CCContext, AddedPropertiesSet &AddedProperties, ResultBuilder &Results, bool IsBaseExprStatement = false, bool IsClassProperty = false, bool InOriginalClass = true) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; // Retrieve the definition. Container = getContainerDef(Container); @@ -6244,7 +6244,7 @@ static bool anyNullArguments(ArrayRef Args) { return false; } -using ResultCandidate = CodeCompleteConsumer::OverloadCandidate; +typedef CodeCompleteConsumer::OverloadCandidate ResultCandidate; static void mergeCandidatesWithResults( Sema &SemaRef, SmallVectorImpl &Results, @@ -7058,7 +7058,7 @@ void SemaCodeCompletion::CodeCompleteOperatorName(Scope *S) { if (!CodeCompleter) return; - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), CodeCompletionContext::CCC_Type, @@ -7349,7 +7349,7 @@ void SemaCodeCompletion::CodeCompleteAfterFunctionEquals(Declarator &D) { static void AddObjCImplementationResults(const LangOptions &LangOpts, ResultBuilder &Results, bool NeedAt) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; // Since we have an implementation, we can end it. Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt, "end"))); @@ -7372,7 +7372,7 @@ static void AddObjCImplementationResults(const LangOptions &LangOpts, static void AddObjCInterfaceResults(const LangOptions &LangOpts, ResultBuilder &Results, bool NeedAt) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; // Since we have an interface or protocol, we can end it. Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt, "end"))); @@ -7390,7 +7390,7 @@ static void AddObjCInterfaceResults(const LangOptions &LangOpts, } static void AddObjCTopLevelResults(ResultBuilder &Results, bool NeedAt) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; CodeCompletionBuilder Builder(Results.getAllocator(), Results.getCodeCompletionTUInfo()); @@ -7458,7 +7458,7 @@ void SemaCodeCompletion::CodeCompleteObjCAtDirective(Scope *S) { } static void AddObjCExpressionResults(ResultBuilder &Results, bool NeedAt) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; CodeCompletionBuilder Builder(Results.getAllocator(), Results.getCodeCompletionTUInfo()); @@ -7523,7 +7523,7 @@ static void AddObjCExpressionResults(ResultBuilder &Results, bool NeedAt) { } static void AddObjCStatementResults(ResultBuilder &Results, bool NeedAt) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; CodeCompletionBuilder Builder(Results.getAllocator(), Results.getCodeCompletionTUInfo()); @@ -7570,7 +7570,7 @@ static void AddObjCStatementResults(ResultBuilder &Results, bool NeedAt) { static void AddObjCVisibilityResults(const LangOptions &LangOpts, ResultBuilder &Results, bool NeedAt) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt, "private"))); Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt, "protected"))); Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt, "public"))); @@ -7767,7 +7767,7 @@ static bool isAcceptableObjCMethod(ObjCMethodDecl *Method, /// A set of selectors, which is used to avoid introducing multiple /// completions with the same selector into the result set. -using VisitedSelectorSet = llvm::SmallPtrSet; +typedef llvm::SmallPtrSet VisitedSelectorSet; /// Add all of the Objective-C methods in the given Objective-C /// container to the set of results. @@ -7796,7 +7796,7 @@ static void AddObjCMethods(ObjCContainerDecl *Container, VisitedSelectorSet &Selectors, bool AllowSameLength, ResultBuilder &Results, bool InOriginalClass = true, bool IsRootClass = false) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; Container = getContainerDef(Container); ObjCInterfaceDecl *IFace = dyn_cast(Container); IsRootClass = IsRootClass || (IFace && !IFace->getSuperClass()); @@ -8205,7 +8205,7 @@ AddSuperSendCompletion(Sema &S, bool NeedSuperKeyword, } void SemaCodeCompletion::CodeCompleteObjCMessageReceiver(Scope *S) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; ResultBuilder Results( SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), @@ -8309,7 +8309,7 @@ void SemaCodeCompletion::CodeCompleteObjCSuperMessage( /// send, determine the preferred type (if any) for that argument expression. static QualType getPreferredArgumentTypeForMessageSend(ResultBuilder &Results, unsigned NumSelIdents) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; ASTContext &Context = Results.getSema().Context; QualType PreferredType; @@ -8344,7 +8344,7 @@ AddClassMessageCompletions(Sema &SemaRef, Scope *S, ParsedType Receiver, ArrayRef SelIdents, bool AtArgumentExpression, bool IsSuper, ResultBuilder &Results) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; ObjCInterfaceDecl *CDecl = nullptr; // If the given name refers to an interface type, retrieve the @@ -8453,7 +8453,7 @@ void SemaCodeCompletion::CodeCompleteObjCClassMessage( void SemaCodeCompletion::CodeCompleteObjCInstanceMessage( Scope *S, Expr *RecExpr, ArrayRef SelIdents, bool AtArgumentExpression, ObjCInterfaceDecl *Super) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; ASTContext &Context = getASTContext(); // If necessary, apply function/array conversion to the receiver. @@ -8690,7 +8690,7 @@ void SemaCodeCompletion::CodeCompleteObjCSelector( static void AddProtocolResults(DeclContext *Ctx, DeclContext *CurContext, bool OnlyForwardDeclarations, ResultBuilder &Results) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; for (const auto *D : Ctx->decls()) { // Record any protocols we find. @@ -8757,7 +8757,7 @@ static void AddInterfaceResults(DeclContext *Ctx, DeclContext *CurContext, bool OnlyForwardDeclarations, bool OnlyUnimplemented, ResultBuilder &Results) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; for (const auto *D : Ctx->decls()) { // Record any interfaces we find. @@ -8855,7 +8855,7 @@ void SemaCodeCompletion::CodeCompleteObjCImplementationDecl(Scope *S) { void SemaCodeCompletion::CodeCompleteObjCInterfaceCategory( Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), @@ -8890,7 +8890,7 @@ void SemaCodeCompletion::CodeCompleteObjCInterfaceCategory( void SemaCodeCompletion::CodeCompleteObjCImplementationCategory( Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; // Find the corresponding interface. If we couldn't find the interface, the // program itself is ill-formed. However, we'll try to be helpful still by @@ -8969,7 +8969,7 @@ void SemaCodeCompletion::CodeCompleteObjCPropertyDefinition(Scope *S) { void SemaCodeCompletion::CodeCompleteObjCPropertySynthesizeIvar( Scope *S, IdentifierInfo *PropertyName) { - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), CodeCompletionContext::CCC_Other); @@ -9040,7 +9040,7 @@ void SemaCodeCompletion::CodeCompleteObjCPropertySynthesizeIvar( // Create ivar result _propName, that the user can use to synthesize // an ivar of the appropriate type. unsigned Priority = CCP_MemberDeclaration + 1; - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; CodeCompletionAllocator &Allocator = Results.getAllocator(); CodeCompletionBuilder Builder(Allocator, Results.getCodeCompletionTUInfo(), Priority, CXAvailability_Available); @@ -9062,8 +9062,9 @@ void SemaCodeCompletion::CodeCompleteObjCPropertySynthesizeIvar( // Mapping from selectors to the methods that implement that selector, along // with the "in original class" flag. -using KnownMethodsMap = - llvm::DenseMap>; +typedef llvm::DenseMap> + KnownMethodsMap; /// Find all of the methods that reside in the given container /// (and its superclasses, protocols, etc.) that meet the given @@ -9194,7 +9195,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, PrintingPolicy Policy = getCompletionPrintingPolicy(Results.getSema()); // Builder that will create each code completion. - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; CodeCompletionAllocator &Allocator = Results.getAllocator(); CodeCompletionBuilder Builder(Allocator, Results.getCodeCompletionTUInfo()); @@ -9838,7 +9839,7 @@ void SemaCodeCompletion::CodeCompleteObjCMethodDecl( KnownMethods); // Add declarations or definitions for each of the known methods. - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), CodeCompletionContext::CCC_Other); @@ -9990,7 +9991,7 @@ void SemaCodeCompletion::CodeCompleteObjCMethodDeclSelector( } // Build the set of methods we can see. - using Result = CodeCompletionResult; + typedef CodeCompletionResult Result; ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), CodeCompletionContext::CCC_Other); diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 9a7bde67f441e..14403e65e8f42 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -12664,7 +12664,7 @@ namespace { llvm::SmallVector InitFieldIndex; public: - using Inherited = EvaluatedExprVisitor; + typedef EvaluatedExprVisitor Inherited; SelfReferenceChecker(Sema &S, Decl *OrigDecl) : Inherited(S.Context), S(S), OrigDecl(OrigDecl) { @@ -20268,13 +20268,13 @@ static void CheckForDuplicateEnumValues(Sema &S, ArrayRef Elements, if (S.Diags.isIgnored(diag::warn_duplicate_enum_values, Enum->getLocation())) return; - using ECDVector = SmallVector; - using DuplicatesVector = SmallVector, 3>; + typedef SmallVector ECDVector; + typedef SmallVector, 3> DuplicatesVector; - using DeclOrVector = llvm::PointerUnion; + typedef llvm::PointerUnion DeclOrVector; // DenseMaps cannot contain the all ones int64_t value, so use unordered_map. - using ValueToVectorMap = std::unordered_map; + typedef std::unordered_map ValueToVectorMap; // Use int64_t as a key to avoid needing special handling for map keys. auto EnumConstantToKey = [](const EnumConstantDecl *D) { diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 8b8931628e831..f5b4614576086 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -2898,7 +2898,7 @@ BaseResult Sema::ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange, /// Use small set to collect indirect bases. As this is only used /// locally, there's no need to abstract the small size parameter. -using IndirectBaseSet = llvm::SmallPtrSet; +typedef llvm::SmallPtrSet IndirectBaseSet; /// Recursively add the bases of Type. Don't add Type itself. static void @@ -3742,7 +3742,7 @@ namespace { llvm::SmallVector InitFieldIndex; public: - using Inherited = EvaluatedExprVisitor; + typedef EvaluatedExprVisitor Inherited; UninitializedFieldVisitor(Sema &S, llvm::SmallPtrSetImpl &Decls, llvm::SmallPtrSetImpl &BaseClasses) @@ -5787,8 +5787,8 @@ bool CheckRedundantInit(Sema &S, return true; } -using UnionEntry = std::pair; -using RedundantUnionMap = llvm::DenseMap; +typedef std::pair UnionEntry; +typedef llvm::DenseMap RedundantUnionMap; bool CheckRedundantUnionInit(Sema &S, CXXCtorInitializer *Init, @@ -9387,7 +9387,7 @@ struct SpecialMemberVisitor { } /// A base or member subobject. - using Subobject = llvm::PointerUnion; + typedef llvm::PointerUnion Subobject; /// Get the location to use for a subobject in diagnostics. static SourceLocation getSubobjectLoc(Subobject Subobj) { @@ -10121,7 +10121,7 @@ static CXXConstructorDecl *findUserDeclaredCtor(CXXRecordDecl *RD) { return CI; // Look for constructor templates. - using tmpl_iter = CXXRecordDecl::specific_decl_iterator; + typedef CXXRecordDecl::specific_decl_iterator tmpl_iter; for (tmpl_iter TI(RD->decls_begin()), TE(RD->decls_end()); TI != TE; ++TI) { if (CXXConstructorDecl *CD = dyn_cast(TI->getTemplatedDecl())) @@ -15483,7 +15483,7 @@ static void checkMoveAssignmentForRepeatedMove(Sema &S, CXXRecordDecl *Class, return; llvm::SmallVector Worklist; - using VBaseMap = llvm::DenseMap; + typedef llvm::DenseMap VBaseMap; VBaseMap VBases; for (auto &BI : Class->bases()) { diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 5aab9165d99db..bbd104909956f 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -1551,7 +1551,7 @@ void SemaObjC::actOnObjCTypeArgsOrProtocolQualifiers( // Objective-C class names. The latter is technically ill-formed, // but is probably something like \c NSArray missing the // \c*. - using TypeOrClassDecl = llvm::PointerUnion; + typedef llvm::PointerUnion TypeOrClassDecl; SmallVector typeDecls; unsigned numTypeDeclsResolved = 0; for (unsigned i = 0, n = identifiers.size(); i != n; ++i) { @@ -2688,8 +2688,8 @@ void SemaObjC::WarnExactTypedMethods(ObjCMethodDecl *ImpMethodDecl, /// we used an immutable set to keep the table then it wouldn't add significant /// memory cost and it would be handy for lookups. -using ProtocolNameSet = llvm::DenseSet; -using LazyProtocolNameSet = std::unique_ptr; +typedef llvm::DenseSet ProtocolNameSet; +typedef std::unique_ptr LazyProtocolNameSet; static void findProtocolsWithExplicitImpls(const ObjCProtocolDecl *PDecl, ProtocolNameSet &PNS) { @@ -4325,7 +4325,7 @@ class OverrideSearch { } } - using iterator = decltype(Overridden)::iterator; + typedef decltype(Overridden)::iterator iterator; iterator begin() const { return Overridden.begin(); } iterator end() const { return Overridden.end(); } diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index fd14866978c39..45c7178c6965d 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1298,7 +1298,7 @@ static bool unsupportedTypeConversion(const Sema &S, QualType LHSType, return true; } -using PerformCastFn = ExprResult(Sema &S, Expr *operand, QualType toType); +typedef ExprResult PerformCastFn(Sema &S, Expr *operand, QualType toType); namespace { /// These helper callbacks are placed in an anonymous namespace to @@ -17486,7 +17486,7 @@ namespace { // Handle the case where we conclude a expression which we speculatively // considered to be unevaluated is actually evaluated. class TransformToPE : public TreeTransform { - using BaseTransform = TreeTransform; + typedef TreeTransform BaseTransform; public: TransformToPE(Sema &SemaRef) : BaseTransform(SemaRef) { } @@ -20354,7 +20354,7 @@ namespace { /// potentially-evaluated subexpressions as "referenced". class EvaluatedExprMarker : public UsedDeclVisitor { public: - using Inherited = UsedDeclVisitor; + typedef UsedDeclVisitor Inherited; bool SkipLocalVariables; ArrayRef StopAt; diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp index c6fc59719c9e0..5dca509d46fdb 100644 --- a/clang/lib/Sema/SemaExprMember.cpp +++ b/clang/lib/Sema/SemaExprMember.cpp @@ -25,7 +25,7 @@ using namespace clang; using namespace sema; -using BaseSet = llvm::SmallPtrSet; +typedef llvm::SmallPtrSet BaseSet; /// Determines if the given class is provably not derived from all of /// the prospective base classes. diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index dd01c0957373f..e0662d82914f4 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -3533,7 +3533,7 @@ namespace { /// A checker which white-lists certain expressions whose conversion /// to or from retainable type would otherwise be forbidden in ARC. class ARCCastChecker : public StmtVisitor { - using super = StmtVisitor; + typedef StmtVisitor super; ASTContext &Context; ARCConversionTypeClass SourceClass; diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index d65bf1eb4acba..1c6f292454ed6 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -2659,7 +2659,7 @@ static void ExpandAnonymousFieldDesignator(Sema &SemaRef, DesignatedInitExpr *DIE, unsigned DesigIdx, IndirectFieldDecl *IndirectField) { - using Designator = DesignatedInitExpr::Designator; + typedef DesignatedInitExpr::Designator Designator; // Build the replacement designators. SmallVector Replacements; @@ -3558,7 +3558,7 @@ ExprResult Sema::ActOnDesignatedInitializer(Designation &Desig, SourceLocation EqualOrColonLoc, bool GNUSyntax, ExprResult Init) { - using ASTDesignator = DesignatedInitExpr::Designator; + typedef DesignatedInitExpr::Designator ASTDesignator; bool Invalid = false; SmallVector Designators; diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index e05ca6e6d6551..8bde18f64f80b 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -97,7 +97,7 @@ namespace { class UnqualUsingDirectiveSet { Sema &SemaRef; - using ListTy = SmallVector; + typedef SmallVector ListTy; ListTy list; llvm::SmallPtrSet visited; @@ -195,7 +195,7 @@ namespace { void done() { llvm::sort(list, UnqualUsingEntry::Comparator()); } - using const_iterator = ListTy::const_iterator; + typedef ListTy::const_iterator const_iterator; const_iterator begin() const { return list.begin(); } const_iterator end() const { return list.end(); } @@ -4004,12 +4004,12 @@ class VisibleDeclsRecord { /// An entry in the shadow map, which is optimized to store a /// single declaration (the common case) but can also store a list /// of declarations. - using ShadowMapEntry = llvm::TinyPtrVector; + typedef llvm::TinyPtrVector ShadowMapEntry; private: /// A mapping from declaration names to the declarations that have /// this name within a particular scope. - using ShadowMap = llvm::DenseMap; + typedef llvm::DenseMap ShadowMap; /// A list of shadow maps, which is used to model name hiding. std::list ShadowMaps; @@ -4047,7 +4047,7 @@ class VisibleDeclsRecord { class ShadowContextRAII { VisibleDeclsRecord &Visible; - using ShadowMap = VisibleDeclsRecord::ShadowMap; + typedef VisibleDeclsRecord::ShadowMap ShadowMap; public: ShadowContextRAII(VisibleDeclsRecord &Visible) : Visible(Visible) { diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index bc8dc83e489cf..4ecc9b0d4c5c8 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -18430,7 +18430,7 @@ namespace { // Transform MemberExpression for specified FieldDecl of current class to // DeclRefExpr to specified OMPCapturedExprDecl. class TransformExprToCaptures : public TreeTransform { - using BaseTransform = TreeTransform; + typedef TreeTransform BaseTransform; ValueDecl *Field = nullptr; DeclRefExpr *CapturedExpr = nullptr; diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 7533519380dca..5dd5b495480d9 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -8822,7 +8822,7 @@ namespace { /// enumeration types. class BuiltinCandidateTypeSet { /// TypeSet - A set of types. - using TypeSet = llvm::SmallSetVector; + typedef llvm::SmallSetVector TypeSet; /// PointerTypes - The set of pointer types that will be used in the /// built-in candidates. @@ -8871,7 +8871,7 @@ class BuiltinCandidateTypeSet { public: /// iterator - Iterates through the types that are part of the set. - using iterator = TypeSet::iterator; + typedef TypeSet::iterator iterator; BuiltinCandidateTypeSet(Sema &SemaRef) : HasNonRecordTypes(false), diff --git a/clang/lib/Sema/SemaPseudoObject.cpp b/clang/lib/Sema/SemaPseudoObject.cpp index 4c8f659b3fcc4..66736670984ef 100644 --- a/clang/lib/Sema/SemaPseudoObject.cpp +++ b/clang/lib/Sema/SemaPseudoObject.cpp @@ -46,7 +46,7 @@ namespace { struct Rebuilder { Sema &S; unsigned MSPropertySubscriptCount; - using SpecificRebuilderRefTy = llvm::function_ref; + typedef llvm::function_ref SpecificRebuilderRefTy; const SpecificRebuilderRefTy &SpecificCallback; Rebuilder(Sema &S, const SpecificRebuilderRefTy &SpecificCallback) : S(S), MSPropertySubscriptCount(0), diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index d16ef2102c413..f85826aecadf3 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -945,7 +945,7 @@ bool Sema::checkMustTailAttr(const Stmt *St, const Attr &MTA) { namespace { class CommaVisitor : public EvaluatedExprVisitor { - using Inherited = EvaluatedExprVisitor; + typedef EvaluatedExprVisitor Inherited; Sema &SemaRef; public: CommaVisitor(Sema &SemaRef) : Inherited(SemaRef.Context), SemaRef(SemaRef) {} @@ -1240,7 +1240,7 @@ static void checkCaseValue(Sema &S, SourceLocation Loc, const llvm::APSInt &Val, } } -using EnumValsTy = SmallVector, 64>; +typedef SmallVector, 64> EnumValsTy; /// Returns true if we should emit a diagnostic about this case expression not /// being a part of the enum used in the switch controlling expression. @@ -1360,11 +1360,11 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, // Accumulate all of the case values in a vector so that we can sort them // and detect duplicates. This vector contains the APInt for the case after // it has been converted to the condition type. - using CaseValsTy = SmallVector, 64>; + typedef SmallVector, 64> CaseValsTy; CaseValsTy CaseVals; // Keep track of any GNU case ranges we see. The APSInt is the low value. - using CaseRangesTy = std::vector>; + typedef std::vector > CaseRangesTy; CaseRangesTy CaseRanges; DefaultStmt *TheDefaultStmt = nullptr; @@ -1771,8 +1771,8 @@ Sema::DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, return; } - using EnumValsTy = - SmallVector, 64>; + typedef SmallVector, 64> + EnumValsTy; EnumValsTy EnumVals; // Gather all enum values, set their type and sort them, @@ -1872,7 +1872,7 @@ namespace { SmallVectorImpl &Ranges; bool Simple; public: - using Inherited = EvaluatedExprVisitor; + typedef EvaluatedExprVisitor Inherited; DeclExtractor(Sema &S, DeclSetVector &Decls, SmallVectorImpl &Ranges) : @@ -1953,7 +1953,7 @@ namespace { bool FoundDecl; public: - using Inherited = EvaluatedExprVisitor; + typedef EvaluatedExprVisitor Inherited; DeclMatcher(Sema &S, DeclSetVector &Decls, Stmt *Statement) : Inherited(S.Context), Decls(Decls), FoundDecl(false) { @@ -2129,7 +2129,7 @@ namespace { Visit(Body); } - using Inherited = ConstEvaluatedExprVisitor; + typedef ConstEvaluatedExprVisitor Inherited; void VisitContinueStmt(const ContinueStmt* E) { ContinueLoc = E->getContinueLoc(); diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp index dded368c2c06c..4507a21a4c111 100644 --- a/clang/lib/Sema/SemaStmtAsm.cpp +++ b/clang/lib/Sema/SemaStmtAsm.cpp @@ -757,7 +757,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, targetDiag(ConstraintLoc, diag::error_inoutput_conflict_with_clobber); // Check for duplicate asm operand name between input, output and label lists. - using NamedOperand = std::pair; + typedef std::pair NamedOperand; SmallVector NamedOperandList; for (unsigned i = 0, e = NumOutputs + NumInputs + NumLabels; i != e; ++i) if (Names[i]) diff --git a/clang/lib/Sema/SemaStmtAttr.cpp b/clang/lib/Sema/SemaStmtAttr.cpp index 16501b46d7125..857d46af9ada9 100644 --- a/clang/lib/Sema/SemaStmtAttr.cpp +++ b/clang/lib/Sema/SemaStmtAttr.cpp @@ -194,7 +194,7 @@ class CallExprFinder : public ConstEvaluatedExprVisitor { std::vector CallExprs; public: - using Inherited = ConstEvaluatedExprVisitor; + typedef ConstEvaluatedExprVisitor Inherited; CallExprFinder(Sema &S, const Stmt *St) : Inherited(S.Context) { Visit(St); } diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index ad29e1d83c164..698d1270be634 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -4546,7 +4546,7 @@ Sema::CheckVarTemplateId(VarTemplateDecl *Template, SourceLocation TemplateLoc, VarDecl *InstantiationPattern = Template->getTemplatedDecl(); const TemplateArgumentList *PartialSpecArgs = nullptr; bool AmbiguousPartialSpec = false; - using MatchResult = PartialSpecMatchResult; + typedef PartialSpecMatchResult MatchResult; SmallVector Matched; SourceLocation PointOfInstantiation = TemplateNameLoc; TemplateSpecCandidateSet FailedCandidates(PointOfInstantiation, @@ -6024,7 +6024,7 @@ namespace { Sema &S; SourceRange SR; - using inherited = TypeVisitor; + typedef TypeVisitor inherited; public: UnnamedLocalNoLinkageFinder(Sema &S, SourceRange SR) : S(S), SR(SR) { } @@ -11207,7 +11207,7 @@ namespace { DeclarationName Entity; public: - using inherited = TreeTransform; + typedef TreeTransform inherited; CurrentInstantiationRebuilder(Sema &SemaRef, SourceLocation Loc, diff --git a/clang/lib/Sema/SemaTemplateDeductionGuide.cpp b/clang/lib/Sema/SemaTemplateDeductionGuide.cpp index a8440b80589b5..9be1c9c356cb2 100644 --- a/clang/lib/Sema/SemaTemplateDeductionGuide.cpp +++ b/clang/lib/Sema/SemaTemplateDeductionGuide.cpp @@ -64,7 +64,7 @@ class ExtractTypeForDeductionGuide std::optional TypedefNameInstantiator; public: - using Base = TreeTransform; + typedef TreeTransform Base; ExtractTypeForDeductionGuide( Sema &SemaRef, llvm::SmallVectorImpl &MaterializedTypedefs, diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index a737429a70e07..20bac0e56b195 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -1401,7 +1401,7 @@ namespace { bool maybeInstantiateFunctionParameterToScope(ParmVarDecl *OldParm); public: - using inherited = TreeTransform; + typedef TreeTransform inherited; TemplateInstantiator(Sema &SemaRef, const MultiLevelTemplateArgumentList &TemplateArgs, @@ -2518,7 +2518,7 @@ TemplateInstantiator::TransformFunctionParmPackExpr(FunctionParmPackExpr *E) { ExprResult TemplateInstantiator::TransformFunctionParmPackRefExpr(DeclRefExpr *E, ValueDecl *PD) { - using DeclArgumentPack = LocalInstantiationScope::DeclArgumentPack; + typedef LocalInstantiationScope::DeclArgumentPack DeclArgumentPack; llvm::PointerUnion *Found = getSema().CurrentInstantiationScope->findInstantiationOf(PD); assert(Found && "no instantiation for parameter pack"); @@ -4029,7 +4029,7 @@ static ActionResult getPatternForClassTemplateSpecialization( // matching the template arguments of the class template // specialization with the template argument lists of the partial // specializations. - using MatchResult = PartialSpecMatchResult; + typedef PartialSpecMatchResult MatchResult; SmallVector Matched, ExtraMatched; SmallVector PartialSpecs; Template->getPartialSpecializations(PartialSpecs); diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index cb153aa1d2008..e2c3cdcd536bc 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -4729,7 +4729,7 @@ TemplateDeclInstantiator::SubstTemplateParams(TemplateParameterList *L) { bool Invalid = false; unsigned N = L->size(); - using ParamVector = SmallVector; + typedef SmallVector ParamVector; ParamVector Params; Params.reserve(N); for (auto &P : *L) { @@ -5310,7 +5310,7 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New, // further errors in the declaration itself. // // FIXME: This is a hack. - using ActiveInstType = Sema::CodeSynthesisContext; + typedef Sema::CodeSynthesisContext ActiveInstType; ActiveInstType &ActiveInst = SemaRef.CodeSynthesisContexts.back(); if (ActiveInst.Kind == ActiveInstType::ExplicitTemplateArgumentSubstitution || ActiveInst.Kind == ActiveInstType::DeducedTemplateArgumentSubstitution) { @@ -6806,7 +6806,7 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, assert(ArgPackSubstIndex && "found declaration pack but not pack expanding"); - using DeclArgumentPack = LocalInstantiationScope::DeclArgumentPack; + typedef LocalInstantiationScope::DeclArgumentPack DeclArgumentPack; return cast( (*cast(*Found))[*ArgPackSubstIndex]); } diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp index d67901f0af5b8..572dbf2e7393f 100644 --- a/clang/lib/Sema/SemaTemplateVariadic.cpp +++ b/clang/lib/Sema/SemaTemplateVariadic.cpp @@ -759,7 +759,7 @@ bool Sema::CheckParameterPacksForExpansion( bool HaveFirstPack = false; UnsignedOrNone NumPartialExpansions = std::nullopt; SourceLocation PartiallySubstitutedPackLoc; - using DeclArgumentPack = LocalInstantiationScope::DeclArgumentPack; + typedef LocalInstantiationScope::DeclArgumentPack DeclArgumentPack; for (UnexpandedParameterPack ParmPack : Unexpanded) { // Compute the depth and index for this parameter pack. @@ -957,7 +957,7 @@ UnsignedOrNone Sema::getNumArgumentsInExpansionFromUnexpanded( NamedDecl *ND = cast(Unexpanded[I].first); if (isa(ND)) { // Function parameter pack or init-capture pack. - using DeclArgumentPack = LocalInstantiationScope::DeclArgumentPack; + typedef LocalInstantiationScope::DeclArgumentPack DeclArgumentPack; llvm::PointerUnion *Instantiation = CurrentInstantiationScope->findInstantiationOf( diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 586d830825e67..7dbd4bb0ed125 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -816,7 +816,7 @@ static void diagnoseAndRemoveTypeQualifiers(Sema &S, const DeclSpec &DS, unsigned DiagID) { // If this occurs outside a template instantiation, warn the user about // it; they probably didn't mean to specify a redundant qualifier. - using QualLoc = std::pair; + typedef std::pair QualLoc; for (QualLoc Qual : {QualLoc(DeclSpec::TQ_const, DS.getConstSpecLoc()), QualLoc(DeclSpec::TQ_restrict, DS.getRestrictSpecLoc()), QualLoc(DeclSpec::TQ_volatile, DS.getVolatileSpecLoc()), diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index a5a58582516dd..c7428d1a02345 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -4975,11 +4975,11 @@ class TemplateArgumentLocInventIterator { InputIterator Iter; public: - using value_type = TemplateArgumentLoc; - using reference = TemplateArgumentLoc; - using difference_type = - typename std::iterator_traits::difference_type; - using iterator_category = std::input_iterator_tag; + typedef TemplateArgumentLoc value_type; + typedef TemplateArgumentLoc reference; + typedef typename std::iterator_traits::difference_type + difference_type; + typedef std::input_iterator_tag iterator_category; class pointer { TemplateArgumentLoc Arg; @@ -5039,9 +5039,9 @@ bool TreeTransform::TransformTemplateArguments( // FIXME: We could do much better if we could guarantee that the // TemplateArgumentLocInfo for the pack expansion would be usable for // all of the template arguments in the argument pack. - using PackLocIterator = - TemplateArgumentLocInventIterator; + typedef TemplateArgumentLocInventIterator + PackLocIterator; if (TransformTemplateArguments(PackLocIterator(*this, In.getArgument().pack_begin()), PackLocIterator(*this, @@ -7262,10 +7262,10 @@ QualType TreeTransform::TransformPredefinedSugarType( unsigned Index; public: - using value_type = TemplateArgumentLoc; - using reference = TemplateArgumentLoc; - using difference_type = int; - using iterator_category = std::input_iterator_tag; + typedef TemplateArgumentLoc value_type; + typedef TemplateArgumentLoc reference; + typedef int difference_type; + typedef std::input_iterator_tag iterator_category; class pointer { TemplateArgumentLoc Arg; @@ -7337,7 +7337,7 @@ QualType TreeTransform::TransformAutoType(TypeLocBuilder &TLB, NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc()); NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc()); - using ArgIterator = TemplateArgumentLocContainerIterator; + typedef TemplateArgumentLocContainerIterator ArgIterator; if (getDerived().TransformTemplateArguments( ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()), NewTemplateArgs)) @@ -7394,8 +7394,8 @@ QualType TreeTransform::TransformTemplateSpecializationType( TemplateArgumentListInfo NewTemplateArgs; NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc()); NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc()); - using ArgIterator = - TemplateArgumentLocContainerIterator; + typedef TemplateArgumentLocContainerIterator + ArgIterator; if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()), NewTemplateArgs)) @@ -7451,8 +7451,8 @@ QualType TreeTransform::TransformDependentTemplateSpecializationType( TemplateArgumentListInfo NewTemplateArgs; NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc()); NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc()); - using ArgIterator = TemplateArgumentLocContainerIterator< - DependentTemplateSpecializationTypeLoc>; + typedef TemplateArgumentLocContainerIterator< + DependentTemplateSpecializationTypeLoc> ArgIterator; if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()), NewTemplateArgs)) @@ -13070,7 +13070,7 @@ TreeTransform::TransformOffsetOfExpr(OffsetOfExpr *E) { // the fields again. However, __builtin_offsetof is rare enough in // template code that we don't care. bool ExprChanged = false; - using Component = Sema::OffsetOfComponent; + typedef Sema::OffsetOfComponent Component; SmallVector Components; for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) { const OffsetOfNode &ON = E->getComponent(I); @@ -15403,7 +15403,7 @@ ExprResult TreeTransform::TransformLambdaExpr(LambdaExpr *E) { // Transform any init-capture expressions before entering the scope of the // lambda body, because they are not semantically within that scope. - using InitCaptureInfoTy = std::pair; + typedef std::pair InitCaptureInfoTy; struct TransformedInitCapture { // The location of the ... if the result is retaining a pack expansion. SourceLocation EllipsisLoc; @@ -16203,8 +16203,8 @@ TreeTransform::TransformSizeOfPackExpr(SizeOfPackExpr *E) { E->getPackLoc()); { TemporaryBase Rebase(*this, E->getPackLoc(), getBaseEntity()); - using PackLocIterator = - TemplateArgumentLocInventIterator; + typedef TemplateArgumentLocInventIterator< + Derived, const TemplateArgument*> PackLocIterator; if (TransformTemplateArguments(PackLocIterator(*this, PackArgs.begin()), PackLocIterator(*this, PackArgs.end()), TransformedPackArgs, /*Uneval*/true)) diff --git a/clang/lib/Sema/UsedDeclVisitor.h b/clang/lib/Sema/UsedDeclVisitor.h index 95073fc7f3ab7..580d702f96fe5 100644 --- a/clang/lib/Sema/UsedDeclVisitor.h +++ b/clang/lib/Sema/UsedDeclVisitor.h @@ -23,7 +23,7 @@ class UsedDeclVisitor : public EvaluatedExprVisitor { Sema &S; public: - using Inherited = EvaluatedExprVisitor; + typedef EvaluatedExprVisitor Inherited; UsedDeclVisitor(Sema &S) : Inherited(S.Context), S(S) {} diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp index 49af1f23c87fb..1e2272c48bd04 100644 --- a/clang/lib/Serialization/GlobalModuleIndex.cpp +++ b/clang/lib/Serialization/GlobalModuleIndex.cpp @@ -71,11 +71,11 @@ namespace { /// table. class IdentifierIndexReaderTrait { public: - using external_key_type = StringRef; - using internal_key_type = StringRef; - using data_type = SmallVector; - using hash_value_type = unsigned; - using offset_type = unsigned; + typedef StringRef external_key_type; + typedef StringRef internal_key_type; + typedef SmallVector data_type; + typedef unsigned hash_value_type; + typedef unsigned offset_type; static bool EqualKey(const internal_key_type& a, const internal_key_type& b) { return a == b; @@ -119,8 +119,9 @@ class IdentifierIndexReaderTrait { } }; -using IdentifierIndexTable = - llvm::OnDiskIterableChainedHashTable; +typedef llvm::OnDiskIterableChainedHashTable + IdentifierIndexTable; + } GlobalModuleIndex::GlobalModuleIndex( @@ -418,7 +419,7 @@ namespace { /// Mapping from identifiers to the list of module file IDs that /// consider this identifier to be interesting. - using InterestingIdentifierMap = llvm::StringMap>; + typedef llvm::StringMap > InterestingIdentifierMap; /// A mapping from all interesting identifiers to the set of module /// files in which those identifiers are considered interesting. @@ -500,7 +501,7 @@ namespace { public: /// The identifier and whether it is "interesting". - using data_type = std::pair; + typedef std::pair data_type; data_type ReadData(const internal_key_type& k, const unsigned char* d, @@ -671,8 +672,8 @@ llvm::Error GlobalModuleIndexBuilder::loadModuleFile(FileEntryRef File) { // Handle the identifier table if (State == ASTBlock && Code == IDENTIFIER_TABLE && Record[0] > 0) { - using InterestingIdentifierTable = llvm::OnDiskIterableChainedHashTable< - InterestingASTIdentifierLookupTrait>; + typedef llvm::OnDiskIterableChainedHashTable< + InterestingASTIdentifierLookupTrait> InterestingIdentifierTable; std::unique_ptr Table( InterestingIdentifierTable::Create( (const unsigned char *)Blob.data() + Record[0], @@ -709,12 +710,12 @@ namespace { /// table. class IdentifierIndexWriterTrait { public: - using key_type = StringRef; - using key_type_ref = StringRef; - using data_type = SmallVector; - using data_type_ref = const SmallVector &; - using hash_value_type = unsigned; - using offset_type = unsigned; + typedef StringRef key_type; + typedef StringRef key_type_ref; + typedef SmallVector data_type; + typedef const SmallVector &data_type_ref; + typedef unsigned hash_value_type; + typedef unsigned offset_type; static hash_value_type ComputeHash(key_type_ref Key) { return llvm::djbHash(Key); diff --git a/clang/lib/Serialization/TemplateArgumentHasher.cpp b/clang/lib/Serialization/TemplateArgumentHasher.cpp index 0209780862a08..c56138e8893c1 100644 --- a/clang/lib/Serialization/TemplateArgumentHasher.cpp +++ b/clang/lib/Serialization/TemplateArgumentHasher.cpp @@ -218,7 +218,7 @@ void TemplateArgumentHasher::AddQualType(QualType T) { // while Visit* methods process the relevant parts of the Type. // Any unhandled type will make the hash computation bail out. class TypeVisitorHelper : public TypeVisitor { - using Inherited = TypeVisitor; + typedef TypeVisitor Inherited; llvm::FoldingSetNodeID &ID; TemplateArgumentHasher &Hash; diff --git a/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp b/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp index 321e7a9bc0802..798b34b3ef0af 100644 --- a/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp +++ b/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp @@ -45,7 +45,7 @@ using namespace llvm; // Define a type for the functions that are compiled and executed -using LLVMFunc = void (*)(int *, int *, int *, int); +typedef void (*LLVMFunc)(int*, int*, int*, int); // Helper function to parse command line args and find the optimization level static CodeGenOptLevel getOptLevel(const std::vector &ExtraArgs) { diff --git a/clang/tools/diagtool/DiagTool.cpp b/clang/tools/diagtool/DiagTool.cpp index 29064acefc9f0..384eef560c6ca 100644 --- a/clang/tools/diagtool/DiagTool.cpp +++ b/clang/tools/diagtool/DiagTool.cpp @@ -22,7 +22,7 @@ DiagTool::DiagTool(llvm::StringRef toolCmd, llvm::StringRef toolDesc) DiagTool::~DiagTool() {} -using ToolMap = llvm::StringMap; +typedef llvm::StringMap ToolMap; static inline ToolMap *getTools(void *v) { return static_cast(v); } DiagTools::DiagTools() : tools(new ToolMap()) {} diff --git a/clang/tools/diagtool/DiagnosticNames.h b/clang/tools/diagtool/DiagnosticNames.h index 6cc366a2695f4..f541e88577cc5 100644 --- a/clang/tools/diagtool/DiagnosticNames.h +++ b/clang/tools/diagtool/DiagnosticNames.h @@ -54,11 +54,11 @@ namespace diagtool { } public: - using value_type = RecordType; - using reference = const value_type &; - using pointer = const value_type *; - using iterator_category = std::forward_iterator_tag; - using difference_type = std::ptrdiff_t; + typedef RecordType value_type; + typedef const value_type & reference; + typedef const value_type * pointer; + typedef std::forward_iterator_tag iterator_category; + typedef std::ptrdiff_t difference_type; inline reference operator*() const; inline pointer operator->() const { @@ -85,12 +85,12 @@ namespace diagtool { } }; - using subgroup_iterator = group_iterator; + typedef group_iterator subgroup_iterator; subgroup_iterator subgroup_begin() const; subgroup_iterator subgroup_end() const; llvm::iterator_range subgroups() const; - using diagnostics_iterator = group_iterator; + typedef group_iterator diagnostics_iterator; diagnostics_iterator diagnostics_begin() const; diagnostics_iterator diagnostics_end() const; llvm::iterator_range diagnostics() const; diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 9431cfba3c35b..9412d9735ef82 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -4024,7 +4024,7 @@ bool CursorVisitor::Visit(const Attr *A) { } namespace { -using RefNamePieces = SmallVector; +typedef SmallVector RefNamePieces; RefNamePieces buildPieces(unsigned NameFlags, bool IsMemberRefExpr, const DeclarationNameInfo &NI, SourceRange QLoc, const SourceRange *TemplateArgsLoc = nullptr) { @@ -5277,13 +5277,13 @@ static enum CXChildVisitResult visitWithBlock(CXCursor cursor, CXCursor parent, #else // If we are compiled with a compiler that doesn't have native blocks support, // define and call the block manually, so the -using CXCursorVisitorBlock = struct _CXChildVisitResult { +typedef struct _CXChildVisitResult { void *isa; int flags; int reserved; enum CXChildVisitResult (*invoke)(struct _CXChildVisitResult *, CXCursor, CXCursor); -} *; +} * CXCursorVisitorBlock; static enum CXChildVisitResult visitWithBlock(CXCursor cursor, CXCursor parent, CXClientData client_data) { @@ -9646,7 +9646,7 @@ CXType clang_getIBOutletCollectionType(CXCursor C) { // Inspecting memory usage. //===----------------------------------------------------------------------===// -using MemUsageEntries = std::vector; +typedef std::vector MemUsageEntries; static inline void createCXTUResourceUsageEntry(MemUsageEntries &entries, enum CXTUResourceUsageKind k, diff --git a/clang/tools/libclang/CIndexHigh.cpp b/clang/tools/libclang/CIndexHigh.cpp index d15dc8120916b..1f6d3b9dcfe31 100644 --- a/clang/tools/libclang/CIndexHigh.cpp +++ b/clang/tools/libclang/CIndexHigh.cpp @@ -50,7 +50,7 @@ struct FindFileIdRefVisitData { int SelectorIdIdx; CXCursorAndRangeVisitor visitor; - using TopMethodsTy = SmallVector; + typedef SmallVector TopMethodsTy; TopMethodsTy TopMethods; FindFileIdRefVisitData(CXTranslationUnit TU, FileID FID, diff --git a/clang/tools/libclang/CLog.h b/clang/tools/libclang/CLog.h index eb62e7c4a40a1..6ce43a01ee8f2 100644 --- a/clang/tools/libclang/CLog.h +++ b/clang/tools/libclang/CLog.h @@ -27,7 +27,7 @@ namespace clang { namespace cxindex { class Logger; -using LogRef = IntrusiveRefCntPtr; +typedef IntrusiveRefCntPtr LogRef; /// Collects logging output and writes it to stderr when it's destructed. /// Common use case: diff --git a/clang/tools/libclang/CXCursor.cpp b/clang/tools/libclang/CXCursor.cpp index b250680338574..a6301daa672c3 100644 --- a/clang/tools/libclang/CXCursor.cpp +++ b/clang/tools/libclang/CXCursor.cpp @@ -1598,7 +1598,7 @@ unsigned long long clang_Cursor_getTemplateArgumentUnsignedValue(CXCursor C, // CXCursorSet. //===----------------------------------------------------------------------===// -using CXCursorSet_Impl = llvm::DenseMap; +typedef llvm::DenseMap CXCursorSet_Impl; static inline CXCursorSet packCXCursorSet(CXCursorSet_Impl *setImpl) { return (CXCursorSet)setImpl; @@ -1688,7 +1688,7 @@ CXCompletionString clang_getCursorCompletionString(CXCursor cursor) { namespace { struct OverridenCursorsPool { - using CursorVec = SmallVector; + typedef SmallVector CursorVec; std::vector AllCursors; std::vector AvailableCursors; diff --git a/clang/tools/libclang/CXCursor.h b/clang/tools/libclang/CXCursor.h index 2cad07ae94a81..1e4c0a05c9ef7 100644 --- a/clang/tools/libclang/CXCursor.h +++ b/clang/tools/libclang/CXCursor.h @@ -225,9 +225,9 @@ CXCursor MakeCursorOverloadedDeclRef(TemplateName Template, CXTranslationUnit TU); /// Internal storage for an overloaded declaration reference cursor; -using OverloadedDeclRefStorage = - llvm::PointerUnion; +typedef llvm::PointerUnion + OverloadedDeclRefStorage; /// Unpack an overloaded declaration reference into an expression, /// declaration, or template name along with the source location. diff --git a/clang/tools/libclang/CXIndexDataConsumer.h b/clang/tools/libclang/CXIndexDataConsumer.h index 409212e8ce329..54a3add3a9c8d 100644 --- a/clang/tools/libclang/CXIndexDataConsumer.h +++ b/clang/tools/libclang/CXIndexDataConsumer.h @@ -278,17 +278,17 @@ class CXIndexDataConsumer : public index::IndexDataConsumer { IndexerCallbacks &CB; unsigned IndexOptions; CXTranslationUnit CXTU; - - using FileMapTy = llvm::DenseMap; - using ContainerMapTy = - llvm::DenseMap; - using EntityMapTy = llvm::DenseMap; + + typedef llvm::DenseMap FileMapTy; + typedef llvm::DenseMap + ContainerMapTy; + typedef llvm::DenseMap EntityMapTy; FileMapTy FileMap; ContainerMapTy ContainerMap; EntityMapTy EntityMap; - using RefFileOccurrence = std::pair; + typedef std::pair RefFileOccurrence; llvm::DenseSet RefFileOccurrences; llvm::BumpPtrAllocator StrScratch; diff --git a/clang/tools/libclang/CXLoadedDiagnostic.cpp b/clang/tools/libclang/CXLoadedDiagnostic.cpp index 4fff36d6c6080..ed89a6a7754da 100644 --- a/clang/tools/libclang/CXLoadedDiagnostic.cpp +++ b/clang/tools/libclang/CXLoadedDiagnostic.cpp @@ -30,7 +30,7 @@ using namespace clang; // Extend CXDiagnosticSetImpl which contains strings for diagnostics. //===----------------------------------------------------------------------===// -using Strings = llvm::DenseMap; +typedef llvm::DenseMap Strings; namespace { class CXLoadedDiagnosticSetImpl : public CXDiagnosticSetImpl { diff --git a/clang/tools/libclang/CursorVisitor.h b/clang/tools/libclang/CursorVisitor.h index 2246708794f52..949b73908c315 100644 --- a/clang/tools/libclang/CursorVisitor.h +++ b/clang/tools/libclang/CursorVisitor.h @@ -64,7 +64,7 @@ class VisitorJob { const CXCursor &getParent() const { return parent; } }; -using VisitorWorkList = SmallVector; +typedef SmallVector VisitorWorkList; // Cursor visitor. class CursorVisitor : public DeclVisitor, @@ -72,8 +72,8 @@ class CursorVisitor : public DeclVisitor, public: /// Callback called after child nodes of a cursor have been visited. /// Return true to break visitation or false to continue. - using PostChildrenVisitorTy = bool (*)(CXCursor cursor, - CXClientData client_data); + typedef bool (*PostChildrenVisitorTy)(CXCursor cursor, + CXClientData client_data); private: /// The translation unit we are traversing. diff --git a/clang/tools/libclang/Index_Internal.h b/clang/tools/libclang/Index_Internal.h index 5457ea526028f..d28438770e7d3 100644 --- a/clang/tools/libclang/Index_Internal.h +++ b/clang/tools/libclang/Index_Internal.h @@ -29,13 +29,13 @@ #define INVOKE_BLOCK2(block, arg1, arg2) block->invoke(block, arg1, arg2) -using CXCursorAndRangeVisitorBlock = struct _CXCursorAndRangeVisitorBlock { +typedef struct _CXCursorAndRangeVisitorBlock { void *isa; int flags; int reserved; enum CXVisitorResult (*invoke)(_CXCursorAndRangeVisitorBlock *, CXCursor, CXSourceRange); -} *; +} *CXCursorAndRangeVisitorBlock; #endif // !__has_feature(blocks) diff --git a/clang/tools/libclang/Indexing.cpp b/clang/tools/libclang/Indexing.cpp index a65f66f99e070..32a7147af3382 100644 --- a/clang/tools/libclang/Indexing.cpp +++ b/clang/tools/libclang/Indexing.cpp @@ -526,7 +526,7 @@ static CXErrorCode clang_indexSourceFile_Impl( if (CInvok->getFrontendOpts().Inputs.empty()) return CXError_Failure; - using MemBufferOwner = SmallVector, 8>; + typedef SmallVector, 8> MemBufferOwner; std::unique_ptr BufOwner(new MemBufferOwner); // Recover resources if we crash before exiting this method. diff --git a/clang/tools/offload-arch/AMDGPUArchByHIP.cpp b/clang/tools/offload-arch/AMDGPUArchByHIP.cpp index 04d7f292c06ad..02431bf909d6d 100644 --- a/clang/tools/offload-arch/AMDGPUArchByHIP.cpp +++ b/clang/tools/offload-arch/AMDGPUArchByHIP.cpp @@ -32,19 +32,19 @@ using namespace llvm; -using hipDeviceProp_t = struct { +typedef struct { char padding[396]; char gcnArchName[256]; char padding2[1024]; -}; +} hipDeviceProp_t; -using hipError_t = enum { +typedef enum { hipSuccess = 0, -}; +} hipError_t; -using hipGetDeviceCount_t = hipError_t (*)(int *); -using hipDeviceGet_t = hipError_t (*)(int *, int); -using hipGetDeviceProperties_t = hipError_t (*)(hipDeviceProp_t *, int); +typedef hipError_t (*hipGetDeviceCount_t)(int *); +typedef hipError_t (*hipDeviceGet_t)(int *, int); +typedef hipError_t (*hipGetDeviceProperties_t)(hipDeviceProp_t *, int); extern cl::opt Verbose; diff --git a/clang/tools/offload-arch/NVPTXArch.cpp b/clang/tools/offload-arch/NVPTXArch.cpp index 2d4cccdf1d2bd..c7b7fcdf80500 100644 --- a/clang/tools/offload-arch/NVPTXArch.cpp +++ b/clang/tools/offload-arch/NVPTXArch.cpp @@ -21,17 +21,17 @@ using namespace llvm; -using CUresult = enum cudaError_enum { +typedef enum cudaError_enum { CUDA_SUCCESS = 0, CUDA_ERROR_NO_DEVICE = 100, -}; +} CUresult; -using CUdevice_attribute = enum CUdevice_attribute_enum { +typedef enum CUdevice_attribute_enum { CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = 76, -}; +} CUdevice_attribute; -using CUdevice = uint32_t; +typedef uint32_t CUdevice; CUresult (*cuInit)(unsigned int); CUresult (*cuDeviceGetCount)(int *); diff --git a/clang/utils/TableGen/ClangASTNodesEmitter.cpp b/clang/utils/TableGen/ClangASTNodesEmitter.cpp index 07980cf72baff..5971b0012305d 100644 --- a/clang/utils/TableGen/ClangASTNodesEmitter.cpp +++ b/clang/utils/TableGen/ClangASTNodesEmitter.cpp @@ -29,8 +29,8 @@ using namespace clang::tblgen; namespace { class ClangASTNodesEmitter { // A map from a node to each of its derived nodes. - using ChildMap = std::multimap; - using ChildIterator = ChildMap::const_iterator; + typedef std::multimap ChildMap; + typedef ChildMap::const_iterator ChildIterator; std::set PrioritizedClasses; const RecordKeeper &Records; diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp index 0199b14d29584..d63e79a5f5155 100644 --- a/clang/utils/TableGen/ClangAttrEmitter.cpp +++ b/clang/utils/TableGen/ClangAttrEmitter.cpp @@ -186,7 +186,7 @@ static StringRef NormalizeGNUAttrSpelling(StringRef AttrSpelling) { return AttrSpelling; } -using ParsedAttrMap = std::vector>; +typedef std::vector> ParsedAttrMap; static ParsedAttrMap getParsedAttrList(const RecordKeeper &Records, ParsedAttrMap *Dupes = nullptr, @@ -1774,7 +1774,7 @@ SpellingNamesAreCommon(const std::vector& Spellings) { return true; } -using SemanticSpellingMap = std::map; +typedef std::map SemanticSpellingMap; static std::string CreateSemanticSpellings(const std::vector &Spellings, SemanticSpellingMap &Map) { diff --git a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp index 017957bb8b436..17078e2bc1505 100644 --- a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp +++ b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -118,7 +118,7 @@ namespace { return CategoryIDs[CategoryString]; } - using const_iterator = std::vector::const_iterator; + typedef std::vector::const_iterator const_iterator; const_iterator begin() const { return CategoryStrings.begin(); } const_iterator end() const { return CategoryStrings.end(); } }; @@ -232,14 +232,14 @@ static void groupDiagnostics(ArrayRef Diags, // Infer members of -Wpedantic. //===----------------------------------------------------------------------===// -using RecordVec = std::vector; -using RecordSet = DenseSet; -using VecOrSet = PointerUnion; +typedef std::vector RecordVec; +typedef DenseSet RecordSet; +typedef PointerUnion VecOrSet; namespace { class InferPedantic { - using GMap = - DenseMap>>; + typedef DenseMap>> + GMap; DiagGroupParentMap &DiagGroupParents; ArrayRef Diags;