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

Victor Chernyakin via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 30 05:00:04 PDT 2025


https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/149934

>From 4d160125b63759c95c9ed6f8298494fa2de5f9a3 Mon Sep 17 00:00:00 2001
From: Victor Chernyakin <chernyakin.victor.j at outlook.com>
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<clang::api_notes::StoredObjCSelector> {
-  typedef DenseMapInfo<unsigned> UnsignedInfo;
+  using UnsignedInfo = DenseMapInfo<unsigned>;
 
   static inline clang::api_notes::StoredObjCSelector getEmptyKey() {
     return clang::api_notes::StoredObjCSelector{UnsignedInfo::getEmptyKey(),
diff --git a/clang/lib/APINotes/APINotesWriter.cpp b/clang/lib/APINotes/APINotesWriter.cpp
index ffc5473988735..830d04ba1ae7c 100644
--- a/clang/lib/APINotes/APINotesWriter.cpp
+++ b/clang/lib/APINotes/APINotesWriter.cpp
@@ -384,7 +384,9 @@ class ContextIDTableInfo {
 
 /// Localized helper to make a type dependent, thwarting template argument
 /// deduction.
-template <typename T> struct MakeDependent { typedef T Type; };
+template <typename T> struct MakeDependent {
+  using Type = T;
+};
 
 /// Retrieve the serialized size of the given VersionTuple, for use in
 /// on-disk hash tables.
diff --git a/clang/lib/APINotes/APINotesYAMLCompiler.cpp b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
index 803410c54c646..8085719dd0148 100644
--- a/clang/lib/APINotes/APINotesYAMLCompiler.cpp
+++ b/clang/lib/APINotes/APINotesYAMLCompiler.cpp
@@ -77,7 +77,7 @@ struct Param {
   StringRef Type;
 };
 
-typedef std::vector<Param> ParamsSeq;
+using ParamsSeq = std::vector<Param>;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(Param)
@@ -131,7 +131,7 @@ template <> struct MappingTraits<Param> {
 } // namespace llvm
 
 namespace {
-typedef std::vector<NullabilityKind> NullabilitySeq;
+using NullabilitySeq = std::vector<NullabilityKind>;
 
 struct AvailabilityItem {
   APIAvailability Mode = APIAvailability::Available;
@@ -165,7 +165,7 @@ struct Method {
   StringRef SwiftReturnOwnership;
 };
 
-typedef std::vector<Method> MethodsSeq;
+using MethodsSeq = std::vector<Method>;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(Method)
@@ -216,7 +216,7 @@ struct Property {
   StringRef Type;
 };
 
-typedef std::vector<Property> PropertiesSeq;
+using PropertiesSeq = std::vector<Property>;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(Property)
@@ -255,7 +255,7 @@ struct Class {
   PropertiesSeq Properties;
 };
 
-typedef std::vector<Class> ClassesSeq;
+using ClassesSeq = std::vector<Class>;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(Class)
@@ -297,7 +297,7 @@ struct Function {
   StringRef SwiftReturnOwnership;
 };
 
-typedef std::vector<Function> FunctionsSeq;
+using FunctionsSeq = std::vector<Function>;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(Function)
@@ -334,7 +334,7 @@ struct GlobalVariable {
   StringRef Type;
 };
 
-typedef std::vector<GlobalVariable> GlobalVariablesSeq;
+using GlobalVariablesSeq = std::vector<GlobalVariable>;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(GlobalVariable)
@@ -364,7 +364,7 @@ struct EnumConstant {
   StringRef SwiftName;
 };
 
-typedef std::vector<EnumConstant> EnumConstantsSeq;
+using EnumConstantsSeq = std::vector<EnumConstant>;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(EnumConstant)
@@ -424,7 +424,7 @@ struct Field {
   StringRef Type;
 };
 
-typedef std::vector<Field> FieldsSeq;
+using FieldsSeq = std::vector<Field>;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(Field)
@@ -448,7 +448,7 @@ template <> struct MappingTraits<Field> {
 
 namespace {
 struct Tag;
-typedef std::vector<Tag> TagsSeq;
+using TagsSeq = std::vector<Tag>;
 
 struct Tag {
   StringRef Name;
@@ -527,7 +527,7 @@ struct Typedef {
   std::optional<SwiftNewTypeKind> SwiftType;
 };
 
-typedef std::vector<Typedef> TypedefsSeq;
+using TypedefsSeq = std::vector<Typedef>;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(Typedef)
@@ -560,7 +560,7 @@ template <> struct MappingTraits<Typedef> {
 
 namespace {
 struct Namespace;
-typedef std::vector<Namespace> NamespacesSeq;
+using NamespacesSeq = std::vector<Namespace>;
 
 struct TopLevelItems {
   ClassesSeq Classes;
@@ -623,7 +623,7 @@ struct Versioned {
   TopLevelItems Items;
 };
 
-typedef std::vector<Versioned> VersionedSeq;
+using VersionedSeq = std::vector<Versioned>;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(Versioned)
diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index ee3dc84479fd9..53975a789f5ed 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -262,7 +262,7 @@ namespace {
 struct APValue::MemberPointerData : MemberPointerBase {
   static const unsigned InlinePathSpace =
       (DataSize - sizeof(MemberPointerBase)) / sizeof(const CXXRecordDecl*);
-  typedef const CXXRecordDecl *PathElem;
+  using PathElem = const CXXRecordDecl *;
   union {
     PathElem Path[InlinePathSpace];
     PathElem *PathPtr;
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp
index 2ef0c31ec1bd9..051f9b30a0687 100644
--- a/clang/lib/AST/ASTDiagnostic.cpp
+++ b/clang/lib/AST/ASTDiagnostic.cpp
@@ -985,8 +985,8 @@ class TemplateDiff {
   /// The desugared TemplateArgument should provide the canonical argument
   /// for comparisons.
   class TSTiterator {
-    typedef const TemplateArgument& reference;
-    typedef const TemplateArgument* pointer;
+    using reference = const TemplateArgument &;
+    using pointer = const TemplateArgument *;
 
     /// InternalIterator - an iterator that is used to enter a
     /// TemplateSpecializationType and read TemplateArguments inside template
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 2e1a9a3d9ad63..8981c93b6a62a 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -835,7 +835,7 @@ std::string PredefinedExpr::ComputeName(PredefinedIdentKind IK,
         POut << " &&";
     }
 
-    typedef SmallVector<const ClassTemplateSpecializationDecl *, 8> SpecsTy;
+    using SpecsTy = SmallVector<const ClassTemplateSpecializationDecl *, 8>;
     SpecsTy Specs;
     const DeclContext *Ctx = FD->getDeclContext();
     while (isa_and_nonnull<NamedDecl>(Ctx)) {
@@ -3549,7 +3549,7 @@ bool CallExpr::isCallToStdMove() const {
 namespace {
   /// Look for any side effects within a Stmt.
   class SideEffectFinder : public ConstEvaluatedExprVisitor<SideEffectFinder> {
-    typedef ConstEvaluatedExprVisitor<SideEffectFinder> Inherited;
+    using Inherited = ConstEvaluatedExprVisitor<SideEffectFinder>;
     const bool IncludePossibleEffects;
     bool HasSideEffects;
 
@@ -3904,7 +3904,7 @@ namespace {
   /// Look for a call to a non-trivial function within an expression.
   class NonTrivialCallFinder : public ConstEvaluatedExprVisitor<NonTrivialCallFinder>
   {
-    typedef ConstEvaluatedExprVisitor<NonTrivialCallFinder> Inherited;
+    using Inherited = ConstEvaluatedExprVisitor<NonTrivialCallFinder>;
 
     bool NonTrivial;
 
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 0d12161756467..6772b1510be8d 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -282,7 +282,7 @@ namespace {
     /// The type of the most derived object referred to by this address.
     QualType MostDerivedType;
 
-    typedef APValue::LValuePathEntry PathEntry;
+    using PathEntry = APValue::LValuePathEntry;
 
     /// The entries on the path from the glvalue to the designated subobject.
     SmallVector<PathEntry, 8> Entries;
@@ -571,8 +571,8 @@ namespace {
 
     // Note that we intentionally use std::map here so that references to
     // values are stable.
-    typedef std::pair<const void *, unsigned> MapKeyTy;
-    typedef std::map<MapKeyTy, APValue> MapTy;
+    using MapKeyTy = std::pair<const void *, unsigned>;
+    using MapTy = std::map<MapKeyTy, APValue>;
     /// Temporaries - Temporary lvalues materialized within this stack frame.
     MapTy Temporaries;
 
@@ -1468,9 +1468,9 @@ namespace {
       return Success;
     }
   };
-  typedef ScopeRAII<ScopeKind::Block> BlockScopeRAII;
-  typedef ScopeRAII<ScopeKind::FullExpression> FullExpressionRAII;
-  typedef ScopeRAII<ScopeKind::Call> CallScopeRAII;
+  using BlockScopeRAII = ScopeRAII<ScopeKind::Block>;
+  using FullExpressionRAII = ScopeRAII<ScopeKind::FullExpression>;
+  using CallScopeRAII = ScopeRAII<ScopeKind::Call>;
 }
 
 bool SubobjectDesignator::checkSubobject(EvalInfo &Info, const Expr *E,
@@ -4156,7 +4156,7 @@ struct ExtractSubobjectHandler {
   APValue &Result;
   const AccessKinds AccessKind;
 
-  typedef bool result_type;
+  using result_type = bool;
   bool failed() { return false; }
   bool found(APValue &Subobj, QualType SubobjType) {
     Result = Subobj;
@@ -4191,7 +4191,7 @@ struct ModifySubobjectHandler {
   APValue &NewVal;
   const Expr *E;
 
-  typedef bool result_type;
+  using result_type = bool;
   static const AccessKinds AccessKind = AK_Assign;
 
   bool checkConst(QualType QT) {
@@ -4698,7 +4698,7 @@ struct CompoundAssignSubobjectHandler {
 
   static const AccessKinds AccessKind = AK_Assign;
 
-  typedef bool result_type;
+  using result_type = bool;
 
   bool checkConst(QualType QT) {
     // Assigning to a const object has undefined behavior.
@@ -4845,7 +4845,7 @@ struct IncDecSubobjectHandler {
   AccessKinds AccessKind;
   APValue *Old;
 
-  typedef bool result_type;
+  using result_type = bool;
 
   bool checkConst(QualType QT) {
     // Assigning to a const object has undefined behavior.
@@ -6070,7 +6070,7 @@ static bool CheckConstexprFunction(EvalInfo &Info, SourceLocation CallLoc,
 namespace {
 struct CheckDynamicTypeHandler {
   AccessKinds AccessKind;
-  typedef bool result_type;
+  using result_type = bool;
   bool failed() { return false; }
   bool found(APValue &Subobj, QualType SubobjType) { return true; }
   bool found(APSInt &Value, QualType SubobjType) { return true; }
@@ -6417,7 +6417,7 @@ struct StartLifetimeOfUnionMemberHandler {
   bool Failed = false;
   static const AccessKinds AccessKind = AK_Assign;
 
-  typedef bool result_type;
+  using result_type = bool;
   bool failed() { return Failed; }
   bool found(APValue &Subobj, QualType SubobjType) {
     // We are supposed to perform no initialization but begin the lifetime of
@@ -7135,7 +7135,7 @@ struct DestroyObjectHandler {
   const LValue &This;
   const AccessKinds AccessKind;
 
-  typedef bool result_type;
+  using result_type = bool;
   bool failed() { return false; }
   bool found(APValue &Subobj, QualType SubobjType) {
     return HandleDestructionImpl(Info, E->getSourceRange(), This, Subobj,
@@ -8096,8 +8096,8 @@ class ExprEvaluatorBase
 
 protected:
   EvalInfo &Info;
-  typedef ConstStmtVisitor<Derived, bool> StmtVisitorTy;
-  typedef ExprEvaluatorBase ExprEvaluatorBaseTy;
+  using StmtVisitorTy = ConstStmtVisitor<Derived, bool>;
+  using ExprEvaluatorBaseTy = ExprEvaluatorBase;
 
   OptionalDiagnostic CCEDiag(const Expr *E, diag::kind D) {
     return Info.CCEDiag(E, D);
@@ -8750,8 +8750,8 @@ class LValueExprEvaluatorBase
 protected:
   LValue &Result;
   bool InvalidBaseOK;
-  typedef LValueExprEvaluatorBase LValueExprEvaluatorBaseTy;
-  typedef ExprEvaluatorBase<Derived> ExprEvaluatorBaseTy;
+  using LValueExprEvaluatorBaseTy = LValueExprEvaluatorBase;
+  using ExprEvaluatorBaseTy = ExprEvaluatorBase<Derived>;
 
   bool Success(APValue::LValueBase B) {
     Result.set(B);
@@ -10517,7 +10517,7 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
       const AccessKinds AccessKind;
       APValue *Value;
 
-      typedef bool result_type;
+      using result_type = bool;
       bool failed() { return false; }
       bool checkConst(QualType QT) {
         if (QT.isConstQualified()) {
@@ -10656,7 +10656,7 @@ bool MemberPointerExprEvaluator::VisitCastExpr(const CastExpr *E) {
     // Base-to-derived member pointer casts store the path in derived-to-base
     // order, so iterate backwards. The CXXBaseSpecifier also provides us with
     // the wrong end of the derived->base arc, so stagger the path by one class.
-    typedef std::reverse_iterator<CastExpr::path_const_iterator> ReverseIter;
+    using ReverseIter = std::reverse_iterator<CastExpr::path_const_iterator>;
     for (ReverseIter PathI(E->path_end() - 1), PathE(E->path_begin());
          PathI != PathE; ++PathI) {
       assert(!(*PathI)->isVirtual() && "memptr cast through vbase");
diff --git a/clang/lib/AST/ExternalASTMerger.cpp b/clang/lib/AST/ExternalASTMerger.cpp
index 15f8531a3ab05..36d76ce677ff5 100644
--- a/clang/lib/AST/ExternalASTMerger.cpp
+++ b/clang/lib/AST/ExternalASTMerger.cpp
@@ -31,7 +31,7 @@ template <typename T> struct Source {
   template <typename U> operator Source<U>() { return Source<U>(t); }
 };
 
-typedef std::pair<Source<NamedDecl *>, ASTImporter *> Candidate;
+using Candidate = std::pair<Source<NamedDecl *>, ASTImporter *>;
 
 /// For the given DC, return the DC that is safe to perform lookups on.  This is
 /// the DC we actually want to work with most of the time.
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index 2a667934dba42..ba467551807f9 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -68,7 +68,7 @@ static bool isLambda(const NamedDecl *ND) {
 static const unsigned UnknownArity = ~0U;
 
 class ItaniumMangleContextImpl : public ItaniumMangleContext {
-  typedef std::pair<const DeclContext*, IdentifierInfo*> DiscriminatorKeyTy;
+  using DiscriminatorKeyTy = std::pair<const DeclContext *, IdentifierInfo *>;
   llvm::DenseMap<DiscriminatorKeyTy, unsigned> Discriminator;
   llvm::DenseMap<const NamedDecl*, unsigned> Uniquifier;
   const DiscriminatorOverrideTy DiscriminatorOverride = nullptr;
@@ -283,7 +283,7 @@ class CXXNameMangler {
   // The goal is to annotate against which version of a library an object was
   // built and to be able to provide backwards compatibility ("dual abi").
   // For more information see docs/ItaniumMangleAbiTags.rst.
-  typedef SmallVector<StringRef, 4> AbiTagList;
+  using AbiTagList = SmallVector<StringRef, 4>;
 
   // State to gather all implicit and explicit tags used in a mangled name.
   // Must always have an instance of this while emitting any name to keep
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp
index bc47e0506add0..99b2433158546 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -139,7 +139,7 @@ static const FunctionDecl *getStructor(const NamedDecl *ND) {
 /// MicrosoftMangleContextImpl - Overrides the default MangleContext for the
 /// Microsoft Visual C++ ABI.
 class MicrosoftMangleContextImpl : public MicrosoftMangleContext {
-  typedef std::pair<const DeclContext *, IdentifierInfo *> DiscriminatorKeyTy;
+  using DiscriminatorKeyTy = std::pair<const DeclContext *, IdentifierInfo *>;
   llvm::DenseMap<DiscriminatorKeyTy, unsigned> Discriminator;
   llvm::DenseMap<const NamedDecl *, unsigned> Uniquifier;
   llvm::DenseMap<const CXXRecordDecl *, unsigned> LambdaIds;
@@ -316,19 +316,19 @@ class MicrosoftCXXNameMangler {
   const NamedDecl *Structor;
   unsigned StructorType;
 
-  typedef llvm::SmallVector<std::string, 10> BackRefVec;
+  using BackRefVec = llvm::SmallVector<std::string, 10>;
   BackRefVec NameBackReferences;
 
-  typedef llvm::DenseMap<const void *, unsigned> ArgBackRefMap;
+  using ArgBackRefMap = llvm::DenseMap<const void *, unsigned>;
   ArgBackRefMap FunArgBackReferences;
   ArgBackRefMap TemplateArgBackReferences;
 
-  typedef llvm::DenseMap<const void *, StringRef> TemplateArgStringMap;
+  using TemplateArgStringMap = llvm::DenseMap<const void *, StringRef>;
   TemplateArgStringMap TemplateArgStrings;
   llvm::BumpPtrAllocator TemplateArgStringStorageAlloc;
   llvm::StringSaver TemplateArgStringStorage;
 
-  typedef std::set<std::pair<int, bool>> PassObjectSizeArgsSet;
+  using PassObjectSizeArgsSet = std::set<std::pair<int, bool>>;
   PassObjectSizeArgsSet PassObjectSizeArgs;
 
   ASTContext &getASTContext() const { return Context.getASTContext(); }
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index bd87d4418484b..88d1482e83258 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -271,7 +271,7 @@ namespace {
 // Process a Decl pointer.  Add* methods call back into ODRHash while Visit*
 // methods process the relevant parts of the Decl.
 class ODRDeclVisitor : public ConstDeclVisitor<ODRDeclVisitor> {
-  typedef ConstDeclVisitor<ODRDeclVisitor> Inherited;
+  using Inherited = ConstDeclVisitor<ODRDeclVisitor>;
   llvm::FoldingSetNodeID &ID;
   ODRHash &Hash;
 
@@ -856,7 +856,7 @@ namespace {
 // Process a Type pointer.  Add* methods call back into ODRHash while Visit*
 // methods process the relevant parts of the Type.
 class ODRTypeVisitor : public TypeVisitor<ODRTypeVisitor> {
-  typedef TypeVisitor<ODRTypeVisitor> Inherited;
+  using Inherited = TypeVisitor<ODRTypeVisitor>;
   llvm::FoldingSetNodeID &ID;
   ODRHash &Hash;
 
diff --git a/clang/lib/AST/ParentMap.cpp b/clang/lib/AST/ParentMap.cpp
index e62e71bf5a514..dc8b929ff4a73 100644
--- a/clang/lib/AST/ParentMap.cpp
+++ b/clang/lib/AST/ParentMap.cpp
@@ -18,7 +18,7 @@
 
 using namespace clang;
 
-typedef llvm::DenseMap<Stmt*, Stmt*> MapTy;
+using MapTy = llvm::DenseMap<Stmt *, Stmt *>;
 
 enum OpaqueValueMode {
   OV_Transparent,
diff --git a/clang/lib/AST/PrintfFormatString.cpp b/clang/lib/AST/PrintfFormatString.cpp
index bcd44f0a85eed..453f0122f473e 100644
--- a/clang/lib/AST/PrintfFormatString.cpp
+++ b/clang/lib/AST/PrintfFormatString.cpp
@@ -26,8 +26,8 @@ using clang::analyze_printf::PrintfSpecifier;
 
 using namespace clang;
 
-typedef clang::analyze_format_string::SpecifierResult<PrintfSpecifier>
-        PrintfSpecifierResult;
+using PrintfSpecifierResult =
+    clang::analyze_format_string::SpecifierResult<PrintfSpecifier>;
 
 //===----------------------------------------------------------------------===//
 // Methods for parsing format strings.
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index 6a74e98dd92d8..9485de987e383 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -109,8 +109,8 @@ class EmptySubobjectMap {
   const CXXRecordDecl *Class;
 
   /// EmptyClassOffsets - A map from offsets to empty record decls.
-  typedef llvm::TinyPtrVector<const CXXRecordDecl *> ClassVectorTy;
-  typedef llvm::DenseMap<CharUnits, ClassVectorTy> EmptyClassOffsetsMapTy;
+  using ClassVectorTy = llvm::TinyPtrVector<const CXXRecordDecl *>;
+  using EmptyClassOffsetsMapTy = llvm::DenseMap<CharUnits, ClassVectorTy>;
   EmptyClassOffsetsMapTy EmptyClassOffsets;
 
   /// MaxEmptyClassOffset - The highest offset known to contain an empty
@@ -560,7 +560,7 @@ void EmptySubobjectMap::UpdateEmptyFieldSubobjects(
   }
 }
 
-typedef llvm::SmallPtrSet<const CXXRecordDecl*, 4> ClassSetTy;
+using ClassSetTy = llvm::SmallPtrSet<const CXXRecordDecl *, 4>;
 
 class ItaniumRecordLayoutBuilder {
 protected:
@@ -660,7 +660,7 @@ class ItaniumRecordLayoutBuilder {
   /// field has been handled, if any.
   bool HandledFirstNonOverlappingEmptyField;
 
-  typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
+  using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
 
   /// Bases - base classes and their offsets in the record.
   BaseOffsetsMapTy Bases;
@@ -719,8 +719,8 @@ class ItaniumRecordLayoutBuilder {
   /// BaseSubobjectInfoAllocator - Allocator for BaseSubobjectInfo objects.
   llvm::SpecificBumpPtrAllocator<BaseSubobjectInfo> BaseSubobjectInfoAllocator;
 
-  typedef llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>
-    BaseSubobjectInfoMapTy;
+  using BaseSubobjectInfoMapTy =
+      llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>;
 
   /// VirtualBaseInfo - Map from all the (direct or indirect) virtual bases
   /// of the class we're laying out to their base subobject info.
@@ -2554,7 +2554,7 @@ struct MicrosoftRecordLayoutBuilder {
     CharUnits Size;
     CharUnits Alignment;
   };
-  typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
+  using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
   MicrosoftRecordLayoutBuilder(const ASTContext &Context,
                                EmptySubobjectMap *EmptySubobjects)
       : Context(Context), EmptySubobjects(EmptySubobjects),
diff --git a/clang/lib/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<ScanfSpecifier>
-        ScanfSpecifierResult;
+using ScanfSpecifierResult =
+    clang::analyze_format_string::SpecifierResult<ScanfSpecifier>;
 
 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 <class T> 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 <class T> 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 <class T> 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<const CXXMethodDecl *, CharUnits> MethodBaseOffsetPairTy;
+  using MethodBaseOffsetPairTy = std::pair<const CXXMethodDecl *, CharUnits>;
 
-  typedef llvm::DenseMap<MethodBaseOffsetPairTy,
-                         OverriderInfo> OverridersMapTy;
+  using OverridersMapTy = llvm::DenseMap<MethodBaseOffsetPairTy, OverriderInfo>;
 
   /// 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<std::pair<const CXXRecordDecl *, unsigned>,
-                         CharUnits> SubobjectOffsetMapTy;
+  using SubobjectOffsetMapTy =
+      llvm::DenseMap<std::pair<const CXXRecordDecl *, unsigned>, CharUnits>;
 
-  typedef llvm::DenseMap<const CXXRecordDecl *, unsigned> SubobjectCountMapTy;
+  using SubobjectCountMapTy = llvm::DenseMap<const CXXRecordDecl *, unsigned>;
 
   /// 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<const CXXRecordDecl *, 4> VisitedVirtualBasesSetTy;
+  using VisitedVirtualBasesSetTy = llvm::SmallPtrSet<const CXXRecordDecl *, 4>;
 
   /// 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<const CXXMethodDecl *, CharUnits> MethodAndOffsetPairTy;
+  using MethodAndOffsetPairTy = std::pair<const CXXMethodDecl *, CharUnits>;
 
   /// 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<const CXXRecordDecl *, CharUnits>
-    VBaseOffsetOffsetsMapTy;
+  using VBaseOffsetOffsetsMapTy =
+      llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
 
 private:
   const ItaniumVTableContext &VTables;
@@ -551,7 +550,7 @@ class VCallAndVBaseOffsetBuilder {
   ASTContext &Context;
 
   /// Components - vcall and vbase offset components
-  typedef SmallVector<VTableComponent, 64> VTableComponentVectorTy;
+  using VTableComponentVectorTy = SmallVector<VTableComponent, 64>;
   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<const CXXRecordDecl *, 8>
-    PrimaryBasesSetVectorTy;
+  using PrimaryBasesSetVectorTy =
+      llvm::SmallSetVector<const CXXRecordDecl *, 8>;
 
-  typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits>
-    VBaseOffsetOffsetsMapTy;
+  using VBaseOffsetOffsetsMapTy =
+      llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
 
-  typedef VTableLayout::AddressPointsMapTy AddressPointsMapTy;
+  using AddressPointsMapTy = VTableLayout::AddressPointsMapTy;
 
-  typedef llvm::DenseMap<GlobalDecl, int64_t> MethodVTableIndicesTy;
+  using MethodVTableIndicesTy = llvm::DenseMap<GlobalDecl, int64_t>;
 
 private:
   /// VTables - Global vtable information.
@@ -864,7 +863,7 @@ class ItaniumVTableBuilder {
     MethodInfo(MethodInfo const&) = default;
   };
 
-  typedef llvm::DenseMap<const CXXMethodDecl *, MethodInfo> MethodInfoMapTy;
+  using MethodInfoMapTy = llvm::DenseMap<const CXXMethodDecl *, MethodInfo>;
 
   /// 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<uint64_t, ThunkInfo> VTableThunksMapTy;
+  using VTableThunksMapTy = llvm::DenseMap<uint64_t, ThunkInfo>;
 
   /// VTableThunks - The thunks by vtable index in the vtable currently being
   /// built.
   VTableThunksMapTy VTableThunks;
 
-  typedef SmallVector<ThunkInfo, 1> ThunkInfoVectorTy;
-  typedef llvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy> ThunksMapTy;
+  using ThunkInfoVectorTy = SmallVector<ThunkInfo, 1>;
+  using ThunksMapTy = llvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy>;
 
   /// 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<const CXXRecordDecl *, 4> VisitedVirtualBasesSetTy;
+  using VisitedVirtualBasesSetTy = llvm::SmallPtrSet<const CXXRecordDecl *, 4>;
 
   /// 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<const CXXMethodDecl *, 8> OverriddenMethodsSetTy;
+using OverriddenMethodsSetTy = llvm::SmallPtrSet<const CXXMethodDecl *, 8>;
 
 /// 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<const CXXRecordDecl *, 8> BasesSetVectorTy;
+using BasesSetVectorTy = llvm::SmallSetVector<const CXXRecordDecl *, 8>;
 
 /// 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<const CXXMethodDecl *, 8> NewVirtualFunctionsTy;
+  using NewVirtualFunctionsTy = llvm::SmallVector<const CXXMethodDecl *, 8>;
   NewVirtualFunctionsTy NewVirtualFunctions;
 
   llvm::SmallVector<const CXXMethodDecl*, 4> NewImplicitVirtualFunctions;
@@ -2512,11 +2511,11 @@ namespace {
 
 class VFTableBuilder {
 public:
-  typedef llvm::DenseMap<GlobalDecl, MethodVFTableLocation>
-    MethodVFTableLocationsTy;
+  using MethodVFTableLocationsTy =
+      llvm::DenseMap<GlobalDecl, MethodVFTableLocation>;
 
-  typedef llvm::iterator_range<MethodVFTableLocationsTy::const_iterator>
-    method_locations_range;
+  using method_locations_range =
+      llvm::iterator_range<MethodVFTableLocationsTy::const_iterator>;
 
 private:
   /// VTables - Global vtable information.
@@ -2573,20 +2572,20 @@ class VFTableBuilder {
           UsesExtraSlot(false) {}
   };
 
-  typedef llvm::DenseMap<const CXXMethodDecl *, MethodInfo> MethodInfoMapTy;
+  using MethodInfoMapTy = llvm::DenseMap<const CXXMethodDecl *, MethodInfo>;
 
   /// MethodInfoMap - The information for all methods in the vftable we're
   /// currently building.
   MethodInfoMapTy MethodInfoMap;
 
-  typedef llvm::DenseMap<uint64_t, ThunkInfo> VTableThunksMapTy;
+  using VTableThunksMapTy = llvm::DenseMap<uint64_t, ThunkInfo>;
 
   /// VTableThunks - The thunks by vftable index in the vftable currently being
   /// built.
   VTableThunksMapTy VTableThunks;
 
-  typedef SmallVector<ThunkInfo, 1> ThunkInfoVectorTy;
-  typedef llvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy> ThunksMapTy;
+  using ThunkInfoVectorTy = SmallVector<ThunkInfo, 1>;
+  using ThunksMapTy = llvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy>;
 
   /// 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<const CXXMethodDecl *, 1> MethodGroup;
+  using MethodGroup = SmallVector<const CXXMethodDecl *, 1>;
   SmallVector<MethodGroup, 10> Groups;
-  typedef llvm::DenseMap<DeclarationName, unsigned> VisitedGroupIndicesTy;
+  using VisitedGroupIndicesTy = llvm::DenseMap<DeclarationName, unsigned>;
   VisitedGroupIndicesTy VisitedGroupIndices;
   for (const auto *D : RD->decls()) {
     const auto *ND = dyn_cast<NamedDecl>(D);
@@ -3511,8 +3510,8 @@ static bool rebucketPaths(VPtrInfoVector &Paths) {
 MicrosoftVTableContext::~MicrosoftVTableContext() {}
 
 namespace {
-typedef llvm::SetVector<BaseSubobject, std::vector<BaseSubobject>,
-                        llvm::DenseSet<BaseSubobject>> FullPathTy;
+using FullPathTy = llvm::SetVector<BaseSubobject, std::vector<BaseSubobject>,
+                                   llvm::DenseSet<BaseSubobject>>;
 }
 
 // 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<const CXXMethodDecl *> OverriderSetTy;
+  using OverriderSetTy = std::set<const CXXMethodDecl *>;
   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<MatchChildASTVisitor> {
 public:
-  typedef RecursiveASTVisitor<MatchChildASTVisitor> VisitorBase;
+  using VisitorBase = RecursiveASTVisitor<MatchChildASTVisitor>;
 
   // 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<MatchASTVisitor>,
       CompatibleAliases;
 
   // Maps (matcher, node) -> the match result for memoization.
-  typedef std::map<MatchKey, MemoizedMatchResult> MemoizationMap;
+  using MemoizationMap = std::map<MatchKey, MemoizedMatchResult>;
   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<const Stmt*, CFGBlock*> SMap;
+using SMap = llvm::DenseMap<const Stmt *, CFGBlock *>;
 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<std::pair<const CFGBlock *, const Stmt *>, 12>
-    DeferredLocsTy;
+    using DeferredLocsTy =
+        SmallVector<std::pair<const CFGBlock *, const Stmt *>, 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, // <name> 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<llvm::ConstantFolder, CGBuilderInserterTy>
-    CGBuilderBaseTy;
+using CGBuilderBaseTy =
+    llvm::IRBuilder<llvm::ConstantFolder, CGBuilderInserterTy>;
 
 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<CallArg, 8> {
 
   bool hasWritebacks() const { return !Writebacks.empty(); }
 
-  typedef llvm::iterator_range<SmallVectorImpl<Writeback>::const_iterator>
-      writeback_const_range;
+  using writeback_const_range =
+      llvm::iterator_range<SmallVectorImpl<Writeback>::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<DynamicThisUseChecker> {
-    typedef ConstEvaluatedExprVisitor<DynamicThisUseChecker> super;
+    using super = ConstEvaluatedExprVisitor<DynamicThisUseChecker>;
 
     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<char, const IdentifierInfo *> IsClassAndIdent;
+    using IsClassAndIdent = std::pair<char, const IdentifierInfo *>;
     /// 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<typename Traits>
   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<DirectCleanupTraits> DirectCleanup;
+    using DirectCleanup = CallDeleteDuringNew<DirectCleanupTraits>;
 
     DirectCleanup *Cleanup = CGF.EHStack.pushCleanupWithExtra<DirectCleanup>(
         EHCleanup, E->getNumPlacementArgs(), E->getOperatorDelete(),
@@ -1577,13 +1577,13 @@ static void EnterNewDeleteCleanup(CodeGenFunction &CGF, const CXXNewExpr *E,
   DominatingValue<RValue>::saved_type SavedTypeIdentity =
       DominatingValue<RValue>::save(CGF, TypeIdentity);
   struct ConditionalCleanupTraits {
-    typedef DominatingValue<RValue>::saved_type ValueTy;
-    typedef DominatingValue<RValue>::saved_type RValueTy;
+    using ValueTy = DominatingValue<RValue>::saved_type;
+    using RValueTy = DominatingValue<RValue>::saved_type;
     static RValue get(CodeGenFunction &CGF, ValueTy V) {
       return V.restore(CGF);
     }
   };
-  typedef CallDeleteDuringNew<ConditionalCleanupTraits> ConditionalCleanup;
+  using ConditionalCleanup = CallDeleteDuringNew<ConditionalCleanupTraits>;
 
   ConditionalCleanup *Cleanup =
       CGF.EHStack.pushCleanupWithExtra<ConditionalCleanup>(
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<bool> 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<OpaqueValueVisitor> {
 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<GenDefaultInitialize>,
       DefaultInitializedTypeVisitor<GenDefaultInitialize> {
   using Super = DefaultInitializedTypeVisitor<GenDefaultInitialize>;
-  typedef GenFuncBase<GenDefaultInitialize> GenFuncBaseTy;
+  using GenFuncBaseTy = GenFuncBase<GenDefaultInitialize>;
 
   GenDefaultInitialize(ASTContext &Ctx)
       : StructVisitor<GenDefaultInitialize>(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<llvm::Value*,1,bool> TryEmitResult;
+using TryEmitResult = llvm::PointerIntPair<llvm::Value *, 1, bool>;
 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<llvm::Value *(CodeGenFunction &CGF,
-                                         llvm::Value *value)>
-  ValueTransform;
+using ValueTransform =
+    llvm::function_ref<llvm::Value *(CodeGenFunction &CGF, llvm::Value *value)>;
 
 /// Insert code immediately after a call.
 
@@ -3188,7 +3187,7 @@ ARCExprEmitter<Impl,Result>::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<OpaqueValueExpr>(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<std::string, llvm::GlobalAlias*> TypedSelector;
+  using TypedSelector = std::pair<std::string, llvm::GlobalAlias *>;
   /// 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<Selector, SmallVector<TypedSelector, 2> >
-    SelectorMap;
+  using SelectorMap = llvm::DenseMap<Selector, SmallVector<TypedSelector, 2>>;
   /// 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<std::string, std::string> ClassAliasPair;
+  using ClassAliasPair = std::pair<std::string, std::string>;
   /// All classes that have aliases set for them.
   std::vector<ClassAliasPair> 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<std::string, std::pair<llvm::GlobalVariable*, int>>
-      EarlyInitPair;
+  using EarlyInitPair =
+      std::pair<std::string, std::pair<llvm::GlobalVariable *, int>>;
   std::vector<EarlyInitPair> 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<CharUnits /*Align*/, PrivateHelpersTy> PrivateDataTy;
+using PrivateDataTy = std::pair<CharUnits /*Align*/, PrivateHelpersTy>;
 } // 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<SourceLocation, llvm::Value *> OpenMPDebugLocMapTy;
+  using OpenMPDebugLocMapTy = llvm::DenseMap<SourceLocation, llvm::Value *>;
   OpenMPDebugLocMapTy OpenMPDebugLocMap;
   /// Stores debug location and ThreadID for the function.
   struct DebugLocThreadIdTy {
@@ -394,18 +394,18 @@ class CGOpenMPRuntime {
     llvm::AssertingVH<llvm::Instruction> ServiceInsertPt = nullptr;
   };
   /// Map of local debug location, ThreadId and functions.
-  typedef llvm::DenseMap<llvm::Function *, DebugLocThreadIdTy>
-      OpenMPLocThreadIDMapTy;
+  using OpenMPLocThreadIDMapTy =
+      llvm::DenseMap<llvm::Function *, DebugLocThreadIdTy>;
   OpenMPLocThreadIDMapTy OpenMPLocThreadIDMap;
   /// Map of UDRs and corresponding combiner/initializer.
-  typedef llvm::DenseMap<const OMPDeclareReductionDecl *,
-                         std::pair<llvm::Function *, llvm::Function *>>
-      UDRMapTy;
+  using UDRMapTy =
+      llvm::DenseMap<const OMPDeclareReductionDecl *,
+                     std::pair<llvm::Function *, llvm::Function *>>;
   UDRMapTy UDRMap;
   /// Map of functions and locally defined UDRs.
-  typedef llvm::DenseMap<llvm::Function *,
-                         SmallVector<const OMPDeclareReductionDecl *, 4>>
-      FunctionUDRMapTy;
+  using FunctionUDRMapTy =
+      llvm::DenseMap<llvm::Function *,
+                     SmallVector<const OMPDeclareReductionDecl *, 4>>;
   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<void(CodeGenFunction &,
-                                const OMPExecutableDirective &,
-                                llvm::SmallVectorImpl<llvm::Value *> &)>
-    CodeGenBoundParametersTy;
+using CodeGenBoundParametersTy =
+    llvm::function_ref<void(CodeGenFunction &, const OMPExecutableDirective &,
+                            llvm::SmallVectorImpl<llvm::Value *> &)>;
 } // 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<const CXXRecordDecl *, BaseSubobject> BaseSubobjectPairTy;
-  typedef llvm::DenseMap<BaseSubobjectPairTy, uint64_t> SubVTTIndicesMapTy;
+  using BaseSubobjectPairTy = std::pair<const CXXRecordDecl *, BaseSubobject>;
+  using SubVTTIndicesMapTy = llvm::DenseMap<BaseSubobjectPairTy, uint64_t>;
 
   /// SubVTTIndices - Contains indices into the various sub-VTTs.
   SubVTTIndicesMapTy SubVTTIndices;
 
-  typedef llvm::DenseMap<BaseSubobjectPairTy, uint64_t>
-    SecondaryVirtualPointerIndicesMapTy;
+  using SecondaryVirtualPointerIndicesMapTy =
+      llvm::DenseMap<BaseSubobjectPairTy, uint64_t>;
 
   /// 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<llvm::Value *, 1, bool> saved_type;
+  using saved_type = llvm::PointerIntPair<llvm::Value *, 1, bool>;
 
   /// 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 <class T> struct DominatingPointer<T, true> : DominatingLLVMValue {
-  typedef T *type;
+  using type = T *;
   static type restore(CodeGenFunction &CGF, saved_type value) {
     return static_cast<T *>(DominatingLLVMValue::restore(CGF, value));
   }
@@ -150,7 +150,7 @@ template <class T> struct DominatingPointer<T, true> : DominatingLLVMValue {
 
 /// A specialization of DominatingValue for Address.
 template <> struct DominatingValue<Address> {
-  typedef Address type;
+  using type = Address;
 
   struct saved_type {
     DominatingLLVMValue::saved_type BasePtr;
@@ -180,7 +180,7 @@ template <> struct DominatingValue<Address> {
 
 /// A specialization of DominatingValue for RValue.
 template <> struct DominatingValue<RValue> {
-  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<llvm::Value *, llvm::Value *> ComplexPairTy;
+  using ComplexPairTy = std::pair<llvm::Value *, llvm::Value *>;
   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<void(CodeGenFunction &, const OMPLoopDirective &,
-                                  JumpDest)>
-      CodeGenLoopTy;
-  typedef llvm::function_ref<void(CodeGenFunction &, SourceLocation,
-                                  const unsigned, const bool)>
-      CodeGenOrderedTy;
+  using CodeGenLoopTy = llvm::function_ref<void(
+      CodeGenFunction &, const OMPLoopDirective &, JumpDest)>;
+  using CodeGenOrderedTy = llvm::function_ref<void(
+      CodeGenFunction &, SourceLocation, const unsigned, const bool)>;
 
   // Codegen lambda for loop bounds in worksharing loop constructs
-  typedef llvm::function_ref<std::pair<LValue, LValue>(
-      CodeGenFunction &, const OMPExecutableDirective &S)>
-      CodeGenLoopBoundsTy;
+  using CodeGenLoopBoundsTy = llvm::function_ref<std::pair<LValue, LValue>(
+      CodeGenFunction &, const OMPExecutableDirective &S)>;
 
   // Codegen lambda for loop bounds in dispatch-based loop implementation
-  typedef llvm::function_ref<std::pair<llvm::Value *, llvm::Value *>(
-      CodeGenFunction &, const OMPExecutableDirective &S, Address LB,
-      Address UB)>
-      CodeGenDispatchBoundsTy;
+  using CodeGenDispatchBoundsTy =
+      llvm::function_ref<std::pair<llvm::Value *, llvm::Value *>(
+          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<T>(kind, A...);
 
     // Stash values in a tuple so we can guarantee the order of saves.
-    typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
+    using SavedTuple = std::tuple<typename DominatingValue<As>::saved_type...>;
     SavedTuple Saved{saveValueInCond(A)...};
 
-    typedef EHScopeStack::ConditionalCleanup<T, As...> CleanupType;
+    using CleanupType = EHScopeStack::ConditionalCleanup<T, As...>;
     EHStack.pushCleanupTuple<CleanupType>(kind, Saved);
     initFullExprCleanup();
   }
@@ -930,10 +927,10 @@ class CodeGenFunction : public CodeGenTypeCache {
     assert(!DominatingValue<Address>::needsSaving(ActiveFlag) &&
            "cleanup active flag should never need saving");
 
-    typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
+    using SavedTuple = std::tuple<typename DominatingValue<As>::saved_type...>;
     SavedTuple Saved{saveValueInCond(A)...};
 
-    typedef EHScopeStack::ConditionalCleanup<T, As...> CleanupType;
+    using CleanupType = EHScopeStack::ConditionalCleanup<T, As...>;
     pushCleanupAfterFullExprWithActiveFlag<CleanupType>(Kind, ActiveFlag,
                                                         Saved);
   }
@@ -1118,7 +1115,7 @@ class CodeGenFunction : public CodeGenTypeCache {
     void rescopeLabels();
   };
 
-  typedef llvm::DenseMap<const Decl *, Address> DeclMapTy;
+  using DeclMapTy = llvm::DenseMap<const Decl *, Address>;
 
   /// 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<VPtr, 4> VPtrsVector;
+  using VPtrsVector = llvm::SmallVector<VPtr, 4>;
 
-  typedef llvm::SmallPtrSet<const CXXRecordDecl *, 4> VisitedVirtualBasesSetTy;
+  using VisitedVirtualBasesSetTy = llvm::SmallPtrSet<const CXXRecordDecl *, 4>;
   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<void(CodeGenFunction & /*CGF*/,
-                                        llvm::Function * /*OutlinedFn*/,
-                                        const OMPTaskDataTy & /*Data*/)>
-      TaskGenTy;
+  using TaskGenTy = const llvm::function_ref<void(
+      CodeGenFunction & /*CGF*/, llvm::Function * /*OutlinedFn*/,
+      const OMPTaskDataTy & /*Data*/)>;
   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<Structor> CtorList;
+  using CtorList = std::vector<Structor>;
 
 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<IdentifierInfo *,
-                          llvm::GlobalValue *> StaticExternCMap;
+  using StaticExternCMap =
+      llvm::MapVector<IdentifierInfo *, llvm::GlobalValue *>;
   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<const Decl*, unsigned> DelayedCXXInitPosition;
 
-  typedef std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *>
-      GlobalInitData;
+  using GlobalInitData =
+      std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *>;
 
   // 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<llvm::FunctionType *, llvm::WeakTrackingVH,
-                     llvm::Constant *>
-      CXXGlobalDtorsOrStermFinalizer_t;
+  using CXXGlobalDtorsOrStermFinalizer_t =
+      std::tuple<llvm::FunctionType *, llvm::WeakTrackingVH, llvm::Constant *>;
   SmallVector<CXXGlobalDtorsOrStermFinalizer_t, 8>
       CXXGlobalDtorsOrStermFinalizers;
 
-  typedef std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *>
-      StermFinalizerData;
+  using StermFinalizerData =
+      std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *>;
 
   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<QualType, llvm::Metadata *> MetadataTypeMap;
+  using MetadataTypeMap = llvm::DenseMap<QualType, llvm::Metadata *>;
   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<Type> CanQualType;
+using CanQualType = CanQual<Type>;
 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<std::pair<SourceLocation, SourceLocation>, 8>
-      SourceRegionFilter;
+  using SourceRegionFilter =
+      llvm::SmallSet<std::pair<SourceLocation, SourceLocation>, 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 <class T> 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 T, class... As>
   class ConditionalCleanup final : public Cleanup {
-    typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
+    using SavedTuple = std::tuple<typename DominatingValue<As>::saved_type...>;
     SavedTuple Saved;
 
     template <std::size_t... Is>
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<const CXXRecordDecl *, CharUnits> VFTableIdTy;
-  typedef llvm::DenseMap<VFTableIdTy, llvm::GlobalVariable *> VTablesMapTy;
-  typedef llvm::DenseMap<VFTableIdTy, llvm::GlobalValue *> VFTablesMapTy;
+  using VFTableIdTy = std::pair<const CXXRecordDecl *, CharUnits>;
+  using VTablesMapTy = llvm::DenseMap<VFTableIdTy, llvm::GlobalVariable *>;
+  using VFTablesMapTy = llvm::DenseMap<VFTableIdTy, llvm::GlobalValue *>;
   /// 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<clang::StringLiteral>(CPUExpr)->getString();
     llvm::Triple Triple = getTarget().getTriple();
 
-    typedef std::tuple<unsigned, unsigned, unsigned, unsigned> CPUInfo;
+    using CPUInfo = std::tuple<unsigned, unsigned, unsigned, unsigned>;
 
     auto [LinuxSupportMethod, LinuxIDValue, AIXSupportMethod, AIXIDValue] =
         static_cast<CPUInfo>(StringSwitch<CPUInfo>(CPUStr)
@@ -183,9 +183,8 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
     const Expr *CPUExpr = E->getArg(0)->IgnoreParenCasts();
     StringRef CPUStr = cast<clang::StringLiteral>(CPUExpr)->getString();
     if (Triple.isOSAIX()) {
-      typedef std::tuple<unsigned, unsigned, unsigned, CmpInst::Predicate,
-                         unsigned>
-          CPUSupportType;
+      using CPUSupportType = std::tuple<unsigned, unsigned, unsigned,
+                                        CmpInst::Predicate, unsigned>;
       auto [SupportMethod, FieldIdx, Mask, CompOp, Value] =
           static_cast<CPUSupportType>(StringSwitch<CPUSupportType>(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<llvm::Value *, StringRef> ValueTy;
+    using ValueTy = std::pair<llvm::Value *, StringRef>;
     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<phases::ID> PhasesTy;
+    using PhasesTy = const llvm::SmallVectorImpl<phases::ID>;
 
     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<StringRef::size_type, unsigned> Split;
+  using Split = std::pair<StringRef::size_type, unsigned>;
 
   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<std::pair<tooling::Replacements, unsigned>(
-      const Environment &)>
-      AnalyzerPass;
+  using AnalyzerPass = std::function<std::pair<tooling::Replacements, unsigned>(
+      const Environment &)>;
 
   SmallVector<AnalyzerPass, 16> 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<std::pair<tooling::Replacements, unsigned>(
-    const Environment &)>
-    AnalyzerPass;
+using AnalyzerPass = std::function<std::pair<tooling::Replacements, unsigned>(
+    const Environment &)>;
 
 void addQualifierAlignmentFixerPasses(const FormatStyle &Style,
                                       SmallVectorImpl<AnalyzerPass> &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<unsigned, unsigned> OrderedPenalty;
+  using OrderedPenalty = std::pair<unsigned, unsigned>;
 
   /// 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<OrderedPenalty, StateNode *> QueueItem;
+  using QueueItem = std::pair<OrderedPenalty, StateNode *>;
 
   /// The BFS queue type.
-  typedef std::priority_queue<QueueItem, SmallVector<QueueItem>,
-                              std::greater<QueueItem>>
-      QueueType;
+  using QueueType = std::priority_queue<QueueItem, SmallVector<QueueItem>,
+                                        std::greater<QueueItem>>;
 
   /// 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<ASTPrinter> {
-    typedef RecursiveASTVisitor<ASTPrinter> base;
+    using base = RecursiveASTVisitor<ASTPrinter>;
 
   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<const IdentifierInfo *, MacroInfo *> id_macro_pair;
+using id_macro_pair = std::pair<const IdentifierInfo *, MacroInfo *>;
 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<uint64_t, 64> RecordData;
-typedef SmallVectorImpl<uint64_t> RecordDataImpl;
-typedef ArrayRef<uint64_t> RecordDataRef;
+using RecordData = SmallVector<uint64_t, 64>;
+using RecordDataImpl = SmallVectorImpl<uint64_t>;
+using RecordDataRef = ArrayRef<uint64_t>;
 
 class SDiagsWriter;
 
@@ -81,7 +81,7 @@ class SDiagsRenderer : public DiagnosticNoteRenderer {
                      DiagnosticsEngine::Level Level) override;
 };
 
-typedef llvm::DenseMap<unsigned, unsigned> AbbrevLookup;
+using AbbrevLookup = llvm::DenseMap<unsigned, unsigned>;
 
 class SDiagsMerger : SerializedDiagnosticReader {
   SDiagsWriter &Writer;
@@ -270,8 +270,8 @@ class SDiagsWriter : public DiagnosticConsumer {
     /// The collection of files used.
     llvm::DenseMap<const char *, unsigned> Files;
 
-    typedef llvm::DenseMap<const void *, std::pair<unsigned, StringRef> >
-    DiagFlagsTy;
+    using DiagFlagsTy =
+        llvm::DenseMap<const void *, std::pair<unsigned, StringRef>>;
 
     /// 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<BodyIndexer> {
   const DeclContext *ParentDC;
   SmallVector<Stmt*, 16> StmtStack;
 
-  typedef RecursiveASTVisitor<BodyIndexer> base;
+  using base = RecursiveASTVisitor<BodyIndexer>;
 
   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<TypeIndexer> {
   bool IsBase;
   SmallVector<SymbolRelation, 3> Relations;
 
-  typedef RecursiveASTVisitor<TypeIndexer> base;
+  using base = RecursiveASTVisitor<TypeIndexer>;
 
 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<const IdentifierInfo *, OpenCLExtState> OpenCLExtData;
+  using OpenCLExtData = std::pair<const IdentifierInfo *, OpenCLExtState>;
 }
 
 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<PragmaHandler>(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<ContainsReference> {
   const DeclRefExpr *Needle;
 
 public:
-  typedef ConstEvaluatedExprVisitor<ContainsReference> Inherited;
+  using Inherited = ConstEvaluatedExprVisitor<ContainsReference>;
 
   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<const AttributedStmt *, 8> AttrStmts;
+  using AttrStmts = llvm::SmallPtrSet<const AttributedStmt *, 8>;
 
   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<const Stmt *, WeakObjectUseMap::const_iterator>
-  StmtUsesPair;
+  using WeakObjectProfileTy = sema::FunctionScopeInfo::WeakObjectProfileTy;
+  using WeakObjectUseMap = sema::FunctionScopeInfo::WeakObjectUseMap;
+  using WeakUseVector = sema::FunctionScopeInfo::WeakUseVector;
+  using StmtUsesPair =
+      std::pair<const Stmt *, WeakObjectUseMap::const_iterator>;
 
   ASTContext &Ctx = S.getASTContext();
 
@@ -1663,9 +1663,9 @@ static void diagnoseRepeatedUseOfWeak(Sema &S,
 
 namespace clang {
 namespace {
-typedef SmallVector<PartialDiagnosticAt, 1> OptionalNotes;
-typedef std::pair<PartialDiagnosticAt, OptionalNotes> DelayedDiag;
-typedef std::list<DelayedDiag> DiagList;
+using OptionalNotes = SmallVector<PartialDiagnosticAt, 1>;
+using DelayedDiag = std::pair<PartialDiagnosticAt, OptionalNotes>;
+using DiagList = std::list<DelayedDiag>;
 
 struct SortDiagBySourceLocation {
   SourceManager &SM;
@@ -1683,12 +1683,12 @@ struct SortDiagBySourceLocation {
 namespace {
 class UninitValsDiagReporter : public UninitVariablesHandler {
   Sema &S;
-  typedef SmallVector<UninitUse, 2> UsesVec;
-  typedef llvm::PointerIntPair<UsesVec *, 1, bool> MappedType;
+  using UsesVec = SmallVector<UninitUse, 2>;
+  using MappedType = llvm::PointerIntPair<UsesVec *, 1, bool>;
   // 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<const VarDecl *, MappedType> UsesMap;
+  using UsesMap = llvm::MapVector<const VarDecl *, MappedType>;
   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<unsigned,unsigned> ScopePair;
+using ScopePair = std::pair<unsigned, unsigned>;
 
 /// 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<const CXXRecordDecl*, bool> RecordCompleteMap;
+using RecordCompleteMap = llvm::DenseMap<const CXXRecordDecl *, bool>;
 
 /// 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<DeferredDiagnosticsEmitter> {
 public:
-  typedef UsedDeclVisitor<DeferredDiagnosticsEmitter> Inherited;
+  using Inherited = UsedDeclVisitor<DeferredDiagnosticsEmitter>;
 
   // Whether the function is already in the current use-path.
   llvm::SmallPtrSet<CanonicalDeclPtr<Decl>, 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<FunctionDecl *, ObjCMethodDecl *> FunctionOrMethod;
+using FunctionOrMethod = llvm::PointerUnion<FunctionDecl *, ObjCMethodDecl *>;
 }
 
 /// 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<CXXRecordDecl*>::const_iterator record_iterator;
+  using record_iterator = SmallVectorImpl<CXXRecordDecl *>::const_iterator;
 
   DeclContext *Inner;
   SmallVector<FunctionDecl*, 4> 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<std::pair<unsigned, SourceLocation> > VisStack;
+using VisStack = std::vector<std::pair<unsigned, SourceLocation>>;
 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<const Decl *, 16> AllDeclsFound;
 
-  typedef std::pair<const NamedDecl *, unsigned> DeclIndexPair;
+  using DeclIndexPair = std::pair<const NamedDecl *, unsigned>;
 
   /// 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<DeclIndexPair, 4> DeclIndexPairVector;
+    using DeclIndexPairVector = SmallVector<DeclIndexPair, 4>;
 
     /// 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<DeclarationName, ShadowMapEntry> ShadowMap;
+  using ShadowMap = llvm::DenseMap<DeclarationName, ShadowMapEntry>;
 
   /// 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<Module *, 8> 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<const IdentifierInfo *, 16> AddedPropertiesSet;
+using AddedPropertiesSet = llvm::SmallPtrSet<const IdentifierInfo *, 16>;
 
 /// 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<Expr *> Args) {
   return false;
 }
 
-typedef CodeCompleteConsumer::OverloadCandidate ResultCandidate;
+using ResultCandidate = CodeCompleteConsumer::OverloadCandidate;
 
 static void mergeCandidatesWithResults(
     Sema &SemaRef, SmallVectorImpl<ResultCandidate> &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<Selector, 16> VisitedSelectorSet;
+using VisitedSelectorSet = llvm::SmallPtrSet<Selector, 16>;
 
 /// 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<ObjCInterfaceDecl>(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<const IdentifierInfo *> 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<const IdentifierInfo *> 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<Selector,
-                       llvm::PointerIntPair<ObjCMethodDecl *, 1, bool>>
-    KnownMethodsMap;
+using KnownMethodsMap =
+    llvm::DenseMap<Selector, llvm::PointerIntPair<ObjCMethodDecl *, 1, bool>>;
 
 /// 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<unsigned, 4> InitFieldIndex;
 
   public:
-    typedef EvaluatedExprVisitor<SelfReferenceChecker> Inherited;
+    using Inherited = EvaluatedExprVisitor<SelfReferenceChecker>;
 
     SelfReferenceChecker(Sema &S, Decl *OrigDecl) : Inherited(S.Context),
                                                     S(S), OrigDecl(OrigDecl) {
@@ -20268,13 +20268,13 @@ static void CheckForDuplicateEnumValues(Sema &S, ArrayRef<Decl *> Elements,
   if (S.Diags.isIgnored(diag::warn_duplicate_enum_values, Enum->getLocation()))
     return;
 
-  typedef SmallVector<EnumConstantDecl *, 3> ECDVector;
-  typedef SmallVector<std::unique_ptr<ECDVector>, 3> DuplicatesVector;
+  using ECDVector = SmallVector<EnumConstantDecl *, 3>;
+  using DuplicatesVector = SmallVector<std::unique_ptr<ECDVector>, 3>;
 
-  typedef llvm::PointerUnion<EnumConstantDecl*, ECDVector*> DeclOrVector;
+  using DeclOrVector = llvm::PointerUnion<EnumConstantDecl *, ECDVector *>;
 
   // DenseMaps cannot contain the all ones int64_t value, so use unordered_map.
-  typedef std::unordered_map<int64_t, DeclOrVector> ValueToVectorMap;
+  using ValueToVectorMap = std::unordered_map<int64_t, DeclOrVector>;
 
   // 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<QualType, 4> IndirectBaseSet;
+using IndirectBaseSet = llvm::SmallPtrSet<QualType, 4>;
 
 /// Recursively add the bases of Type.  Don't add Type itself.
 static void
@@ -3742,7 +3742,7 @@ namespace {
     llvm::SmallVector<unsigned, 4> InitFieldIndex;
 
   public:
-    typedef EvaluatedExprVisitor<UninitializedFieldVisitor> Inherited;
+    using Inherited = EvaluatedExprVisitor<UninitializedFieldVisitor>;
     UninitializedFieldVisitor(Sema &S,
                               llvm::SmallPtrSetImpl<ValueDecl*> &Decls,
                               llvm::SmallPtrSetImpl<QualType> &BaseClasses)
@@ -5787,8 +5787,8 @@ bool CheckRedundantInit(Sema &S,
   return true;
 }
 
-typedef std::pair<NamedDecl *, CXXCtorInitializer *> UnionEntry;
-typedef llvm::DenseMap<RecordDecl*, UnionEntry> RedundantUnionMap;
+using UnionEntry = std::pair<NamedDecl *, CXXCtorInitializer *>;
+using RedundantUnionMap = llvm::DenseMap<RecordDecl *, UnionEntry>;
 
 bool CheckRedundantUnionInit(Sema &S,
                              CXXCtorInitializer *Init,
@@ -9387,7 +9387,7 @@ struct SpecialMemberVisitor {
   }
 
   /// A base or member subobject.
-  typedef llvm::PointerUnion<CXXBaseSpecifier*, FieldDecl*> Subobject;
+  using Subobject = llvm::PointerUnion<CXXBaseSpecifier *, FieldDecl *>;
 
   /// 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<FunctionTemplateDecl> tmpl_iter;
+  using tmpl_iter = CXXRecordDecl::specific_decl_iterator<FunctionTemplateDecl>;
   for (tmpl_iter TI(RD->decls_begin()), TE(RD->decls_end()); TI != TE; ++TI) {
     if (CXXConstructorDecl *CD =
           dyn_cast<CXXConstructorDecl>(TI->getTemplatedDecl()))
@@ -15483,7 +15483,7 @@ static void checkMoveAssignmentForRepeatedMove(Sema &S, CXXRecordDecl *Class,
     return;
 
   llvm::SmallVector<CXXBaseSpecifier *, 16> Worklist;
-  typedef llvm::DenseMap<CXXRecordDecl*, CXXBaseSpecifier*> VBaseMap;
+  using VBaseMap = llvm::DenseMap<CXXRecordDecl *, CXXBaseSpecifier *>;
   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<NSView *> missing the
   // \c*.
-  typedef llvm::PointerUnion<TypeDecl *, ObjCInterfaceDecl *> TypeOrClassDecl;
+  using TypeOrClassDecl = llvm::PointerUnion<TypeDecl *, ObjCInterfaceDecl *>;
   SmallVector<TypeOrClassDecl, 4> 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<IdentifierInfo*> ProtocolNameSet;
-typedef std::unique_ptr<ProtocolNameSet> LazyProtocolNameSet;
+using ProtocolNameSet = llvm::DenseSet<IdentifierInfo *>;
+using LazyProtocolNameSet = std::unique_ptr<ProtocolNameSet>;
 
 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<TransformToPE> {
-    typedef TreeTransform<TransformToPE> BaseTransform;
+    using BaseTransform = TreeTransform<TransformToPE>;
 
   public:
     TransformToPE(Sema &SemaRef) : BaseTransform(SemaRef) { }
@@ -20354,7 +20354,7 @@ namespace {
 /// potentially-evaluated subexpressions as "referenced".
 class EvaluatedExprMarker : public UsedDeclVisitor<EvaluatedExprMarker> {
 public:
-  typedef UsedDeclVisitor<EvaluatedExprMarker> Inherited;
+  using Inherited = UsedDeclVisitor<EvaluatedExprMarker>;
   bool SkipLocalVariables;
   ArrayRef<const Expr *> 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<const CXXRecordDecl*, 4> BaseSet;
+using BaseSet = llvm::SmallPtrSet<const CXXRecordDecl *, 4>;
 
 /// 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<ARCCastChecker, ACCResult> {
-    typedef StmtVisitor<ARCCastChecker, ACCResult> super;
+    using super = StmtVisitor<ARCCastChecker, ACCResult>;
 
     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<Designator, 4> 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<ASTDesignator, 32> 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<UnqualUsingEntry, 8> ListTy;
+    using ListTy = SmallVector<UnqualUsingEntry, 8>;
 
     ListTy list;
     llvm::SmallPtrSet<DeclContext*, 8> 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<NamedDecl*> ShadowMapEntry;
+  using ShadowMapEntry = llvm::TinyPtrVector<NamedDecl *>;
 
 private:
   /// A mapping from declaration names to the declarations that have
   /// this name within a particular scope.
-  typedef llvm::DenseMap<DeclarationName, ShadowMapEntry> ShadowMap;
+  using ShadowMap = llvm::DenseMap<DeclarationName, ShadowMapEntry>;
 
   /// A list of shadow maps, which is used to model name hiding.
   std::list<ShadowMap> 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<TransformExprToCaptures> {
-  typedef TreeTransform<TransformExprToCaptures> BaseTransform;
+  using BaseTransform = TreeTransform<TransformExprToCaptures>;
   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<QualType, 8> TypeSet;
+  using TypeSet = llvm::SmallSetVector<QualType, 8>;
 
   /// 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<Expr *(Expr *, unsigned)> SpecificRebuilderRefTy;
+    using SpecificRebuilderRefTy = llvm::function_ref<Expr *(Expr *, unsigned)>;
     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<CommaVisitor> {
-  typedef EvaluatedExprVisitor<CommaVisitor> Inherited;
+  using Inherited = EvaluatedExprVisitor<CommaVisitor>;
   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<std::pair<llvm::APSInt, EnumConstantDecl*>, 64> EnumValsTy;
+using EnumValsTy = SmallVector<std::pair<llvm::APSInt, EnumConstantDecl *>, 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<std::pair<llvm::APSInt, CaseStmt*>, 64> CaseValsTy;
+  using CaseValsTy = SmallVector<std::pair<llvm::APSInt, CaseStmt *>, 64>;
   CaseValsTy CaseVals;
 
   // Keep track of any GNU case ranges we see.  The APSInt is the low value.
-  typedef std::vector<std::pair<llvm::APSInt, CaseStmt*> > CaseRangesTy;
+  using CaseRangesTy = std::vector<std::pair<llvm::APSInt, CaseStmt *>>;
   CaseRangesTy CaseRanges;
 
   DefaultStmt *TheDefaultStmt = nullptr;
@@ -1771,8 +1771,8 @@ Sema::DiagnoseAssignmentEnum(QualType DstType, QualType SrcType,
     return;
   }
 
-  typedef SmallVector<std::pair<llvm::APSInt, EnumConstantDecl *>, 64>
-      EnumValsTy;
+  using EnumValsTy =
+      SmallVector<std::pair<llvm::APSInt, EnumConstantDecl *>, 64>;
   EnumValsTy EnumVals;
 
   // Gather all enum values, set their type and sort them,
@@ -1872,7 +1872,7 @@ namespace {
     SmallVectorImpl<SourceRange> &Ranges;
     bool Simple;
   public:
-    typedef EvaluatedExprVisitor<DeclExtractor> Inherited;
+    using Inherited = EvaluatedExprVisitor<DeclExtractor>;
 
     DeclExtractor(Sema &S, DeclSetVector &Decls,
                   SmallVectorImpl<SourceRange> &Ranges) :
@@ -1953,7 +1953,7 @@ namespace {
     bool FoundDecl;
 
   public:
-    typedef EvaluatedExprVisitor<DeclMatcher> Inherited;
+    using Inherited = EvaluatedExprVisitor<DeclMatcher>;
 
     DeclMatcher(Sema &S, DeclSetVector &Decls, Stmt *Statement) :
         Inherited(S.Context), Decls(Decls), FoundDecl(false) {
@@ -2129,7 +2129,7 @@ namespace {
       Visit(Body);
     }
 
-    typedef ConstEvaluatedExprVisitor<BreakContinueFinder> Inherited;
+    using Inherited = ConstEvaluatedExprVisitor<BreakContinueFinder>;
 
     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<StringRef , Expr *> NamedOperand;
+  using NamedOperand = std::pair<StringRef, Expr *>;
   SmallVector<NamedOperand, 4> 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<CallExprFinder> {
   std::vector<const CallExpr *> CallExprs;
 
 public:
-  typedef ConstEvaluatedExprVisitor<CallExprFinder> Inherited;
+  using Inherited = ConstEvaluatedExprVisitor<CallExprFinder>;
 
   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<MatchResult, 4> Matched;
   SourceLocation PointOfInstantiation = TemplateNameLoc;
   TemplateSpecCandidateSet FailedCandidates(PointOfInstantiation,
@@ -6024,7 +6024,7 @@ namespace {
     Sema &S;
     SourceRange SR;
 
-    typedef TypeVisitor<UnnamedLocalNoLinkageFinder, bool> inherited;
+    using inherited = TypeVisitor<UnnamedLocalNoLinkageFinder, bool>;
 
   public:
     UnnamedLocalNoLinkageFinder(Sema &S, SourceRange SR) : S(S), SR(SR) { }
@@ -11207,7 +11207,7 @@ namespace {
     DeclarationName Entity;
 
   public:
-    typedef TreeTransform<CurrentInstantiationRebuilder> inherited;
+    using inherited = TreeTransform<CurrentInstantiationRebuilder>;
 
     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<TemplateDeclInstantiator> TypedefNameInstantiator;
 
 public:
-  typedef TreeTransform<ExtractTypeForDeductionGuide> Base;
+  using Base = TreeTransform<ExtractTypeForDeductionGuide>;
   ExtractTypeForDeductionGuide(
       Sema &SemaRef,
       llvm::SmallVectorImpl<TypedefNameDecl *> &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<TemplateInstantiator> inherited;
+    using inherited = TreeTransform<TemplateInstantiator>;
 
     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<Decl *, DeclArgumentPack *> *Found
     = getSema().CurrentInstantiationScope->findInstantiationOf(PD);
   assert(Found && "no instantiation for parameter pack");
@@ -4029,7 +4029,7 @@ static ActionResult<CXXRecordDecl *> 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<MatchResult, 4> Matched, ExtraMatched;
     SmallVector<ClassTemplatePartialSpecializationDecl *, 4> 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<NamedDecl *, 8> ParamVector;
+  using ParamVector = SmallVector<NamedDecl *, 8>;
   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<NamedDecl>(
             (*cast<DeclArgumentPack *>(*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<NamedDecl *>(Unexpanded[I].first);
       if (isa<VarDecl>(ND)) {
         // Function parameter pack or init-capture pack.
-        typedef LocalInstantiationScope::DeclArgumentPack DeclArgumentPack;
+        using DeclArgumentPack = LocalInstantiationScope::DeclArgumentPack;
 
         llvm::PointerUnion<Decl *, DeclArgumentPack *> *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<DeclSpec::TQ, SourceLocation> QualLoc;
+  using QualLoc = std::pair<DeclSpec::TQ, SourceLocation>;
   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<InputIterator>::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<InputIterator>::difference_type;
+  using iterator_category = std::input_iterator_tag;
 
   class pointer {
     TemplateArgumentLoc Arg;
@@ -5039,9 +5039,9 @@ bool TreeTransform<Derived>::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<Derived,
-                                                TemplateArgument::pack_iterator>
-        PackLocIterator;
+      using PackLocIterator =
+          TemplateArgumentLocInventIterator<Derived,
+                                            TemplateArgument::pack_iterator>;
       if (TransformTemplateArguments(PackLocIterator(*this,
                                                  In.getArgument().pack_begin()),
                                      PackLocIterator(*this,
@@ -7262,10 +7262,10 @@ QualType TreeTransform<Derived>::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<Derived>::TransformAutoType(TypeLocBuilder &TLB,
 
     NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
     NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
-    typedef TemplateArgumentLocContainerIterator<AutoTypeLoc> ArgIterator;
+    using ArgIterator = TemplateArgumentLocContainerIterator<AutoTypeLoc>;
     if (getDerived().TransformTemplateArguments(
             ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
             NewTemplateArgs))
@@ -7394,8 +7394,8 @@ QualType TreeTransform<Derived>::TransformTemplateSpecializationType(
   TemplateArgumentListInfo NewTemplateArgs;
   NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
   NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
-  typedef TemplateArgumentLocContainerIterator<TemplateSpecializationTypeLoc>
-    ArgIterator;
+  using ArgIterator =
+      TemplateArgumentLocContainerIterator<TemplateSpecializationTypeLoc>;
   if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
                                               ArgIterator(TL, TL.getNumArgs()),
                                               NewTemplateArgs))
@@ -7451,8 +7451,8 @@ QualType TreeTransform<Derived>::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<Derived>::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<Component, 4> Components;
   for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
     const OffsetOfNode &ON = E->getComponent(I);
@@ -15403,7 +15403,7 @@ ExprResult
 TreeTransform<Derived>::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<ExprResult, QualType> InitCaptureInfoTy;
+  using InitCaptureInfoTy = std::pair<ExprResult, QualType>;
   struct TransformedInitCapture {
     // The location of the ... if the result is retaining a pack expansion.
     SourceLocation EllipsisLoc;
@@ -16203,8 +16203,8 @@ TreeTransform<Derived>::TransformSizeOfPackExpr(SizeOfPackExpr *E) {
                                                E->getPackLoc());
   {
     TemporaryBase Rebase(*this, E->getPackLoc(), getBaseEntity());
-    typedef TemplateArgumentLocInventIterator<
-        Derived, const TemplateArgument*> PackLocIterator;
+    using PackLocIterator =
+        TemplateArgumentLocInventIterator<Derived, const TemplateArgument *>;
     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<Derived> {
   Sema &S;
 
 public:
-  typedef EvaluatedExprVisitor<Derived> Inherited;
+  using Inherited = EvaluatedExprVisitor<Derived>;
 
   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<unsigned, 2> 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<unsigned, 2>;
+  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<IdentifierIndexReaderTrait>
-    IdentifierIndexTable;
-
+using IdentifierIndexTable =
+    llvm::OnDiskIterableChainedHashTable<IdentifierIndexReaderTrait>;
 }
 
 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<SmallVector<unsigned, 2> > InterestingIdentifierMap;
+    using InterestingIdentifierMap = llvm::StringMap<SmallVector<unsigned, 2>>;
 
     /// 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<StringRef, bool> data_type;
+    using data_type = std::pair<StringRef, bool>;
 
     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<InterestingIdentifierTable> 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<unsigned, 2> data_type;
-  typedef const SmallVector<unsigned, 2> &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<unsigned, 2>;
+  using data_type_ref = const SmallVector<unsigned, 2> &;
+  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<TypeVisitorHelper> {
-  typedef TypeVisitor<TypeVisitorHelper> Inherited;
+  using Inherited = TypeVisitor<TypeVisitorHelper>;
   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<Selector,ObjCMethodDecl*> MapTy;
+  using MapTy = llvm::DenseMap<Selector, ObjCMethodDecl *>;
   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<WalkAST> {
   // 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<FnCheck> 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<FnCheck> 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<check::ASTDecl<ObjCImplementationDecl> > {
 
-  typedef llvm::DenseMap<const ObjCIvarDecl*,
-                         const ObjCPropertyDecl*> IvarToPropertyMapTy;
+  using IvarToPropertyMapTy =
+      llvm::DenseMap<const ObjCIvarDecl *, const ObjCPropertyDecl *>;
 
   /// 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<const ObjCMethodDecl*, 2> MethodSet;
-  typedef llvm::DenseMap<const ObjCMethodDecl*,
-                         const ObjCIvarDecl*> MethToIvarMapTy;
-  typedef llvm::DenseMap<const ObjCPropertyDecl*,
-                         const ObjCIvarDecl*> PropToIvarMapTy;
-  typedef llvm::DenseMap<const ObjCIvarDecl*,
-                         const ObjCPropertyDecl*> IvarToPropMapTy;
+  using MethodSet = llvm::SmallSetVector<const ObjCMethodDecl *, 2>;
+  using MethToIvarMapTy =
+      llvm::DenseMap<const ObjCMethodDecl *, const ObjCIvarDecl *>;
+  using PropToIvarMapTy =
+      llvm::DenseMap<const ObjCPropertyDecl *, const ObjCIvarDecl *>;
+  using IvarToPropMapTy =
+      llvm::DenseMap<const ObjCIvarDecl *, const ObjCPropertyDecl *>;
 
   struct InvalidationInfo {
     /// Has the ivar been invalidated?
@@ -90,7 +90,7 @@ class IvarInvalidationCheckerImpl {
     }
   };
 
-  typedef llvm::DenseMap<const ObjCIvarDecl*, InvalidationInfo> IvarSet;
+  using IvarSet = llvm::DenseMap<const ObjCIvarDecl *, InvalidationInfo>;
 
   /// 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<const clang::ento::MemRegion *,
-                           clang::ento::mpi::Request>
-    RequestMapImpl;
+using RequestMapImpl = llvm::ImmutableMap<const clang::ento::MemRegion *,
+                                          clang::ento::mpi::Request>;
 
 } // 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<check::PreStmt<CallExpr>,
                   const char *NL, const char *Sep) const override;
 
 private:
-  typedef std::pair<SymbolRef, const AllocationState*> AllocationPair;
-  typedef SmallVector<AllocationPair, 2> AllocationPairVec;
+  using AllocationPair = std::pair<SymbolRef, const AllocationState *>;
+  using AllocationPairVec = SmallVector<AllocationPair, 2>;
 
   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<CallExpr> > {
   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<const TypeSourceInfo *, const CallExpr *> TypeCallPair;
-typedef llvm::PointerUnion<const Stmt *, const VarDecl *> ExprParent;
+using TypeCallPair = std::pair<const TypeSourceInfo *, const CallExpr *>;
+using ExprParent = llvm::PointerUnion<const Stmt *, const VarDecl *>;
 
 class CastedAllocFinder
   : public ConstStmtVisitor<CastedAllocFinder, TypeCallPair> {
@@ -47,7 +47,7 @@ class CastedAllocFinder
         ExplicitCastType(ExplicitCastType), AllocCall(AllocCall) {}
   };
 
-  typedef std::vector<CallRecord> CallVec;
+  using CallVec = std::vector<CallRecord>;
   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<SymbolRef, unsigned> ErrorOutFlag;
+using ErrorOutFlag = llvm::ImmutableMap<SymbolRef, unsigned>;
 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<const ObjCIvarDecl*,IVarState> IvarUsageMap;
+using IvarUsageMap = llvm::DenseMap<const ObjCIvarDecl *, IVarState>;
 
 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<check::PostCall, check::DeadSymbols,
   CheckerNameRef CheckNames[CK_NumCheckKinds];
 
 private:
-  typedef void (PthreadLockChecker::*FnCheck)(const CallEvent &Call,
-                                              CheckerContext &C,
-                                              CheckerKind CheckKind) const;
+  using FnCheck = void (PthreadLockChecker::*)(const CallEvent &Call,
+                                               CheckerContext &C,
+                                               CheckerKind CheckKind) const;
   CallDescriptionMap<FnCheck> 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<SymbolRef, 2> SymbolVector;
+using SymbolVector = SmallVector<SymbolRef, 2>;
 
 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<std::pair<RangeInt, RangeInt>> IntRangeVector;
+  using IntRangeVector = std::vector<std::pair<RangeInt, RangeInt>>;
 
   /// 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<check::EndAnalysis> {
   void checkEndAnalysis(ExplodedGraph &G, BugReporter &B,
                         ExprEngine &Eng) const;
 private:
-  typedef llvm::SmallSet<unsigned, 32> CFGBlocksSet;
+  using CFGBlocksSet = llvm::SmallSet<unsigned, 32>;
 
   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<const MemRegion *, 2> RegionVector;
+using RegionVector = SmallVector<const MemRegion *, 2>;
 
 class ValistChecker : public Checker<check::PreCall, check::PreStmt<VAArgExpr>,
                                      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<CountKey, unsigned> CountMap;
+using CountMap = llvm::ImmutableMap<CountKey, unsigned>;
 
 static inline CountMap GetMap(void *D) {
   return CountMap(static_cast<CountMap::TreeTy*>(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<ConstructedObjectKey, SVal>
-    ObjectsUnderConstructionMap;
+using ObjectsUnderConstructionMap =
+    llvm::ImmutableMap<ConstructedObjectKey, SVal>;
 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<const CXXConstructExpr *, const LocationContext *>, unsigned>
-    IndexOfElementToConstructMap;
+using IndexOfElementToConstructMap = llvm::ImmutableMap<
+    std::pair<const CXXConstructExpr *, const LocationContext *>, 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<const CXXConstructExpr *, const LocationContext *>, unsigned>
-    PendingInitLoopMap;
+using PendingInitLoopMap = llvm::ImmutableMap<
+    std::pair<const CXXConstructExpr *, const LocationContext *>, unsigned>;
 REGISTER_TRAIT_WITH_PROGRAMSTATE(PendingInitLoop, PendingInitLoopMap)
 
-typedef llvm::ImmutableMap<const LocationContext *, unsigned>
-    PendingArrayDestructionMap;
+using PendingArrayDestructionMap =
+    llvm::ImmutableMap<const LocationContext *, unsigned>;
 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<const MemRegion *> RegionList;
-typedef ArrayRef<SVal> ValueList;
+using RegionList = ArrayRef<const MemRegion *>;
+using ValueList = ArrayRef<SVal>;
 
 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<BindingKey, SVal>    ClusterBindings;
-typedef llvm::ImmutableMapRef<BindingKey, SVal> ClusterBindingsRef;
-typedef std::pair<BindingKey, SVal> BindingPair;
+using ClusterBindings = llvm::ImmutableMap<BindingKey, SVal>;
+using ClusterBindingsRef = llvm::ImmutableMapRef<BindingKey, SVal>;
+using BindingPair = std::pair<BindingKey, SVal>;
 
-typedef llvm::ImmutableMap<const MemRegion *, ClusterBindings>
-        RegionBindings;
+using RegionBindings = llvm::ImmutableMap<const MemRegion *, ClusterBindings>;
 
 namespace {
 class RegionBindingsRef : public llvm::ImmutableMapRef<const MemRegion *,
@@ -176,8 +175,7 @@ class RegionBindingsRef : public llvm::ImmutableMapRef<const MemRegion *,
   bool IsMainAnalysis;
 
 public:
-  typedef llvm::ImmutableMapRef<const MemRegion *, ClusterBindings>
-          ParentTy;
+  using ParentTy = llvm::ImmutableMapRef<const MemRegion *, ClusterBindings>;
 
   RegionBindingsRef(ClusterBindings::Factory &CBFactory,
                     const RegionBindings::TreeTy *T,
@@ -396,8 +394,8 @@ class LimitedRegionBindingsRef : public RegionBindingsRef {
   std::optional<unsigned> BindingsLeft;
 };
 
-typedef const RegionBindingsRef& RegionBindingsConstRef;
-typedef const LimitedRegionBindingsRef &LimitedRegionBindingsConstRef;
+using RegionBindingsConstRef = const RegionBindingsRef &;
+using LimitedRegionBindingsConstRef = const LimitedRegionBindingsRef &;
 
 std::optional<SVal>
 RegionBindingsRef::getDirectBinding(const MemRegion *R) const {
@@ -474,10 +472,11 @@ class RegionStoreManager : public StoreManager {
   RegionBindings::Factory RBFactory;
   mutable ClusterBindings::Factory CBFactory;
 
-  typedef std::vector<SVal> SValListTy;
+  using SValListTy = std::vector<SVal>;
+
 private:
-  typedef llvm::DenseMap<const LazyCompoundValData *,
-                         SValListTy> LazyBindingsMapTy;
+  using LazyBindingsMapTy =
+      llvm::DenseMap<const LazyCompoundValData *, SValListTy>;
   LazyBindingsMapTy LazyBindingsMap;
 
   /// The largest number of fields a struct can have and still be
@@ -860,9 +859,9 @@ enum GlobalsFilterKind {
 template <typename DERIVED>
 class ClusterAnalysis  {
 protected:
-  typedef llvm::DenseMap<const MemRegion *, const ClusterBindings *> ClusterMap;
-  typedef const MemRegion * WorkListElement;
-  typedef SmallVector<WorkListElement, 10> WorkList;
+  using ClusterMap = llvm::DenseMap<const MemRegion *, const ClusterBindings *>;
+  using WorkListElement = const MemRegion *;
+  using WorkList = SmallVector<WorkListElement, 10>;
 
   llvm::SmallPtrSet<const ClusterBindings *, 16> Visited;
 
@@ -972,7 +971,7 @@ static inline bool isUnionField(const FieldRegion *FR) {
   return FR->getDecl()->getParent()->isUnion();
 }
 
-typedef SmallVector<const FieldDecl *, 8> FieldVector;
+using FieldVector = SmallVector<const FieldDecl *, 8>;
 
 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<Store, const SubRegion *> StoreRegionPair;
+  using StoreRegionPair = std::pair<Store, const SubRegion *>;
   StoreRegionPair Result = StoreRegionPair();
 
   if (const ElementRegion *ER = dyn_cast<ElementRegion>(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<const char *> &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<DiagTool *> ToolMap;
+using ToolMap = llvm::StringMap<DiagTool *>;
 static inline ToolMap *getTools(void *v) { return static_cast<ToolMap*>(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<GroupRecord> subgroup_iterator;
+    using subgroup_iterator = group_iterator<GroupRecord>;
     subgroup_iterator subgroup_begin() const;
     subgroup_iterator subgroup_end() const;
     llvm::iterator_range<subgroup_iterator> subgroups() const;
 
-    typedef group_iterator<DiagnosticRecord> diagnostics_iterator;
+    using diagnostics_iterator = group_iterator<DiagnosticRecord>;
     diagnostics_iterator diagnostics_begin() const;
     diagnostics_iterator diagnostics_end() const;
     llvm::iterator_range<diagnostics_iterator> 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<SourceRange, 4> RefNamePieces;
+using RefNamePieces = SmallVector<SourceRange, 4>;
 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<CXTUResourceUsageEntry> MemUsageEntries;
+using MemUsageEntries = std::vector<CXTUResourceUsageEntry>;
 
 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<const Decl *, 8> TopMethodsTy;
+  using TopMethodsTy = SmallVector<const Decl *, 8>;
   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<Logger> LogRef;
+using LogRef = IntrusiveRefCntPtr<Logger>;
 
 /// 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<CXCursor, unsigned> CXCursorSet_Impl;
+using CXCursorSet_Impl = llvm::DenseMap<CXCursor, unsigned>;
 
 static inline CXCursorSet packCXCursorSet(CXCursorSet_Impl *setImpl) {
   return (CXCursorSet)setImpl;
@@ -1688,7 +1688,7 @@ CXCompletionString clang_getCursorCompletionString(CXCursor cursor) {
 
 namespace {
 struct OverridenCursorsPool {
-  typedef SmallVector<CXCursor, 2> CursorVec;
+  using CursorVec = SmallVector<CXCursor, 2>;
   std::vector<CursorVec *> AllCursors;
   std::vector<CursorVec *> 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<const OverloadExpr *, const Decl *,
-                           OverloadedTemplateStorage *>
-    OverloadedDeclRefStorage;
+using OverloadedDeclRefStorage =
+    llvm::PointerUnion<const OverloadExpr *, const Decl *,
+                       OverloadedTemplateStorage *>;
 
 /// 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<const FileEntry *, CXIdxClientFile> FileMapTy;
-  typedef llvm::DenseMap<const DeclContext *, CXIdxClientContainer>
-    ContainerMapTy;
-  typedef llvm::DenseMap<const Decl *, CXIdxClientEntity> EntityMapTy;
+
+  using FileMapTy = llvm::DenseMap<const FileEntry *, CXIdxClientFile>;
+  using ContainerMapTy =
+      llvm::DenseMap<const DeclContext *, CXIdxClientContainer>;
+  using EntityMapTy = llvm::DenseMap<const Decl *, CXIdxClientEntity>;
 
   FileMapTy FileMap;
   ContainerMapTy ContainerMap;
   EntityMapTy EntityMap;
 
-  typedef std::pair<const FileEntry *, const Decl *> RefFileOccurrence;
+  using RefFileOccurrence = std::pair<const FileEntry *, const Decl *>;
   llvm::DenseSet<RefFileOccurrence> 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<unsigned, const char *> Strings;
+using Strings = llvm::DenseMap<unsigned, const char *>;
 
 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<VisitorJob, 10> VisitorWorkList;
+using VisitorWorkList = SmallVector<VisitorJob, 10>;
 
 // Cursor visitor.
 class CursorVisitor : public DeclVisitor<CursorVisitor, bool>,
@@ -72,8 +72,8 @@ class CursorVisitor : public DeclVisitor<CursorVisitor, bool>,
 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<std::unique_ptr<llvm::MemoryBuffer>, 8> MemBufferOwner;
+  using MemBufferOwner = SmallVector<std::unique_ptr<llvm::MemoryBuffer>, 8>;
   std::unique_ptr<MemBufferOwner> 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<bool> 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<ASTNode, ASTNode> ChildMap;
-  typedef ChildMap::const_iterator ChildIterator;
+  using ChildMap = std::multimap<ASTNode, ASTNode>;
+  using ChildIterator = ChildMap::const_iterator;
 
   std::set<ASTNode> 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<std::pair<std::string, const Record *>> ParsedAttrMap;
+using ParsedAttrMap = std::vector<std::pair<std::string, const Record *>>;
 
 static ParsedAttrMap getParsedAttrList(const RecordKeeper &Records,
                                        ParsedAttrMap *Dupes = nullptr,
@@ -1774,7 +1774,7 @@ SpellingNamesAreCommon(const std::vector<FlattenedSpelling>& Spellings) {
   return true;
 }
 
-typedef std::map<unsigned, std::string> SemanticSpellingMap;
+using SemanticSpellingMap = std::map<unsigned, std::string>;
 static std::string
 CreateSemanticSpellings(const std::vector<FlattenedSpelling> &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<StringRef>::const_iterator const_iterator;
+    using const_iterator = std::vector<StringRef>::const_iterator;
     const_iterator begin() const { return CategoryStrings.begin(); }
     const_iterator end() const { return CategoryStrings.end(); }
   };
@@ -232,14 +232,14 @@ static void groupDiagnostics(ArrayRef<const Record *> Diags,
 // Infer members of -Wpedantic.
 //===----------------------------------------------------------------------===//
 
-typedef std::vector<const Record *> RecordVec;
-typedef DenseSet<const Record *> RecordSet;
-typedef PointerUnion<RecordVec *, RecordSet *> VecOrSet;
+using RecordVec = std::vector<const Record *>;
+using RecordSet = DenseSet<const Record *>;
+using VecOrSet = PointerUnion<RecordVec *, RecordSet *>;
 
 namespace {
 class InferPedantic {
-  typedef DenseMap<const Record *, std::pair<unsigned, std::optional<unsigned>>>
-      GMap;
+  using GMap =
+      DenseMap<const Record *, std::pair<unsigned, std::optional<unsigned>>>;
 
   DiagGroupParentMap &DiagGroupParents;
   ArrayRef<const Record *> Diags;

>From 2e7c5bebe209d61a2e7a327798c8796975adc2df Mon Sep 17 00:00:00 2001
From: Victor Chernyakin <chernyakin.victor.j at outlook.com>
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<clang::api_notes::StoredObjCSelector> {
-  using UnsignedInfo = DenseMapInfo<unsigned>;
+  typedef DenseMapInfo<unsigned> 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 <typename T> struct MakeDependent {
-  using Type = T;
-};
+template <typename T> 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<Param>;
+typedef std::vector<Param> ParamsSeq;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(Param)
@@ -131,7 +131,7 @@ template <> struct MappingTraits<Param> {
 } // namespace llvm
 
 namespace {
-using NullabilitySeq = std::vector<NullabilityKind>;
+typedef std::vector<NullabilityKind> NullabilitySeq;
 
 struct AvailabilityItem {
   APIAvailability Mode = APIAvailability::Available;
@@ -165,7 +165,7 @@ struct Method {
   StringRef SwiftReturnOwnership;
 };
 
-using MethodsSeq = std::vector<Method>;
+typedef std::vector<Method> MethodsSeq;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(Method)
@@ -216,7 +216,7 @@ struct Property {
   StringRef Type;
 };
 
-using PropertiesSeq = std::vector<Property>;
+typedef std::vector<Property> PropertiesSeq;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(Property)
@@ -255,7 +255,7 @@ struct Class {
   PropertiesSeq Properties;
 };
 
-using ClassesSeq = std::vector<Class>;
+typedef std::vector<Class> ClassesSeq;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(Class)
@@ -297,7 +297,7 @@ struct Function {
   StringRef SwiftReturnOwnership;
 };
 
-using FunctionsSeq = std::vector<Function>;
+typedef std::vector<Function> FunctionsSeq;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(Function)
@@ -334,7 +334,7 @@ struct GlobalVariable {
   StringRef Type;
 };
 
-using GlobalVariablesSeq = std::vector<GlobalVariable>;
+typedef std::vector<GlobalVariable> GlobalVariablesSeq;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(GlobalVariable)
@@ -364,7 +364,7 @@ struct EnumConstant {
   StringRef SwiftName;
 };
 
-using EnumConstantsSeq = std::vector<EnumConstant>;
+typedef std::vector<EnumConstant> EnumConstantsSeq;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(EnumConstant)
@@ -424,7 +424,7 @@ struct Field {
   StringRef Type;
 };
 
-using FieldsSeq = std::vector<Field>;
+typedef std::vector<Field> FieldsSeq;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(Field)
@@ -448,7 +448,7 @@ template <> struct MappingTraits<Field> {
 
 namespace {
 struct Tag;
-using TagsSeq = std::vector<Tag>;
+typedef std::vector<Tag> TagsSeq;
 
 struct Tag {
   StringRef Name;
@@ -527,7 +527,7 @@ struct Typedef {
   std::optional<SwiftNewTypeKind> SwiftType;
 };
 
-using TypedefsSeq = std::vector<Typedef>;
+typedef std::vector<Typedef> TypedefsSeq;
 } // namespace
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(Typedef)
@@ -560,7 +560,7 @@ template <> struct MappingTraits<Typedef> {
 
 namespace {
 struct Namespace;
-using NamespacesSeq = std::vector<Namespace>;
+typedef std::vector<Namespace> NamespacesSeq;
 
 struct TopLevelItems {
   ClassesSeq Classes;
@@ -623,7 +623,7 @@ struct Versioned {
   TopLevelItems Items;
 };
 
-using VersionedSeq = std::vector<Versioned>;
+typedef std::vector<Versioned> 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<const ClassTemplateSpecializationDecl *, 8>;
+    typedef SmallVector<const ClassTemplateSpecializationDecl *, 8> SpecsTy;
     SpecsTy Specs;
     const DeclContext *Ctx = FD->getDeclContext();
     while (isa_and_nonnull<NamedDecl>(Ctx)) {
@@ -3549,7 +3549,7 @@ bool CallExpr::isCallToStdMove() const {
 namespace {
   /// Look for any side effects within a Stmt.
   class SideEffectFinder : public ConstEvaluatedExprVisitor<SideEffectFinder> {
-    using Inherited = ConstEvaluatedExprVisitor<SideEffectFinder>;
+    typedef ConstEvaluatedExprVisitor<SideEffectFinder> 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<NonTrivialCallFinder>
   {
-    using Inherited = ConstEvaluatedExprVisitor<NonTrivialCallFinder>;
+    typedef ConstEvaluatedExprVisitor<NonTrivialCallFinder> 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<PathEntry, 8> 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<const void *, unsigned>;
-    using MapTy = std::map<MapKeyTy, APValue>;
+    typedef std::pair<const void *, unsigned> MapKeyTy;
+    typedef std::map<MapKeyTy, APValue> MapTy;
     /// Temporaries - Temporary lvalues materialized within this stack frame.
     MapTy Temporaries;
 
@@ -1468,9 +1468,9 @@ namespace {
       return Success;
     }
   };
-  using BlockScopeRAII = ScopeRAII<ScopeKind::Block>;
-  using FullExpressionRAII = ScopeRAII<ScopeKind::FullExpression>;
-  using CallScopeRAII = ScopeRAII<ScopeKind::Call>;
+  typedef ScopeRAII<ScopeKind::Block> BlockScopeRAII;
+  typedef ScopeRAII<ScopeKind::FullExpression> FullExpressionRAII;
+  typedef ScopeRAII<ScopeKind::Call> 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<Derived, bool>;
-  using ExprEvaluatorBaseTy = ExprEvaluatorBase;
+  typedef ConstStmtVisitor<Derived, bool> 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<Derived>;
+  typedef LValueExprEvaluatorBase LValueExprEvaluatorBaseTy;
+  typedef ExprEvaluatorBase<Derived> 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<CastExpr::path_const_iterator>;
+    typedef std::reverse_iterator<CastExpr::path_const_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 <typename T> struct Source {
   template <typename U> operator Source<U>() { return Source<U>(t); }
 };
 
-using Candidate = std::pair<Source<NamedDecl *>, ASTImporter *>;
+typedef std::pair<Source<NamedDecl *>, 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<const DeclContext *, IdentifierInfo *>;
+  typedef std::pair<const DeclContext*, IdentifierInfo*> DiscriminatorKeyTy;
   llvm::DenseMap<DiscriminatorKeyTy, unsigned> Discriminator;
   llvm::DenseMap<const NamedDecl*, unsigned> Uniquifier;
   const DiscriminatorOverrideTy DiscriminatorOverride = nullptr;
@@ -283,7 +283,7 @@ class CXXNameMangler {
   // The goal is to annotate against which version of a library an object was
   // built and to be able to provide backwards compatibility ("dual abi").
   // For more information see docs/ItaniumMangleAbiTags.rst.
-  using AbiTagList = SmallVector<StringRef, 4>;
+  typedef SmallVector<StringRef, 4> 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<const DeclContext *, IdentifierInfo *>;
+  typedef std::pair<const DeclContext *, IdentifierInfo *> DiscriminatorKeyTy;
   llvm::DenseMap<DiscriminatorKeyTy, unsigned> Discriminator;
   llvm::DenseMap<const NamedDecl *, unsigned> Uniquifier;
   llvm::DenseMap<const CXXRecordDecl *, unsigned> LambdaIds;
@@ -316,19 +316,19 @@ class MicrosoftCXXNameMangler {
   const NamedDecl *Structor;
   unsigned StructorType;
 
-  using BackRefVec = llvm::SmallVector<std::string, 10>;
+  typedef llvm::SmallVector<std::string, 10> BackRefVec;
   BackRefVec NameBackReferences;
 
-  using ArgBackRefMap = llvm::DenseMap<const void *, unsigned>;
+  typedef llvm::DenseMap<const void *, unsigned> ArgBackRefMap;
   ArgBackRefMap FunArgBackReferences;
   ArgBackRefMap TemplateArgBackReferences;
 
-  using TemplateArgStringMap = llvm::DenseMap<const void *, StringRef>;
+  typedef llvm::DenseMap<const void *, StringRef> TemplateArgStringMap;
   TemplateArgStringMap TemplateArgStrings;
   llvm::BumpPtrAllocator TemplateArgStringStorageAlloc;
   llvm::StringSaver TemplateArgStringStorage;
 
-  using PassObjectSizeArgsSet = std::set<std::pair<int, bool>>;
+  typedef std::set<std::pair<int, bool>> 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<ODRDeclVisitor> {
-  using Inherited = ConstDeclVisitor<ODRDeclVisitor>;
+  typedef ConstDeclVisitor<ODRDeclVisitor> 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<ODRTypeVisitor> {
-  using Inherited = TypeVisitor<ODRTypeVisitor>;
+  typedef TypeVisitor<ODRTypeVisitor> 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<Stmt *, Stmt *>;
+typedef llvm::DenseMap<Stmt*, Stmt*> 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<PrintfSpecifier>;
+typedef clang::analyze_format_string::SpecifierResult<PrintfSpecifier>
+        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<const CXXRecordDecl *>;
-  using EmptyClassOffsetsMapTy = llvm::DenseMap<CharUnits, ClassVectorTy>;
+  typedef llvm::TinyPtrVector<const CXXRecordDecl *> ClassVectorTy;
+  typedef llvm::DenseMap<CharUnits, ClassVectorTy> EmptyClassOffsetsMapTy;
   EmptyClassOffsetsMapTy EmptyClassOffsets;
 
   /// MaxEmptyClassOffset - The highest offset known to contain an empty
@@ -560,7 +560,7 @@ void EmptySubobjectMap::UpdateEmptyFieldSubobjects(
   }
 }
 
-using ClassSetTy = llvm::SmallPtrSet<const CXXRecordDecl *, 4>;
+typedef llvm::SmallPtrSet<const CXXRecordDecl*, 4> ClassSetTy;
 
 class ItaniumRecordLayoutBuilder {
 protected:
@@ -660,7 +660,7 @@ class ItaniumRecordLayoutBuilder {
   /// field has been handled, if any.
   bool HandledFirstNonOverlappingEmptyField;
 
-  using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
+  typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> 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<BaseSubobjectInfo> BaseSubobjectInfoAllocator;
 
-  using BaseSubobjectInfoMapTy =
-      llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>;
+  typedef llvm::DenseMap<const CXXRecordDecl *, BaseSubobjectInfo *>
+    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<const CXXRecordDecl *, CharUnits>;
+  typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> 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<ScanfSpecifier>;
+typedef clang::analyze_format_string::SpecifierResult<ScanfSpecifier>
+        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 <class T> 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 <class T> 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 <class T> 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<const CXXMethodDecl *, CharUnits>;
+  typedef std::pair<const CXXMethodDecl *, CharUnits> MethodBaseOffsetPairTy;
 
-  using OverridersMapTy = llvm::DenseMap<MethodBaseOffsetPairTy, OverriderInfo>;
+  typedef llvm::DenseMap<MethodBaseOffsetPairTy,
+                         OverriderInfo> 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<std::pair<const CXXRecordDecl *, unsigned>, CharUnits>;
+  typedef llvm::DenseMap<std::pair<const CXXRecordDecl *, unsigned>,
+                         CharUnits> SubobjectOffsetMapTy;
 
-  using SubobjectCountMapTy = llvm::DenseMap<const CXXRecordDecl *, unsigned>;
+  typedef llvm::DenseMap<const CXXRecordDecl *, unsigned> 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<const CXXRecordDecl *, 4>;
+  typedef llvm::SmallPtrSet<const CXXRecordDecl *, 4> 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<const CXXMethodDecl *, CharUnits>;
+  typedef std::pair<const CXXMethodDecl *, CharUnits> 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<const CXXRecordDecl *, CharUnits>;
+  typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits>
+    VBaseOffsetOffsetsMapTy;
 
 private:
   const ItaniumVTableContext &VTables;
@@ -550,7 +551,7 @@ class VCallAndVBaseOffsetBuilder {
   ASTContext &Context;
 
   /// Components - vcall and vbase offset components
-  using VTableComponentVectorTy = SmallVector<VTableComponent, 64>;
+  typedef SmallVector<VTableComponent, 64> 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<const CXXRecordDecl *, 8>;
+  typedef llvm::SmallSetVector<const CXXRecordDecl *, 8>
+    PrimaryBasesSetVectorTy;
 
-  using VBaseOffsetOffsetsMapTy =
-      llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
+  typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits>
+    VBaseOffsetOffsetsMapTy;
 
-  using AddressPointsMapTy = VTableLayout::AddressPointsMapTy;
+  typedef VTableLayout::AddressPointsMapTy AddressPointsMapTy;
 
-  using MethodVTableIndicesTy = llvm::DenseMap<GlobalDecl, int64_t>;
+  typedef llvm::DenseMap<GlobalDecl, int64_t> MethodVTableIndicesTy;
 
 private:
   /// VTables - Global vtable information.
@@ -863,7 +864,7 @@ class ItaniumVTableBuilder {
     MethodInfo(MethodInfo const&) = default;
   };
 
-  using MethodInfoMapTy = llvm::DenseMap<const CXXMethodDecl *, MethodInfo>;
+  typedef llvm::DenseMap<const CXXMethodDecl *, MethodInfo> 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<uint64_t, ThunkInfo>;
+  typedef llvm::DenseMap<uint64_t, ThunkInfo> VTableThunksMapTy;
 
   /// VTableThunks - The thunks by vtable index in the vtable currently being
   /// built.
   VTableThunksMapTy VTableThunks;
 
-  using ThunkInfoVectorTy = SmallVector<ThunkInfo, 1>;
-  using ThunksMapTy = llvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy>;
+  typedef SmallVector<ThunkInfo, 1> ThunkInfoVectorTy;
+  typedef llvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy> 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<const CXXRecordDecl *, 4>;
+  typedef llvm::SmallPtrSet<const CXXRecordDecl *, 4> 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<const CXXMethodDecl *, 8>;
+typedef llvm::SmallPtrSet<const CXXMethodDecl *, 8> 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<const CXXRecordDecl *, 8>;
+typedef llvm::SmallSetVector<const CXXRecordDecl *, 8> 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<const CXXMethodDecl *, 8>;
+  typedef llvm::SmallVector<const CXXMethodDecl *, 8> NewVirtualFunctionsTy;
   NewVirtualFunctionsTy NewVirtualFunctions;
 
   llvm::SmallVector<const CXXMethodDecl*, 4> NewImplicitVirtualFunctions;
@@ -2511,11 +2512,11 @@ namespace {
 
 class VFTableBuilder {
 public:
-  using MethodVFTableLocationsTy =
-      llvm::DenseMap<GlobalDecl, MethodVFTableLocation>;
+  typedef llvm::DenseMap<GlobalDecl, MethodVFTableLocation>
+    MethodVFTableLocationsTy;
 
-  using method_locations_range =
-      llvm::iterator_range<MethodVFTableLocationsTy::const_iterator>;
+  typedef llvm::iterator_range<MethodVFTableLocationsTy::const_iterator>
+    method_locations_range;
 
 private:
   /// VTables - Global vtable information.
@@ -2572,20 +2573,20 @@ class VFTableBuilder {
           UsesExtraSlot(false) {}
   };
 
-  using MethodInfoMapTy = llvm::DenseMap<const CXXMethodDecl *, MethodInfo>;
+  typedef llvm::DenseMap<const CXXMethodDecl *, MethodInfo> MethodInfoMapTy;
 
   /// MethodInfoMap - The information for all methods in the vftable we're
   /// currently building.
   MethodInfoMapTy MethodInfoMap;
 
-  using VTableThunksMapTy = llvm::DenseMap<uint64_t, ThunkInfo>;
+  typedef llvm::DenseMap<uint64_t, ThunkInfo> VTableThunksMapTy;
 
   /// VTableThunks - The thunks by vftable index in the vftable currently being
   /// built.
   VTableThunksMapTy VTableThunks;
 
-  using ThunkInfoVectorTy = SmallVector<ThunkInfo, 1>;
-  using ThunksMapTy = llvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy>;
+  typedef SmallVector<ThunkInfo, 1> ThunkInfoVectorTy;
+  typedef llvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy> 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<const CXXMethodDecl *, 1>;
+  typedef SmallVector<const CXXMethodDecl *, 1> MethodGroup;
   SmallVector<MethodGroup, 10> Groups;
-  using VisitedGroupIndicesTy = llvm::DenseMap<DeclarationName, unsigned>;
+  typedef llvm::DenseMap<DeclarationName, unsigned> VisitedGroupIndicesTy;
   VisitedGroupIndicesTy VisitedGroupIndices;
   for (const auto *D : RD->decls()) {
     const auto *ND = dyn_cast<NamedDecl>(D);
@@ -3510,8 +3511,8 @@ static bool rebucketPaths(VPtrInfoVector &Paths) {
 MicrosoftVTableContext::~MicrosoftVTableContext() {}
 
 namespace {
-using FullPathTy = llvm::SetVector<BaseSubobject, std::vector<BaseSubobject>,
-                                   llvm::DenseSet<BaseSubobject>>;
+typedef llvm::SetVector<BaseSubobject, std::vector<BaseSubobject>,
+                        llvm::DenseSet<BaseSubobject>> 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<const CXXMethodDecl *>;
+  typedef std::set<const CXXMethodDecl *> 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<MatchChildASTVisitor> {
 public:
-  using VisitorBase = RecursiveASTVisitor<MatchChildASTVisitor>;
+  typedef RecursiveASTVisitor<MatchChildASTVisitor> 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<MatchASTVisitor>,
       CompatibleAliases;
 
   // Maps (matcher, node) -> the match result for memoization.
-  using MemoizationMap = std::map<MatchKey, MemoizedMatchResult>;
+  typedef std::map<MatchKey, MemoizedMatchResult> 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, // <name> 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<llvm::ConstantFolder, CGBuilderInserterTy>;
+typedef llvm::IRBuilder<llvm::ConstantFolder, CGBuilderInserterTy>
+    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<CallArg, 8> {
 
   bool hasWritebacks() const { return !Writebacks.empty(); }
 
-  using writeback_const_range =
-      llvm::iterator_range<SmallVectorImpl<Writeback>::const_iterator>;
+  typedef llvm::iterator_range<SmallVectorImpl<Writeback>::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<DynamicThisUseChecker> {
-    using super = ConstEvaluatedExprVisitor<DynamicThisUseChecker>;
+    typedef ConstEvaluatedExprVisitor<DynamicThisUseChecker> 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<char, const IdentifierInfo *>;
+    typedef std::pair<char, const IdentifierInfo *> 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<typename Traits>
   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<DirectCleanupTraits>;
+    typedef CallDeleteDuringNew<DirectCleanupTraits> DirectCleanup;
 
     DirectCleanup *Cleanup = CGF.EHStack.pushCleanupWithExtra<DirectCleanup>(
         EHCleanup, E->getNumPlacementArgs(), E->getOperatorDelete(),
@@ -1577,13 +1577,13 @@ static void EnterNewDeleteCleanup(CodeGenFunction &CGF, const CXXNewExpr *E,
   DominatingValue<RValue>::saved_type SavedTypeIdentity =
       DominatingValue<RValue>::save(CGF, TypeIdentity);
   struct ConditionalCleanupTraits {
-    using ValueTy = DominatingValue<RValue>::saved_type;
-    using RValueTy = DominatingValue<RValue>::saved_type;
+    typedef DominatingValue<RValue>::saved_type ValueTy;
+    typedef DominatingValue<RValue>::saved_type RValueTy;
     static RValue get(CodeGenFunction &CGF, ValueTy V) {
       return V.restore(CGF);
     }
   };
-  using ConditionalCleanup = CallDeleteDuringNew<ConditionalCleanupTraits>;
+  typedef CallDeleteDuringNew<ConditionalCleanupTraits> ConditionalCleanup;
 
   ConditionalCleanup *Cleanup =
       CGF.EHStack.pushCleanupWithExtra<ConditionalCleanup>(
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<bool> 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<OpaqueValueVisitor> {
 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<GenDefaultInitialize>,
       DefaultInitializedTypeVisitor<GenDefaultInitialize> {
   using Super = DefaultInitializedTypeVisitor<GenDefaultInitialize>;
-  using GenFuncBaseTy = GenFuncBase<GenDefaultInitialize>;
+  typedef GenFuncBase<GenDefaultInitialize> GenFuncBaseTy;
 
   GenDefaultInitialize(ASTContext &Ctx)
       : StructVisitor<GenDefaultInitialize>(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<llvm::Value *, 1, bool>;
+typedef llvm::PointerIntPair<llvm::Value*,1,bool> 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<llvm::Value *(CodeGenFunction &CGF, llvm::Value *value)>;
+typedef llvm::function_ref<llvm::Value *(CodeGenFunction &CGF,
+                                         llvm::Value *value)>
+  ValueTransform;
 
 /// Insert code immediately after a call.
 
@@ -3187,7 +3188,7 @@ ARCExprEmitter<Impl,Result>::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<OpaqueValueExpr>(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<std::string, llvm::GlobalAlias *>;
+  typedef std::pair<std::string, llvm::GlobalAlias*> 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<Selector, SmallVector<TypedSelector, 2>>;
+  typedef llvm::DenseMap<Selector, SmallVector<TypedSelector, 2> >
+    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<std::string, std::string>;
+  typedef std::pair<std::string, std::string> ClassAliasPair;
   /// All classes that have aliases set for them.
   std::vector<ClassAliasPair> 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<std::string, std::pair<llvm::GlobalVariable *, int>>;
+  typedef std::pair<std::string, std::pair<llvm::GlobalVariable*, int>>
+      EarlyInitPair;
   std::vector<EarlyInitPair> 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<CharUnits /*Align*/, PrivateHelpersTy>;
+typedef std::pair<CharUnits /*Align*/, PrivateHelpersTy> 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<SourceLocation, llvm::Value *>;
+  typedef llvm::DenseMap<SourceLocation, llvm::Value *> OpenMPDebugLocMapTy;
   OpenMPDebugLocMapTy OpenMPDebugLocMap;
   /// Stores debug location and ThreadID for the function.
   struct DebugLocThreadIdTy {
@@ -394,18 +394,18 @@ class CGOpenMPRuntime {
     llvm::AssertingVH<llvm::Instruction> ServiceInsertPt = nullptr;
   };
   /// Map of local debug location, ThreadId and functions.
-  using OpenMPLocThreadIDMapTy =
-      llvm::DenseMap<llvm::Function *, DebugLocThreadIdTy>;
+  typedef llvm::DenseMap<llvm::Function *, DebugLocThreadIdTy>
+      OpenMPLocThreadIDMapTy;
   OpenMPLocThreadIDMapTy OpenMPLocThreadIDMap;
   /// Map of UDRs and corresponding combiner/initializer.
-  using UDRMapTy =
-      llvm::DenseMap<const OMPDeclareReductionDecl *,
-                     std::pair<llvm::Function *, llvm::Function *>>;
+  typedef llvm::DenseMap<const OMPDeclareReductionDecl *,
+                         std::pair<llvm::Function *, llvm::Function *>>
+      UDRMapTy;
   UDRMapTy UDRMap;
   /// Map of functions and locally defined UDRs.
-  using FunctionUDRMapTy =
-      llvm::DenseMap<llvm::Function *,
-                     SmallVector<const OMPDeclareReductionDecl *, 4>>;
+  typedef llvm::DenseMap<llvm::Function *,
+                         SmallVector<const OMPDeclareReductionDecl *, 4>>
+      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<void(CodeGenFunction &, const OMPExecutableDirective &,
-                            llvm::SmallVectorImpl<llvm::Value *> &)>;
+typedef llvm::function_ref<void(CodeGenFunction &,
+                                const OMPExecutableDirective &,
+                                llvm::SmallVectorImpl<llvm::Value *> &)>
+    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<const CXXRecordDecl *, BaseSubobject>;
-  using SubVTTIndicesMapTy = llvm::DenseMap<BaseSubobjectPairTy, uint64_t>;
+  typedef std::pair<const CXXRecordDecl *, BaseSubobject> BaseSubobjectPairTy;
+  typedef llvm::DenseMap<BaseSubobjectPairTy, uint64_t> SubVTTIndicesMapTy;
 
   /// SubVTTIndices - Contains indices into the various sub-VTTs.
   SubVTTIndicesMapTy SubVTTIndices;
 
-  using SecondaryVirtualPointerIndicesMapTy =
-      llvm::DenseMap<BaseSubobjectPairTy, uint64_t>;
+  typedef llvm::DenseMap<BaseSubobjectPairTy, uint64_t>
+    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<llvm::Value *, 1, bool>;
+  typedef llvm::PointerIntPair<llvm::Value *, 1, bool> 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 <class T> struct DominatingPointer<T, true> : DominatingLLVMValue {
-  using type = T *;
+  typedef T *type;
   static type restore(CodeGenFunction &CGF, saved_type value) {
     return static_cast<T *>(DominatingLLVMValue::restore(CGF, value));
   }
@@ -150,7 +150,7 @@ template <class T> struct DominatingPointer<T, true> : DominatingLLVMValue {
 
 /// A specialization of DominatingValue for Address.
 template <> struct DominatingValue<Address> {
-  using type = Address;
+  typedef Address type;
 
   struct saved_type {
     DominatingLLVMValue::saved_type BasePtr;
@@ -180,7 +180,7 @@ template <> struct DominatingValue<Address> {
 
 /// A specialization of DominatingValue for RValue.
 template <> struct DominatingValue<RValue> {
-  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<llvm::Value *, llvm::Value *>;
+  typedef std::pair<llvm::Value *, llvm::Value *> 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<void(
-      CodeGenFunction &, const OMPLoopDirective &, JumpDest)>;
-  using CodeGenOrderedTy = llvm::function_ref<void(
-      CodeGenFunction &, SourceLocation, const unsigned, const bool)>;
+  typedef llvm::function_ref<void(CodeGenFunction &, const OMPLoopDirective &,
+                                  JumpDest)>
+      CodeGenLoopTy;
+  typedef llvm::function_ref<void(CodeGenFunction &, SourceLocation,
+                                  const unsigned, const bool)>
+      CodeGenOrderedTy;
 
   // Codegen lambda for loop bounds in worksharing loop constructs
-  using CodeGenLoopBoundsTy = llvm::function_ref<std::pair<LValue, LValue>(
-      CodeGenFunction &, const OMPExecutableDirective &S)>;
+  typedef llvm::function_ref<std::pair<LValue, LValue>(
+      CodeGenFunction &, const OMPExecutableDirective &S)>
+      CodeGenLoopBoundsTy;
 
   // Codegen lambda for loop bounds in dispatch-based loop implementation
-  using CodeGenDispatchBoundsTy =
-      llvm::function_ref<std::pair<llvm::Value *, llvm::Value *>(
-          CodeGenFunction &, const OMPExecutableDirective &S, Address LB,
-          Address UB)>;
+  typedef llvm::function_ref<std::pair<llvm::Value *, llvm::Value *>(
+      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<T>(kind, A...);
 
     // Stash values in a tuple so we can guarantee the order of saves.
-    using SavedTuple = std::tuple<typename DominatingValue<As>::saved_type...>;
+    typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
     SavedTuple Saved{saveValueInCond(A)...};
 
-    using CleanupType = EHScopeStack::ConditionalCleanup<T, As...>;
+    typedef EHScopeStack::ConditionalCleanup<T, As...> CleanupType;
     EHStack.pushCleanupTuple<CleanupType>(kind, Saved);
     initFullExprCleanup();
   }
@@ -927,10 +930,10 @@ class CodeGenFunction : public CodeGenTypeCache {
     assert(!DominatingValue<Address>::needsSaving(ActiveFlag) &&
            "cleanup active flag should never need saving");
 
-    using SavedTuple = std::tuple<typename DominatingValue<As>::saved_type...>;
+    typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
     SavedTuple Saved{saveValueInCond(A)...};
 
-    using CleanupType = EHScopeStack::ConditionalCleanup<T, As...>;
+    typedef EHScopeStack::ConditionalCleanup<T, As...> CleanupType;
     pushCleanupAfterFullExprWithActiveFlag<CleanupType>(Kind, ActiveFlag,
                                                         Saved);
   }
@@ -1115,7 +1118,7 @@ class CodeGenFunction : public CodeGenTypeCache {
     void rescopeLabels();
   };
 
-  using DeclMapTy = llvm::DenseMap<const Decl *, Address>;
+  typedef llvm::DenseMap<const Decl *, Address> 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<VPtr, 4>;
+  typedef llvm::SmallVector<VPtr, 4> VPtrsVector;
 
-  using VisitedVirtualBasesSetTy = llvm::SmallPtrSet<const CXXRecordDecl *, 4>;
+  typedef llvm::SmallPtrSet<const CXXRecordDecl *, 4> 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<void(
-      CodeGenFunction & /*CGF*/, llvm::Function * /*OutlinedFn*/,
-      const OMPTaskDataTy & /*Data*/)>;
+  typedef const llvm::function_ref<void(CodeGenFunction & /*CGF*/,
+                                        llvm::Function * /*OutlinedFn*/,
+                                        const OMPTaskDataTy & /*Data*/)>
+      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<Structor>;
+  typedef std::vector<Structor> 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<IdentifierInfo *, llvm::GlobalValue *>;
+  typedef llvm::MapVector<IdentifierInfo *,
+                          llvm::GlobalValue *> 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<const Decl*, unsigned> DelayedCXXInitPosition;
 
-  using GlobalInitData =
-      std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *>;
+  typedef std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *>
+      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<llvm::FunctionType *, llvm::WeakTrackingVH, llvm::Constant *>;
+  typedef std::tuple<llvm::FunctionType *, llvm::WeakTrackingVH,
+                     llvm::Constant *>
+      CXXGlobalDtorsOrStermFinalizer_t;
   SmallVector<CXXGlobalDtorsOrStermFinalizer_t, 8>
       CXXGlobalDtorsOrStermFinalizers;
 
-  using StermFinalizerData =
-      std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *>;
+  typedef std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *>
+      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<QualType, llvm::Metadata *>;
+  typedef llvm::DenseMap<QualType, llvm::Metadata *> 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<Type>;
+typedef CanQual<Type> 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<std::pair<SourceLocation, SourceLocation>, 8>;
+  typedef llvm::SmallSet<std::pair<SourceLocation, SourceLocation>, 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 <class T> 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 T, class... As>
   class ConditionalCleanup final : public Cleanup {
-    using SavedTuple = std::tuple<typename DominatingValue<As>::saved_type...>;
+    typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
     SavedTuple Saved;
 
     template <std::size_t... Is>
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<const CXXRecordDecl *, CharUnits>;
-  using VTablesMapTy = llvm::DenseMap<VFTableIdTy, llvm::GlobalVariable *>;
-  using VFTablesMapTy = llvm::DenseMap<VFTableIdTy, llvm::GlobalValue *>;
+  typedef std::pair<const CXXRecordDecl *, CharUnits> VFTableIdTy;
+  typedef llvm::DenseMap<VFTableIdTy, llvm::GlobalVariable *> VTablesMapTy;
+  typedef llvm::DenseMap<VFTableIdTy, llvm::GlobalValue *> 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<clang::StringLiteral>(CPUExpr)->getString();
     llvm::Triple Triple = getTarget().getTriple();
 
-    using CPUInfo = std::tuple<unsigned, unsigned, unsigned, unsigned>;
+    typedef std::tuple<unsigned, unsigned, unsigned, unsigned> CPUInfo;
 
     auto [LinuxSupportMethod, LinuxIDValue, AIXSupportMethod, AIXIDValue] =
         static_cast<CPUInfo>(StringSwitch<CPUInfo>(CPUStr)
@@ -183,8 +183,9 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
     const Expr *CPUExpr = E->getArg(0)->IgnoreParenCasts();
     StringRef CPUStr = cast<clang::StringLiteral>(CPUExpr)->getString();
     if (Triple.isOSAIX()) {
-      using CPUSupportType = std::tuple<unsigned, unsigned, unsigned,
-                                        CmpInst::Predicate, unsigned>;
+      typedef std::tuple<unsigned, unsigned, unsigned, CmpInst::Predicate,
+                         unsigned>
+          CPUSupportType;
       auto [SupportMethod, FieldIdx, Mask, CompOp, Value] =
           static_cast<CPUSupportType>(StringSwitch<CPUSupportType>(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<llvm::Value *, StringRef>;
+    typedef std::pair<llvm::Value *, StringRef> 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<phases::ID>;
+    typedef const llvm::SmallVectorImpl<phases::ID> 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<StringRef::size_type, unsigned>;
+  typedef std::pair<StringRef::size_type, unsigned> 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<std::pair<tooling::Replacements, unsigned>(
-      const Environment &)>;
+  typedef std::function<std::pair<tooling::Replacements, unsigned>(
+      const Environment &)>
+      AnalyzerPass;
 
   SmallVector<AnalyzerPass, 16> 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<std::pair<tooling::Replacements, unsigned>(
-    const Environment &)>;
+typedef std::function<std::pair<tooling::Replacements, unsigned>(
+    const Environment &)>
+    AnalyzerPass;
 
 void addQualifierAlignmentFixerPasses(const FormatStyle &Style,
                                       SmallVectorImpl<AnalyzerPass> &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<unsigned, unsigned>;
+  typedef std::pair<unsigned, unsigned> 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<OrderedPenalty, StateNode *>;
+  typedef std::pair<OrderedPenalty, StateNode *> QueueItem;
 
   /// The BFS queue type.
-  using QueueType = std::priority_queue<QueueItem, SmallVector<QueueItem>,
-                                        std::greater<QueueItem>>;
+  typedef std::priority_queue<QueueItem, SmallVector<QueueItem>,
+                              std::greater<QueueItem>>
+      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<ASTPrinter> {
-    using base = RecursiveASTVisitor<ASTPrinter>;
+    typedef RecursiveASTVisitor<ASTPrinter> 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<const IdentifierInfo *, MacroInfo *>;
+typedef std::pair<const IdentifierInfo *, MacroInfo *> 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<uint64_t, 64>;
-using RecordDataImpl = SmallVectorImpl<uint64_t>;
-using RecordDataRef = ArrayRef<uint64_t>;
+typedef SmallVector<uint64_t, 64> RecordData;
+typedef SmallVectorImpl<uint64_t> RecordDataImpl;
+typedef ArrayRef<uint64_t> RecordDataRef;
 
 class SDiagsWriter;
 
@@ -81,7 +81,7 @@ class SDiagsRenderer : public DiagnosticNoteRenderer {
                      DiagnosticsEngine::Level Level) override;
 };
 
-using AbbrevLookup = llvm::DenseMap<unsigned, unsigned>;
+typedef llvm::DenseMap<unsigned, unsigned> AbbrevLookup;
 
 class SDiagsMerger : SerializedDiagnosticReader {
   SDiagsWriter &Writer;
@@ -270,8 +270,8 @@ class SDiagsWriter : public DiagnosticConsumer {
     /// The collection of files used.
     llvm::DenseMap<const char *, unsigned> Files;
 
-    using DiagFlagsTy =
-        llvm::DenseMap<const void *, std::pair<unsigned, StringRef>>;
+    typedef llvm::DenseMap<const void *, std::pair<unsigned, StringRef> >
+    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<BodyIndexer> {
   const DeclContext *ParentDC;
   SmallVector<Stmt*, 16> StmtStack;
 
-  using base = RecursiveASTVisitor<BodyIndexer>;
+  typedef RecursiveASTVisitor<BodyIndexer> 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<TypeIndexer> {
   bool IsBase;
   SmallVector<SymbolRelation, 3> Relations;
 
-  using base = RecursiveASTVisitor<TypeIndexer>;
+  typedef RecursiveASTVisitor<TypeIndexer> 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<const IdentifierInfo *, OpenCLExtState>;
+  typedef std::pair<const IdentifierInfo *, OpenCLExtState> 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<PragmaHandler>(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<ContainsReference> {
   const DeclRefExpr *Needle;
 
 public:
-  using Inherited = ConstEvaluatedExprVisitor<ContainsReference>;
+  typedef ConstEvaluatedExprVisitor<ContainsReference> 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<const AttributedStmt *, 8>;
+  typedef llvm::SmallPtrSet<const AttributedStmt *, 8> 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<const Stmt *, WeakObjectUseMap::const_iterator>;
+  typedef sema::FunctionScopeInfo::WeakObjectProfileTy WeakObjectProfileTy;
+  typedef sema::FunctionScopeInfo::WeakObjectUseMap WeakObjectUseMap;
+  typedef sema::FunctionScopeInfo::WeakUseVector WeakUseVector;
+  typedef std::pair<const Stmt *, WeakObjectUseMap::const_iterator>
+  StmtUsesPair;
 
   ASTContext &Ctx = S.getASTContext();
 
@@ -1663,9 +1663,9 @@ static void diagnoseRepeatedUseOfWeak(Sema &S,
 
 namespace clang {
 namespace {
-using OptionalNotes = SmallVector<PartialDiagnosticAt, 1>;
-using DelayedDiag = std::pair<PartialDiagnosticAt, OptionalNotes>;
-using DiagList = std::list<DelayedDiag>;
+typedef SmallVector<PartialDiagnosticAt, 1> OptionalNotes;
+typedef std::pair<PartialDiagnosticAt, OptionalNotes> DelayedDiag;
+typedef std::list<DelayedDiag> DiagList;
 
 struct SortDiagBySourceLocation {
   SourceManager &SM;
@@ -1683,12 +1683,12 @@ struct SortDiagBySourceLocation {
 namespace {
 class UninitValsDiagReporter : public UninitVariablesHandler {
   Sema &S;
-  using UsesVec = SmallVector<UninitUse, 2>;
-  using MappedType = llvm::PointerIntPair<UsesVec *, 1, bool>;
+  typedef SmallVector<UninitUse, 2> UsesVec;
+  typedef llvm::PointerIntPair<UsesVec *, 1, bool> 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<const VarDecl *, MappedType>;
+  typedef llvm::MapVector<const VarDecl *, MappedType> 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<unsigned, unsigned>;
+typedef std::pair<unsigned,unsigned> 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<const CXXRecordDecl *, bool>;
+
+typedef llvm::DenseMap<const CXXRecordDecl*, bool> 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<DeferredDiagnosticsEmitter> {
 public:
-  using Inherited = UsedDeclVisitor<DeferredDiagnosticsEmitter>;
+  typedef UsedDeclVisitor<DeferredDiagnosticsEmitter> Inherited;
 
   // Whether the function is already in the current use-path.
   llvm::SmallPtrSet<CanonicalDeclPtr<Decl>, 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<FunctionDecl *, ObjCMethodDecl *>;
+typedef llvm::PointerUnion<FunctionDecl *, ObjCMethodDecl *> 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<CXXRecordDecl *>::const_iterator;
+  typedef SmallVectorImpl<CXXRecordDecl*>::const_iterator record_iterator;
 
   DeclContext *Inner;
   SmallVector<FunctionDecl*, 4> 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<std::pair<unsigned, SourceLocation>>;
+typedef std::vector<std::pair<unsigned, SourceLocation> > 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<const Decl *, 16> AllDeclsFound;
 
-  using DeclIndexPair = std::pair<const NamedDecl *, unsigned>;
+  typedef std::pair<const NamedDecl *, unsigned> 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<DeclIndexPair, 4>;
+    typedef SmallVector<DeclIndexPair, 4> 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<DeclarationName, ShadowMapEntry>;
+  typedef llvm::DenseMap<DeclarationName, ShadowMapEntry> 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<Module *, 8> 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<const IdentifierInfo *, 16>;
+typedef llvm::SmallPtrSet<const IdentifierInfo *, 16> 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<Expr *> Args) {
   return false;
 }
 
-using ResultCandidate = CodeCompleteConsumer::OverloadCandidate;
+typedef CodeCompleteConsumer::OverloadCandidate ResultCandidate;
 
 static void mergeCandidatesWithResults(
     Sema &SemaRef, SmallVectorImpl<ResultCandidate> &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<Selector, 16>;
+typedef llvm::SmallPtrSet<Selector, 16> 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<ObjCInterfaceDecl>(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<const IdentifierInfo *> 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<const IdentifierInfo *> 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<Selector, llvm::PointerIntPair<ObjCMethodDecl *, 1, bool>>;
+typedef llvm::DenseMap<Selector,
+                       llvm::PointerIntPair<ObjCMethodDecl *, 1, bool>>
+    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<unsigned, 4> InitFieldIndex;
 
   public:
-    using Inherited = EvaluatedExprVisitor<SelfReferenceChecker>;
+    typedef EvaluatedExprVisitor<SelfReferenceChecker> Inherited;
 
     SelfReferenceChecker(Sema &S, Decl *OrigDecl) : Inherited(S.Context),
                                                     S(S), OrigDecl(OrigDecl) {
@@ -20268,13 +20268,13 @@ static void CheckForDuplicateEnumValues(Sema &S, ArrayRef<Decl *> Elements,
   if (S.Diags.isIgnored(diag::warn_duplicate_enum_values, Enum->getLocation()))
     return;
 
-  using ECDVector = SmallVector<EnumConstantDecl *, 3>;
-  using DuplicatesVector = SmallVector<std::unique_ptr<ECDVector>, 3>;
+  typedef SmallVector<EnumConstantDecl *, 3> ECDVector;
+  typedef SmallVector<std::unique_ptr<ECDVector>, 3> DuplicatesVector;
 
-  using DeclOrVector = llvm::PointerUnion<EnumConstantDecl *, ECDVector *>;
+  typedef llvm::PointerUnion<EnumConstantDecl*, ECDVector*> DeclOrVector;
 
   // DenseMaps cannot contain the all ones int64_t value, so use unordered_map.
-  using ValueToVectorMap = std::unordered_map<int64_t, DeclOrVector>;
+  typedef std::unordered_map<int64_t, DeclOrVector> 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<QualType, 4>;
+typedef llvm::SmallPtrSet<QualType, 4> IndirectBaseSet;
 
 /// Recursively add the bases of Type.  Don't add Type itself.
 static void
@@ -3742,7 +3742,7 @@ namespace {
     llvm::SmallVector<unsigned, 4> InitFieldIndex;
 
   public:
-    using Inherited = EvaluatedExprVisitor<UninitializedFieldVisitor>;
+    typedef EvaluatedExprVisitor<UninitializedFieldVisitor> Inherited;
     UninitializedFieldVisitor(Sema &S,
                               llvm::SmallPtrSetImpl<ValueDecl*> &Decls,
                               llvm::SmallPtrSetImpl<QualType> &BaseClasses)
@@ -5787,8 +5787,8 @@ bool CheckRedundantInit(Sema &S,
   return true;
 }
 
-using UnionEntry = std::pair<NamedDecl *, CXXCtorInitializer *>;
-using RedundantUnionMap = llvm::DenseMap<RecordDecl *, UnionEntry>;
+typedef std::pair<NamedDecl *, CXXCtorInitializer *> UnionEntry;
+typedef llvm::DenseMap<RecordDecl*, UnionEntry> RedundantUnionMap;
 
 bool CheckRedundantUnionInit(Sema &S,
                              CXXCtorInitializer *Init,
@@ -9387,7 +9387,7 @@ struct SpecialMemberVisitor {
   }
 
   /// A base or member subobject.
-  using Subobject = llvm::PointerUnion<CXXBaseSpecifier *, FieldDecl *>;
+  typedef llvm::PointerUnion<CXXBaseSpecifier*, FieldDecl*> 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<FunctionTemplateDecl>;
+  typedef CXXRecordDecl::specific_decl_iterator<FunctionTemplateDecl> tmpl_iter;
   for (tmpl_iter TI(RD->decls_begin()), TE(RD->decls_end()); TI != TE; ++TI) {
     if (CXXConstructorDecl *CD =
           dyn_cast<CXXConstructorDecl>(TI->getTemplatedDecl()))
@@ -15483,7 +15483,7 @@ static void checkMoveAssignmentForRepeatedMove(Sema &S, CXXRecordDecl *Class,
     return;
 
   llvm::SmallVector<CXXBaseSpecifier *, 16> Worklist;
-  using VBaseMap = llvm::DenseMap<CXXRecordDecl *, CXXBaseSpecifier *>;
+  typedef llvm::DenseMap<CXXRecordDecl*, CXXBaseSpecifier*> 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<NSView *> missing the
   // \c*.
-  using TypeOrClassDecl = llvm::PointerUnion<TypeDecl *, ObjCInterfaceDecl *>;
+  typedef llvm::PointerUnion<TypeDecl *, ObjCInterfaceDecl *> TypeOrClassDecl;
   SmallVector<TypeOrClassDecl, 4> 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<IdentifierInfo *>;
-using LazyProtocolNameSet = std::unique_ptr<ProtocolNameSet>;
+typedef llvm::DenseSet<IdentifierInfo*> ProtocolNameSet;
+typedef std::unique_ptr<ProtocolNameSet> 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<TransformToPE> {
-    using BaseTransform = TreeTransform<TransformToPE>;
+    typedef TreeTransform<TransformToPE> BaseTransform;
 
   public:
     TransformToPE(Sema &SemaRef) : BaseTransform(SemaRef) { }
@@ -20354,7 +20354,7 @@ namespace {
 /// potentially-evaluated subexpressions as "referenced".
 class EvaluatedExprMarker : public UsedDeclVisitor<EvaluatedExprMarker> {
 public:
-  using Inherited = UsedDeclVisitor<EvaluatedExprMarker>;
+  typedef UsedDeclVisitor<EvaluatedExprMarker> Inherited;
   bool SkipLocalVariables;
   ArrayRef<const Expr *> 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<const CXXRecordDecl *, 4>;
+typedef llvm::SmallPtrSet<const CXXRecordDecl*, 4> 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<ARCCastChecker, ACCResult> {
-    using super = StmtVisitor<ARCCastChecker, ACCResult>;
+    typedef StmtVisitor<ARCCastChecker, ACCResult> 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<Designator, 4> 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<ASTDesignator, 32> 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<UnqualUsingEntry, 8>;
+    typedef SmallVector<UnqualUsingEntry, 8> ListTy;
 
     ListTy list;
     llvm::SmallPtrSet<DeclContext*, 8> 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<NamedDecl *>;
+  typedef llvm::TinyPtrVector<NamedDecl*> ShadowMapEntry;
 
 private:
   /// A mapping from declaration names to the declarations that have
   /// this name within a particular scope.
-  using ShadowMap = llvm::DenseMap<DeclarationName, ShadowMapEntry>;
+  typedef llvm::DenseMap<DeclarationName, ShadowMapEntry> ShadowMap;
 
   /// A list of shadow maps, which is used to model name hiding.
   std::list<ShadowMap> 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<TransformExprToCaptures> {
-  using BaseTransform = TreeTransform<TransformExprToCaptures>;
+  typedef TreeTransform<TransformExprToCaptures> 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<QualType, 8>;
+  typedef llvm::SmallSetVector<QualType, 8> 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<Expr *(Expr *, unsigned)>;
+    typedef llvm::function_ref<Expr *(Expr *, unsigned)> 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<CommaVisitor> {
-  using Inherited = EvaluatedExprVisitor<CommaVisitor>;
+  typedef EvaluatedExprVisitor<CommaVisitor> 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<std::pair<llvm::APSInt, EnumConstantDecl *>, 64>;
+typedef SmallVector<std::pair<llvm::APSInt, EnumConstantDecl*>, 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<std::pair<llvm::APSInt, CaseStmt *>, 64>;
+  typedef SmallVector<std::pair<llvm::APSInt, CaseStmt*>, 64> CaseValsTy;
   CaseValsTy CaseVals;
 
   // Keep track of any GNU case ranges we see.  The APSInt is the low value.
-  using CaseRangesTy = std::vector<std::pair<llvm::APSInt, CaseStmt *>>;
+  typedef std::vector<std::pair<llvm::APSInt, CaseStmt*> > CaseRangesTy;
   CaseRangesTy CaseRanges;
 
   DefaultStmt *TheDefaultStmt = nullptr;
@@ -1771,8 +1771,8 @@ Sema::DiagnoseAssignmentEnum(QualType DstType, QualType SrcType,
     return;
   }
 
-  using EnumValsTy =
-      SmallVector<std::pair<llvm::APSInt, EnumConstantDecl *>, 64>;
+  typedef SmallVector<std::pair<llvm::APSInt, EnumConstantDecl *>, 64>
+      EnumValsTy;
   EnumValsTy EnumVals;
 
   // Gather all enum values, set their type and sort them,
@@ -1872,7 +1872,7 @@ namespace {
     SmallVectorImpl<SourceRange> &Ranges;
     bool Simple;
   public:
-    using Inherited = EvaluatedExprVisitor<DeclExtractor>;
+    typedef EvaluatedExprVisitor<DeclExtractor> Inherited;
 
     DeclExtractor(Sema &S, DeclSetVector &Decls,
                   SmallVectorImpl<SourceRange> &Ranges) :
@@ -1953,7 +1953,7 @@ namespace {
     bool FoundDecl;
 
   public:
-    using Inherited = EvaluatedExprVisitor<DeclMatcher>;
+    typedef EvaluatedExprVisitor<DeclMatcher> 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<BreakContinueFinder>;
+    typedef ConstEvaluatedExprVisitor<BreakContinueFinder> 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<StringRef, Expr *>;
+  typedef std::pair<StringRef , Expr *> NamedOperand;
   SmallVector<NamedOperand, 4> 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<CallExprFinder> {
   std::vector<const CallExpr *> CallExprs;
 
 public:
-  using Inherited = ConstEvaluatedExprVisitor<CallExprFinder>;
+  typedef ConstEvaluatedExprVisitor<CallExprFinder> 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<MatchResult, 4> Matched;
   SourceLocation PointOfInstantiation = TemplateNameLoc;
   TemplateSpecCandidateSet FailedCandidates(PointOfInstantiation,
@@ -6024,7 +6024,7 @@ namespace {
     Sema &S;
     SourceRange SR;
 
-    using inherited = TypeVisitor<UnnamedLocalNoLinkageFinder, bool>;
+    typedef TypeVisitor<UnnamedLocalNoLinkageFinder, bool> inherited;
 
   public:
     UnnamedLocalNoLinkageFinder(Sema &S, SourceRange SR) : S(S), SR(SR) { }
@@ -11207,7 +11207,7 @@ namespace {
     DeclarationName Entity;
 
   public:
-    using inherited = TreeTransform<CurrentInstantiationRebuilder>;
+    typedef TreeTransform<CurrentInstantiationRebuilder> 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<TemplateDeclInstantiator> TypedefNameInstantiator;
 
 public:
-  using Base = TreeTransform<ExtractTypeForDeductionGuide>;
+  typedef TreeTransform<ExtractTypeForDeductionGuide> Base;
   ExtractTypeForDeductionGuide(
       Sema &SemaRef,
       llvm::SmallVectorImpl<TypedefNameDecl *> &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<TemplateInstantiator>;
+    typedef TreeTransform<TemplateInstantiator> 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<Decl *, DeclArgumentPack *> *Found
     = getSema().CurrentInstantiationScope->findInstantiationOf(PD);
   assert(Found && "no instantiation for parameter pack");
@@ -4029,7 +4029,7 @@ static ActionResult<CXXRecordDecl *> 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<MatchResult, 4> Matched, ExtraMatched;
     SmallVector<ClassTemplatePartialSpecializationDecl *, 4> 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<NamedDecl *, 8>;
+  typedef SmallVector<NamedDecl *, 8> 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<NamedDecl>(
             (*cast<DeclArgumentPack *>(*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<NamedDecl *>(Unexpanded[I].first);
       if (isa<VarDecl>(ND)) {
         // Function parameter pack or init-capture pack.
-        using DeclArgumentPack = LocalInstantiationScope::DeclArgumentPack;
+        typedef LocalInstantiationScope::DeclArgumentPack DeclArgumentPack;
 
         llvm::PointerUnion<Decl *, DeclArgumentPack *> *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<DeclSpec::TQ, SourceLocation>;
+  typedef std::pair<DeclSpec::TQ, SourceLocation> 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<InputIterator>::difference_type;
-  using iterator_category = std::input_iterator_tag;
+  typedef TemplateArgumentLoc value_type;
+  typedef TemplateArgumentLoc reference;
+  typedef typename std::iterator_traits<InputIterator>::difference_type
+    difference_type;
+  typedef std::input_iterator_tag iterator_category;
 
   class pointer {
     TemplateArgumentLoc Arg;
@@ -5039,9 +5039,9 @@ bool TreeTransform<Derived>::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<Derived,
-                                            TemplateArgument::pack_iterator>;
+      typedef TemplateArgumentLocInventIterator<Derived,
+                                                TemplateArgument::pack_iterator>
+        PackLocIterator;
       if (TransformTemplateArguments(PackLocIterator(*this,
                                                  In.getArgument().pack_begin()),
                                      PackLocIterator(*this,
@@ -7262,10 +7262,10 @@ QualType TreeTransform<Derived>::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<Derived>::TransformAutoType(TypeLocBuilder &TLB,
 
     NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
     NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
-    using ArgIterator = TemplateArgumentLocContainerIterator<AutoTypeLoc>;
+    typedef TemplateArgumentLocContainerIterator<AutoTypeLoc> ArgIterator;
     if (getDerived().TransformTemplateArguments(
             ArgIterator(TL, 0), ArgIterator(TL, TL.getNumArgs()),
             NewTemplateArgs))
@@ -7394,8 +7394,8 @@ QualType TreeTransform<Derived>::TransformTemplateSpecializationType(
   TemplateArgumentListInfo NewTemplateArgs;
   NewTemplateArgs.setLAngleLoc(TL.getLAngleLoc());
   NewTemplateArgs.setRAngleLoc(TL.getRAngleLoc());
-  using ArgIterator =
-      TemplateArgumentLocContainerIterator<TemplateSpecializationTypeLoc>;
+  typedef TemplateArgumentLocContainerIterator<TemplateSpecializationTypeLoc>
+    ArgIterator;
   if (getDerived().TransformTemplateArguments(ArgIterator(TL, 0),
                                               ArgIterator(TL, TL.getNumArgs()),
                                               NewTemplateArgs))
@@ -7451,8 +7451,8 @@ QualType TreeTransform<Derived>::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<Derived>::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<Component, 4> Components;
   for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
     const OffsetOfNode &ON = E->getComponent(I);
@@ -15403,7 +15403,7 @@ ExprResult
 TreeTransform<Derived>::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<ExprResult, QualType>;
+  typedef std::pair<ExprResult, QualType> InitCaptureInfoTy;
   struct TransformedInitCapture {
     // The location of the ... if the result is retaining a pack expansion.
     SourceLocation EllipsisLoc;
@@ -16203,8 +16203,8 @@ TreeTransform<Derived>::TransformSizeOfPackExpr(SizeOfPackExpr *E) {
                                                E->getPackLoc());
   {
     TemporaryBase Rebase(*this, E->getPackLoc(), getBaseEntity());
-    using PackLocIterator =
-        TemplateArgumentLocInventIterator<Derived, const TemplateArgument *>;
+    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<Derived> {
   Sema &S;
 
 public:
-  using Inherited = EvaluatedExprVisitor<Derived>;
+  typedef EvaluatedExprVisitor<Derived> 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<unsigned, 2>;
-  using hash_value_type = unsigned;
-  using offset_type = unsigned;
+  typedef StringRef external_key_type;
+  typedef StringRef internal_key_type;
+  typedef SmallVector<unsigned, 2> 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<IdentifierIndexReaderTrait>;
+typedef llvm::OnDiskIterableChainedHashTable<IdentifierIndexReaderTrait>
+    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<SmallVector<unsigned, 2>>;
+    typedef llvm::StringMap<SmallVector<unsigned, 2> > 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<StringRef, bool>;
+    typedef std::pair<StringRef, bool> 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<InterestingIdentifierTable> 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<unsigned, 2>;
-  using data_type_ref = const SmallVector<unsigned, 2> &;
-  using hash_value_type = unsigned;
-  using offset_type = unsigned;
+  typedef StringRef key_type;
+  typedef StringRef key_type_ref;
+  typedef SmallVector<unsigned, 2> data_type;
+  typedef const SmallVector<unsigned, 2> &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<TypeVisitorHelper> {
-  using Inherited = TypeVisitor<TypeVisitorHelper>;
+  typedef TypeVisitor<TypeVisitorHelper> 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<const char *> &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<DiagTool *>;
+typedef llvm::StringMap<DiagTool *> ToolMap;
 static inline ToolMap *getTools(void *v) { return static_cast<ToolMap*>(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<GroupRecord>;
+    typedef group_iterator<GroupRecord> subgroup_iterator;
     subgroup_iterator subgroup_begin() const;
     subgroup_iterator subgroup_end() const;
     llvm::iterator_range<subgroup_iterator> subgroups() const;
 
-    using diagnostics_iterator = group_iterator<DiagnosticRecord>;
+    typedef group_iterator<DiagnosticRecord> diagnostics_iterator;
     diagnostics_iterator diagnostics_begin() const;
     diagnostics_iterator diagnostics_end() const;
     llvm::iterator_range<diagnostics_iterator> 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<SourceRange, 4>;
+typedef SmallVector<SourceRange, 4> 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<CXTUResourceUsageEntry>;
+typedef std::vector<CXTUResourceUsageEntry> 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<const Decl *, 8>;
+  typedef SmallVector<const Decl *, 8> 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<Logger>;
+typedef IntrusiveRefCntPtr<Logger> 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<CXCursor, unsigned>;
+typedef llvm::DenseMap<CXCursor, unsigned> 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<CXCursor, 2>;
+  typedef SmallVector<CXCursor, 2> CursorVec;
   std::vector<CursorVec *> AllCursors;
   std::vector<CursorVec *> 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<const OverloadExpr *, const Decl *,
-                       OverloadedTemplateStorage *>;
+typedef llvm::PointerUnion<const OverloadExpr *, const Decl *,
+                           OverloadedTemplateStorage *>
+    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<const FileEntry *, CXIdxClientFile>;
-  using ContainerMapTy =
-      llvm::DenseMap<const DeclContext *, CXIdxClientContainer>;
-  using EntityMapTy = llvm::DenseMap<const Decl *, CXIdxClientEntity>;
+  
+  typedef llvm::DenseMap<const FileEntry *, CXIdxClientFile> FileMapTy;
+  typedef llvm::DenseMap<const DeclContext *, CXIdxClientContainer>
+    ContainerMapTy;
+  typedef llvm::DenseMap<const Decl *, CXIdxClientEntity> EntityMapTy;
 
   FileMapTy FileMap;
   ContainerMapTy ContainerMap;
   EntityMapTy EntityMap;
 
-  using RefFileOccurrence = std::pair<const FileEntry *, const Decl *>;
+  typedef std::pair<const FileEntry *, const Decl *> RefFileOccurrence;
   llvm::DenseSet<RefFileOccurrence> 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<unsigned, const char *>;
+typedef llvm::DenseMap<unsigned, const char *> 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<VisitorJob, 10>;
+typedef SmallVector<VisitorJob, 10> VisitorWorkList;
 
 // Cursor visitor.
 class CursorVisitor : public DeclVisitor<CursorVisitor, bool>,
@@ -72,8 +72,8 @@ class CursorVisitor : public DeclVisitor<CursorVisitor, bool>,
 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<std::unique_ptr<llvm::MemoryBuffer>, 8>;
+  typedef SmallVector<std::unique_ptr<llvm::MemoryBuffer>, 8> MemBufferOwner;
   std::unique_ptr<MemBufferOwner> 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<bool> 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<ASTNode, ASTNode>;
-  using ChildIterator = ChildMap::const_iterator;
+  typedef std::multimap<ASTNode, ASTNode> ChildMap;
+  typedef ChildMap::const_iterator ChildIterator;
 
   std::set<ASTNode> 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<std::pair<std::string, const Record *>>;
+typedef std::vector<std::pair<std::string, const Record *>> ParsedAttrMap;
 
 static ParsedAttrMap getParsedAttrList(const RecordKeeper &Records,
                                        ParsedAttrMap *Dupes = nullptr,
@@ -1774,7 +1774,7 @@ SpellingNamesAreCommon(const std::vector<FlattenedSpelling>& Spellings) {
   return true;
 }
 
-using SemanticSpellingMap = std::map<unsigned, std::string>;
+typedef std::map<unsigned, std::string> SemanticSpellingMap;
 static std::string
 CreateSemanticSpellings(const std::vector<FlattenedSpelling> &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<StringRef>::const_iterator;
+    typedef std::vector<StringRef>::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<const Record *> Diags,
 // Infer members of -Wpedantic.
 //===----------------------------------------------------------------------===//
 
-using RecordVec = std::vector<const Record *>;
-using RecordSet = DenseSet<const Record *>;
-using VecOrSet = PointerUnion<RecordVec *, RecordSet *>;
+typedef std::vector<const Record *> RecordVec;
+typedef DenseSet<const Record *> RecordSet;
+typedef PointerUnion<RecordVec *, RecordSet *> VecOrSet;
 
 namespace {
 class InferPedantic {
-  using GMap =
-      DenseMap<const Record *, std::pair<unsigned, std::optional<unsigned>>>;
+  typedef DenseMap<const Record *, std::pair<unsigned, std::optional<unsigned>>>
+      GMap;
 
   DiagGroupParentMap &DiagGroupParents;
   ArrayRef<const Record *> Diags;



More information about the cfe-commits mailing list