[clang] [clang]: support std::meta::info for primitive types (PR #190356)

Nhat Nguyen via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 8 14:13:51 PDT 2026


https://github.com/changkhothuychung updated https://github.com/llvm/llvm-project/pull/190356

>From e41e160d5881b1383fcaa7fc847c1f5a375c0ac7 Mon Sep 17 00:00:00 2001
From: changkhothuychung <nhat7203 at gmail.com>
Date: Fri, 3 Apr 2026 11:48:07 -0400
Subject: [PATCH 01/12] initial commit

---
 clang/include/clang/AST/APValue.h             | 37 ++++++++++-
 clang/include/clang/AST/ASTContext.h          |  1 +
 clang/include/clang/AST/BuiltinTypes.def      |  3 +
 clang/include/clang/AST/ExprCXX.h             | 20 +++---
 clang/include/clang/AST/Reflection.h          | 25 ++++++++
 clang/include/clang/AST/TypeBase.h            |  5 ++
 clang/include/clang/Basic/TargetInfo.h        |  5 ++
 clang/lib/AST/APValue.cpp                     | 22 +++++++
 clang/lib/AST/ASTContext.cpp                  |  7 +++
 clang/lib/AST/ExprCXX.cpp                     |  9 +--
 clang/lib/AST/ExprConstant.cpp                | 63 +++++++++++++++++++
 clang/lib/AST/Type.cpp                        | 10 +++
 clang/lib/Basic/TargetInfo.cpp                |  2 +
 clang/lib/CodeGen/CodeGenModule.cpp           |  3 +
 clang/lib/CodeGen/CodeGenTypes.cpp            |  4 ++
 clang/lib/CodeGen/ItaniumCXXABI.cpp           |  1 +
 clang/lib/Sema/SemaExpr.cpp                   |  7 +++
 clang/lib/Sema/SemaOverload.cpp               | 16 +++++
 clang/lib/Sema/TreeTransform.h                |  5 +-
 .../CodeGenCXX/reflection-mangle-itanium.cpp  |  4 ++
 .../test/CodeGenCXX/reflection-mangle-ms.cpp  |  3 +
 .../test/Parser/reflection-meta-info.fail.cpp | 21 +++++++
 .../test/Parser/reflection-meta-info.pass.cpp | 39 ++++++++++++
 23 files changed, 298 insertions(+), 14 deletions(-)
 create mode 100644 clang/include/clang/AST/Reflection.h
 create mode 100644 clang/test/Parser/reflection-meta-info.fail.cpp
 create mode 100644 clang/test/Parser/reflection-meta-info.pass.cpp

diff --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h
index 8a2d6d434792a..efd293914ff32 100644
--- a/clang/include/clang/AST/APValue.h
+++ b/clang/include/clang/AST/APValue.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_CLANG_AST_APVALUE_H
 #define LLVM_CLANG_AST_APVALUE_H
 
+#include "clang/AST/Reflection.h"
 #include "clang/Basic/LLVM.h"
 #include "llvm/ADT/APFixedPoint.h"
 #include "llvm/ADT/APFloat.h"
@@ -140,7 +141,8 @@ class APValue {
     Struct,
     Union,
     MemberPointer,
-    AddrLabelDiff
+    AddrLabelDiff,
+    Reflection
   };
 
   class alignas(uint64_t) LValueBase {
@@ -304,12 +306,16 @@ class APValue {
     const AddrLabelExpr* LHSExpr;
     const AddrLabelExpr* RHSExpr;
   };
+  struct ReflectionData {
+    const ReflectionKind OperandKind;
+    const void *Operand;
+  };
   struct MemberPointerData;
 
   // We ensure elsewhere that Data is big enough for LV and MemberPointerData.
   typedef llvm::AlignedCharArrayUnion<void *, APSInt, APFloat, ComplexAPSInt,
                                       ComplexAPFloat, Vec, Arr, StructData,
-                                      UnionData, AddrLabelDiffData> DataType;
+                                      UnionData, AddrLabelDiffData, ReflectionData> DataType;
   static const size_t DataSize = sizeof(DataType);
 
   DataType Data;
@@ -396,6 +402,15 @@ class APValue {
       : Kind(None), AllowConstexprUnknown(false) {
     MakeArray(InitElts, Size);
   }
+
+  /// Creates a new Reflection APValue.
+  /// \param OperandKind The kind of reflection.
+  /// \param Operand The entity being reflected.
+  APValue(ReflectionKind OperandKind, const void *Operand)
+      : Kind(None) {
+    MakeReflection(OperandKind, Operand);
+  }
+
   /// Creates a new struct APValue.
   /// \param UninitStruct Marker. Pass an empty UninitStruct.
   /// \param NumBases Number of bases.
@@ -476,6 +491,7 @@ class APValue {
   bool isUnion() const { return Kind == Union; }
   bool isMemberPointer() const { return Kind == MemberPointer; }
   bool isAddrLabelDiff() const { return Kind == AddrLabelDiff; }
+  bool isReflection() const { return Kind == Reflection; }
 
   void dump() const;
   void dump(raw_ostream &OS, const ASTContext &Context) const;
@@ -651,6 +667,16 @@ class APValue {
     return ((const AddrLabelDiffData *)(const char *)&Data)->RHSExpr;
   }
 
+  const ReflectionKind getReflectionOperandKind() const {
+    assert(isReflection() && "Invalid accessor");
+    return ((const ReflectionData *)(const char *)&Data)->OperandKind;
+  }
+
+  const void* getOpaqueReflectionOperand() const {
+    assert(isReflection() && "Invalid accessor");
+    return ((const ReflectionData *)(const char *)&Data)->Operand;
+  }
+
   void setInt(APSInt I) {
     assert(isInt() && "Invalid accessor");
     *(APSInt *)(char *)&Data = std::move(I);
@@ -696,6 +722,13 @@ class APValue {
 
 private:
   void DestroyDataAndMakeUninit();
+  void MakeReflection(ReflectionKind OperandKind,
+                      const void *Operand) {
+    assert(isAbsent() && "Bad state change");
+    new ((void *)(char *)Data.buffer) ReflectionData(
+            OperandKind, Operand);
+    Kind = Reflection;
+  }
   void MakeInt() {
     assert(isAbsent() && "Bad state change");
     new ((void *)&Data) APSInt(1);
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index 05302c30d18d1..0f96ce9fc7f7b 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -1315,6 +1315,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
   CanQualType BFloat16Ty;
   CanQualType Float16Ty; // C11 extension ISO/IEC TS 18661-3
   CanQualType VoidPtrTy, NullPtrTy;
+  CanQualType MetaInfoTy;
   CanQualType DependentTy, OverloadTy, BoundMemberTy, UnresolvedTemplateTy,
       UnknownAnyTy;
   CanQualType BuiltinFnTy;
diff --git a/clang/include/clang/AST/BuiltinTypes.def b/clang/include/clang/AST/BuiltinTypes.def
index 444be4311a743..87a376a839cda 100644
--- a/clang/include/clang/AST/BuiltinTypes.def
+++ b/clang/include/clang/AST/BuiltinTypes.def
@@ -226,6 +226,9 @@ FLOATING_TYPE(Ibm128, Ibm128Ty)
 // This is the type of C++0x 'nullptr'.
 BUILTIN_TYPE(NullPtr, NullPtrTy)
 
+// 'std::meta::info' in C++
+BUILTIN_TYPE(MetaInfo, MetaInfoTy)
+
 // The primitive Objective C 'id' type.  The user-visible 'id'
 // type is a typedef of an ObjCObjectPointerType to an
 // ObjCObjectType with this as its base.  In fact, this only ever
diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h
index c40cd929b7408..824d96cb9dae1 100644
--- a/clang/include/clang/AST/ExprCXX.h
+++ b/clang/include/clang/AST/ExprCXX.h
@@ -25,6 +25,7 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/OperationKinds.h"
+#include "clang/AST/Reflection.h"
 #include "clang/AST/Stmt.h"
 #include "clang/AST/StmtCXX.h"
 #include "clang/AST/TemplateBase.h"
@@ -5508,15 +5509,18 @@ class BuiltinBitCastExpr final
 ///  - an id-expression.
 class CXXReflectExpr : public Expr {
 
-  // TODO(Reflection): add support for TemplateReference, NamespaceReference and
-  // DeclRefExpr
-  using operand_type = llvm::PointerUnion<const TypeSourceInfo *>;
 
-  SourceLocation CaretCaretLoc;
-  operand_type Operand;
+  private:
+    // TODO(Reflection): add support for TemplateReference, NamespaceReference and
+    // DeclRefExpr
+    using operand_type = llvm::PointerUnion<const TypeSourceInfo *>;
 
-  CXXReflectExpr(SourceLocation CaretCaretLoc, const TypeSourceInfo *TSI);
-  CXXReflectExpr(EmptyShell Empty);
+    SourceLocation CaretCaretLoc;
+    ReflectionKind Kind;
+    operand_type Operand;
+
+    CXXReflectExpr(ASTContext &C, SourceLocation CaretCaretLoc, const TypeSourceInfo *TSI);
+    CXXReflectExpr(EmptyShell Empty);
 
 public:
   static CXXReflectExpr *Create(ASTContext &C, SourceLocation OperatorLoc,
@@ -5538,6 +5542,8 @@ class CXXReflectExpr : public Expr {
 
   /// Returns location of the '^^'-operator.
   SourceLocation getOperatorLoc() const { return CaretCaretLoc; }
+  ReflectionKind getKind() const { return Kind; }
+  const void* getOpaqueValue() const { return Operand.getOpaqueValue(); }
 
   child_range children() {
     // TODO(Reflection)
diff --git a/clang/include/clang/AST/Reflection.h b/clang/include/clang/AST/Reflection.h
new file mode 100644
index 0000000000000..140f48af6efe3
--- /dev/null
+++ b/clang/include/clang/AST/Reflection.h
@@ -0,0 +1,25 @@
+//===--- Reflection.h - Kind of reflection operands ---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares the kinds of reflection operands.
+//
+//===----------------------------------------------------------------------===//
+
+
+#ifndef LLVM_CLANG_AST_REFLECTION_H
+#define LLVM_CLANG_AST_REFLECTION_H
+namespace clang {
+
+// TODO(Reflection): Add support for Template, Namespace and DeclRefExpr.
+enum class ReflectionKind {
+  Type
+};
+
+}
+
+#endif
diff --git a/clang/include/clang/AST/TypeBase.h b/clang/include/clang/AST/TypeBase.h
index 9402469f5e12b..bdbca5b8d9dae 100644
--- a/clang/include/clang/AST/TypeBase.h
+++ b/clang/include/clang/AST/TypeBase.h
@@ -2634,6 +2634,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
   bool isRecordType() const;
   bool isClassType() const;
   bool isStructureType() const;
+  bool isMetaInfoType() const;
   bool isStructureTypeWithFlexibleArrayMember() const;
   bool isObjCBoxableRecordType() const;
   bool isInterfaceType() const;
@@ -8953,6 +8954,10 @@ inline bool Type::isVoidType() const {
   return isSpecificBuiltinType(BuiltinType::Void);
 }
 
+inline bool Type::isMetaInfoType() const {
+  return isSpecificBuiltinType(BuiltinType::MetaInfo);
+}
+
 inline bool Type::isHalfType() const {
   // FIXME: Should we allow complex __fp16? Probably not.
   return isSpecificBuiltinType(BuiltinType::Half);
diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index ec6cd2be7c3c5..a830d165de98c 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -96,6 +96,7 @@ struct TransferrableTargetInfo {
   unsigned char FloatWidth, FloatAlign;
   unsigned char DoubleWidth, DoubleAlign;
   unsigned char LongDoubleWidth, LongDoubleAlign, Float128Align, Ibm128Align;
+  unsigned char MetaInfoWidth, MetaInfoAlign;
   unsigned char LargeArrayMinWidth, LargeArrayAlign;
   unsigned char LongWidth, LongAlign;
   unsigned char LongLongWidth, LongLongAlign;
@@ -824,6 +825,10 @@ class TargetInfo : public TransferrableTargetInfo,
   unsigned getIbm128Align() const { return Ibm128Align; }
   const llvm::fltSemantics &getIbm128Format() const { return *Ibm128Format; }
 
+  /// getMetaInfoWidth/Align - Returns the size/align of std::meta::info.
+  unsigned getMetaInfoWidth() const { return MetaInfoWidth; }
+  unsigned getMetaInfoAlign() const { return MetaInfoAlign; }
+
   /// Return the mangled code of long double.
   virtual const char *getLongDoubleMangling() const { return "e"; }
 
diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index 2e1c8eb3726cf..803c54d4f1c07 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -377,6 +377,9 @@ APValue::APValue(const APValue &RHS)
     MakeAddrLabelDiff();
     setAddrLabelDiff(RHS.getAddrLabelDiffLHS(), RHS.getAddrLabelDiffRHS());
     break;
+  case Reflection:
+    MakeReflection(RHS.getReflectionOperandKind(), RHS.getOpaqueReflectionOperand());
+    break;
   }
 }
 
@@ -430,6 +433,8 @@ void APValue::DestroyDataAndMakeUninit() {
     ((MemberPointerData *)(char *)&Data)->~MemberPointerData();
   else if (Kind == AddrLabelDiff)
     ((AddrLabelDiffData *)(char *)&Data)->~AddrLabelDiffData();
+  else if (Kind == Reflection)
+    ((ReflectionData *)(char *)&Data)->~ReflectionData();
   Kind = None;
   AllowConstexprUnknown = false;
 }
@@ -439,6 +444,7 @@ bool APValue::needsCleanup() const {
   case None:
   case Indeterminate:
   case AddrLabelDiff:
+  case Reflection:
     return false;
   case Struct:
   case Union:
@@ -486,6 +492,18 @@ static void profileIntValue(llvm::FoldingSetNodeID &ID, const llvm::APInt &V) {
     ID.AddInteger((uint32_t)V.extractBitsAsZExtValue(std::min(32u, N - I), I));
 }
 
+static void profileReflection(llvm::FoldingSetNodeID &ID, APValue V) {
+  ID.AddInteger(static_cast<int>(V.getReflectionOperandKind()));
+  switch (V.getReflectionOperandKind()) {
+    case ReflectionKind::Type: {
+      const TypeSourceInfo* info = static_cast<const TypeSourceInfo*>(V.getOpaqueReflectionOperand());
+      ID.AddPointer((info->getType().getCanonicalType().getAsOpaquePtr()));
+      return;
+    }
+    assert(false && "unknown or unimplemented reflection entities");
+  }
+}
+
 void APValue::Profile(llvm::FoldingSetNodeID &ID) const {
   // Note that our profiling assumes that only APValues of the same type are
   // ever compared. As a result, we don't consider collisions that could only
@@ -624,6 +642,9 @@ void APValue::Profile(llvm::FoldingSetNodeID &ID) const {
     for (const CXXRecordDecl *D : getMemberPointerPath())
       ID.AddPointer(D);
     return;
+  case Reflection:
+    profileReflection(ID, *this);
+    return;
   }
 
   llvm_unreachable("Unknown APValue kind!");
@@ -1139,6 +1160,7 @@ LinkageInfo LinkageComputer::getLVForValue(const APValue &V,
   case APValue::ComplexInt:
   case APValue::ComplexFloat:
   case APValue::Vector:
+  case APValue::Reflection:
     break;
 
   case APValue::AddrLabelDiff:
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index b74766dab38f8..937bcb17da44f 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1452,6 +1452,9 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target,
   // nullptr type (C++0x 2.14.7)
   InitBuiltinType(NullPtrTy,           BuiltinType::NullPtr);
 
+  // std::meta::info type (C++26 21.4.1)
+  InitBuiltinType(MetaInfoTy, BuiltinType::MetaInfo);
+
   // half type (OpenCL 6.1.1.1) / ARM NEON __fp16
   InitBuiltinType(HalfTy, BuiltinType::Half);
 
@@ -2280,6 +2283,10 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const {
       Width = Target->getPointerWidth(LangAS::Default);
       Align = Target->getPointerAlign(LangAS::Default);
       break;
+    case BuiltinType::MetaInfo:
+      Width = Target->getMetaInfoWidth();
+      Align = Target->getMetaInfoAlign();
+      break;
     case BuiltinType::ObjCId:
     case BuiltinType::ObjCClass:
     case BuiltinType::ObjCSel:
diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp
index bcc481fc8399f..489ad54b1509c 100644
--- a/clang/lib/AST/ExprCXX.cpp
+++ b/clang/lib/AST/ExprCXX.cpp
@@ -24,6 +24,7 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/LambdaCapture.h"
 #include "clang/AST/NestedNameSpecifier.h"
+#include "clang/AST/Reflection.h"
 #include "clang/AST/TemplateBase.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLoc.h"
@@ -1942,15 +1943,15 @@ TypeTraitExpr *TypeTraitExpr::CreateDeserialized(const ASTContext &C,
 CXXReflectExpr::CXXReflectExpr(EmptyShell Empty)
     : Expr(CXXReflectExprClass, Empty) {}
 
-CXXReflectExpr::CXXReflectExpr(SourceLocation CaretCaretLoc,
+CXXReflectExpr::CXXReflectExpr(ASTContext &C, SourceLocation CaretCaretLoc,
                                const TypeSourceInfo *TSI)
-    : Expr(CXXReflectExprClass, TSI->getType(), VK_PRValue, OK_Ordinary),
-      CaretCaretLoc(CaretCaretLoc), Operand(TSI) {}
+    : Expr(CXXReflectExprClass, C.MetaInfoTy, VK_PRValue, OK_Ordinary),
+      CaretCaretLoc(CaretCaretLoc), Kind(ReflectionKind::Type), Operand(TSI) {}
 
 CXXReflectExpr *CXXReflectExpr::Create(ASTContext &C,
                                        SourceLocation CaretCaretLoc,
                                        TypeSourceInfo *TSI) {
-  return new (C) CXXReflectExpr(CaretCaretLoc, TSI);
+  return new (C) CXXReflectExpr(C, CaretCaretLoc, TSI);
 }
 
 CXXReflectExpr *CXXReflectExpr::CreateEmpty(ASTContext &C) {
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 5973315406aed..069c9b9116af6 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -51,6 +51,7 @@
 #include "clang/AST/StmtVisitor.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLoc.h"
+#include "clang/AST/Reflection.h"
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/DiagnosticSema.h"
 #include "clang/Basic/TargetBuiltins.h"
@@ -2469,6 +2470,8 @@ static bool CheckEvaluationResult(CheckEvaluationResultKind CERK,
         Value.getUnionValue(), Kind, Value.getUnionField(), CheckedTemps);
   }
   if (Value.isStruct()) {
+    if (Type->isMetaInfoType())
+        return true;
     auto *RD = Type->castAsRecordDecl();
     if (const CXXRecordDecl *CD = dyn_cast<CXXRecordDecl>(RD)) {
       unsigned BaseIndex = 0;
@@ -10895,6 +10898,46 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
 
   return true;
 }
+
+//===----------------------------------------------------------------------===//
+// Reflection expression evaluation
+//===----------------------------------------------------------------------===//
+
+namespace {
+class ReflectionEvaluator
+  : public ExprEvaluatorBase<ReflectionEvaluator> {
+
+  using BaseType = ExprEvaluatorBase<ReflectionEvaluator>;
+
+  APValue &Result;
+public:
+  ReflectionEvaluator(EvalInfo &E, APValue &Result)
+    : ExprEvaluatorBaseTy(E), Result(Result) {}
+
+  bool Success(const APValue &V, const Expr *E) {
+    Result = V;
+    return true;
+  }
+
+  bool VisitCXXReflectExpr(const CXXReflectExpr *E);
+};
+
+bool ReflectionEvaluator::VisitCXXReflectExpr(const CXXReflectExpr *E) {
+  switch (E->getKind()) {
+    case ReflectionKind::Type: {
+      APValue Result(ReflectionKind::Type, E->getOpaqueValue());
+      return Success(Result, E);
+    }
+  }
+  llvm_unreachable("invalid reflection");
+}
+}  // end anonymous namespace
+
+static bool EvaluateReflection(const Expr *E, APValue &Result, EvalInfo &Info) {
+  assert(E->isPRValue() && E->getType()->isMetaInfoType());
+  return ReflectionEvaluator(Info, Result).Visit(E);
+}
+
 //===----------------------------------------------------------------------===//
 // Member Pointer Evaluation
 //===----------------------------------------------------------------------===//
@@ -18277,6 +18320,23 @@ EvaluateComparisonBinaryOperator(EvalInfo &Info, const BinaryOperator *E,
     return Success(CmpResult::Equal, E);
   }
 
+  if (LHSTy->isMetaInfoType() && RHSTy->isMetaInfoType()) {
+    APValue LHSValue, RHSValue;
+    llvm::FoldingSetNodeID LID, RID;
+    if (!Evaluate(LHSValue, Info, E->getLHS()))
+      return false;
+    LHSValue.Profile(LID);
+
+    if (!Evaluate(RHSValue, Info, E->getRHS()))
+      return false;
+    RHSValue.Profile(RID);
+
+    if (LID == RID)
+      return Success(CmpResult::Equal, E);
+    else
+      return Success(CmpResult::Unequal, E);
+  }
+
   return DoAfter();
 }
 
@@ -20432,6 +20492,9 @@ static bool Evaluate(APValue &Result, EvalInfo &Info, const Expr *E) {
   } else if (T->isIntegralOrEnumerationType()) {
     if (!IntExprEvaluator(Info, Result).Visit(E))
       return false;
+  } else if (T->isMetaInfoType()) {
+    if(!EvaluateReflection(E, Result, Info))
+      return false;
   } else if (T->hasPointerRepresentation()) {
     LValue LV;
     if (!EvaluatePointer(E, LV, Info))
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index a85f08753a132..eebea6811b5c6 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -3105,6 +3105,13 @@ bool Type::isLiteralType(const ASTContext &Ctx) const {
     return true;
   }
 
+  // C++26 [basic.types]p9:
+  // -- std::meta::info is a scalar type
+  // C++26 [basic.types]p10:
+  // -- a scalar type is a literal type
+  if(isMetaInfoType())
+    return true;
+
   // We treat _Atomic T as a literal type if T is a literal type.
   if (const auto *AT = BaseTy->getAs<AtomicType>())
     return AT->getValueType()->isLiteralType(Ctx);
@@ -3480,6 +3487,8 @@ StringRef BuiltinType::getName(const PrintingPolicy &Policy) const {
     return "unsigned _Accum";
   case ULongAccum:
     return "unsigned long _Accum";
+  case BuiltinType::MetaInfo:
+    return "meta::info";
   case BuiltinType::ShortFract:
     return "short _Fract";
   case BuiltinType::Fract:
@@ -5194,6 +5203,7 @@ bool Type::canHaveNullability(bool ResultIfUnknown) const {
 #include "clang/Basic/HLSLIntangibleTypes.def"
     case BuiltinType::BuiltinFn:
     case BuiltinType::NullPtr:
+    case BuiltinType::MetaInfo:
     case BuiltinType::IncompleteMatrixIdx:
     case BuiltinType::ArraySection:
     case BuiltinType::OMPArrayShaping:
diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index 794621c4b3e1f..3943347947d5c 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/lib/Basic/TargetInfo.cpp
@@ -125,6 +125,8 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : Triple(T) {
   LongDoubleAlign = 64;
   Float128Align = 128;
   Ibm128Align = 128;
+  MetaInfoWidth = 64;
+  MetaInfoAlign = 64;
   LargeArrayMinWidth = 0;
   LargeArrayAlign = 0;
   MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 0;
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 35ee108cdc4fc..fb341ba9615dc 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -6085,6 +6085,9 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D,
   if (getLangOpts().OpenCL && ASTTy->isSamplerT())
     return;
 
+  if (getLangOpts().Reflection && ASTTy->isMetaInfoType())
+    return;
+
   // HLSL default buffer constants will be emitted during HLSLBufferDecl codegen
   if (getLangOpts().HLSL &&
       D->getType().getAddressSpace() == LangAS::hlsl_constant)
diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp
index 6bd79056e599a..b17d38e659450 100644
--- a/clang/lib/CodeGen/CodeGenTypes.cpp
+++ b/clang/lib/CodeGen/CodeGenTypes.cpp
@@ -515,6 +515,10 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
       ResultType = llvm::PointerType::getUnqual(getLLVMContext());
       break;
 
+    case BuiltinType::MetaInfo:
+      ResultType = llvm::IntegerType::get(getLLVMContext(), 64);
+      break;
+
     case BuiltinType::UInt128:
     case BuiltinType::Int128:
       ResultType = llvm::IntegerType::get(getLLVMContext(), 128);
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index 397db2ee59408..740a1bae37e8b 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -3774,6 +3774,7 @@ static bool TypeInfoIsInStandardLibrary(const BuiltinType *Ty) {
     case BuiltinType::SatUFract:
     case BuiltinType::SatULongFract:
     case BuiltinType::BFloat16:
+    case BuiltinType::MetaInfo:
       return false;
 
     case BuiltinType::Dependent:
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 82da5dc032237..91a51ee23c064 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -12890,6 +12890,13 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
         *CCT, Loc, ComparisonCategoryUsage::OperatorInExpression);
   };
 
+  if(LHSType->isMetaInfoType() && RHSType->isMetaInfoType()){
+    if(!BinaryOperator::isEqualityOp(Opc)) {
+      return InvalidOperands(Loc, LHS, RHS);
+    }
+    return computeResultTy();
+  }
+
   if (!IsOrdered && LHSIsNull != RHSIsNull) {
     bool IsEquality = Opc == BO_EQ;
     if (RHSIsNull)
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index c513e72db1094..26f1e8a6a70c8 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -9049,6 +9049,10 @@ class BuiltinCandidateTypeSet  {
   /// candidate set.
   bool HasNullPtrType;
 
+  /// A flag indicating whether the reflection type was present in the
+  /// candidate set.
+  bool HasReflectionType;
+
   /// Sema - The semantic analysis instance where we are building the
   /// candidate type set.
   Sema &SemaRef;
@@ -9068,6 +9072,7 @@ class BuiltinCandidateTypeSet  {
     : HasNonRecordTypes(false),
       HasArithmeticOrEnumeralTypes(false),
       HasNullPtrType(false),
+      HasReflectionType(false),
       SemaRef(SemaRef),
       Context(SemaRef.Context) { }
 
@@ -9092,6 +9097,7 @@ class BuiltinCandidateTypeSet  {
   bool hasNonRecordTypes() { return HasNonRecordTypes; }
   bool hasArithmeticOrEnumeralTypes() { return HasArithmeticOrEnumeralTypes; }
   bool hasNullPtrType() const { return HasNullPtrType; }
+  bool hasReflectionType() const { return HasReflectionType; }
 };
 
 } // end anonymous namespace
@@ -9273,6 +9279,8 @@ BuiltinCandidateTypeSet::AddTypesConvertedFrom(QualType Ty,
     MatrixTypes.insert(Ty);
   } else if (Ty->isNullPtrType()) {
     HasNullPtrType = true;
+  } else if (Ty->isMetaInfoType()) {
+    HasReflectionType = true;
   } else if (AllowUserConversions && TyIsRec) {
     // No conversion functions in incomplete types.
     if (!SemaRef.isCompleteType(Loc, Ty))
@@ -9752,6 +9760,14 @@ class BuiltinOperatorOverloadBuilder {
           S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet);
         }
       }
+
+      if (CandidateTypes[ArgIdx].hasReflectionType()) {
+        CanQualType InfoTy = S.Context.getCanonicalType(S.Context.MetaInfoTy);
+        if (AddedTypes.insert(InfoTy).second) {
+          QualType ParamTypes[2] = { InfoTy, InfoTy };
+          S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet);
+        }
+      }
     }
   }
 
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 1a050bd6a8737..4cabed7aea323 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -13079,7 +13079,10 @@ ExprResult TreeTransform<Derived>::TransformSYCLUniqueStableNameExpr(
 template <typename Derived>
 ExprResult TreeTransform<Derived>::TransformCXXReflectExpr(CXXReflectExpr *E) {
   // TODO(reflection): Implement its transform
-  assert(false && "not implemented yet");
+  if (!E->isTypeDependent())
+    return E;
+
+  assert(false && "unknown or unimplemented reflection entities");
   return ExprError();
 }
 
diff --git a/clang/test/CodeGenCXX/reflection-mangle-itanium.cpp b/clang/test/CodeGenCXX/reflection-mangle-itanium.cpp
index a6266165e77f8..1530b4064169a 100644
--- a/clang/test/CodeGenCXX/reflection-mangle-itanium.cpp
+++ b/clang/test/CodeGenCXX/reflection-mangle-itanium.cpp
@@ -1,6 +1,10 @@
 // RUN: %clang_cc1 -std=c++26 -freflection -triple x86_64-unknown-linux-gnu \
 // RUN:   -emit-llvm -o - %s -verify
 
+constexpr auto r = ^^int;
+constexpr auto q = r;
+
+
 int main() {
   (void)(^^int); // expected-error {{cannot compile this scalar expression yet}}
   return 0;
diff --git a/clang/test/CodeGenCXX/reflection-mangle-ms.cpp b/clang/test/CodeGenCXX/reflection-mangle-ms.cpp
index 327bc0111bae8..224049521e77e 100644
--- a/clang/test/CodeGenCXX/reflection-mangle-ms.cpp
+++ b/clang/test/CodeGenCXX/reflection-mangle-ms.cpp
@@ -1,6 +1,9 @@
 // RUN: %clang_cc1 -std=c++26 -freflection -triple x86_64-pc-windows-msvc \
 // RUN:   -emit-llvm -o - %s -verify
 
+constexpr auto r = ^^int;
+constexpr auto q = r;
+
 int main() {
   (void)(^^int); // expected-error {{cannot compile this scalar expression yet}}
   return 0;
diff --git a/clang/test/Parser/reflection-meta-info.fail.cpp b/clang/test/Parser/reflection-meta-info.fail.cpp
new file mode 100644
index 0000000000000..2eade98ea6c5d
--- /dev/null
+++ b/clang/test/Parser/reflection-meta-info.fail.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 %s -std=c++26 -freflection -fsyntax-only -verify
+
+using info = decltype(^^int);
+
+struct X { int a; }; // expected-note {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'meta::info' to 'const X' for 1st argument}} \
+                     // expected-note {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'meta::info' to 'X' for 1st argument}} \
+                     // expected-note {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}}
+template <typename T = X, auto ptm = &X::a>
+constexpr auto ptmOp = ((T)(^^int)).*ptm; // expected-error {{no matching conversion for C-style cast from 'meta::info' to 'X'}}
+constexpr auto var = ptmOp<>; // expected-note {{in instantiation of variable template specialization 'ptmOp' requested here}}
+
+consteval void test()
+{
+    (^^char)++; // expected-error {{cannot increment value of type 'meta::info'}}
+    (^^short)++; // expected-error {{cannot increment value of type 'meta::info'}}
+    (^^int)++; // expected-error {{cannot increment value of type 'meta::info'}}
+
+    (^^char)--; // expected-error {{cannot decrement value of type 'meta::info'}}
+    (^^short)--; // expected-error {{cannot decrement value of type 'meta::info'}}
+    (^^int)--; // expected-error {{cannot decrement value of type 'meta::info'}}
+}
diff --git a/clang/test/Parser/reflection-meta-info.pass.cpp b/clang/test/Parser/reflection-meta-info.pass.cpp
new file mode 100644
index 0000000000000..843227000bcec
--- /dev/null
+++ b/clang/test/Parser/reflection-meta-info.pass.cpp
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 %s -std=c++26 -freflection -fsyntax-only
+
+using info = decltype(^^int);
+
+consteval void test()
+{
+    constexpr auto r = ^^int;
+    constexpr auto q = ^^int;
+
+    static_assert(__is_same(decltype(^^int), info));
+    static_assert(__is_same(decltype(^^float), info));
+    static_assert(__is_same(decltype(^^double), info));
+    static_assert(__is_same(decltype(^^long), info));
+    static_assert(__is_same(decltype(^^long long), info));
+    static_assert(__is_same(decltype(^^short), info));
+    static_assert(__is_same(decltype(^^char), info));
+    static_assert(__is_same(decltype(^^unsigned char), info));
+    static_assert(__is_same(decltype(^^unsigned short), info));
+    static_assert(__is_same(decltype(^^unsigned int), info));
+    static_assert(__is_same(decltype(^^unsigned long), info));
+    static_assert(__is_same(decltype(^^unsigned long long), info));
+
+    static_assert(__is_same(decltype(^^int), decltype(^^int)));
+    static_assert(__is_same(decltype(^^int), decltype(^^float)));
+    static_assert(__is_same(decltype(^^int), decltype(^^char)));
+    static_assert(__is_same(decltype(^^double), decltype(^^float)));
+
+    static_assert(!__is_same(decltype(^^int), int));
+
+    static_assert(sizeof(^^int) == sizeof(^^float));
+    static_assert(sizeof(^^int) == 8);
+
+
+    static_assert(^^int == ^^int);
+    static_assert(^^int != ^^float);
+    static_assert(^^float != ^^int);
+    static_assert(!(^^float == ^^int));
+    static_assert(r == q);
+}

>From 8fad3d6f4fd1bdd01bce7bfea8ce03c76c8a83db Mon Sep 17 00:00:00 2001
From: changkhothuychung <nhat7203 at gmail.com>
Date: Mon, 6 Apr 2026 16:05:28 -0400
Subject: [PATCH 02/12] clang format

---
 clang/include/clang/AST/APValue.h    |  119 +-
 clang/include/clang/AST/ExprCXX.h    |  111 +-
 clang/include/clang/AST/Reflection.h |    7 +-
 clang/lib/AST/APValue.cpp            |  120 +-
 clang/lib/AST/ExprConstant.cpp       | 3921 +++++++++++++-------------
 clang/lib/AST/Type.cpp               |    2 +-
 clang/lib/Sema/SemaExpr.cpp          | 2524 +++++++++--------
 clang/lib/Sema/SemaOverload.cpp      | 2729 +++++++++---------
 8 files changed, 4716 insertions(+), 4817 deletions(-)

diff --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h
index 2492dd4847b3e..d48155de208b6 100644
--- a/clang/include/clang/AST/APValue.h
+++ b/clang/include/clang/AST/APValue.h
@@ -28,18 +28,18 @@ namespace serialization {
 template <typename T> class BasicReaderBase;
 } // end namespace serialization
 
-  class AddrLabelExpr;
-  class ASTContext;
-  class CharUnits;
-  class CXXRecordDecl;
-  class Decl;
-  class DiagnosticBuilder;
-  class Expr;
-  class FieldDecl;
-  struct PrintingPolicy;
-  class Type;
-  class ValueDecl;
-  class QualType;
+class AddrLabelExpr;
+class ASTContext;
+class CharUnits;
+class CXXRecordDecl;
+class Decl;
+class DiagnosticBuilder;
+class Expr;
+class FieldDecl;
+struct PrintingPolicy;
+class Type;
+class ValueDecl;
+class QualType;
 
 /// Symbolic representation of typeid(T) for some type T.
 class TypeInfoLValue {
@@ -55,7 +55,7 @@ class TypeInfoLValue {
   const void *getOpaqueValue() const { return T; }
   static TypeInfoLValue getFromOpaqueValue(const void *Value) {
     TypeInfoLValue V;
-    V.T = reinterpret_cast<const Type*>(Value);
+    V.T = reinterpret_cast<const Type *>(Value);
     return V;
   }
 
@@ -89,10 +89,10 @@ class DynamicAllocLValue {
 
   static constexpr int NumLowBitsAvailable = 3;
 };
-}
+} // namespace clang
 
 namespace llvm {
-template<> struct PointerLikeTypeTraits<clang::TypeInfoLValue> {
+template <> struct PointerLikeTypeTraits<clang::TypeInfoLValue> {
   static const void *getAsVoidPointer(clang::TypeInfoLValue V) {
     return V.getOpaqueValue();
   }
@@ -104,7 +104,7 @@ template<> struct PointerLikeTypeTraits<clang::TypeInfoLValue> {
   static constexpr int NumLowBitsAvailable = 3;
 };
 
-template<> struct PointerLikeTypeTraits<clang::DynamicAllocLValue> {
+template <> struct PointerLikeTypeTraits<clang::DynamicAllocLValue> {
   static const void *getAsVoidPointer(clang::DynamicAllocLValue V) {
     return V.getOpaqueValue();
   }
@@ -114,7 +114,7 @@ template<> struct PointerLikeTypeTraits<clang::DynamicAllocLValue> {
   static constexpr int NumLowBitsAvailable =
       clang::DynamicAllocLValue::NumLowBitsAvailable;
 };
-}
+} // namespace llvm
 
 namespace clang {
 /// APValue - This class implements a discriminated union of [uninitialized]
@@ -124,6 +124,7 @@ class APValue {
   typedef llvm::APFixedPoint APFixedPoint;
   typedef llvm::APSInt APSInt;
   typedef llvm::APFloat APFloat;
+
 public:
   enum ValueKind {
     /// There is no such object (it's outside its lifetime).
@@ -313,8 +314,8 @@ class APValue {
     ~UnionData();
   };
   struct AddrLabelDiffData {
-    const AddrLabelExpr* LHSExpr;
-    const AddrLabelExpr* RHSExpr;
+    const AddrLabelExpr *LHSExpr;
+    const AddrLabelExpr *RHSExpr;
   };
   struct ReflectionData {
     const ReflectionKind OperandKind;
@@ -323,9 +324,10 @@ class APValue {
   struct MemberPointerData;
 
   // We ensure elsewhere that Data is big enough for LV and MemberPointerData.
-  typedef llvm::AlignedCharArrayUnion<void *, APSInt, APFloat, ComplexAPSInt,
-                                      ComplexAPFloat, Vec, Mat, Arr, StructData,
-                                      UnionData, AddrLabelDiffData, ReflectionData> DataType;
+  typedef llvm::AlignedCharArrayUnion<
+      void *, APSInt, APFloat, ComplexAPSInt, ComplexAPFloat, Vec, Mat, Arr,
+      StructData, UnionData, AddrLabelDiffData, ReflectionData>
+      DataType;
   static const size_t DataSize = sizeof(DataType);
 
   DataType Data;
@@ -341,11 +343,13 @@ class APValue {
   APValue() : Kind(None), AllowConstexprUnknown(false) {}
   /// Creates an integer APValue holding the given value.
   explicit APValue(APSInt I) : Kind(None), AllowConstexprUnknown(false) {
-    MakeInt(); setInt(std::move(I));
+    MakeInt();
+    setInt(std::move(I));
   }
   /// Creates a float APValue holding the given value.
   explicit APValue(APFloat F) : Kind(None), AllowConstexprUnknown(false) {
-    MakeFloat(); setFloat(std::move(F));
+    MakeFloat();
+    setFloat(std::move(F));
   }
   /// Creates a fixed-point APValue holding the given value.
   explicit APValue(APFixedPoint FX) : Kind(None), AllowConstexprUnknown(false) {
@@ -355,7 +359,8 @@ class APValue {
   /// are read from \p E.
   explicit APValue(const APValue *E, unsigned N)
       : Kind(None), AllowConstexprUnknown(false) {
-    MakeVector(); setVector(E, N);
+    MakeVector();
+    setVector(E, N);
   }
   /// Creates a matrix APValue with given dimensions. The elements
   /// are read from \p E and assumed to be in row-major order.
@@ -367,11 +372,13 @@ class APValue {
   /// Creates an integer complex APValue with the given real and imaginary
   /// values.
   APValue(APSInt R, APSInt I) : Kind(None), AllowConstexprUnknown(false) {
-    MakeComplexInt(); setComplexInt(std::move(R), std::move(I));
+    MakeComplexInt();
+    setComplexInt(std::move(R), std::move(I));
   }
   /// Creates a float complex APValue with the given real and imaginary values.
   APValue(APFloat R, APFloat I) : Kind(None), AllowConstexprUnknown(false) {
-    MakeComplexFloat(); setComplexFloat(std::move(R), std::move(I));
+    MakeComplexFloat();
+    setComplexFloat(std::move(R), std::move(I));
   }
   APValue(const APValue &RHS);
   APValue(APValue &&RHS);
@@ -423,8 +430,7 @@ class APValue {
   /// Creates a new Reflection APValue.
   /// \param OperandKind The kind of reflection.
   /// \param Operand The entity being reflected.
-  APValue(ReflectionKind OperandKind, const void *Operand)
-      : Kind(None) {
+  APValue(ReflectionKind OperandKind, const void *Operand) : Kind(None) {
     MakeReflection(OperandKind, Operand);
   }
 
@@ -459,7 +465,8 @@ class APValue {
   /// \param RHSExpr The right-hand side of the difference.
   APValue(const AddrLabelExpr *LHSExpr, const AddrLabelExpr *RHSExpr)
       : Kind(None), AllowConstexprUnknown(false) {
-    MakeAddrLabelDiff(); setAddrLabelDiff(LHSExpr, RHSExpr);
+    MakeAddrLabelDiff();
+    setAddrLabelDiff(LHSExpr, RHSExpr);
   }
   static APValue IndeterminateValue() {
     APValue Result;
@@ -524,9 +531,7 @@ class APValue {
     assert(isInt() && "Invalid accessor");
     return *(APSInt *)(char *)&Data;
   }
-  const APSInt &getInt() const {
-    return const_cast<APValue*>(this)->getInt();
-  }
+  const APSInt &getInt() const { return const_cast<APValue *>(this)->getInt(); }
 
   /// Try to convert this value to an integral constant. This works if it's an
   /// integer, null pointer, or offset from a null pointer. Returns true on
@@ -539,7 +544,7 @@ class APValue {
     return *(APFloat *)(char *)&Data;
   }
   const APFloat &getFloat() const {
-    return const_cast<APValue*>(this)->getFloat();
+    return const_cast<APValue *>(this)->getFloat();
   }
 
   APFixedPoint &getFixedPoint() {
@@ -555,7 +560,7 @@ class APValue {
     return ((ComplexAPSInt *)(char *)&Data)->Real;
   }
   const APSInt &getComplexIntReal() const {
-    return const_cast<APValue*>(this)->getComplexIntReal();
+    return const_cast<APValue *>(this)->getComplexIntReal();
   }
 
   APSInt &getComplexIntImag() {
@@ -563,7 +568,7 @@ class APValue {
     return ((ComplexAPSInt *)(char *)&Data)->Imag;
   }
   const APSInt &getComplexIntImag() const {
-    return const_cast<APValue*>(this)->getComplexIntImag();
+    return const_cast<APValue *>(this)->getComplexIntImag();
   }
 
   APFloat &getComplexFloatReal() {
@@ -571,7 +576,7 @@ class APValue {
     return ((ComplexAPFloat *)(char *)&Data)->Real;
   }
   const APFloat &getComplexFloatReal() const {
-    return const_cast<APValue*>(this)->getComplexFloatReal();
+    return const_cast<APValue *>(this)->getComplexFloatReal();
   }
 
   APFloat &getComplexFloatImag() {
@@ -579,13 +584,13 @@ class APValue {
     return ((ComplexAPFloat *)(char *)&Data)->Imag;
   }
   const APFloat &getComplexFloatImag() const {
-    return const_cast<APValue*>(this)->getComplexFloatImag();
+    return const_cast<APValue *>(this)->getComplexFloatImag();
   }
 
   const LValueBase getLValueBase() const;
   CharUnits &getLValueOffset();
   const CharUnits &getLValueOffset() const {
-    return const_cast<APValue*>(this)->getLValueOffset();
+    return const_cast<APValue *>(this)->getLValueOffset();
   }
   bool isLValueOnePastTheEnd() const;
   bool hasLValuePath() const;
@@ -600,7 +605,7 @@ class APValue {
     return ((Vec *)(char *)&Data)->Elts[I];
   }
   const APValue &getVectorElt(unsigned I) const {
-    return const_cast<APValue*>(this)->getVectorElt(I);
+    return const_cast<APValue *>(this)->getVectorElt(I);
   }
   unsigned getVectorLength() const {
     assert(isVector() && "Invalid accessor");
@@ -644,7 +649,7 @@ class APValue {
     return ((Arr *)(char *)&Data)->Elts[I];
   }
   const APValue &getArrayInitializedElt(unsigned I) const {
-    return const_cast<APValue*>(this)->getArrayInitializedElt(I);
+    return const_cast<APValue *>(this)->getArrayInitializedElt(I);
   }
   bool hasArrayFiller() const {
     return getArrayInitializedElts() != getArraySize();
@@ -655,7 +660,7 @@ class APValue {
     return ((Arr *)(char *)&Data)->Elts[getArrayInitializedElts()];
   }
   const APValue &getArrayFiller() const {
-    return const_cast<APValue*>(this)->getArrayFiller();
+    return const_cast<APValue *>(this)->getArrayFiller();
   }
   unsigned getArrayInitializedElts() const {
     assert(isArray() && "Invalid accessor");
@@ -685,10 +690,10 @@ class APValue {
     return ((StructData *)(char *)&Data)->Elts[getStructNumBases() + i];
   }
   const APValue &getStructBase(unsigned i) const {
-    return const_cast<APValue*>(this)->getStructBase(i);
+    return const_cast<APValue *>(this)->getStructBase(i);
   }
   const APValue &getStructField(unsigned i) const {
-    return const_cast<APValue*>(this)->getStructField(i);
+    return const_cast<APValue *>(this)->getStructField(i);
   }
 
   const FieldDecl *getUnionField() const {
@@ -700,18 +705,18 @@ class APValue {
     return *((UnionData *)(char *)&Data)->Value;
   }
   const APValue &getUnionValue() const {
-    return const_cast<APValue*>(this)->getUnionValue();
+    return const_cast<APValue *>(this)->getUnionValue();
   }
 
   const ValueDecl *getMemberPointerDecl() const;
   bool isMemberPointerToDerivedMember() const;
-  ArrayRef<const CXXRecordDecl*> getMemberPointerPath() const;
+  ArrayRef<const CXXRecordDecl *> getMemberPointerPath() const;
 
-  const AddrLabelExpr* getAddrLabelDiffLHS() const {
+  const AddrLabelExpr *getAddrLabelDiffLHS() const {
     assert(isAddrLabelDiff() && "Invalid accessor");
     return ((const AddrLabelDiffData *)(const char *)&Data)->LHSExpr;
   }
-  const AddrLabelExpr* getAddrLabelDiffRHS() const {
+  const AddrLabelExpr *getAddrLabelDiffRHS() const {
     assert(isAddrLabelDiff() && "Invalid accessor");
     return ((const AddrLabelDiffData *)(const char *)&Data)->RHSExpr;
   }
@@ -721,7 +726,7 @@ class APValue {
     return ((const ReflectionData *)(const char *)&Data)->OperandKind;
   }
 
-  const void* getOpaqueReflectionOperand() const {
+  const void *getOpaqueReflectionOperand() const {
     assert(isReflection() && "Invalid accessor");
     return ((const ReflectionData *)(const char *)&Data)->Operand;
   }
@@ -768,19 +773,17 @@ class APValue {
                  ArrayRef<LValuePathEntry> Path, bool OnePastTheEnd,
                  bool IsNullPtr);
   void setUnion(const FieldDecl *Field, const APValue &Value);
-  void setAddrLabelDiff(const AddrLabelExpr* LHSExpr,
-                        const AddrLabelExpr* RHSExpr) {
+  void setAddrLabelDiff(const AddrLabelExpr *LHSExpr,
+                        const AddrLabelExpr *RHSExpr) {
     ((AddrLabelDiffData *)(char *)&Data)->LHSExpr = LHSExpr;
     ((AddrLabelDiffData *)(char *)&Data)->RHSExpr = RHSExpr;
   }
 
 private:
   void DestroyDataAndMakeUninit();
-  void MakeReflection(ReflectionKind OperandKind,
-                      const void *Operand) {
+  void MakeReflection(ReflectionKind OperandKind, const void *Operand) {
     assert(isAbsent() && "Bad state change");
-    new ((void *)(char *)Data.buffer) ReflectionData(
-            OperandKind, Operand);
+    new ((void *)(char *)Data.buffer) ReflectionData(OperandKind, Operand);
     Kind = Reflection;
   }
   void MakeInt() {
@@ -831,7 +834,7 @@ class APValue {
     Kind = Union;
   }
   void MakeMemberPointer(const ValueDecl *Member, bool IsDerivedMember,
-                         ArrayRef<const CXXRecordDecl*> Path);
+                         ArrayRef<const CXXRecordDecl *> Path);
   void MakeAddrLabelDiff() {
     assert(isAbsent() && "Bad state change");
     new ((void *)(char *)&Data) AddrLabelDiffData();
@@ -869,13 +872,13 @@ class APValue {
 } // end namespace clang.
 
 namespace llvm {
-template<> struct DenseMapInfo<clang::APValue::LValueBase> {
+template <> struct DenseMapInfo<clang::APValue::LValueBase> {
   static clang::APValue::LValueBase getEmptyKey();
   static clang::APValue::LValueBase getTombstoneKey();
   static unsigned getHashValue(const clang::APValue::LValueBase &Base);
   static bool isEqual(const clang::APValue::LValueBase &LHS,
                       const clang::APValue::LValueBase &RHS);
 };
-}
+} // namespace llvm
 
 #endif
diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h
index 824d96cb9dae1..6d55bb76b4e1c 100644
--- a/clang/include/clang/AST/ExprCXX.h
+++ b/clang/include/clang/AST/ExprCXX.h
@@ -497,12 +497,10 @@ class CXXDynamicCastExpr final
   friend class CastExpr;
   friend TrailingObjects;
 
-  static CXXDynamicCastExpr *Create(const ASTContext &Context, QualType T,
-                                    ExprValueKind VK, CastKind Kind, Expr *Op,
-                                    const CXXCastPath *Path,
-                                    TypeSourceInfo *Written, SourceLocation L,
-                                    SourceLocation RParenLoc,
-                                    SourceRange AngleBrackets);
+  static CXXDynamicCastExpr *
+  Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind,
+         Expr *Op, const CXXCastPath *Path, TypeSourceInfo *Written,
+         SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets);
 
   static CXXDynamicCastExpr *CreateEmpty(const ASTContext &Context,
                                          unsigned pathSize);
@@ -542,12 +540,10 @@ class CXXReinterpretCastExpr final
   friend class CastExpr;
   friend TrailingObjects;
 
-  static CXXReinterpretCastExpr *Create(const ASTContext &Context, QualType T,
-                                        ExprValueKind VK, CastKind Kind,
-                                        Expr *Op, const CXXCastPath *Path,
-                                 TypeSourceInfo *WrittenTy, SourceLocation L,
-                                        SourceLocation RParenLoc,
-                                        SourceRange AngleBrackets);
+  static CXXReinterpretCastExpr *
+  Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind,
+         Expr *Op, const CXXCastPath *Path, TypeSourceInfo *WrittenTy,
+         SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets);
   static CXXReinterpretCastExpr *CreateEmpty(const ASTContext &Context,
                                              unsigned pathSize);
 
@@ -696,7 +692,7 @@ class UserDefinedLiteral final : public CallExpr {
   /// removed).
   Expr *getCookedLiteral();
   const Expr *getCookedLiteral() const {
-    return const_cast<UserDefinedLiteral*>(this)->getCookedLiteral();
+    return const_cast<UserDefinedLiteral *>(this)->getCookedLiteral();
   }
 
   SourceLocation getBeginLoc() const {
@@ -815,8 +811,8 @@ class CXXStdInitializerListExpr : public Expr {
     setDependence(computeDependence(this));
   }
 
-  Expr *getSubExpr() { return static_cast<Expr*>(SubExpr); }
-  const Expr *getSubExpr() const { return static_cast<const Expr*>(SubExpr); }
+  Expr *getSubExpr() { return static_cast<Expr *>(SubExpr); }
+  const Expr *getSubExpr() const { return static_cast<const Expr *>(SubExpr); }
 
   SourceLocation getBeginLoc() const LLVM_READONLY {
     return SubExpr->getBeginLoc();
@@ -870,9 +866,9 @@ class CXXTypeidExpr : public Expr {
   CXXTypeidExpr(EmptyShell Empty, bool isExpr)
       : Expr(CXXTypeidExprClass, Empty) {
     if (isExpr)
-      Operand = (Expr*)nullptr;
+      Operand = (Expr *)nullptr;
     else
-      Operand = (TypeSourceInfo*)nullptr;
+      Operand = (TypeSourceInfo *)nullptr;
   }
 
   /// Determine whether this typeid has a type operand which is potentially
@@ -970,13 +966,13 @@ class MSPropertyRefExpr : public Expr {
     else if (QualifierLoc)
       return QualifierLoc.getBeginLoc();
     else
-        return MemberLoc;
+      return MemberLoc;
   }
 
   SourceLocation getEndLoc() const { return getMemberLoc(); }
 
   child_range children() {
-    return child_range((Stmt**)&BaseExpr, (Stmt**)&BaseExpr + 1);
+    return child_range((Stmt **)&BaseExpr, (Stmt **)&BaseExpr + 1);
   }
 
   const_child_range children() const {
@@ -1090,11 +1086,11 @@ class CXXUuidofExpr : public Expr {
   }
 
   CXXUuidofExpr(EmptyShell Empty, bool isExpr)
-    : Expr(CXXUuidofExprClass, Empty) {
+      : Expr(CXXUuidofExprClass, Empty) {
     if (isExpr)
-      Operand = (Expr*)nullptr;
+      Operand = (Expr *)nullptr;
     else
-      Operand = (TypeSourceInfo*)nullptr;
+      Operand = (TypeSourceInfo *)nullptr;
   }
 
   bool isTypeOperand() const { return isa<TypeSourceInfo *>(Operand); }
@@ -1471,9 +1467,7 @@ class CXXTemporary {
 
   const CXXDestructorDecl *getDestructor() const { return Destructor; }
 
-  void setDestructor(const CXXDestructorDecl *Dtor) {
-    Destructor = Dtor;
-  }
+  void setDestructor(const CXXDestructorDecl *Dtor) { Destructor = Dtor; }
 };
 
 /// Represents binding an expression to a temporary.
@@ -1508,7 +1502,7 @@ class CXXBindTemporaryExpr : public Expr {
       : Expr(CXXBindTemporaryExprClass, Empty) {}
 
   static CXXBindTemporaryExpr *Create(const ASTContext &C, CXXTemporary *Temp,
-                                      Expr* SubExpr);
+                                      Expr *SubExpr);
 
   CXXTemporary *getTemporary() { return Temp; }
   const CXXTemporary *getTemporary() const { return Temp; }
@@ -2214,9 +2208,7 @@ class CXXScalarValueInitExpr : public Expr {
   explicit CXXScalarValueInitExpr(EmptyShell Shell)
       : Expr(CXXScalarValueInitExprClass, Shell) {}
 
-  TypeSourceInfo *getTypeSourceInfo() const {
-    return TypeInfo;
-  }
+  TypeSourceInfo *getTypeSourceInfo() const { return TypeInfo; }
 
   SourceLocation getRParenLoc() const {
     return CXXScalarValueInitExprBits.RParenLoc;
@@ -2777,12 +2769,11 @@ class CXXPseudoDestructorExpr : public Expr {
   PseudoDestructorTypeStorage DestroyedType;
 
 public:
-  CXXPseudoDestructorExpr(const ASTContext &Context,
-                          Expr *Base, bool isArrow, SourceLocation OperatorLoc,
+  CXXPseudoDestructorExpr(const ASTContext &Context, Expr *Base, bool isArrow,
+                          SourceLocation OperatorLoc,
                           NestedNameSpecifierLoc QualifierLoc,
                           TypeSourceInfo *ScopeType,
-                          SourceLocation ColonColonLoc,
-                          SourceLocation TildeLoc,
+                          SourceLocation ColonColonLoc, SourceLocation TildeLoc,
                           PseudoDestructorTypeStorage DestroyedType);
 
   explicit CXXPseudoDestructorExpr(EmptyShell Shell)
@@ -2925,8 +2916,7 @@ class TypeTraitExpr final
   static TypeTraitExpr *Create(const ASTContext &C, QualType T,
                                SourceLocation Loc, TypeTrait Kind,
                                ArrayRef<TypeSourceInfo *> Args,
-                               SourceLocation RParenLoc,
-                               bool Value);
+                               SourceLocation RParenLoc, bool Value);
 
   static TypeTraitExpr *Create(const ASTContext &C, QualType T,
                                SourceLocation Loc, TypeTrait Kind,
@@ -3043,7 +3033,10 @@ class ArrayTypeTraitExpr : public Expr {
 
   TypeSourceInfo *getQueriedTypeSourceInfo() const { return QueriedType; }
 
-  uint64_t getValue() const { assert(!isTypeDependent()); return Value; }
+  uint64_t getValue() const {
+    assert(!isTypeDependent());
+    return Value;
+  }
 
   Expr *getDimensionExpression() const { return Dimension; }
 
@@ -3076,7 +3069,7 @@ class ExpressionTraitExpr : public Expr {
   SourceLocation RParen;
 
   /// The expression being queried.
-  Expr* QueriedExpression = nullptr;
+  Expr *QueriedExpression = nullptr;
 
 public:
   friend class ASTStmtReader;
@@ -3810,7 +3803,7 @@ class CXXUnresolvedConstructExpr final
   arg_iterator arg_end() { return arg_begin() + getNumArgs(); }
   arg_range arguments() { return arg_range(arg_begin(), arg_end()); }
 
-  using const_arg_iterator = const Expr* const *;
+  using const_arg_iterator = const Expr *const *;
   using const_arg_range = llvm::iterator_range<const_arg_iterator>;
 
   const_arg_iterator arg_begin() const { return getTrailingObjects(); }
@@ -4420,9 +4413,7 @@ class PackExpansionExpr : public Expr {
   }
 
   // Iterators
-  child_range children() {
-    return child_range(&Pattern, &Pattern + 1);
-  }
+  child_range children() { return child_range(&Pattern, &Pattern + 1); }
 
   const_child_range children() const {
     return const_child_range(&Pattern, &Pattern + 1);
@@ -4525,9 +4516,7 @@ class SizeOfPackExpr final
   ///
   ///   template<typename ...Ts> using X = int[sizeof...(Ts)];
   ///   template<typename ...Us> void f(X<Us..., 1, 2, 3, Us...>);
-  bool isPartiallySubstituted() const {
-    return isValueDependent() && Length;
-  }
+  bool isPartiallySubstituted() const { return isValueDependent() && Length; }
 
   /// Get
   ArrayRef<TemplateArgument> getPartialArguments() const {
@@ -5056,8 +5045,8 @@ class CXXFoldExpr : public Expr {
   UnresolvedLookupExpr *getCallee() const {
     return static_cast<UnresolvedLookupExpr *>(SubExprs[SubExpr::Callee]);
   }
-  Expr *getLHS() const { return static_cast<Expr*>(SubExprs[SubExpr::LHS]); }
-  Expr *getRHS() const { return static_cast<Expr*>(SubExprs[SubExpr::RHS]); }
+  Expr *getLHS() const { return static_cast<Expr *>(SubExprs[SubExpr::LHS]); }
+  Expr *getRHS() const { return static_cast<Expr *>(SubExprs[SubExpr::RHS]); }
 
   /// Does this produce a right-associated sequence of operators?
   bool isRightFold() const {
@@ -5304,22 +5293,22 @@ class CoroutineSuspendExpr : public Expr {
   }
 
   Expr *getCommonExpr() const {
-    return static_cast<Expr*>(SubExprs[SubExpr::Common]);
+    return static_cast<Expr *>(SubExprs[SubExpr::Common]);
   }
 
   /// getOpaqueValue - Return the opaque value placeholder.
   OpaqueValueExpr *getOpaqueValue() const { return OpaqueValue; }
 
   Expr *getReadyExpr() const {
-    return static_cast<Expr*>(SubExprs[SubExpr::Ready]);
+    return static_cast<Expr *>(SubExprs[SubExpr::Ready]);
   }
 
   Expr *getSuspendExpr() const {
-    return static_cast<Expr*>(SubExprs[SubExpr::Suspend]);
+    return static_cast<Expr *>(SubExprs[SubExpr::Suspend]);
   }
 
   Expr *getResumeExpr() const {
-    return static_cast<Expr*>(SubExprs[SubExpr::Resume]);
+    return static_cast<Expr *>(SubExprs[SubExpr::Resume]);
   }
 
   // The syntactic operand written in the code
@@ -5509,18 +5498,18 @@ class BuiltinBitCastExpr final
 ///  - an id-expression.
 class CXXReflectExpr : public Expr {
 
+private:
+  // TODO(Reflection): add support for TemplateReference, NamespaceReference and
+  // DeclRefExpr
+  using operand_type = llvm::PointerUnion<const TypeSourceInfo *>;
 
-  private:
-    // TODO(Reflection): add support for TemplateReference, NamespaceReference and
-    // DeclRefExpr
-    using operand_type = llvm::PointerUnion<const TypeSourceInfo *>;
-
-    SourceLocation CaretCaretLoc;
-    ReflectionKind Kind;
-    operand_type Operand;
+  SourceLocation CaretCaretLoc;
+  ReflectionKind Kind;
+  operand_type Operand;
 
-    CXXReflectExpr(ASTContext &C, SourceLocation CaretCaretLoc, const TypeSourceInfo *TSI);
-    CXXReflectExpr(EmptyShell Empty);
+  CXXReflectExpr(ASTContext &C, SourceLocation CaretCaretLoc,
+                 const TypeSourceInfo *TSI);
+  CXXReflectExpr(EmptyShell Empty);
 
 public:
   static CXXReflectExpr *Create(ASTContext &C, SourceLocation OperatorLoc,
@@ -5543,7 +5532,7 @@ class CXXReflectExpr : public Expr {
   /// Returns location of the '^^'-operator.
   SourceLocation getOperatorLoc() const { return CaretCaretLoc; }
   ReflectionKind getKind() const { return Kind; }
-  const void* getOpaqueValue() const { return Operand.getOpaqueValue(); }
+  const void *getOpaqueValue() const { return Operand.getOpaqueValue(); }
 
   child_range children() {
     // TODO(Reflection)
diff --git a/clang/include/clang/AST/Reflection.h b/clang/include/clang/AST/Reflection.h
index 140f48af6efe3..c50c20a0c5afc 100644
--- a/clang/include/clang/AST/Reflection.h
+++ b/clang/include/clang/AST/Reflection.h
@@ -10,16 +10,13 @@
 //
 //===----------------------------------------------------------------------===//
 
-
 #ifndef LLVM_CLANG_AST_REFLECTION_H
 #define LLVM_CLANG_AST_REFLECTION_H
 namespace clang {
 
 // TODO(Reflection): Add support for Template, Namespace and DeclRefExpr.
-enum class ReflectionKind {
-  Type
-};
+enum class ReflectionKind { Type };
 
-}
+} // namespace clang
 
 #endif
diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index 32faed3bcb1dc..03b45bd3dc461 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -61,8 +61,9 @@ APValue::LValueBase APValue::LValueBase::getTypeInfo(TypeInfoLValue LV,
 }
 
 QualType APValue::LValueBase::getType() const {
-  if (!*this) return QualType();
-  if (const ValueDecl *D = dyn_cast<const ValueDecl*>()) {
+  if (!*this)
+    return QualType();
+  if (const ValueDecl *D = dyn_cast<const ValueDecl *>()) {
     // FIXME: It's unclear where we're supposed to take the type from, and
     // this actually matters for arrays of unknown bound. Eg:
     //
@@ -85,7 +86,7 @@ QualType APValue::LValueBase::getType() const {
   if (is<DynamicAllocLValue>())
     return getDynamicAllocType();
 
-  const Expr *Base = get<const Expr*>();
+  const Expr *Base = get<const Expr *>();
 
   // For a materialized temporary, the type of the temporary we materialized
   // may not be the type of the expression.
@@ -94,8 +95,8 @@ QualType APValue::LValueBase::getType() const {
     SmallVector<const Expr *, 2> CommaLHSs;
     SmallVector<SubobjectAdjustment, 2> Adjustments;
     const Expr *Temp = MTE->getSubExpr();
-    const Expr *Inner = Temp->skipRValueSubobjectAdjustments(CommaLHSs,
-                                                             Adjustments);
+    const Expr *Inner =
+        Temp->skipRValueSubobjectAdjustments(CommaLHSs, Adjustments);
     // Keep any cv-qualifiers from the reference if we generated a temporary
     // for it directly. Otherwise use the type after adjustment.
     if (!Adjustments.empty())
@@ -142,7 +143,7 @@ bool operator==(const APValue::LValueBase &LHS,
   return LHS.Local.CallIndex == RHS.Local.CallIndex &&
          LHS.Local.Version == RHS.Local.Version;
 }
-}
+} // namespace clang
 
 APValue::LValuePathEntry::LValuePathEntry(BaseOrMemberType BaseOrMember) {
   if (const Decl *D = BaseOrMember.getPointer())
@@ -163,38 +164,34 @@ QualType APValue::LValuePathSerializationHelper::getType() {
 }
 
 namespace {
-  struct LVBase {
-    APValue::LValueBase Base;
-    CharUnits Offset;
-    unsigned PathLength;
-    bool IsNullPtr : 1;
-    bool IsOnePastTheEnd : 1;
-  };
-}
+struct LVBase {
+  APValue::LValueBase Base;
+  CharUnits Offset;
+  unsigned PathLength;
+  bool IsNullPtr : 1;
+  bool IsOnePastTheEnd : 1;
+};
+} // namespace
 
 void *APValue::LValueBase::getOpaqueValue() const {
   return Ptr.getOpaqueValue();
 }
 
-bool APValue::LValueBase::isNull() const {
-  return Ptr.isNull();
-}
+bool APValue::LValueBase::isNull() const { return Ptr.isNull(); }
 
-APValue::LValueBase::operator bool () const {
-  return static_cast<bool>(Ptr);
-}
+APValue::LValueBase::operator bool() const { return static_cast<bool>(Ptr); }
 
 clang::APValue::LValueBase
 llvm::DenseMapInfo<clang::APValue::LValueBase>::getEmptyKey() {
   clang::APValue::LValueBase B;
-  B.Ptr = DenseMapInfo<const ValueDecl*>::getEmptyKey();
+  B.Ptr = DenseMapInfo<const ValueDecl *>::getEmptyKey();
   return B;
 }
 
 clang::APValue::LValueBase
 llvm::DenseMapInfo<clang::APValue::LValueBase>::getTombstoneKey() {
   clang::APValue::LValueBase B;
-  B.Ptr = DenseMapInfo<const ValueDecl*>::getTombstoneKey();
+  B.Ptr = DenseMapInfo<const ValueDecl *>::getTombstoneKey();
   return B;
 }
 
@@ -205,7 +202,7 @@ llvm::hash_code hash_value(const APValue::LValueBase &Base) {
   return llvm::hash_combine(Base.getOpaqueValue(), Base.getCallIndex(),
                             Base.getVersion());
 }
-}
+} // namespace clang
 
 unsigned llvm::DenseMapInfo<clang::APValue::LValueBase>::getHashValue(
     const clang::APValue::LValueBase &Base) {
@@ -237,7 +234,7 @@ struct APValue::LV : LVBase {
     if (Length == PathLength)
       return;
     if (hasPathPtr())
-      delete [] PathPtr;
+      delete[] PathPtr;
     PathLength = Length;
     if (hasPathPtr())
       PathPtr = new LValuePathEntry[Length];
@@ -253,15 +250,15 @@ struct APValue::LV : LVBase {
 };
 
 namespace {
-  struct MemberPointerBase {
-    llvm::PointerIntPair<const ValueDecl*, 1, bool> MemberAndIsDerivedMember;
-    unsigned PathLength;
-  };
-}
+struct MemberPointerBase {
+  llvm::PointerIntPair<const ValueDecl *, 1, bool> MemberAndIsDerivedMember;
+  unsigned PathLength;
+};
+} // namespace
 
 struct APValue::MemberPointerData : MemberPointerBase {
   static const unsigned InlinePathSpace =
-      (DataSize - sizeof(MemberPointerBase)) / sizeof(const CXXRecordDecl*);
+      (DataSize - sizeof(MemberPointerBase)) / sizeof(const CXXRecordDecl *);
   typedef const CXXRecordDecl *PathElem;
   union {
     PathElem Path[InlinePathSpace];
@@ -275,7 +272,7 @@ struct APValue::MemberPointerData : MemberPointerBase {
     if (Length == PathLength)
       return;
     if (hasPathPtr())
-      delete [] PathPtr;
+      delete[] PathPtr;
     PathLength = Length;
     if (hasPathPtr())
       PathPtr = new PathElem[Length];
@@ -284,29 +281,23 @@ struct APValue::MemberPointerData : MemberPointerBase {
   bool hasPathPtr() const { return PathLength > InlinePathSpace; }
 
   PathElem *getPath() { return hasPathPtr() ? PathPtr : Path; }
-  const PathElem *getPath() const {
-    return hasPathPtr() ? PathPtr : Path;
-  }
+  const PathElem *getPath() const { return hasPathPtr() ? PathPtr : Path; }
 };
 
 // FIXME: Reduce the malloc traffic here.
 
-APValue::Arr::Arr(unsigned NumElts, unsigned Size) :
-  Elts(new APValue[NumElts + (NumElts != Size ? 1 : 0)]),
-  NumElts(NumElts), ArrSize(Size) {}
-APValue::Arr::~Arr() { delete [] Elts; }
+APValue::Arr::Arr(unsigned NumElts, unsigned Size)
+    : Elts(new APValue[NumElts + (NumElts != Size ? 1 : 0)]), NumElts(NumElts),
+      ArrSize(Size) {}
+APValue::Arr::~Arr() { delete[] Elts; }
 
-APValue::StructData::StructData(unsigned NumBases, unsigned NumFields) :
-  Elts(new APValue[NumBases+NumFields]),
-  NumBases(NumBases), NumFields(NumFields) {}
-APValue::StructData::~StructData() {
-  delete [] Elts;
-}
+APValue::StructData::StructData(unsigned NumBases, unsigned NumFields)
+    : Elts(new APValue[NumBases + NumFields]), NumBases(NumBases),
+      NumFields(NumFields) {}
+APValue::StructData::~StructData() { delete[] Elts; }
 
 APValue::UnionData::UnionData() : Field(nullptr), Value(new APValue) {}
-APValue::UnionData::~UnionData () {
-  delete Value;
-}
+APValue::UnionData::~UnionData() { delete Value; }
 
 APValue::APValue(const APValue &RHS)
     : Kind(None), AllowConstexprUnknown(RHS.AllowConstexprUnknown) {
@@ -383,7 +374,8 @@ APValue::APValue(const APValue &RHS)
     setAddrLabelDiff(RHS.getAddrLabelDiffLHS(), RHS.getAddrLabelDiffRHS());
     break;
   case Reflection:
-    MakeReflection(RHS.getReflectionOperandKind(), RHS.getOpaqueReflectionOperand());
+    MakeReflection(RHS.getReflectionOperandKind(),
+                   RHS.getOpaqueReflectionOperand());
     break;
   }
 }
@@ -503,11 +495,12 @@ static void profileIntValue(llvm::FoldingSetNodeID &ID, const llvm::APInt &V) {
 static void profileReflection(llvm::FoldingSetNodeID &ID, APValue V) {
   ID.AddInteger(static_cast<int>(V.getReflectionOperandKind()));
   switch (V.getReflectionOperandKind()) {
-    case ReflectionKind::Type: {
-      const TypeSourceInfo* info = static_cast<const TypeSourceInfo*>(V.getOpaqueReflectionOperand());
-      ID.AddPointer((info->getType().getCanonicalType().getAsOpaquePtr()));
-      return;
-    }
+  case ReflectionKind::Type: {
+    const TypeSourceInfo *info =
+        static_cast<const TypeSourceInfo *>(V.getOpaqueReflectionOperand());
+    ID.AddPointer((info->getType().getCanonicalType().getAsOpaquePtr()));
+    return;
+  }
     assert(false && "unknown or unimplemented reflection entities");
   }
 }
@@ -809,8 +802,8 @@ void APValue::printPretty(raw_ostream &Out, const PrintingPolicy &Policy,
     return;
   case APValue::LValue: {
     bool IsReference = Ty->isReferenceType();
-    QualType InnerTy
-      = IsReference ? Ty.getNonReferenceType() : Ty->getPointeeType();
+    QualType InnerTy =
+        IsReference ? Ty.getNonReferenceType() : Ty->getPointeeType();
     if (InnerTy.isNull())
       InnerTy = Ty;
 
@@ -846,18 +839,17 @@ void APValue::printPretty(raw_ostream &Out, const PrintingPolicy &Policy,
         Out << '&';
       }
 
-      if (const ValueDecl *VD = Base.dyn_cast<const ValueDecl*>())
+      if (const ValueDecl *VD = Base.dyn_cast<const ValueDecl *>())
         Out << *VD;
       else if (TypeInfoLValue TI = Base.dyn_cast<TypeInfoLValue>()) {
         TI.print(Out, Policy);
       } else if (DynamicAllocLValue DA = Base.dyn_cast<DynamicAllocLValue>()) {
-        Out << "{*new "
-            << Base.getDynamicAllocType().stream(Policy) << "#"
+        Out << "{*new " << Base.getDynamicAllocType().stream(Policy) << "#"
             << DA.getIndex() << "}";
       } else {
         assert(Base.get<const Expr *>() != nullptr &&
                "Expecting non-null Expr");
-        Base.get<const Expr*>()->printPretty(Out, nullptr, Policy);
+        Base.get<const Expr *>()->printPretty(Out, nullptr, Policy);
       }
 
       if (!O.isZero()) {
@@ -875,7 +867,7 @@ void APValue::printPretty(raw_ostream &Out, const PrintingPolicy &Policy,
       Out << "*(&";
 
     QualType ElemTy = Base.getType().getNonReferenceType();
-    if (const ValueDecl *VD = Base.dyn_cast<const ValueDecl*>()) {
+    if (const ValueDecl *VD = Base.dyn_cast<const ValueDecl *>()) {
       Out << *VD;
     } else if (TypeInfoLValue TI = Base.dyn_cast<TypeInfoLValue>()) {
       TI.print(Out, Policy);
@@ -883,7 +875,7 @@ void APValue::printPretty(raw_ostream &Out, const PrintingPolicy &Policy,
       Out << "{*new " << Base.getDynamicAllocType().stream(Policy) << "#"
           << DA.getIndex() << "}";
     } else {
-      const Expr *E = Base.get<const Expr*>();
+      const Expr *E = Base.get<const Expr *>();
       assert(E != nullptr && "Expecting non-null Expr");
       E->printPretty(Out, nullptr, Policy);
     }
@@ -973,8 +965,8 @@ void APValue::printPretty(raw_ostream &Out, const PrintingPolicy &Policy,
         Out << ", ";
       if (FI->isUnnamedBitField())
         continue;
-      getStructField(FI->getFieldIndex()).
-        printPretty(Out, Policy, FI->getType(), Ctx);
+      getStructField(FI->getFieldIndex())
+          .printPretty(Out, Policy, FI->getType(), Ctx);
       First = false;
     }
     Out << '}';
@@ -1130,7 +1122,7 @@ bool APValue::isMemberPointerToDerivedMember() const {
   return MPD.MemberAndIsDerivedMember.getInt();
 }
 
-ArrayRef<const CXXRecordDecl*> APValue::getMemberPointerPath() const {
+ArrayRef<const CXXRecordDecl *> APValue::getMemberPointerPath() const {
   assert(isMemberPointer() && "Invalid accessor");
   const MemberPointerData &MPD =
       *((const MemberPointerData *)(const char *)&Data);
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 827710c01e73b..752a3733f5a38 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -48,10 +48,10 @@
 #include "clang/AST/OSLog.h"
 #include "clang/AST/OptionalDiagnostic.h"
 #include "clang/AST/RecordLayout.h"
+#include "clang/AST/Reflection.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLoc.h"
-#include "clang/AST/Reflection.h"
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/DiagnosticSema.h"
 #include "clang/Basic/TargetBuiltins.h"
@@ -75,667 +75,651 @@
 
 using namespace clang;
 using llvm::APFixedPoint;
+using llvm::APFloat;
 using llvm::APInt;
 using llvm::APSInt;
-using llvm::APFloat;
 using llvm::FixedPointSemantics;
 
 namespace {
-  struct LValue;
-  class CallStackFrame;
-  class EvalInfo;
+struct LValue;
+class CallStackFrame;
+class EvalInfo;
 
-  using SourceLocExprScopeGuard =
-      CurrentSourceLocExprScope::SourceLocExprScopeGuard;
+using SourceLocExprScopeGuard =
+    CurrentSourceLocExprScope::SourceLocExprScopeGuard;
 
-  static QualType getType(APValue::LValueBase B) {
-    return B.getType();
-  }
+static QualType getType(APValue::LValueBase B) { return B.getType(); }
 
-  /// Get an LValue path entry, which is known to not be an array index, as a
-  /// field declaration.
-  static const FieldDecl *getAsField(APValue::LValuePathEntry E) {
-    return dyn_cast_or_null<FieldDecl>(E.getAsBaseOrMember().getPointer());
-  }
-  /// Get an LValue path entry, which is known to not be an array index, as a
-  /// base class declaration.
-  static const CXXRecordDecl *getAsBaseClass(APValue::LValuePathEntry E) {
-    return dyn_cast_or_null<CXXRecordDecl>(E.getAsBaseOrMember().getPointer());
-  }
-  /// Determine whether this LValue path entry for a base class names a virtual
-  /// base class.
-  static bool isVirtualBaseClass(APValue::LValuePathEntry E) {
-    return E.getAsBaseOrMember().getInt();
-  }
+/// Get an LValue path entry, which is known to not be an array index, as a
+/// field declaration.
+static const FieldDecl *getAsField(APValue::LValuePathEntry E) {
+  return dyn_cast_or_null<FieldDecl>(E.getAsBaseOrMember().getPointer());
+}
+/// Get an LValue path entry, which is known to not be an array index, as a
+/// base class declaration.
+static const CXXRecordDecl *getAsBaseClass(APValue::LValuePathEntry E) {
+  return dyn_cast_or_null<CXXRecordDecl>(E.getAsBaseOrMember().getPointer());
+}
+/// Determine whether this LValue path entry for a base class names a virtual
+/// base class.
+static bool isVirtualBaseClass(APValue::LValuePathEntry E) {
+  return E.getAsBaseOrMember().getInt();
+}
 
-  /// Given an expression, determine the type used to store the result of
-  /// evaluating that expression.
-  static QualType getStorageType(const ASTContext &Ctx, const Expr *E) {
-    if (E->isPRValue())
-      return E->getType();
-    return Ctx.getLValueReferenceType(E->getType());
-  }
+/// Given an expression, determine the type used to store the result of
+/// evaluating that expression.
+static QualType getStorageType(const ASTContext &Ctx, const Expr *E) {
+  if (E->isPRValue())
+    return E->getType();
+  return Ctx.getLValueReferenceType(E->getType());
+}
 
-  /// Attempts to unwrap a CallExpr (with an alloc_size attribute) from an Expr.
-  /// This will look through a single cast.
-  ///
-  /// Returns null if we couldn't unwrap a function with alloc_size.
-  static const CallExpr *tryUnwrapAllocSizeCall(const Expr *E) {
-    if (!E->getType()->isPointerType())
-      return nullptr;
+/// Attempts to unwrap a CallExpr (with an alloc_size attribute) from an Expr.
+/// This will look through a single cast.
+///
+/// Returns null if we couldn't unwrap a function with alloc_size.
+static const CallExpr *tryUnwrapAllocSizeCall(const Expr *E) {
+  if (!E->getType()->isPointerType())
+    return nullptr;
 
-    E = E->IgnoreParens();
-    // If we're doing a variable assignment from e.g. malloc(N), there will
-    // probably be a cast of some kind. In exotic cases, we might also see a
-    // top-level ExprWithCleanups. Ignore them either way.
-    if (const auto *FE = dyn_cast<FullExpr>(E))
-      E = FE->getSubExpr()->IgnoreParens();
+  E = E->IgnoreParens();
+  // If we're doing a variable assignment from e.g. malloc(N), there will
+  // probably be a cast of some kind. In exotic cases, we might also see a
+  // top-level ExprWithCleanups. Ignore them either way.
+  if (const auto *FE = dyn_cast<FullExpr>(E))
+    E = FE->getSubExpr()->IgnoreParens();
 
-    if (const auto *Cast = dyn_cast<CastExpr>(E))
-      E = Cast->getSubExpr()->IgnoreParens();
+  if (const auto *Cast = dyn_cast<CastExpr>(E))
+    E = Cast->getSubExpr()->IgnoreParens();
 
-    if (const auto *CE = dyn_cast<CallExpr>(E))
-      return CE->getCalleeAllocSizeAttr() ? CE : nullptr;
-    return nullptr;
-  }
+  if (const auto *CE = dyn_cast<CallExpr>(E))
+    return CE->getCalleeAllocSizeAttr() ? CE : nullptr;
+  return nullptr;
+}
 
-  /// Determines whether or not the given Base contains a call to a function
-  /// with the alloc_size attribute.
-  static bool isBaseAnAllocSizeCall(APValue::LValueBase Base) {
-    const auto *E = Base.dyn_cast<const Expr *>();
-    return E && E->getType()->isPointerType() && tryUnwrapAllocSizeCall(E);
-  }
+/// Determines whether or not the given Base contains a call to a function
+/// with the alloc_size attribute.
+static bool isBaseAnAllocSizeCall(APValue::LValueBase Base) {
+  const auto *E = Base.dyn_cast<const Expr *>();
+  return E && E->getType()->isPointerType() && tryUnwrapAllocSizeCall(E);
+}
 
-  /// Determines whether the given kind of constant expression is only ever
-  /// used for name mangling. If so, it's permitted to reference things that we
-  /// can't generate code for (in particular, dllimported functions).
-  static bool isForManglingOnly(ConstantExprKind Kind) {
-    switch (Kind) {
-    case ConstantExprKind::Normal:
-    case ConstantExprKind::ClassTemplateArgument:
-    case ConstantExprKind::ImmediateInvocation:
-      // Note that non-type template arguments of class type are emitted as
-      // template parameter objects.
-      return false;
+/// Determines whether the given kind of constant expression is only ever
+/// used for name mangling. If so, it's permitted to reference things that we
+/// can't generate code for (in particular, dllimported functions).
+static bool isForManglingOnly(ConstantExprKind Kind) {
+  switch (Kind) {
+  case ConstantExprKind::Normal:
+  case ConstantExprKind::ClassTemplateArgument:
+  case ConstantExprKind::ImmediateInvocation:
+    // Note that non-type template arguments of class type are emitted as
+    // template parameter objects.
+    return false;
 
-    case ConstantExprKind::NonClassTemplateArgument:
-      return true;
-    }
-    llvm_unreachable("unknown ConstantExprKind");
+  case ConstantExprKind::NonClassTemplateArgument:
+    return true;
   }
+  llvm_unreachable("unknown ConstantExprKind");
+}
 
-  static bool isTemplateArgument(ConstantExprKind Kind) {
-    switch (Kind) {
-    case ConstantExprKind::Normal:
-    case ConstantExprKind::ImmediateInvocation:
-      return false;
+static bool isTemplateArgument(ConstantExprKind Kind) {
+  switch (Kind) {
+  case ConstantExprKind::Normal:
+  case ConstantExprKind::ImmediateInvocation:
+    return false;
 
-    case ConstantExprKind::ClassTemplateArgument:
-    case ConstantExprKind::NonClassTemplateArgument:
-      return true;
-    }
-    llvm_unreachable("unknown ConstantExprKind");
-  }
-
-  /// The bound to claim that an array of unknown bound has.
-  /// The value in MostDerivedArraySize is undefined in this case. So, set it
-  /// to an arbitrary value that's likely to loudly break things if it's used.
-  static const uint64_t AssumedSizeForUnsizedArray =
-      std::numeric_limits<uint64_t>::max() / 2;
-
-  /// Determines if an LValue with the given LValueBase will have an unsized
-  /// array in its designator.
-  /// Find the path length and type of the most-derived subobject in the given
-  /// path, and find the size of the containing array, if any.
-  static unsigned
-  findMostDerivedSubobject(const ASTContext &Ctx, APValue::LValueBase Base,
-                           ArrayRef<APValue::LValuePathEntry> Path,
-                           uint64_t &ArraySize, QualType &Type, bool &IsArray,
-                           bool &FirstEntryIsUnsizedArray) {
-    // This only accepts LValueBases from APValues, and APValues don't support
-    // arrays that lack size info.
-    assert(!isBaseAnAllocSizeCall(Base) &&
-           "Unsized arrays shouldn't appear here");
-    unsigned MostDerivedLength = 0;
-    // The type of Base is a reference type if the base is a constexpr-unknown
-    // variable. In that case, look through the reference type.
-    Type = getType(Base).getNonReferenceType();
-
-    for (unsigned I = 0, N = Path.size(); I != N; ++I) {
-      if (Type->isArrayType()) {
-        const ArrayType *AT = Ctx.getAsArrayType(Type);
-        Type = AT->getElementType();
-        MostDerivedLength = I + 1;
-        IsArray = true;
-
-        if (auto *CAT = dyn_cast<ConstantArrayType>(AT)) {
-          ArraySize = CAT->getZExtSize();
-        } else {
-          assert(I == 0 && "unexpected unsized array designator");
-          FirstEntryIsUnsizedArray = true;
-          ArraySize = AssumedSizeForUnsizedArray;
-        }
-      } else if (Type->isAnyComplexType()) {
-        const ComplexType *CT = Type->castAs<ComplexType>();
-        Type = CT->getElementType();
-        ArraySize = 2;
-        MostDerivedLength = I + 1;
-        IsArray = true;
-      } else if (const auto *VT = Type->getAs<VectorType>()) {
-        Type = VT->getElementType();
-        ArraySize = VT->getNumElements();
-        MostDerivedLength = I + 1;
-        IsArray = true;
-      } else if (const FieldDecl *FD = getAsField(Path[I])) {
-        Type = FD->getType();
-        ArraySize = 0;
-        MostDerivedLength = I + 1;
-        IsArray = false;
+  case ConstantExprKind::ClassTemplateArgument:
+  case ConstantExprKind::NonClassTemplateArgument:
+    return true;
+  }
+  llvm_unreachable("unknown ConstantExprKind");
+}
+
+/// The bound to claim that an array of unknown bound has.
+/// The value in MostDerivedArraySize is undefined in this case. So, set it
+/// to an arbitrary value that's likely to loudly break things if it's used.
+static const uint64_t AssumedSizeForUnsizedArray =
+    std::numeric_limits<uint64_t>::max() / 2;
+
+/// Determines if an LValue with the given LValueBase will have an unsized
+/// array in its designator.
+/// Find the path length and type of the most-derived subobject in the given
+/// path, and find the size of the containing array, if any.
+static unsigned
+findMostDerivedSubobject(const ASTContext &Ctx, APValue::LValueBase Base,
+                         ArrayRef<APValue::LValuePathEntry> Path,
+                         uint64_t &ArraySize, QualType &Type, bool &IsArray,
+                         bool &FirstEntryIsUnsizedArray) {
+  // This only accepts LValueBases from APValues, and APValues don't support
+  // arrays that lack size info.
+  assert(!isBaseAnAllocSizeCall(Base) &&
+         "Unsized arrays shouldn't appear here");
+  unsigned MostDerivedLength = 0;
+  // The type of Base is a reference type if the base is a constexpr-unknown
+  // variable. In that case, look through the reference type.
+  Type = getType(Base).getNonReferenceType();
+
+  for (unsigned I = 0, N = Path.size(); I != N; ++I) {
+    if (Type->isArrayType()) {
+      const ArrayType *AT = Ctx.getAsArrayType(Type);
+      Type = AT->getElementType();
+      MostDerivedLength = I + 1;
+      IsArray = true;
+
+      if (auto *CAT = dyn_cast<ConstantArrayType>(AT)) {
+        ArraySize = CAT->getZExtSize();
       } else {
-        // Path[I] describes a base class.
-        ArraySize = 0;
-        IsArray = false;
-      }
-    }
-    return MostDerivedLength;
-  }
-
-  /// A path from a glvalue to a subobject of that glvalue.
-  struct SubobjectDesignator {
-    /// True if the subobject was named in a manner not supported by C++11. Such
-    /// lvalues can still be folded, but they are not core constant expressions
-    /// and we cannot perform lvalue-to-rvalue conversions on them.
-    LLVM_PREFERRED_TYPE(bool)
-    unsigned Invalid : 1;
-
-    /// Is this a pointer one past the end of an object?
-    LLVM_PREFERRED_TYPE(bool)
-    unsigned IsOnePastTheEnd : 1;
-
-    /// Indicator of whether the first entry is an unsized array.
-    LLVM_PREFERRED_TYPE(bool)
-    unsigned FirstEntryIsAnUnsizedArray : 1;
-
-    /// Indicator of whether the most-derived object is an array element.
-    LLVM_PREFERRED_TYPE(bool)
-    unsigned MostDerivedIsArrayElement : 1;
-
-    /// The length of the path to the most-derived object of which this is a
-    /// subobject.
-    unsigned MostDerivedPathLength : 28;
-
-    /// The size of the array of which the most-derived object is an element.
-    /// This will always be 0 if the most-derived object is not an array
-    /// element. 0 is not an indicator of whether or not the most-derived object
-    /// is an array, however, because 0-length arrays are allowed.
-    ///
-    /// If the current array is an unsized array, the value of this is
-    /// undefined.
-    uint64_t MostDerivedArraySize;
-    /// The type of the most derived object referred to by this address.
-    QualType MostDerivedType;
-
-    typedef APValue::LValuePathEntry PathEntry;
-
-    /// The entries on the path from the glvalue to the designated subobject.
-    SmallVector<PathEntry, 8> Entries;
-
-    SubobjectDesignator() : Invalid(true) {}
-
-    explicit SubobjectDesignator(QualType T)
-        : Invalid(false), IsOnePastTheEnd(false),
-          FirstEntryIsAnUnsizedArray(false), MostDerivedIsArrayElement(false),
-          MostDerivedPathLength(0), MostDerivedArraySize(0),
-          MostDerivedType(T.isNull() ? QualType() : T.getNonReferenceType()) {}
-
-    SubobjectDesignator(const ASTContext &Ctx, const APValue &V)
-        : Invalid(!V.isLValue() || !V.hasLValuePath()), IsOnePastTheEnd(false),
-          FirstEntryIsAnUnsizedArray(false), MostDerivedIsArrayElement(false),
-          MostDerivedPathLength(0), MostDerivedArraySize(0) {
-      assert(V.isLValue() && "Non-LValue used to make an LValue designator?");
-      if (!Invalid) {
-        IsOnePastTheEnd = V.isLValueOnePastTheEnd();
-        llvm::append_range(Entries, V.getLValuePath());
-        if (V.getLValueBase()) {
-          bool IsArray = false;
-          bool FirstIsUnsizedArray = false;
-          MostDerivedPathLength = findMostDerivedSubobject(
-              Ctx, V.getLValueBase(), V.getLValuePath(), MostDerivedArraySize,
-              MostDerivedType, IsArray, FirstIsUnsizedArray);
-          MostDerivedIsArrayElement = IsArray;
-          FirstEntryIsAnUnsizedArray = FirstIsUnsizedArray;
-        }
+        assert(I == 0 && "unexpected unsized array designator");
+        FirstEntryIsUnsizedArray = true;
+        ArraySize = AssumedSizeForUnsizedArray;
       }
+    } else if (Type->isAnyComplexType()) {
+      const ComplexType *CT = Type->castAs<ComplexType>();
+      Type = CT->getElementType();
+      ArraySize = 2;
+      MostDerivedLength = I + 1;
+      IsArray = true;
+    } else if (const auto *VT = Type->getAs<VectorType>()) {
+      Type = VT->getElementType();
+      ArraySize = VT->getNumElements();
+      MostDerivedLength = I + 1;
+      IsArray = true;
+    } else if (const FieldDecl *FD = getAsField(Path[I])) {
+      Type = FD->getType();
+      ArraySize = 0;
+      MostDerivedLength = I + 1;
+      IsArray = false;
+    } else {
+      // Path[I] describes a base class.
+      ArraySize = 0;
+      IsArray = false;
     }
+  }
+  return MostDerivedLength;
+}
 
-    void truncate(ASTContext &Ctx, APValue::LValueBase Base,
-                  unsigned NewLength) {
-      if (Invalid)
-        return;
+/// A path from a glvalue to a subobject of that glvalue.
+struct SubobjectDesignator {
+  /// True if the subobject was named in a manner not supported by C++11. Such
+  /// lvalues can still be folded, but they are not core constant expressions
+  /// and we cannot perform lvalue-to-rvalue conversions on them.
+  LLVM_PREFERRED_TYPE(bool)
+  unsigned Invalid : 1;
 
-      assert(Base && "cannot truncate path for null pointer");
-      assert(NewLength <= Entries.size() && "not a truncation");
+  /// Is this a pointer one past the end of an object?
+  LLVM_PREFERRED_TYPE(bool)
+  unsigned IsOnePastTheEnd : 1;
 
-      if (NewLength == Entries.size())
-        return;
-      Entries.resize(NewLength);
+  /// Indicator of whether the first entry is an unsized array.
+  LLVM_PREFERRED_TYPE(bool)
+  unsigned FirstEntryIsAnUnsizedArray : 1;
 
-      bool IsArray = false;
-      bool FirstIsUnsizedArray = false;
-      MostDerivedPathLength = findMostDerivedSubobject(
-          Ctx, Base, Entries, MostDerivedArraySize, MostDerivedType, IsArray,
-          FirstIsUnsizedArray);
-      MostDerivedIsArrayElement = IsArray;
-      FirstEntryIsAnUnsizedArray = FirstIsUnsizedArray;
-    }
+  /// Indicator of whether the most-derived object is an array element.
+  LLVM_PREFERRED_TYPE(bool)
+  unsigned MostDerivedIsArrayElement : 1;
 
-    void setInvalid() {
-      Invalid = true;
-      Entries.clear();
-    }
+  /// The length of the path to the most-derived object of which this is a
+  /// subobject.
+  unsigned MostDerivedPathLength : 28;
 
-    /// Determine whether the most derived subobject is an array without a
-    /// known bound.
-    bool isMostDerivedAnUnsizedArray() const {
-      assert(!Invalid && "Calling this makes no sense on invalid designators");
-      return Entries.size() == 1 && FirstEntryIsAnUnsizedArray;
+  /// The size of the array of which the most-derived object is an element.
+  /// This will always be 0 if the most-derived object is not an array
+  /// element. 0 is not an indicator of whether or not the most-derived object
+  /// is an array, however, because 0-length arrays are allowed.
+  ///
+  /// If the current array is an unsized array, the value of this is
+  /// undefined.
+  uint64_t MostDerivedArraySize;
+  /// The type of the most derived object referred to by this address.
+  QualType MostDerivedType;
+
+  typedef APValue::LValuePathEntry PathEntry;
+
+  /// The entries on the path from the glvalue to the designated subobject.
+  SmallVector<PathEntry, 8> Entries;
+
+  SubobjectDesignator() : Invalid(true) {}
+
+  explicit SubobjectDesignator(QualType T)
+      : Invalid(false), IsOnePastTheEnd(false),
+        FirstEntryIsAnUnsizedArray(false), MostDerivedIsArrayElement(false),
+        MostDerivedPathLength(0), MostDerivedArraySize(0),
+        MostDerivedType(T.isNull() ? QualType() : T.getNonReferenceType()) {}
+
+  SubobjectDesignator(const ASTContext &Ctx, const APValue &V)
+      : Invalid(!V.isLValue() || !V.hasLValuePath()), IsOnePastTheEnd(false),
+        FirstEntryIsAnUnsizedArray(false), MostDerivedIsArrayElement(false),
+        MostDerivedPathLength(0), MostDerivedArraySize(0) {
+    assert(V.isLValue() && "Non-LValue used to make an LValue designator?");
+    if (!Invalid) {
+      IsOnePastTheEnd = V.isLValueOnePastTheEnd();
+      llvm::append_range(Entries, V.getLValuePath());
+      if (V.getLValueBase()) {
+        bool IsArray = false;
+        bool FirstIsUnsizedArray = false;
+        MostDerivedPathLength = findMostDerivedSubobject(
+            Ctx, V.getLValueBase(), V.getLValuePath(), MostDerivedArraySize,
+            MostDerivedType, IsArray, FirstIsUnsizedArray);
+        MostDerivedIsArrayElement = IsArray;
+        FirstEntryIsAnUnsizedArray = FirstIsUnsizedArray;
+      }
     }
+  }
 
-    /// Determine what the most derived array's size is. Results in an assertion
-    /// failure if the most derived array lacks a size.
-    uint64_t getMostDerivedArraySize() const {
-      assert(!isMostDerivedAnUnsizedArray() && "Unsized array has no size");
-      return MostDerivedArraySize;
-    }
+  void truncate(ASTContext &Ctx, APValue::LValueBase Base, unsigned NewLength) {
+    if (Invalid)
+      return;
 
-    /// Determine whether this is a one-past-the-end pointer.
-    bool isOnePastTheEnd() const {
-      assert(!Invalid);
-      if (IsOnePastTheEnd)
-        return true;
-      if (!isMostDerivedAnUnsizedArray() && MostDerivedIsArrayElement &&
-          Entries[MostDerivedPathLength - 1].getAsArrayIndex() ==
-              MostDerivedArraySize)
-        return true;
-      return false;
-    }
+    assert(Base && "cannot truncate path for null pointer");
+    assert(NewLength <= Entries.size() && "not a truncation");
 
-    /// Get the range of valid index adjustments in the form
-    ///   {maximum value that can be subtracted from this pointer,
-    ///    maximum value that can be added to this pointer}
-    std::pair<uint64_t, uint64_t> validIndexAdjustments() {
-      if (Invalid || isMostDerivedAnUnsizedArray())
-        return {0, 0};
+    if (NewLength == Entries.size())
+      return;
+    Entries.resize(NewLength);
 
-      // [expr.add]p4: For the purposes of these operators, a pointer to a
-      // nonarray object behaves the same as a pointer to the first element of
-      // an array of length one with the type of the object as its element type.
-      bool IsArray = MostDerivedPathLength == Entries.size() &&
-                     MostDerivedIsArrayElement;
-      uint64_t ArrayIndex = IsArray ? Entries.back().getAsArrayIndex()
-                                    : (uint64_t)IsOnePastTheEnd;
-      uint64_t ArraySize =
-          IsArray ? getMostDerivedArraySize() : (uint64_t)1;
-      return {ArrayIndex, ArraySize - ArrayIndex};
-    }
+    bool IsArray = false;
+    bool FirstIsUnsizedArray = false;
+    MostDerivedPathLength =
+        findMostDerivedSubobject(Ctx, Base, Entries, MostDerivedArraySize,
+                                 MostDerivedType, IsArray, FirstIsUnsizedArray);
+    MostDerivedIsArrayElement = IsArray;
+    FirstEntryIsAnUnsizedArray = FirstIsUnsizedArray;
+  }
 
-    /// Check that this refers to a valid subobject.
-    bool isValidSubobject() const {
-      if (Invalid)
-        return false;
-      return !isOnePastTheEnd();
-    }
-    /// Check that this refers to a valid subobject, and if not, produce a
-    /// relevant diagnostic and set the designator as invalid.
-    bool checkSubobject(EvalInfo &Info, const Expr *E, CheckSubobjectKind CSK);
+  void setInvalid() {
+    Invalid = true;
+    Entries.clear();
+  }
 
-    /// Get the type of the designated object.
-    QualType getType(ASTContext &Ctx) const {
-      assert(!Invalid && "invalid designator has no subobject type");
-      return MostDerivedPathLength == Entries.size()
-                 ? MostDerivedType
-                 : Ctx.getCanonicalTagType(getAsBaseClass(Entries.back()));
-    }
+  /// Determine whether the most derived subobject is an array without a
+  /// known bound.
+  bool isMostDerivedAnUnsizedArray() const {
+    assert(!Invalid && "Calling this makes no sense on invalid designators");
+    return Entries.size() == 1 && FirstEntryIsAnUnsizedArray;
+  }
 
-    /// Update this designator to refer to the first element within this array.
-    void addArrayUnchecked(const ConstantArrayType *CAT) {
-      Entries.push_back(PathEntry::ArrayIndex(0));
+  /// Determine what the most derived array's size is. Results in an assertion
+  /// failure if the most derived array lacks a size.
+  uint64_t getMostDerivedArraySize() const {
+    assert(!isMostDerivedAnUnsizedArray() && "Unsized array has no size");
+    return MostDerivedArraySize;
+  }
 
-      // This is a most-derived object.
-      MostDerivedType = CAT->getElementType();
-      MostDerivedIsArrayElement = true;
-      MostDerivedArraySize = CAT->getZExtSize();
-      MostDerivedPathLength = Entries.size();
-    }
-    /// Update this designator to refer to the first element within the array of
-    /// elements of type T. This is an array of unknown size.
-    void addUnsizedArrayUnchecked(QualType ElemTy) {
-      Entries.push_back(PathEntry::ArrayIndex(0));
-
-      MostDerivedType = ElemTy;
-      MostDerivedIsArrayElement = true;
-      // The value in MostDerivedArraySize is undefined in this case. So, set it
-      // to an arbitrary value that's likely to loudly break things if it's
-      // used.
-      MostDerivedArraySize = AssumedSizeForUnsizedArray;
-      MostDerivedPathLength = Entries.size();
-    }
-    /// Update this designator to refer to the given base or member of this
-    /// object.
-    void addDeclUnchecked(const Decl *D, bool Virtual = false) {
-      Entries.push_back(APValue::BaseOrMemberType(D, Virtual));
-
-      // If this isn't a base class, it's a new most-derived object.
-      if (const FieldDecl *FD = dyn_cast<FieldDecl>(D)) {
-        MostDerivedType = FD->getType();
-        MostDerivedIsArrayElement = false;
-        MostDerivedArraySize = 0;
-        MostDerivedPathLength = Entries.size();
-      }
-    }
-    /// Update this designator to refer to the given complex component.
-    void addComplexUnchecked(QualType EltTy, bool Imag) {
-      Entries.push_back(PathEntry::ArrayIndex(Imag));
+  /// Determine whether this is a one-past-the-end pointer.
+  bool isOnePastTheEnd() const {
+    assert(!Invalid);
+    if (IsOnePastTheEnd)
+      return true;
+    if (!isMostDerivedAnUnsizedArray() && MostDerivedIsArrayElement &&
+        Entries[MostDerivedPathLength - 1].getAsArrayIndex() ==
+            MostDerivedArraySize)
+      return true;
+    return false;
+  }
 
-      // This is technically a most-derived object, though in practice this
-      // is unlikely to matter.
-      MostDerivedType = EltTy;
-      MostDerivedIsArrayElement = true;
-      MostDerivedArraySize = 2;
+  /// Get the range of valid index adjustments in the form
+  ///   {maximum value that can be subtracted from this pointer,
+  ///    maximum value that can be added to this pointer}
+  std::pair<uint64_t, uint64_t> validIndexAdjustments() {
+    if (Invalid || isMostDerivedAnUnsizedArray())
+      return {0, 0};
+
+    // [expr.add]p4: For the purposes of these operators, a pointer to a
+    // nonarray object behaves the same as a pointer to the first element of
+    // an array of length one with the type of the object as its element type.
+    bool IsArray =
+        MostDerivedPathLength == Entries.size() && MostDerivedIsArrayElement;
+    uint64_t ArrayIndex =
+        IsArray ? Entries.back().getAsArrayIndex() : (uint64_t)IsOnePastTheEnd;
+    uint64_t ArraySize = IsArray ? getMostDerivedArraySize() : (uint64_t)1;
+    return {ArrayIndex, ArraySize - ArrayIndex};
+  }
+
+  /// Check that this refers to a valid subobject.
+  bool isValidSubobject() const {
+    if (Invalid)
+      return false;
+    return !isOnePastTheEnd();
+  }
+  /// Check that this refers to a valid subobject, and if not, produce a
+  /// relevant diagnostic and set the designator as invalid.
+  bool checkSubobject(EvalInfo &Info, const Expr *E, CheckSubobjectKind CSK);
+
+  /// Get the type of the designated object.
+  QualType getType(ASTContext &Ctx) const {
+    assert(!Invalid && "invalid designator has no subobject type");
+    return MostDerivedPathLength == Entries.size()
+               ? MostDerivedType
+               : Ctx.getCanonicalTagType(getAsBaseClass(Entries.back()));
+  }
+
+  /// Update this designator to refer to the first element within this array.
+  void addArrayUnchecked(const ConstantArrayType *CAT) {
+    Entries.push_back(PathEntry::ArrayIndex(0));
+
+    // This is a most-derived object.
+    MostDerivedType = CAT->getElementType();
+    MostDerivedIsArrayElement = true;
+    MostDerivedArraySize = CAT->getZExtSize();
+    MostDerivedPathLength = Entries.size();
+  }
+  /// Update this designator to refer to the first element within the array of
+  /// elements of type T. This is an array of unknown size.
+  void addUnsizedArrayUnchecked(QualType ElemTy) {
+    Entries.push_back(PathEntry::ArrayIndex(0));
+
+    MostDerivedType = ElemTy;
+    MostDerivedIsArrayElement = true;
+    // The value in MostDerivedArraySize is undefined in this case. So, set it
+    // to an arbitrary value that's likely to loudly break things if it's
+    // used.
+    MostDerivedArraySize = AssumedSizeForUnsizedArray;
+    MostDerivedPathLength = Entries.size();
+  }
+  /// Update this designator to refer to the given base or member of this
+  /// object.
+  void addDeclUnchecked(const Decl *D, bool Virtual = false) {
+    Entries.push_back(APValue::BaseOrMemberType(D, Virtual));
+
+    // If this isn't a base class, it's a new most-derived object.
+    if (const FieldDecl *FD = dyn_cast<FieldDecl>(D)) {
+      MostDerivedType = FD->getType();
+      MostDerivedIsArrayElement = false;
+      MostDerivedArraySize = 0;
       MostDerivedPathLength = Entries.size();
     }
+  }
+  /// Update this designator to refer to the given complex component.
+  void addComplexUnchecked(QualType EltTy, bool Imag) {
+    Entries.push_back(PathEntry::ArrayIndex(Imag));
 
-    void addVectorElementUnchecked(QualType EltTy, uint64_t Size,
-                                   uint64_t Idx) {
-      Entries.push_back(PathEntry::ArrayIndex(Idx));
-      MostDerivedType = EltTy;
-      MostDerivedPathLength = Entries.size();
-      MostDerivedArraySize = 0;
-      MostDerivedIsArrayElement = false;
-    }
+    // This is technically a most-derived object, though in practice this
+    // is unlikely to matter.
+    MostDerivedType = EltTy;
+    MostDerivedIsArrayElement = true;
+    MostDerivedArraySize = 2;
+    MostDerivedPathLength = Entries.size();
+  }
 
-    void diagnoseUnsizedArrayPointerArithmetic(EvalInfo &Info, const Expr *E);
-    void diagnosePointerArithmetic(EvalInfo &Info, const Expr *E,
-                                   const APSInt &N);
-    /// Add N to the address of this subobject.
-    void adjustIndex(EvalInfo &Info, const Expr *E, APSInt N, const LValue &LV);
-  };
+  void addVectorElementUnchecked(QualType EltTy, uint64_t Size, uint64_t Idx) {
+    Entries.push_back(PathEntry::ArrayIndex(Idx));
+    MostDerivedType = EltTy;
+    MostDerivedPathLength = Entries.size();
+    MostDerivedArraySize = 0;
+    MostDerivedIsArrayElement = false;
+  }
 
-  /// A scope at the end of which an object can need to be destroyed.
-  enum class ScopeKind {
-    Block,
-    FullExpression,
-    Call
-  };
+  void diagnoseUnsizedArrayPointerArithmetic(EvalInfo &Info, const Expr *E);
+  void diagnosePointerArithmetic(EvalInfo &Info, const Expr *E,
+                                 const APSInt &N);
+  /// Add N to the address of this subobject.
+  void adjustIndex(EvalInfo &Info, const Expr *E, APSInt N, const LValue &LV);
+};
 
-  /// A reference to a particular call and its arguments.
-  struct CallRef {
-    CallRef() : OrigCallee(), CallIndex(0), Version() {}
-    CallRef(const FunctionDecl *Callee, unsigned CallIndex, unsigned Version)
-        : OrigCallee(Callee), CallIndex(CallIndex), Version(Version) {}
-
-    explicit operator bool() const { return OrigCallee; }
-
-    /// Get the parameter that the caller initialized, corresponding to the
-    /// given parameter in the callee.
-    const ParmVarDecl *getOrigParam(const ParmVarDecl *PVD) const {
-      return OrigCallee ? OrigCallee->getParamDecl(PVD->getFunctionScopeIndex())
-                        : PVD;
-    }
-
-    /// The callee at the point where the arguments were evaluated. This might
-    /// be different from the actual callee (a different redeclaration, or a
-    /// virtual override), but this function's parameters are the ones that
-    /// appear in the parameter map.
-    const FunctionDecl *OrigCallee;
-    /// The call index of the frame that holds the argument values.
-    unsigned CallIndex;
-    /// The version of the parameters corresponding to this call.
-    unsigned Version;
-  };
+/// A scope at the end of which an object can need to be destroyed.
+enum class ScopeKind { Block, FullExpression, Call };
+
+/// A reference to a particular call and its arguments.
+struct CallRef {
+  CallRef() : OrigCallee(), CallIndex(0), Version() {}
+  CallRef(const FunctionDecl *Callee, unsigned CallIndex, unsigned Version)
+      : OrigCallee(Callee), CallIndex(CallIndex), Version(Version) {}
+
+  explicit operator bool() const { return OrigCallee; }
+
+  /// Get the parameter that the caller initialized, corresponding to the
+  /// given parameter in the callee.
+  const ParmVarDecl *getOrigParam(const ParmVarDecl *PVD) const {
+    return OrigCallee ? OrigCallee->getParamDecl(PVD->getFunctionScopeIndex())
+                      : PVD;
+  }
+
+  /// The callee at the point where the arguments were evaluated. This might
+  /// be different from the actual callee (a different redeclaration, or a
+  /// virtual override), but this function's parameters are the ones that
+  /// appear in the parameter map.
+  const FunctionDecl *OrigCallee;
+  /// The call index of the frame that holds the argument values.
+  unsigned CallIndex;
+  /// The version of the parameters corresponding to this call.
+  unsigned Version;
+};
 
-  /// A stack frame in the constexpr call stack.
-  class CallStackFrame : public interp::Frame {
-  public:
-    EvalInfo &Info;
+/// A stack frame in the constexpr call stack.
+class CallStackFrame : public interp::Frame {
+public:
+  EvalInfo &Info;
 
-    /// Parent - The caller of this stack frame.
-    CallStackFrame *Caller;
+  /// Parent - The caller of this stack frame.
+  CallStackFrame *Caller;
 
-    /// Callee - The function which was called.
-    const FunctionDecl *Callee;
+  /// Callee - The function which was called.
+  const FunctionDecl *Callee;
 
-    /// This - The binding for the this pointer in this call, if any.
-    const LValue *This;
+  /// This - The binding for the this pointer in this call, if any.
+  const LValue *This;
 
-    /// CallExpr - The syntactical structure of member function calls
-    const Expr *CallExpr;
+  /// CallExpr - The syntactical structure of member function calls
+  const Expr *CallExpr;
 
-    /// Information on how to find the arguments to this call. Our arguments
-    /// are stored in our parent's CallStackFrame, using the ParmVarDecl* as a
-    /// key and this value as the version.
-    CallRef Arguments;
+  /// Information on how to find the arguments to this call. Our arguments
+  /// are stored in our parent's CallStackFrame, using the ParmVarDecl* as a
+  /// key and this value as the version.
+  CallRef Arguments;
 
-    /// Source location information about the default argument or default
-    /// initializer expression we're evaluating, if any.
-    CurrentSourceLocExprScope CurSourceLocExprScope;
+  /// Source location information about the default argument or default
+  /// initializer expression we're evaluating, if any.
+  CurrentSourceLocExprScope CurSourceLocExprScope;
 
-    // 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;
-    /// Temporaries - Temporary lvalues materialized within this stack frame.
-    MapTy Temporaries;
+  // 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;
+  /// Temporaries - Temporary lvalues materialized within this stack frame.
+  MapTy Temporaries;
 
-    /// CallRange - The source range of the call expression for this call.
-    SourceRange CallRange;
+  /// CallRange - The source range of the call expression for this call.
+  SourceRange CallRange;
 
-    /// Index - The call index of this call.
-    unsigned Index;
+  /// Index - The call index of this call.
+  unsigned Index;
 
-    /// The stack of integers for tracking version numbers for temporaries.
-    SmallVector<unsigned, 2> TempVersionStack = {1};
-    unsigned CurTempVersion = TempVersionStack.back();
+  /// The stack of integers for tracking version numbers for temporaries.
+  SmallVector<unsigned, 2> TempVersionStack = {1};
+  unsigned CurTempVersion = TempVersionStack.back();
 
-    unsigned getTempVersion() const { return TempVersionStack.back(); }
+  unsigned getTempVersion() const { return TempVersionStack.back(); }
 
-    void pushTempVersion() {
-      TempVersionStack.push_back(++CurTempVersion);
-    }
+  void pushTempVersion() { TempVersionStack.push_back(++CurTempVersion); }
 
-    void popTempVersion() {
-      TempVersionStack.pop_back();
-    }
+  void popTempVersion() { TempVersionStack.pop_back(); }
 
-    CallRef createCall(const FunctionDecl *Callee) {
-      return {Callee, Index, ++CurTempVersion};
-    }
+  CallRef createCall(const FunctionDecl *Callee) {
+    return {Callee, Index, ++CurTempVersion};
+  }
 
-    // FIXME: Adding this to every 'CallStackFrame' may have a nontrivial impact
-    // on the overall stack usage of deeply-recursing constexpr evaluations.
-    // (We should cache this map rather than recomputing it repeatedly.)
-    // But let's try this and see how it goes; we can look into caching the map
-    // as a later change.
+  // FIXME: Adding this to every 'CallStackFrame' may have a nontrivial impact
+  // on the overall stack usage of deeply-recursing constexpr evaluations.
+  // (We should cache this map rather than recomputing it repeatedly.)
+  // But let's try this and see how it goes; we can look into caching the map
+  // as a later change.
 
-    /// LambdaCaptureFields - Mapping from captured variables/this to
-    /// corresponding data members in the closure class.
-    llvm::DenseMap<const ValueDecl *, FieldDecl *> LambdaCaptureFields;
-    FieldDecl *LambdaThisCaptureField = nullptr;
+  /// LambdaCaptureFields - Mapping from captured variables/this to
+  /// corresponding data members in the closure class.
+  llvm::DenseMap<const ValueDecl *, FieldDecl *> LambdaCaptureFields;
+  FieldDecl *LambdaThisCaptureField = nullptr;
 
-    CallStackFrame(EvalInfo &Info, SourceRange CallRange,
-                   const FunctionDecl *Callee, const LValue *This,
-                   const Expr *CallExpr, CallRef Arguments);
-    ~CallStackFrame();
+  CallStackFrame(EvalInfo &Info, SourceRange CallRange,
+                 const FunctionDecl *Callee, const LValue *This,
+                 const Expr *CallExpr, CallRef Arguments);
+  ~CallStackFrame();
 
-    // Return the temporary for Key whose version number is Version.
-    APValue *getTemporary(const void *Key, unsigned Version) {
-      MapKeyTy KV(Key, Version);
-      auto LB = Temporaries.lower_bound(KV);
-      if (LB != Temporaries.end() && LB->first == KV)
-        return &LB->second;
-      return nullptr;
-    }
+  // Return the temporary for Key whose version number is Version.
+  APValue *getTemporary(const void *Key, unsigned Version) {
+    MapKeyTy KV(Key, Version);
+    auto LB = Temporaries.lower_bound(KV);
+    if (LB != Temporaries.end() && LB->first == KV)
+      return &LB->second;
+    return nullptr;
+  }
 
-    // Return the current temporary for Key in the map.
-    APValue *getCurrentTemporary(const void *Key) {
-      auto UB = Temporaries.upper_bound(MapKeyTy(Key, UINT_MAX));
-      if (UB != Temporaries.begin() && std::prev(UB)->first.first == Key)
-        return &std::prev(UB)->second;
-      return nullptr;
-    }
+  // Return the current temporary for Key in the map.
+  APValue *getCurrentTemporary(const void *Key) {
+    auto UB = Temporaries.upper_bound(MapKeyTy(Key, UINT_MAX));
+    if (UB != Temporaries.begin() && std::prev(UB)->first.first == Key)
+      return &std::prev(UB)->second;
+    return nullptr;
+  }
 
-    // Return the version number of the current temporary for Key.
-    unsigned getCurrentTemporaryVersion(const void *Key) const {
-      auto UB = Temporaries.upper_bound(MapKeyTy(Key, UINT_MAX));
-      if (UB != Temporaries.begin() && std::prev(UB)->first.first == Key)
-        return std::prev(UB)->first.second;
-      return 0;
-    }
+  // Return the version number of the current temporary for Key.
+  unsigned getCurrentTemporaryVersion(const void *Key) const {
+    auto UB = Temporaries.upper_bound(MapKeyTy(Key, UINT_MAX));
+    if (UB != Temporaries.begin() && std::prev(UB)->first.first == Key)
+      return std::prev(UB)->first.second;
+    return 0;
+  }
 
-    /// Allocate storage for an object of type T in this stack frame.
-    /// Populates LV with a handle to the created object. Key identifies
-    /// the temporary within the stack frame, and must not be reused without
-    /// bumping the temporary version number.
-    template<typename KeyT>
-    APValue &createTemporary(const KeyT *Key, QualType T,
-                             ScopeKind Scope, LValue &LV);
+  /// Allocate storage for an object of type T in this stack frame.
+  /// Populates LV with a handle to the created object. Key identifies
+  /// the temporary within the stack frame, and must not be reused without
+  /// bumping the temporary version number.
+  template <typename KeyT>
+  APValue &createTemporary(const KeyT *Key, QualType T, ScopeKind Scope,
+                           LValue &LV);
 
-    /// Allocate storage for a parameter of a function call made in this frame.
-    APValue &createParam(CallRef Args, const ParmVarDecl *PVD, LValue &LV);
+  /// Allocate storage for a parameter of a function call made in this frame.
+  APValue &createParam(CallRef Args, const ParmVarDecl *PVD, LValue &LV);
 
-    void describe(llvm::raw_ostream &OS) const override;
+  void describe(llvm::raw_ostream &OS) const override;
 
-    Frame *getCaller() const override { return Caller; }
-    SourceRange getCallRange() const override { return CallRange; }
-    const FunctionDecl *getCallee() const override { return Callee; }
+  Frame *getCaller() const override { return Caller; }
+  SourceRange getCallRange() const override { return CallRange; }
+  const FunctionDecl *getCallee() const override { return Callee; }
 
-    bool isStdFunction() const {
-      for (const DeclContext *DC = Callee; DC; DC = DC->getParent())
-        if (DC->isStdNamespace())
-          return true;
-      return false;
-    }
+  bool isStdFunction() const {
+    for (const DeclContext *DC = Callee; DC; DC = DC->getParent())
+      if (DC->isStdNamespace())
+        return true;
+    return false;
+  }
 
-    /// Whether we're in a context where [[msvc::constexpr]] evaluation is
-    /// permitted. See MSConstexprDocs for description of permitted contexts.
-    bool CanEvalMSConstexpr = false;
+  /// Whether we're in a context where [[msvc::constexpr]] evaluation is
+  /// permitted. See MSConstexprDocs for description of permitted contexts.
+  bool CanEvalMSConstexpr = false;
 
-  private:
-    APValue &createLocal(APValue::LValueBase Base, const void *Key, QualType T,
-                         ScopeKind Scope);
-  };
+private:
+  APValue &createLocal(APValue::LValueBase Base, const void *Key, QualType T,
+                       ScopeKind Scope);
+};
 
-  /// Temporarily override 'this'.
-  class ThisOverrideRAII {
-  public:
-    ThisOverrideRAII(CallStackFrame &Frame, const LValue *NewThis, bool Enable)
-        : Frame(Frame), OldThis(Frame.This) {
-      if (Enable)
-        Frame.This = NewThis;
-    }
-    ~ThisOverrideRAII() {
-      Frame.This = OldThis;
-    }
-  private:
-    CallStackFrame &Frame;
-    const LValue *OldThis;
-  };
+/// Temporarily override 'this'.
+class ThisOverrideRAII {
+public:
+  ThisOverrideRAII(CallStackFrame &Frame, const LValue *NewThis, bool Enable)
+      : Frame(Frame), OldThis(Frame.This) {
+    if (Enable)
+      Frame.This = NewThis;
+  }
+  ~ThisOverrideRAII() { Frame.This = OldThis; }
 
-  // A shorthand time trace scope struct, prints source range, for example
-  // {"name":"EvaluateAsRValue","args":{"detail":"<test.cc:8:21, col:25>"}}}
-  class ExprTimeTraceScope {
-  public:
-    ExprTimeTraceScope(const Expr *E, const ASTContext &Ctx, StringRef Name)
-        : TimeScope(Name, [E, &Ctx] {
-            return E->getSourceRange().printToString(Ctx.getSourceManager());
-          }) {}
+private:
+  CallStackFrame &Frame;
+  const LValue *OldThis;
+};
 
-  private:
-    llvm::TimeTraceScope TimeScope;
-  };
+// A shorthand time trace scope struct, prints source range, for example
+// {"name":"EvaluateAsRValue","args":{"detail":"<test.cc:8:21, col:25>"}}}
+class ExprTimeTraceScope {
+public:
+  ExprTimeTraceScope(const Expr *E, const ASTContext &Ctx, StringRef Name)
+      : TimeScope(Name, [E, &Ctx] {
+          return E->getSourceRange().printToString(Ctx.getSourceManager());
+        }) {}
 
-  /// RAII object used to change the current ability of
-  /// [[msvc::constexpr]] evaulation.
-  struct MSConstexprContextRAII {
-    CallStackFrame &Frame;
-    bool OldValue;
-    explicit MSConstexprContextRAII(CallStackFrame &Frame, bool Value)
-        : Frame(Frame), OldValue(Frame.CanEvalMSConstexpr) {
-      Frame.CanEvalMSConstexpr = Value;
-    }
+private:
+  llvm::TimeTraceScope TimeScope;
+};
 
-    ~MSConstexprContextRAII() { Frame.CanEvalMSConstexpr = OldValue; }
-  };
-}
+/// RAII object used to change the current ability of
+/// [[msvc::constexpr]] evaulation.
+struct MSConstexprContextRAII {
+  CallStackFrame &Frame;
+  bool OldValue;
+  explicit MSConstexprContextRAII(CallStackFrame &Frame, bool Value)
+      : Frame(Frame), OldValue(Frame.CanEvalMSConstexpr) {
+    Frame.CanEvalMSConstexpr = Value;
+  }
+
+  ~MSConstexprContextRAII() { Frame.CanEvalMSConstexpr = OldValue; }
+};
+} // namespace
 
-static bool HandleDestruction(EvalInfo &Info, const Expr *E,
-                              const LValue &This, QualType ThisType);
+static bool HandleDestruction(EvalInfo &Info, const Expr *E, const LValue &This,
+                              QualType ThisType);
 static bool HandleDestruction(EvalInfo &Info, SourceLocation Loc,
                               APValue::LValueBase LVBase, APValue &Value,
                               QualType T);
 
 namespace {
-  /// A cleanup, and a flag indicating whether it is lifetime-extended.
-  class Cleanup {
-    llvm::PointerIntPair<APValue*, 2, ScopeKind> Value;
-    APValue::LValueBase Base;
-    QualType T;
+/// A cleanup, and a flag indicating whether it is lifetime-extended.
+class Cleanup {
+  llvm::PointerIntPair<APValue *, 2, ScopeKind> Value;
+  APValue::LValueBase Base;
+  QualType T;
 
-  public:
-    Cleanup(APValue *Val, APValue::LValueBase Base, QualType T,
-            ScopeKind Scope)
-        : Value(Val, Scope), Base(Base), T(T) {}
-
-    /// Determine whether this cleanup should be performed at the end of the
-    /// given kind of scope.
-    bool isDestroyedAtEndOf(ScopeKind K) const {
-      return (int)Value.getInt() >= (int)K;
-    }
-    bool endLifetime(EvalInfo &Info, bool RunDestructors) {
-      if (RunDestructors) {
-        SourceLocation Loc;
-        if (const ValueDecl *VD = Base.dyn_cast<const ValueDecl*>())
-          Loc = VD->getLocation();
-        else if (const Expr *E = Base.dyn_cast<const Expr*>())
-          Loc = E->getExprLoc();
-        return HandleDestruction(Info, Loc, Base, *Value.getPointer(), T);
-      }
-      *Value.getPointer() = APValue();
-      return true;
-    }
+public:
+  Cleanup(APValue *Val, APValue::LValueBase Base, QualType T, ScopeKind Scope)
+      : Value(Val, Scope), Base(Base), T(T) {}
+
+  /// Determine whether this cleanup should be performed at the end of the
+  /// given kind of scope.
+  bool isDestroyedAtEndOf(ScopeKind K) const {
+    return (int)Value.getInt() >= (int)K;
+  }
+  bool endLifetime(EvalInfo &Info, bool RunDestructors) {
+    if (RunDestructors) {
+      SourceLocation Loc;
+      if (const ValueDecl *VD = Base.dyn_cast<const ValueDecl *>())
+        Loc = VD->getLocation();
+      else if (const Expr *E = Base.dyn_cast<const Expr *>())
+        Loc = E->getExprLoc();
+      return HandleDestruction(Info, Loc, Base, *Value.getPointer(), T);
+    }
+    *Value.getPointer() = APValue();
+    return true;
+  }
 
-    bool hasSideEffect() {
-      return T.isDestructedType();
-    }
-  };
+  bool hasSideEffect() { return T.isDestructedType(); }
+};
 
-  /// A reference to an object whose construction we are currently evaluating.
-  struct ObjectUnderConstruction {
-    APValue::LValueBase Base;
-    ArrayRef<APValue::LValuePathEntry> Path;
-    friend bool operator==(const ObjectUnderConstruction &LHS,
-                           const ObjectUnderConstruction &RHS) {
-      return LHS.Base == RHS.Base && LHS.Path == RHS.Path;
-    }
-    friend llvm::hash_code hash_value(const ObjectUnderConstruction &Obj) {
-      return llvm::hash_combine(Obj.Base, Obj.Path);
-    }
-  };
-  enum class ConstructionPhase {
-    None,
-    Bases,
-    AfterBases,
-    AfterFields,
-    Destroying,
-    DestroyingBases
-  };
-}
+/// A reference to an object whose construction we are currently evaluating.
+struct ObjectUnderConstruction {
+  APValue::LValueBase Base;
+  ArrayRef<APValue::LValuePathEntry> Path;
+  friend bool operator==(const ObjectUnderConstruction &LHS,
+                         const ObjectUnderConstruction &RHS) {
+    return LHS.Base == RHS.Base && LHS.Path == RHS.Path;
+  }
+  friend llvm::hash_code hash_value(const ObjectUnderConstruction &Obj) {
+    return llvm::hash_combine(Obj.Base, Obj.Path);
+  }
+};
+enum class ConstructionPhase {
+  None,
+  Bases,
+  AfterBases,
+  AfterFields,
+  Destroying,
+  DestroyingBases
+};
+} // namespace
 
 namespace llvm {
-template<> struct DenseMapInfo<ObjectUnderConstruction> {
+template <> struct DenseMapInfo<ObjectUnderConstruction> {
   using Base = DenseMapInfo<APValue::LValueBase>;
   static ObjectUnderConstruction getEmptyKey() {
-    return {Base::getEmptyKey(), {}}; }
+    return {Base::getEmptyKey(), {}};
+  }
   static ObjectUnderConstruction getTombstoneKey() {
     return {Base::getTombstoneKey(), {}};
   }
@@ -747,541 +731,531 @@ template<> struct DenseMapInfo<ObjectUnderConstruction> {
     return LHS == RHS;
   }
 };
-}
+} // namespace llvm
 
 namespace {
-  /// A dynamically-allocated heap object.
-  struct DynAlloc {
-    /// The value of this heap-allocated object.
-    APValue Value;
-    /// The allocating expression; used for diagnostics. Either a CXXNewExpr
-    /// or a CallExpr (the latter is for direct calls to operator new inside
-    /// std::allocator<T>::allocate).
-    const Expr *AllocExpr = nullptr;
-
-    enum Kind {
-      New,
-      ArrayNew,
-      StdAllocator
-    };
+/// A dynamically-allocated heap object.
+struct DynAlloc {
+  /// The value of this heap-allocated object.
+  APValue Value;
+  /// The allocating expression; used for diagnostics. Either a CXXNewExpr
+  /// or a CallExpr (the latter is for direct calls to operator new inside
+  /// std::allocator<T>::allocate).
+  const Expr *AllocExpr = nullptr;
+
+  enum Kind { New, ArrayNew, StdAllocator };
+
+  /// Get the kind of the allocation. This must match between allocation
+  /// and deallocation.
+  Kind getKind() const {
+    if (auto *NE = dyn_cast<CXXNewExpr>(AllocExpr))
+      return NE->isArray() ? ArrayNew : New;
+    assert(isa<CallExpr>(AllocExpr));
+    return StdAllocator;
+  }
+};
+
+struct DynAllocOrder {
+  bool operator()(DynamicAllocLValue L, DynamicAllocLValue R) const {
+    return L.getIndex() < R.getIndex();
+  }
+};
+
+/// EvalInfo - This is a private struct used by the evaluator to capture
+/// information about a subexpression as it is folded.  It retains information
+/// about the AST context, but also maintains information about the folded
+/// expression.
+///
+/// If an expression could be evaluated, it is still possible it is not a C
+/// "integer constant expression" or constant expression.  If not, this struct
+/// captures information about how and why not.
+///
+/// One bit of information passed *into* the request for constant folding
+/// indicates whether the subexpression is "evaluated" or not according to C
+/// rules.  For example, the RHS of (0 && foo()) is not evaluated.  We can
+/// evaluate the expression regardless of what the RHS is, but C only allows
+/// certain things in certain situations.
+class EvalInfo final : public interp::State {
+public:
+  /// CurrentCall - The top of the constexpr call stack.
+  CallStackFrame *CurrentCall;
+
+  /// CallStackDepth - The number of calls in the call stack right now.
+  unsigned CallStackDepth;
+
+  /// NextCallIndex - The next call index to assign.
+  unsigned NextCallIndex;
+
+  /// StepsLeft - The remaining number of evaluation steps we're permitted
+  /// to perform. This is essentially a limit for the number of statements
+  /// we will evaluate.
+  unsigned StepsLeft;
+
+  /// Enable the experimental new constant interpreter. If an expression is
+  /// not supported by the interpreter, an error is triggered.
+  bool EnableNewConstInterp;
+
+  /// BottomFrame - The frame in which evaluation started. This must be
+  /// initialized after CurrentCall and CallStackDepth.
+  CallStackFrame BottomFrame;
 
-    /// Get the kind of the allocation. This must match between allocation
-    /// and deallocation.
-    Kind getKind() const {
-      if (auto *NE = dyn_cast<CXXNewExpr>(AllocExpr))
-        return NE->isArray() ? ArrayNew : New;
-      assert(isa<CallExpr>(AllocExpr));
-      return StdAllocator;
+  /// A stack of values whose lifetimes end at the end of some surrounding
+  /// evaluation frame.
+  llvm::SmallVector<Cleanup, 16> CleanupStack;
+
+  /// EvaluatingDecl - This is the declaration whose initializer is being
+  /// evaluated, if any.
+  APValue::LValueBase EvaluatingDecl;
+
+  enum class EvaluatingDeclKind {
+    None,
+    /// We're evaluating the construction of EvaluatingDecl.
+    Ctor,
+    /// We're evaluating the destruction of EvaluatingDecl.
+    Dtor,
+  };
+  EvaluatingDeclKind IsEvaluatingDecl = EvaluatingDeclKind::None;
+
+  /// EvaluatingDeclValue - This is the value being constructed for the
+  /// declaration whose initializer is being evaluated, if any.
+  APValue *EvaluatingDeclValue;
+
+  /// Stack of loops and 'switch' statements which we're currently
+  /// breaking/continuing; null entries are used to mark unlabeled
+  /// break/continue.
+  SmallVector<const Stmt *> BreakContinueStack;
+
+  /// Set of objects that are currently being constructed.
+  llvm::DenseMap<ObjectUnderConstruction, ConstructionPhase>
+      ObjectsUnderConstruction;
+
+  /// Current heap allocations, along with the location where each was
+  /// allocated. We use std::map here because we need stable addresses
+  /// for the stored APValues.
+  std::map<DynamicAllocLValue, DynAlloc, DynAllocOrder> HeapAllocs;
+
+  /// The number of heap allocations performed so far in this evaluation.
+  unsigned NumHeapAllocs = 0;
+
+  struct EvaluatingConstructorRAII {
+    EvalInfo &EI;
+    ObjectUnderConstruction Object;
+    bool DidInsert;
+    EvaluatingConstructorRAII(EvalInfo &EI, ObjectUnderConstruction Object,
+                              bool HasBases)
+        : EI(EI), Object(Object) {
+      DidInsert =
+          EI.ObjectsUnderConstruction
+              .insert({Object, HasBases ? ConstructionPhase::Bases
+                                        : ConstructionPhase::AfterBases})
+              .second;
+    }
+    void finishedConstructingBases() {
+      EI.ObjectsUnderConstruction[Object] = ConstructionPhase::AfterBases;
+    }
+    void finishedConstructingFields() {
+      EI.ObjectsUnderConstruction[Object] = ConstructionPhase::AfterFields;
+    }
+    ~EvaluatingConstructorRAII() {
+      if (DidInsert)
+        EI.ObjectsUnderConstruction.erase(Object);
     }
   };
 
-  struct DynAllocOrder {
-    bool operator()(DynamicAllocLValue L, DynamicAllocLValue R) const {
-      return L.getIndex() < R.getIndex();
+  struct EvaluatingDestructorRAII {
+    EvalInfo &EI;
+    ObjectUnderConstruction Object;
+    bool DidInsert;
+    EvaluatingDestructorRAII(EvalInfo &EI, ObjectUnderConstruction Object)
+        : EI(EI), Object(Object) {
+      DidInsert = EI.ObjectsUnderConstruction
+                      .insert({Object, ConstructionPhase::Destroying})
+                      .second;
+    }
+    void startedDestroyingBases() {
+      EI.ObjectsUnderConstruction[Object] = ConstructionPhase::DestroyingBases;
+    }
+    ~EvaluatingDestructorRAII() {
+      if (DidInsert)
+        EI.ObjectsUnderConstruction.erase(Object);
     }
   };
 
-  /// EvalInfo - This is a private struct used by the evaluator to capture
-  /// information about a subexpression as it is folded.  It retains information
-  /// about the AST context, but also maintains information about the folded
-  /// expression.
-  ///
-  /// If an expression could be evaluated, it is still possible it is not a C
-  /// "integer constant expression" or constant expression.  If not, this struct
-  /// captures information about how and why not.
-  ///
-  /// One bit of information passed *into* the request for constant folding
-  /// indicates whether the subexpression is "evaluated" or not according to C
-  /// rules.  For example, the RHS of (0 && foo()) is not evaluated.  We can
-  /// evaluate the expression regardless of what the RHS is, but C only allows
-  /// certain things in certain situations.
-  class EvalInfo final : public interp::State {
-  public:
-    /// CurrentCall - The top of the constexpr call stack.
-    CallStackFrame *CurrentCall;
-
-    /// CallStackDepth - The number of calls in the call stack right now.
-    unsigned CallStackDepth;
-
-    /// NextCallIndex - The next call index to assign.
-    unsigned NextCallIndex;
-
-    /// StepsLeft - The remaining number of evaluation steps we're permitted
-    /// to perform. This is essentially a limit for the number of statements
-    /// we will evaluate.
-    unsigned StepsLeft;
-
-    /// Enable the experimental new constant interpreter. If an expression is
-    /// not supported by the interpreter, an error is triggered.
-    bool EnableNewConstInterp;
-
-    /// BottomFrame - The frame in which evaluation started. This must be
-    /// initialized after CurrentCall and CallStackDepth.
-    CallStackFrame BottomFrame;
-
-    /// A stack of values whose lifetimes end at the end of some surrounding
-    /// evaluation frame.
-    llvm::SmallVector<Cleanup, 16> CleanupStack;
-
-    /// EvaluatingDecl - This is the declaration whose initializer is being
-    /// evaluated, if any.
-    APValue::LValueBase EvaluatingDecl;
-
-    enum class EvaluatingDeclKind {
-      None,
-      /// We're evaluating the construction of EvaluatingDecl.
-      Ctor,
-      /// We're evaluating the destruction of EvaluatingDecl.
-      Dtor,
-    };
-    EvaluatingDeclKind IsEvaluatingDecl = EvaluatingDeclKind::None;
-
-    /// EvaluatingDeclValue - This is the value being constructed for the
-    /// declaration whose initializer is being evaluated, if any.
-    APValue *EvaluatingDeclValue;
-
-    /// Stack of loops and 'switch' statements which we're currently
-    /// breaking/continuing; null entries are used to mark unlabeled
-    /// break/continue.
-    SmallVector<const Stmt *> BreakContinueStack;
-
-    /// Set of objects that are currently being constructed.
-    llvm::DenseMap<ObjectUnderConstruction, ConstructionPhase>
-        ObjectsUnderConstruction;
-
-    /// Current heap allocations, along with the location where each was
-    /// allocated. We use std::map here because we need stable addresses
-    /// for the stored APValues.
-    std::map<DynamicAllocLValue, DynAlloc, DynAllocOrder> HeapAllocs;
-
-    /// The number of heap allocations performed so far in this evaluation.
-    unsigned NumHeapAllocs = 0;
-
-    struct EvaluatingConstructorRAII {
-      EvalInfo &EI;
-      ObjectUnderConstruction Object;
-      bool DidInsert;
-      EvaluatingConstructorRAII(EvalInfo &EI, ObjectUnderConstruction Object,
-                                bool HasBases)
-          : EI(EI), Object(Object) {
-        DidInsert =
-            EI.ObjectsUnderConstruction
-                .insert({Object, HasBases ? ConstructionPhase::Bases
-                                          : ConstructionPhase::AfterBases})
-                .second;
-      }
-      void finishedConstructingBases() {
-        EI.ObjectsUnderConstruction[Object] = ConstructionPhase::AfterBases;
-      }
-      void finishedConstructingFields() {
-        EI.ObjectsUnderConstruction[Object] = ConstructionPhase::AfterFields;
-      }
-      ~EvaluatingConstructorRAII() {
-        if (DidInsert) EI.ObjectsUnderConstruction.erase(Object);
-      }
-    };
-
-    struct EvaluatingDestructorRAII {
-      EvalInfo &EI;
-      ObjectUnderConstruction Object;
-      bool DidInsert;
-      EvaluatingDestructorRAII(EvalInfo &EI, ObjectUnderConstruction Object)
-          : EI(EI), Object(Object) {
-        DidInsert = EI.ObjectsUnderConstruction
-                        .insert({Object, ConstructionPhase::Destroying})
-                        .second;
-      }
-      void startedDestroyingBases() {
-        EI.ObjectsUnderConstruction[Object] =
-            ConstructionPhase::DestroyingBases;
-      }
-      ~EvaluatingDestructorRAII() {
-        if (DidInsert)
-          EI.ObjectsUnderConstruction.erase(Object);
-      }
-    };
+  ConstructionPhase
+  isEvaluatingCtorDtor(APValue::LValueBase Base,
+                       ArrayRef<APValue::LValuePathEntry> Path) {
+    return ObjectsUnderConstruction.lookup({Base, Path});
+  }
 
-    ConstructionPhase
-    isEvaluatingCtorDtor(APValue::LValueBase Base,
-                         ArrayRef<APValue::LValuePathEntry> Path) {
-      return ObjectsUnderConstruction.lookup({Base, Path});
-    }
+  /// If we're currently speculatively evaluating, the outermost call stack
+  /// depth at which we can mutate state, otherwise 0.
+  unsigned SpeculativeEvaluationDepth = 0;
 
-    /// If we're currently speculatively evaluating, the outermost call stack
-    /// depth at which we can mutate state, otherwise 0.
-    unsigned SpeculativeEvaluationDepth = 0;
+  /// The current array initialization index, if we're performing array
+  /// initialization.
+  uint64_t ArrayInitIndex = -1;
 
-    /// The current array initialization index, if we're performing array
-    /// initialization.
-    uint64_t ArrayInitIndex = -1;
+  EvalInfo(const ASTContext &C, Expr::EvalStatus &S, EvaluationMode Mode)
+      : State(const_cast<ASTContext &>(C), S), CurrentCall(nullptr),
+        CallStackDepth(0), NextCallIndex(1),
+        StepsLeft(C.getLangOpts().ConstexprStepLimit),
+        EnableNewConstInterp(C.getLangOpts().EnableNewConstInterp),
+        BottomFrame(*this, SourceLocation(), /*Callee=*/nullptr,
+                    /*This=*/nullptr,
+                    /*CallExpr=*/nullptr, CallRef()),
+        EvaluatingDecl((const ValueDecl *)nullptr),
+        EvaluatingDeclValue(nullptr) {
+    EvalMode = Mode;
+  }
 
-    EvalInfo(const ASTContext &C, Expr::EvalStatus &S, EvaluationMode Mode)
-        : State(const_cast<ASTContext &>(C), S), CurrentCall(nullptr),
-          CallStackDepth(0), NextCallIndex(1),
-          StepsLeft(C.getLangOpts().ConstexprStepLimit),
-          EnableNewConstInterp(C.getLangOpts().EnableNewConstInterp),
-          BottomFrame(*this, SourceLocation(), /*Callee=*/nullptr,
-                      /*This=*/nullptr,
-                      /*CallExpr=*/nullptr, CallRef()),
-          EvaluatingDecl((const ValueDecl *)nullptr),
-          EvaluatingDeclValue(nullptr) {
-      EvalMode = Mode;
-    }
+  ~EvalInfo() { discardCleanups(); }
 
-    ~EvalInfo() {
-      discardCleanups();
-    }
+  void setEvaluatingDecl(APValue::LValueBase Base, APValue &Value,
+                         EvaluatingDeclKind EDK = EvaluatingDeclKind::Ctor) {
+    EvaluatingDecl = Base;
+    IsEvaluatingDecl = EDK;
+    EvaluatingDeclValue = &Value;
+  }
 
-    void setEvaluatingDecl(APValue::LValueBase Base, APValue &Value,
-                           EvaluatingDeclKind EDK = EvaluatingDeclKind::Ctor) {
-      EvaluatingDecl = Base;
-      IsEvaluatingDecl = EDK;
-      EvaluatingDeclValue = &Value;
+  bool CheckCallLimit(SourceLocation Loc) {
+    // Don't perform any constexpr calls (other than the call we're checking)
+    // when checking a potential constant expression.
+    if (checkingPotentialConstantExpression() && CallStackDepth > 1)
+      return false;
+    if (NextCallIndex == 0) {
+      // NextCallIndex has wrapped around.
+      FFDiag(Loc, diag::note_constexpr_call_limit_exceeded);
+      return false;
     }
-
-    bool CheckCallLimit(SourceLocation Loc) {
-      // Don't perform any constexpr calls (other than the call we're checking)
-      // when checking a potential constant expression.
-      if (checkingPotentialConstantExpression() && CallStackDepth > 1)
-        return false;
-      if (NextCallIndex == 0) {
-        // NextCallIndex has wrapped around.
-        FFDiag(Loc, diag::note_constexpr_call_limit_exceeded);
-        return false;
-      }
-      if (CallStackDepth <= getLangOpts().ConstexprCallDepth)
-        return true;
-      FFDiag(Loc, diag::note_constexpr_depth_limit_exceeded)
+    if (CallStackDepth <= getLangOpts().ConstexprCallDepth)
+      return true;
+    FFDiag(Loc, diag::note_constexpr_depth_limit_exceeded)
         << getLangOpts().ConstexprCallDepth;
+    return false;
+  }
+
+  bool CheckArraySize(SourceLocation Loc, unsigned BitWidth, uint64_t ElemCount,
+                      bool Diag) {
+    // FIXME: GH63562
+    // APValue stores array extents as unsigned,
+    // so anything that is greater that unsigned would overflow when
+    // constructing the array, we catch this here.
+    if (BitWidth > ConstantArrayType::getMaxSizeBits(Ctx) ||
+        ElemCount > uint64_t(std::numeric_limits<unsigned>::max())) {
+      if (Diag)
+        FFDiag(Loc, diag::note_constexpr_new_too_large) << ElemCount;
       return false;
     }
 
-    bool CheckArraySize(SourceLocation Loc, unsigned BitWidth,
-                        uint64_t ElemCount, bool Diag) {
-      // FIXME: GH63562
-      // APValue stores array extents as unsigned,
-      // so anything that is greater that unsigned would overflow when
-      // constructing the array, we catch this here.
-      if (BitWidth > ConstantArrayType::getMaxSizeBits(Ctx) ||
-          ElemCount > uint64_t(std::numeric_limits<unsigned>::max())) {
-        if (Diag)
-          FFDiag(Loc, diag::note_constexpr_new_too_large) << ElemCount;
-        return false;
-      }
-
-      // FIXME: GH63562
-      // Arrays allocate an APValue per element.
-      // We use the number of constexpr steps as a proxy for the maximum size
-      // of arrays to avoid exhausting the system resources, as initialization
-      // of each element is likely to take some number of steps anyway.
-      uint64_t Limit = getLangOpts().ConstexprStepLimit;
-      if (Limit != 0 && ElemCount > Limit) {
-        if (Diag)
-          FFDiag(Loc, diag::note_constexpr_new_exceeds_limits)
-              << ElemCount << Limit;
-        return false;
-      }
-      return true;
+    // FIXME: GH63562
+    // Arrays allocate an APValue per element.
+    // We use the number of constexpr steps as a proxy for the maximum size
+    // of arrays to avoid exhausting the system resources, as initialization
+    // of each element is likely to take some number of steps anyway.
+    uint64_t Limit = getLangOpts().ConstexprStepLimit;
+    if (Limit != 0 && ElemCount > Limit) {
+      if (Diag)
+        FFDiag(Loc, diag::note_constexpr_new_exceeds_limits)
+            << ElemCount << Limit;
+      return false;
     }
+    return true;
+  }
 
-    std::pair<CallStackFrame *, unsigned>
-    getCallFrameAndDepth(unsigned CallIndex) {
-      assert(CallIndex && "no call index in getCallFrameAndDepth");
-      // We will eventually hit BottomFrame, which has Index 1, so Frame can't
-      // be null in this loop.
-      unsigned Depth = CallStackDepth;
-      CallStackFrame *Frame = CurrentCall;
-      while (Frame->Index > CallIndex) {
-        Frame = Frame->Caller;
-        --Depth;
-      }
-      if (Frame->Index == CallIndex)
-        return {Frame, Depth};
-      return {nullptr, 0};
+  std::pair<CallStackFrame *, unsigned>
+  getCallFrameAndDepth(unsigned CallIndex) {
+    assert(CallIndex && "no call index in getCallFrameAndDepth");
+    // We will eventually hit BottomFrame, which has Index 1, so Frame can't
+    // be null in this loop.
+    unsigned Depth = CallStackDepth;
+    CallStackFrame *Frame = CurrentCall;
+    while (Frame->Index > CallIndex) {
+      Frame = Frame->Caller;
+      --Depth;
     }
+    if (Frame->Index == CallIndex)
+      return {Frame, Depth};
+    return {nullptr, 0};
+  }
 
-    bool nextStep(const Stmt *S) {
-      if (getLangOpts().ConstexprStepLimit == 0)
-        return true;
-
-      if (!StepsLeft) {
-        FFDiag(S->getBeginLoc(), diag::note_constexpr_step_limit_exceeded);
-        return false;
-      }
-      --StepsLeft;
+  bool nextStep(const Stmt *S) {
+    if (getLangOpts().ConstexprStepLimit == 0)
       return true;
-    }
-
-    APValue *createHeapAlloc(const Expr *E, QualType T, LValue &LV);
 
-    std::optional<DynAlloc *> lookupDynamicAlloc(DynamicAllocLValue DA) {
-      std::optional<DynAlloc *> Result;
-      auto It = HeapAllocs.find(DA);
-      if (It != HeapAllocs.end())
-        Result = &It->second;
-      return Result;
+    if (!StepsLeft) {
+      FFDiag(S->getBeginLoc(), diag::note_constexpr_step_limit_exceeded);
+      return false;
     }
+    --StepsLeft;
+    return true;
+  }
 
-    /// Get the allocated storage for the given parameter of the given call.
-    APValue *getParamSlot(CallRef Call, const ParmVarDecl *PVD) {
-      CallStackFrame *Frame = getCallFrameAndDepth(Call.CallIndex).first;
-      return Frame ? Frame->getTemporary(Call.getOrigParam(PVD), Call.Version)
-                   : nullptr;
-    }
+  APValue *createHeapAlloc(const Expr *E, QualType T, LValue &LV);
 
-    /// Information about a stack frame for std::allocator<T>::[de]allocate.
-    struct StdAllocatorCaller {
-      unsigned FrameIndex;
-      QualType ElemType;
-      const Expr *Call;
-      explicit operator bool() const { return FrameIndex != 0; };
-    };
+  std::optional<DynAlloc *> lookupDynamicAlloc(DynamicAllocLValue DA) {
+    std::optional<DynAlloc *> Result;
+    auto It = HeapAllocs.find(DA);
+    if (It != HeapAllocs.end())
+      Result = &It->second;
+    return Result;
+  }
 
-    StdAllocatorCaller getStdAllocatorCaller(StringRef FnName) const {
-      for (const CallStackFrame *Call = CurrentCall; Call != &BottomFrame;
-           Call = Call->Caller) {
-        const auto *MD = dyn_cast_or_null<CXXMethodDecl>(Call->Callee);
-        if (!MD)
-          continue;
-        const IdentifierInfo *FnII = MD->getIdentifier();
-        if (!FnII || !FnII->isStr(FnName))
-          continue;
+  /// Get the allocated storage for the given parameter of the given call.
+  APValue *getParamSlot(CallRef Call, const ParmVarDecl *PVD) {
+    CallStackFrame *Frame = getCallFrameAndDepth(Call.CallIndex).first;
+    return Frame ? Frame->getTemporary(Call.getOrigParam(PVD), Call.Version)
+                 : nullptr;
+  }
 
-        const auto *CTSD =
-            dyn_cast<ClassTemplateSpecializationDecl>(MD->getParent());
-        if (!CTSD)
-          continue;
+  /// Information about a stack frame for std::allocator<T>::[de]allocate.
+  struct StdAllocatorCaller {
+    unsigned FrameIndex;
+    QualType ElemType;
+    const Expr *Call;
+    explicit operator bool() const { return FrameIndex != 0; };
+  };
 
-        const IdentifierInfo *ClassII = CTSD->getIdentifier();
-        const TemplateArgumentList &TAL = CTSD->getTemplateArgs();
-        if (CTSD->isInStdNamespace() && ClassII &&
-            ClassII->isStr("allocator") && TAL.size() >= 1 &&
-            TAL[0].getKind() == TemplateArgument::Type)
-          return {Call->Index, TAL[0].getAsType(), Call->CallExpr};
-      }
+  StdAllocatorCaller getStdAllocatorCaller(StringRef FnName) const {
+    for (const CallStackFrame *Call = CurrentCall; Call != &BottomFrame;
+         Call = Call->Caller) {
+      const auto *MD = dyn_cast_or_null<CXXMethodDecl>(Call->Callee);
+      if (!MD)
+        continue;
+      const IdentifierInfo *FnII = MD->getIdentifier();
+      if (!FnII || !FnII->isStr(FnName))
+        continue;
 
-      return {};
-    }
+      const auto *CTSD =
+          dyn_cast<ClassTemplateSpecializationDecl>(MD->getParent());
+      if (!CTSD)
+        continue;
 
-    void performLifetimeExtension() {
-      // Disable the cleanups for lifetime-extended temporaries.
-      llvm::erase_if(CleanupStack, [](Cleanup &C) {
-        return !C.isDestroyedAtEndOf(ScopeKind::FullExpression);
-      });
+      const IdentifierInfo *ClassII = CTSD->getIdentifier();
+      const TemplateArgumentList &TAL = CTSD->getTemplateArgs();
+      if (CTSD->isInStdNamespace() && ClassII && ClassII->isStr("allocator") &&
+          TAL.size() >= 1 && TAL[0].getKind() == TemplateArgument::Type)
+        return {Call->Index, TAL[0].getAsType(), Call->CallExpr};
     }
 
-    /// Throw away any remaining cleanups at the end of evaluation. If any
-    /// cleanups would have had a side-effect, note that as an unmodeled
-    /// side-effect and return false. Otherwise, return true.
-    bool discardCleanups() {
-      for (Cleanup &C : CleanupStack) {
-        if (C.hasSideEffect() && !noteSideEffect()) {
-          CleanupStack.clear();
-          return false;
-        }
+    return {};
+  }
+
+  void performLifetimeExtension() {
+    // Disable the cleanups for lifetime-extended temporaries.
+    llvm::erase_if(CleanupStack, [](Cleanup &C) {
+      return !C.isDestroyedAtEndOf(ScopeKind::FullExpression);
+    });
+  }
+
+  /// Throw away any remaining cleanups at the end of evaluation. If any
+  /// cleanups would have had a side-effect, note that as an unmodeled
+  /// side-effect and return false. Otherwise, return true.
+  bool discardCleanups() {
+    for (Cleanup &C : CleanupStack) {
+      if (C.hasSideEffect() && !noteSideEffect()) {
+        CleanupStack.clear();
+        return false;
       }
-      CleanupStack.clear();
-      return true;
     }
+    CleanupStack.clear();
+    return true;
+  }
 
-  private:
-    const interp::Frame *getCurrentFrame() override { return CurrentCall; }
-    const interp::Frame *getBottomFrame() const override { return &BottomFrame; }
+private:
+  const interp::Frame *getCurrentFrame() override { return CurrentCall; }
+  const interp::Frame *getBottomFrame() const override { return &BottomFrame; }
 
-    unsigned getCallStackDepth() override { return CallStackDepth; }
-    bool stepsLeft() const override { return StepsLeft > 0; }
+  unsigned getCallStackDepth() override { return CallStackDepth; }
+  bool stepsLeft() const override { return StepsLeft > 0; }
 
-  public:
-    /// Notes that we failed to evaluate an expression that other expressions
-    /// directly depend on, and determine if we should keep evaluating. This
-    /// should only be called if we actually intend to keep evaluating.
-    ///
-    /// Call noteSideEffect() instead if we may be able to ignore the value that
-    /// we failed to evaluate, e.g. if we failed to evaluate Foo() in:
-    ///
-    /// (Foo(), 1)      // use noteSideEffect
-    /// (Foo() || true) // use noteSideEffect
-    /// Foo() + 1       // use noteFailure
-    [[nodiscard]] bool noteFailure() {
-      // Failure when evaluating some expression often means there is some
-      // subexpression whose evaluation was skipped. Therefore, (because we
-      // don't track whether we skipped an expression when unwinding after an
-      // evaluation failure) every evaluation failure that bubbles up from a
-      // subexpression implies that a side-effect has potentially happened. We
-      // skip setting the HasSideEffects flag to true until we decide to
-      // continue evaluating after that point, which happens here.
-      bool KeepGoing = keepEvaluatingAfterFailure();
-      EvalStatus.HasSideEffects |= KeepGoing;
-      return KeepGoing;
-    }
-
-    class ArrayInitLoopIndex {
-      EvalInfo &Info;
-      uint64_t OuterIndex;
+public:
+  /// Notes that we failed to evaluate an expression that other expressions
+  /// directly depend on, and determine if we should keep evaluating. This
+  /// should only be called if we actually intend to keep evaluating.
+  ///
+  /// Call noteSideEffect() instead if we may be able to ignore the value that
+  /// we failed to evaluate, e.g. if we failed to evaluate Foo() in:
+  ///
+  /// (Foo(), 1)      // use noteSideEffect
+  /// (Foo() || true) // use noteSideEffect
+  /// Foo() + 1       // use noteFailure
+  [[nodiscard]] bool noteFailure() {
+    // Failure when evaluating some expression often means there is some
+    // subexpression whose evaluation was skipped. Therefore, (because we
+    // don't track whether we skipped an expression when unwinding after an
+    // evaluation failure) every evaluation failure that bubbles up from a
+    // subexpression implies that a side-effect has potentially happened. We
+    // skip setting the HasSideEffects flag to true until we decide to
+    // continue evaluating after that point, which happens here.
+    bool KeepGoing = keepEvaluatingAfterFailure();
+    EvalStatus.HasSideEffects |= KeepGoing;
+    return KeepGoing;
+  }
+
+  class ArrayInitLoopIndex {
+    EvalInfo &Info;
+    uint64_t OuterIndex;
 
-    public:
-      ArrayInitLoopIndex(EvalInfo &Info)
-          : Info(Info), OuterIndex(Info.ArrayInitIndex) {
-        Info.ArrayInitIndex = 0;
-      }
-      ~ArrayInitLoopIndex() { Info.ArrayInitIndex = OuterIndex; }
+  public:
+    ArrayInitLoopIndex(EvalInfo &Info)
+        : Info(Info), OuterIndex(Info.ArrayInitIndex) {
+      Info.ArrayInitIndex = 0;
+    }
+    ~ArrayInitLoopIndex() { Info.ArrayInitIndex = OuterIndex; }
 
-      operator uint64_t&() { return Info.ArrayInitIndex; }
-    };
+    operator uint64_t &() { return Info.ArrayInitIndex; }
   };
+};
 
-  /// Object used to treat all foldable expressions as constant expressions.
-  struct FoldConstant {
-    EvalInfo &Info;
-    bool Enabled;
-    bool HadNoPriorDiags;
-    EvaluationMode OldMode;
+/// Object used to treat all foldable expressions as constant expressions.
+struct FoldConstant {
+  EvalInfo &Info;
+  bool Enabled;
+  bool HadNoPriorDiags;
+  EvaluationMode OldMode;
 
-    explicit FoldConstant(EvalInfo &Info, bool Enabled)
-      : Info(Info),
-        Enabled(Enabled),
-        HadNoPriorDiags(Info.EvalStatus.Diag &&
-                        Info.EvalStatus.Diag->empty() &&
+  explicit FoldConstant(EvalInfo &Info, bool Enabled)
+      : Info(Info), Enabled(Enabled),
+        HadNoPriorDiags(Info.EvalStatus.Diag && Info.EvalStatus.Diag->empty() &&
                         !Info.EvalStatus.HasSideEffects),
         OldMode(Info.EvalMode) {
-      if (Enabled)
-        Info.EvalMode = EvaluationMode::ConstantFold;
-    }
-    void keepDiagnostics() { Enabled = false; }
-    ~FoldConstant() {
-      if (Enabled && HadNoPriorDiags && !Info.EvalStatus.Diag->empty() &&
-          !Info.EvalStatus.HasSideEffects)
-        Info.EvalStatus.Diag->clear();
-      Info.EvalMode = OldMode;
-    }
-  };
+    if (Enabled)
+      Info.EvalMode = EvaluationMode::ConstantFold;
+  }
+  void keepDiagnostics() { Enabled = false; }
+  ~FoldConstant() {
+    if (Enabled && HadNoPriorDiags && !Info.EvalStatus.Diag->empty() &&
+        !Info.EvalStatus.HasSideEffects)
+      Info.EvalStatus.Diag->clear();
+    Info.EvalMode = OldMode;
+  }
+};
 
-  /// RAII object used to set the current evaluation mode to ignore
-  /// side-effects.
-  struct IgnoreSideEffectsRAII {
-    EvalInfo &Info;
-    EvaluationMode OldMode;
-    explicit IgnoreSideEffectsRAII(EvalInfo &Info)
-        : Info(Info), OldMode(Info.EvalMode) {
-      Info.EvalMode = EvaluationMode::IgnoreSideEffects;
-    }
+/// RAII object used to set the current evaluation mode to ignore
+/// side-effects.
+struct IgnoreSideEffectsRAII {
+  EvalInfo &Info;
+  EvaluationMode OldMode;
+  explicit IgnoreSideEffectsRAII(EvalInfo &Info)
+      : Info(Info), OldMode(Info.EvalMode) {
+    Info.EvalMode = EvaluationMode::IgnoreSideEffects;
+  }
 
-    ~IgnoreSideEffectsRAII() { Info.EvalMode = OldMode; }
-  };
+  ~IgnoreSideEffectsRAII() { Info.EvalMode = OldMode; }
+};
 
-  /// RAII object used to optionally suppress diagnostics and side-effects from
-  /// a speculative evaluation.
-  class SpeculativeEvaluationRAII {
-    EvalInfo *Info = nullptr;
-    Expr::EvalStatus OldStatus;
-    unsigned OldSpeculativeEvaluationDepth = 0;
+/// RAII object used to optionally suppress diagnostics and side-effects from
+/// a speculative evaluation.
+class SpeculativeEvaluationRAII {
+  EvalInfo *Info = nullptr;
+  Expr::EvalStatus OldStatus;
+  unsigned OldSpeculativeEvaluationDepth = 0;
 
-    void moveFromAndCancel(SpeculativeEvaluationRAII &&Other) {
-      Info = Other.Info;
-      OldStatus = Other.OldStatus;
-      OldSpeculativeEvaluationDepth = Other.OldSpeculativeEvaluationDepth;
-      Other.Info = nullptr;
-    }
+  void moveFromAndCancel(SpeculativeEvaluationRAII &&Other) {
+    Info = Other.Info;
+    OldStatus = Other.OldStatus;
+    OldSpeculativeEvaluationDepth = Other.OldSpeculativeEvaluationDepth;
+    Other.Info = nullptr;
+  }
 
-    void maybeRestoreState() {
-      if (!Info)
-        return;
+  void maybeRestoreState() {
+    if (!Info)
+      return;
 
-      Info->EvalStatus = OldStatus;
-      Info->SpeculativeEvaluationDepth = OldSpeculativeEvaluationDepth;
-    }
+    Info->EvalStatus = OldStatus;
+    Info->SpeculativeEvaluationDepth = OldSpeculativeEvaluationDepth;
+  }
 
-  public:
-    SpeculativeEvaluationRAII() = default;
+public:
+  SpeculativeEvaluationRAII() = default;
 
-    SpeculativeEvaluationRAII(
-        EvalInfo &Info, SmallVectorImpl<PartialDiagnosticAt> *NewDiag = nullptr)
-        : Info(&Info), OldStatus(Info.EvalStatus),
-          OldSpeculativeEvaluationDepth(Info.SpeculativeEvaluationDepth) {
-      Info.EvalStatus.Diag = NewDiag;
-      Info.SpeculativeEvaluationDepth = Info.CallStackDepth + 1;
-    }
+  SpeculativeEvaluationRAII(
+      EvalInfo &Info, SmallVectorImpl<PartialDiagnosticAt> *NewDiag = nullptr)
+      : Info(&Info), OldStatus(Info.EvalStatus),
+        OldSpeculativeEvaluationDepth(Info.SpeculativeEvaluationDepth) {
+    Info.EvalStatus.Diag = NewDiag;
+    Info.SpeculativeEvaluationDepth = Info.CallStackDepth + 1;
+  }
 
-    SpeculativeEvaluationRAII(const SpeculativeEvaluationRAII &Other) = delete;
-    SpeculativeEvaluationRAII(SpeculativeEvaluationRAII &&Other) {
-      moveFromAndCancel(std::move(Other));
-    }
+  SpeculativeEvaluationRAII(const SpeculativeEvaluationRAII &Other) = delete;
+  SpeculativeEvaluationRAII(SpeculativeEvaluationRAII &&Other) {
+    moveFromAndCancel(std::move(Other));
+  }
 
-    SpeculativeEvaluationRAII &operator=(SpeculativeEvaluationRAII &&Other) {
-      maybeRestoreState();
-      moveFromAndCancel(std::move(Other));
-      return *this;
-    }
+  SpeculativeEvaluationRAII &operator=(SpeculativeEvaluationRAII &&Other) {
+    maybeRestoreState();
+    moveFromAndCancel(std::move(Other));
+    return *this;
+  }
 
-    ~SpeculativeEvaluationRAII() { maybeRestoreState(); }
-  };
+  ~SpeculativeEvaluationRAII() { maybeRestoreState(); }
+};
 
-  /// RAII object wrapping a full-expression or block scope, and handling
-  /// the ending of the lifetime of temporaries created within it.
-  template<ScopeKind Kind>
-  class ScopeRAII {
-    EvalInfo &Info;
-    unsigned OldStackSize;
-  public:
-    ScopeRAII(EvalInfo &Info)
-        : Info(Info), OldStackSize(Info.CleanupStack.size()) {
-      // Push a new temporary version. This is needed to distinguish between
-      // temporaries created in different iterations of a loop.
-      Info.CurrentCall->pushTempVersion();
-    }
-    bool destroy(bool RunDestructors = true) {
-      bool OK = cleanup(Info, RunDestructors, OldStackSize);
-      OldStackSize = std::numeric_limits<unsigned>::max();
-      return OK;
-    }
-    ~ScopeRAII() {
-      if (OldStackSize != std::numeric_limits<unsigned>::max())
-        destroy(false);
-      // Body moved to a static method to encourage the compiler to inline away
-      // instances of this class.
-      Info.CurrentCall->popTempVersion();
-    }
-  private:
-    static bool cleanup(EvalInfo &Info, bool RunDestructors,
-                        unsigned OldStackSize) {
-      assert(OldStackSize <= Info.CleanupStack.size() &&
-             "running cleanups out of order?");
+/// RAII object wrapping a full-expression or block scope, and handling
+/// the ending of the lifetime of temporaries created within it.
+template <ScopeKind Kind> class ScopeRAII {
+  EvalInfo &Info;
+  unsigned OldStackSize;
 
-      // Run all cleanups for a block scope, and non-lifetime-extended cleanups
-      // for a full-expression scope.
-      bool Success = true;
-      for (unsigned I = Info.CleanupStack.size(); I > OldStackSize; --I) {
-        if (Info.CleanupStack[I - 1].isDestroyedAtEndOf(Kind)) {
-          if (!Info.CleanupStack[I - 1].endLifetime(Info, RunDestructors)) {
-            Success = false;
-            break;
-          }
+public:
+  ScopeRAII(EvalInfo &Info)
+      : Info(Info), OldStackSize(Info.CleanupStack.size()) {
+    // Push a new temporary version. This is needed to distinguish between
+    // temporaries created in different iterations of a loop.
+    Info.CurrentCall->pushTempVersion();
+  }
+  bool destroy(bool RunDestructors = true) {
+    bool OK = cleanup(Info, RunDestructors, OldStackSize);
+    OldStackSize = std::numeric_limits<unsigned>::max();
+    return OK;
+  }
+  ~ScopeRAII() {
+    if (OldStackSize != std::numeric_limits<unsigned>::max())
+      destroy(false);
+    // Body moved to a static method to encourage the compiler to inline away
+    // instances of this class.
+    Info.CurrentCall->popTempVersion();
+  }
+
+private:
+  static bool cleanup(EvalInfo &Info, bool RunDestructors,
+                      unsigned OldStackSize) {
+    assert(OldStackSize <= Info.CleanupStack.size() &&
+           "running cleanups out of order?");
+
+    // Run all cleanups for a block scope, and non-lifetime-extended cleanups
+    // for a full-expression scope.
+    bool Success = true;
+    for (unsigned I = Info.CleanupStack.size(); I > OldStackSize; --I) {
+      if (Info.CleanupStack[I - 1].isDestroyedAtEndOf(Kind)) {
+        if (!Info.CleanupStack[I - 1].endLifetime(Info, RunDestructors)) {
+          Success = false;
+          break;
         }
       }
-
-      // Compact any retained cleanups.
-      auto NewEnd = Info.CleanupStack.begin() + OldStackSize;
-      if (Kind != ScopeKind::Block)
-        NewEnd =
-            std::remove_if(NewEnd, Info.CleanupStack.end(), [](Cleanup &C) {
-              return C.isDestroyedAtEndOf(Kind);
-            });
-      Info.CleanupStack.erase(NewEnd, Info.CleanupStack.end());
-      return Success;
     }
-  };
-  typedef ScopeRAII<ScopeKind::Block> BlockScopeRAII;
-  typedef ScopeRAII<ScopeKind::FullExpression> FullExpressionRAII;
-  typedef ScopeRAII<ScopeKind::Call> CallScopeRAII;
-}
+
+    // Compact any retained cleanups.
+    auto NewEnd = Info.CleanupStack.begin() + OldStackSize;
+    if (Kind != ScopeKind::Block)
+      NewEnd = std::remove_if(NewEnd, Info.CleanupStack.end(), [](Cleanup &C) {
+        return C.isDestroyedAtEndOf(Kind);
+      });
+    Info.CleanupStack.erase(NewEnd, Info.CleanupStack.end());
+    return Success;
+  }
+};
+typedef ScopeRAII<ScopeKind::Block> BlockScopeRAII;
+typedef ScopeRAII<ScopeKind::FullExpression> FullExpressionRAII;
+typedef ScopeRAII<ScopeKind::Call> CallScopeRAII;
+} // namespace
 
 bool SubobjectDesignator::checkSubobject(EvalInfo &Info, const Expr *E,
                                          CheckSubobjectKind CSK) {
   if (Invalid)
     return false;
   if (isOnePastTheEnd()) {
-    Info.CCEDiag(E, diag::note_constexpr_past_end_subobject)
-      << CSK;
+    Info.CCEDiag(E, diag::note_constexpr_past_end_subobject) << CSK;
     setInvalid();
     return false;
   }
@@ -1305,11 +1279,9 @@ void SubobjectDesignator::diagnosePointerArithmetic(EvalInfo &Info,
   // the most derived array.
   if (MostDerivedPathLength == Entries.size() && MostDerivedIsArrayElement)
     Info.CCEDiag(E, diag::note_constexpr_array_index)
-      << N << /*array*/ 0
-      << static_cast<unsigned>(getMostDerivedArraySize());
+        << N << /*array*/ 0 << static_cast<unsigned>(getMostDerivedArraySize());
   else
-    Info.CCEDiag(E, diag::note_constexpr_array_index)
-      << N << /*non-array*/ 1;
+    Info.CCEDiag(E, diag::note_constexpr_array_index) << N << /*non-array*/ 1;
   setInvalid();
 }
 
@@ -1392,322 +1364,314 @@ static bool isValidIndeterminateAccess(AccessKinds AK) {
 }
 
 namespace {
-  struct ComplexValue {
-  private:
-    bool IsInt;
+struct ComplexValue {
+private:
+  bool IsInt;
 
-  public:
-    APSInt IntReal, IntImag;
-    APFloat FloatReal, FloatImag;
+public:
+  APSInt IntReal, IntImag;
+  APFloat FloatReal, FloatImag;
 
-    ComplexValue() : FloatReal(APFloat::Bogus()), FloatImag(APFloat::Bogus()) {}
+  ComplexValue() : FloatReal(APFloat::Bogus()), FloatImag(APFloat::Bogus()) {}
 
-    void makeComplexFloat() { IsInt = false; }
-    bool isComplexFloat() const { return !IsInt; }
-    APFloat &getComplexFloatReal() { return FloatReal; }
-    APFloat &getComplexFloatImag() { return FloatImag; }
+  void makeComplexFloat() { IsInt = false; }
+  bool isComplexFloat() const { return !IsInt; }
+  APFloat &getComplexFloatReal() { return FloatReal; }
+  APFloat &getComplexFloatImag() { return FloatImag; }
 
-    void makeComplexInt() { IsInt = true; }
-    bool isComplexInt() const { return IsInt; }
-    APSInt &getComplexIntReal() { return IntReal; }
-    APSInt &getComplexIntImag() { return IntImag; }
+  void makeComplexInt() { IsInt = true; }
+  bool isComplexInt() const { return IsInt; }
+  APSInt &getComplexIntReal() { return IntReal; }
+  APSInt &getComplexIntImag() { return IntImag; }
 
-    void moveInto(APValue &v) const {
-      if (isComplexFloat())
-        v = APValue(FloatReal, FloatImag);
-      else
-        v = APValue(IntReal, IntImag);
-    }
-    void setFrom(const APValue &v) {
-      assert(v.isComplexFloat() || v.isComplexInt());
-      if (v.isComplexFloat()) {
-        makeComplexFloat();
-        FloatReal = v.getComplexFloatReal();
-        FloatImag = v.getComplexFloatImag();
-      } else {
-        makeComplexInt();
-        IntReal = v.getComplexIntReal();
-        IntImag = v.getComplexIntImag();
-      }
+  void moveInto(APValue &v) const {
+    if (isComplexFloat())
+      v = APValue(FloatReal, FloatImag);
+    else
+      v = APValue(IntReal, IntImag);
+  }
+  void setFrom(const APValue &v) {
+    assert(v.isComplexFloat() || v.isComplexInt());
+    if (v.isComplexFloat()) {
+      makeComplexFloat();
+      FloatReal = v.getComplexFloatReal();
+      FloatImag = v.getComplexFloatImag();
+    } else {
+      makeComplexInt();
+      IntReal = v.getComplexIntReal();
+      IntImag = v.getComplexIntImag();
     }
-  };
+  }
+};
 
-  struct LValue {
-    APValue::LValueBase Base;
-    CharUnits Offset;
-    SubobjectDesignator Designator;
-    bool IsNullPtr : 1;
-    bool InvalidBase : 1;
-    // P2280R4 track if we have an unknown reference or pointer.
-    bool AllowConstexprUnknown = false;
-
-    const APValue::LValueBase getLValueBase() const { return Base; }
-    bool allowConstexprUnknown() const { return AllowConstexprUnknown; }
-    CharUnits &getLValueOffset() { return Offset; }
-    const CharUnits &getLValueOffset() const { return Offset; }
-    SubobjectDesignator &getLValueDesignator() { return Designator; }
-    const SubobjectDesignator &getLValueDesignator() const { return Designator;}
-    bool isNullPointer() const { return IsNullPtr;}
-
-    unsigned getLValueCallIndex() const { return Base.getCallIndex(); }
-    unsigned getLValueVersion() const { return Base.getVersion(); }
-
-    void moveInto(APValue &V) const {
-      if (Designator.Invalid)
-        V = APValue(Base, Offset, APValue::NoLValuePath(), IsNullPtr);
-      else {
-        assert(!InvalidBase && "APValues can't handle invalid LValue bases");
-        V = APValue(Base, Offset, Designator.Entries,
-                    Designator.IsOnePastTheEnd, IsNullPtr);
-      }
-      if (AllowConstexprUnknown)
-        V.setConstexprUnknown();
-    }
-    void setFrom(const ASTContext &Ctx, const APValue &V) {
-      assert(V.isLValue() && "Setting LValue from a non-LValue?");
-      Base = V.getLValueBase();
-      Offset = V.getLValueOffset();
-      InvalidBase = false;
-      Designator = SubobjectDesignator(Ctx, V);
-      IsNullPtr = V.isNullPointer();
-      AllowConstexprUnknown = V.allowConstexprUnknown();
+struct LValue {
+  APValue::LValueBase Base;
+  CharUnits Offset;
+  SubobjectDesignator Designator;
+  bool IsNullPtr : 1;
+  bool InvalidBase : 1;
+  // P2280R4 track if we have an unknown reference or pointer.
+  bool AllowConstexprUnknown = false;
+
+  const APValue::LValueBase getLValueBase() const { return Base; }
+  bool allowConstexprUnknown() const { return AllowConstexprUnknown; }
+  CharUnits &getLValueOffset() { return Offset; }
+  const CharUnits &getLValueOffset() const { return Offset; }
+  SubobjectDesignator &getLValueDesignator() { return Designator; }
+  const SubobjectDesignator &getLValueDesignator() const { return Designator; }
+  bool isNullPointer() const { return IsNullPtr; }
+
+  unsigned getLValueCallIndex() const { return Base.getCallIndex(); }
+  unsigned getLValueVersion() const { return Base.getVersion(); }
+
+  void moveInto(APValue &V) const {
+    if (Designator.Invalid)
+      V = APValue(Base, Offset, APValue::NoLValuePath(), IsNullPtr);
+    else {
+      assert(!InvalidBase && "APValues can't handle invalid LValue bases");
+      V = APValue(Base, Offset, Designator.Entries, Designator.IsOnePastTheEnd,
+                  IsNullPtr);
     }
+    if (AllowConstexprUnknown)
+      V.setConstexprUnknown();
+  }
+  void setFrom(const ASTContext &Ctx, const APValue &V) {
+    assert(V.isLValue() && "Setting LValue from a non-LValue?");
+    Base = V.getLValueBase();
+    Offset = V.getLValueOffset();
+    InvalidBase = false;
+    Designator = SubobjectDesignator(Ctx, V);
+    IsNullPtr = V.isNullPointer();
+    AllowConstexprUnknown = V.allowConstexprUnknown();
+  }
 
-    void set(APValue::LValueBase B, bool BInvalid = false) {
+  void set(APValue::LValueBase B, bool BInvalid = false) {
 #ifndef NDEBUG
-      // We only allow a few types of invalid bases. Enforce that here.
-      if (BInvalid) {
-        const auto *E = B.get<const Expr *>();
-        assert((isa<MemberExpr>(E) || tryUnwrapAllocSizeCall(E)) &&
-               "Unexpected type of invalid base");
-      }
+    // We only allow a few types of invalid bases. Enforce that here.
+    if (BInvalid) {
+      const auto *E = B.get<const Expr *>();
+      assert((isa<MemberExpr>(E) || tryUnwrapAllocSizeCall(E)) &&
+             "Unexpected type of invalid base");
+    }
 #endif
 
-      Base = B;
-      Offset = CharUnits::fromQuantity(0);
-      InvalidBase = BInvalid;
-      Designator = SubobjectDesignator(getType(B));
-      IsNullPtr = false;
-      AllowConstexprUnknown = false;
-    }
+    Base = B;
+    Offset = CharUnits::fromQuantity(0);
+    InvalidBase = BInvalid;
+    Designator = SubobjectDesignator(getType(B));
+    IsNullPtr = false;
+    AllowConstexprUnknown = false;
+  }
 
-    void setNull(ASTContext &Ctx, QualType PointerTy) {
-      Base = (const ValueDecl *)nullptr;
-      Offset =
-          CharUnits::fromQuantity(Ctx.getTargetNullPointerValue(PointerTy));
-      InvalidBase = false;
-      Designator = SubobjectDesignator(PointerTy->getPointeeType());
-      IsNullPtr = true;
-      AllowConstexprUnknown = false;
-    }
+  void setNull(ASTContext &Ctx, QualType PointerTy) {
+    Base = (const ValueDecl *)nullptr;
+    Offset = CharUnits::fromQuantity(Ctx.getTargetNullPointerValue(PointerTy));
+    InvalidBase = false;
+    Designator = SubobjectDesignator(PointerTy->getPointeeType());
+    IsNullPtr = true;
+    AllowConstexprUnknown = false;
+  }
 
-    void setInvalid(APValue::LValueBase B, unsigned I = 0) {
-      set(B, true);
-    }
+  void setInvalid(APValue::LValueBase B, unsigned I = 0) { set(B, true); }
 
-    std::string toString(ASTContext &Ctx, QualType T) const {
-      APValue Printable;
-      moveInto(Printable);
-      return Printable.getAsString(Ctx, T);
-    }
+  std::string toString(ASTContext &Ctx, QualType T) const {
+    APValue Printable;
+    moveInto(Printable);
+    return Printable.getAsString(Ctx, T);
+  }
 
-  private:
-    // Check that this LValue is not based on a null pointer. If it is, produce
-    // a diagnostic and mark the designator as invalid.
-    template <typename GenDiagType>
-    bool checkNullPointerDiagnosingWith(const GenDiagType &GenDiag) {
-      if (Designator.Invalid)
-        return false;
-      if (IsNullPtr) {
-        GenDiag();
-        Designator.setInvalid();
-        return false;
-      }
-      return true;
+private:
+  // Check that this LValue is not based on a null pointer. If it is, produce
+  // a diagnostic and mark the designator as invalid.
+  template <typename GenDiagType>
+  bool checkNullPointerDiagnosingWith(const GenDiagType &GenDiag) {
+    if (Designator.Invalid)
+      return false;
+    if (IsNullPtr) {
+      GenDiag();
+      Designator.setInvalid();
+      return false;
     }
+    return true;
+  }
 
-  public:
-    bool checkNullPointer(EvalInfo &Info, const Expr *E,
-                          CheckSubobjectKind CSK) {
-      return checkNullPointerDiagnosingWith([&Info, E, CSK] {
-        Info.CCEDiag(E, diag::note_constexpr_null_subobject) << CSK;
-      });
-    }
+public:
+  bool checkNullPointer(EvalInfo &Info, const Expr *E, CheckSubobjectKind CSK) {
+    return checkNullPointerDiagnosingWith([&Info, E, CSK] {
+      Info.CCEDiag(E, diag::note_constexpr_null_subobject) << CSK;
+    });
+  }
 
-    bool checkNullPointerForFoldAccess(EvalInfo &Info, const Expr *E,
-                                       AccessKinds AK) {
-      return checkNullPointerDiagnosingWith([&Info, E, AK] {
-        if (AK == AccessKinds::AK_Dereference)
-          Info.FFDiag(E, diag::note_constexpr_dereferencing_null);
-        else
-          Info.FFDiag(E, diag::note_constexpr_access_null) << AK;
-      });
-    }
+  bool checkNullPointerForFoldAccess(EvalInfo &Info, const Expr *E,
+                                     AccessKinds AK) {
+    return checkNullPointerDiagnosingWith([&Info, E, AK] {
+      if (AK == AccessKinds::AK_Dereference)
+        Info.FFDiag(E, diag::note_constexpr_dereferencing_null);
+      else
+        Info.FFDiag(E, diag::note_constexpr_access_null) << AK;
+    });
+  }
 
-    // Check this LValue refers to an object. If not, set the designator to be
-    // invalid and emit a diagnostic.
-    bool checkSubobject(EvalInfo &Info, const Expr *E, CheckSubobjectKind CSK) {
-      return (CSK == CSK_ArrayToPointer || checkNullPointer(Info, E, CSK)) &&
-             Designator.checkSubobject(Info, E, CSK);
-    }
+  // Check this LValue refers to an object. If not, set the designator to be
+  // invalid and emit a diagnostic.
+  bool checkSubobject(EvalInfo &Info, const Expr *E, CheckSubobjectKind CSK) {
+    return (CSK == CSK_ArrayToPointer || checkNullPointer(Info, E, CSK)) &&
+           Designator.checkSubobject(Info, E, CSK);
+  }
 
-    void addDecl(EvalInfo &Info, const Expr *E,
-                 const Decl *D, bool Virtual = false) {
-      if (checkSubobject(Info, E, isa<FieldDecl>(D) ? CSK_Field : CSK_Base))
-        Designator.addDeclUnchecked(D, Virtual);
-    }
-    void addUnsizedArray(EvalInfo &Info, const Expr *E, QualType ElemTy) {
-      if (!Designator.Entries.empty()) {
-        Info.CCEDiag(E, diag::note_constexpr_unsupported_unsized_array);
-        Designator.setInvalid();
-        return;
-      }
-      if (checkSubobject(Info, E, CSK_ArrayToPointer)) {
-        assert(getType(Base).getNonReferenceType()->isPointerType() ||
-               getType(Base).getNonReferenceType()->isArrayType());
-        Designator.FirstEntryIsAnUnsizedArray = true;
-        Designator.addUnsizedArrayUnchecked(ElemTy);
-      }
-    }
-    void addArray(EvalInfo &Info, const Expr *E, const ConstantArrayType *CAT) {
-      if (checkSubobject(Info, E, CSK_ArrayToPointer))
-        Designator.addArrayUnchecked(CAT);
-    }
-    void addComplex(EvalInfo &Info, const Expr *E, QualType EltTy, bool Imag) {
-      if (checkSubobject(Info, E, Imag ? CSK_Imag : CSK_Real))
-        Designator.addComplexUnchecked(EltTy, Imag);
-    }
-    void addVectorElement(EvalInfo &Info, const Expr *E, QualType EltTy,
-                          uint64_t Size, uint64_t Idx) {
-      if (checkSubobject(Info, E, CSK_VectorElement))
-        Designator.addVectorElementUnchecked(EltTy, Size, Idx);
+  void addDecl(EvalInfo &Info, const Expr *E, const Decl *D,
+               bool Virtual = false) {
+    if (checkSubobject(Info, E, isa<FieldDecl>(D) ? CSK_Field : CSK_Base))
+      Designator.addDeclUnchecked(D, Virtual);
+  }
+  void addUnsizedArray(EvalInfo &Info, const Expr *E, QualType ElemTy) {
+    if (!Designator.Entries.empty()) {
+      Info.CCEDiag(E, diag::note_constexpr_unsupported_unsized_array);
+      Designator.setInvalid();
+      return;
     }
-    void clearIsNullPointer() {
-      IsNullPtr = false;
+    if (checkSubobject(Info, E, CSK_ArrayToPointer)) {
+      assert(getType(Base).getNonReferenceType()->isPointerType() ||
+             getType(Base).getNonReferenceType()->isArrayType());
+      Designator.FirstEntryIsAnUnsizedArray = true;
+      Designator.addUnsizedArrayUnchecked(ElemTy);
     }
-    void adjustOffsetAndIndex(EvalInfo &Info, const Expr *E,
-                              const APSInt &Index, CharUnits ElementSize) {
-      // An index of 0 has no effect. (In C, adding 0 to a null pointer is UB,
-      // but we're not required to diagnose it and it's valid in C++.)
-      if (!Index)
-        return;
-
-      // Compute the new offset in the appropriate width, wrapping at 64 bits.
-      // FIXME: When compiling for a 32-bit target, we should use 32-bit
-      // offsets.
-      uint64_t Offset64 = Offset.getQuantity();
-      uint64_t ElemSize64 = ElementSize.getQuantity();
-      uint64_t Index64 = Index.extOrTrunc(64).getZExtValue();
-      Offset = CharUnits::fromQuantity(Offset64 + ElemSize64 * Index64);
+  }
+  void addArray(EvalInfo &Info, const Expr *E, const ConstantArrayType *CAT) {
+    if (checkSubobject(Info, E, CSK_ArrayToPointer))
+      Designator.addArrayUnchecked(CAT);
+  }
+  void addComplex(EvalInfo &Info, const Expr *E, QualType EltTy, bool Imag) {
+    if (checkSubobject(Info, E, Imag ? CSK_Imag : CSK_Real))
+      Designator.addComplexUnchecked(EltTy, Imag);
+  }
+  void addVectorElement(EvalInfo &Info, const Expr *E, QualType EltTy,
+                        uint64_t Size, uint64_t Idx) {
+    if (checkSubobject(Info, E, CSK_VectorElement))
+      Designator.addVectorElementUnchecked(EltTy, Size, Idx);
+  }
+  void clearIsNullPointer() { IsNullPtr = false; }
+  void adjustOffsetAndIndex(EvalInfo &Info, const Expr *E, const APSInt &Index,
+                            CharUnits ElementSize) {
+    // An index of 0 has no effect. (In C, adding 0 to a null pointer is UB,
+    // but we're not required to diagnose it and it's valid in C++.)
+    if (!Index)
+      return;
 
-      if (checkNullPointer(Info, E, CSK_ArrayIndex))
-        Designator.adjustIndex(Info, E, Index, *this);
+    // Compute the new offset in the appropriate width, wrapping at 64 bits.
+    // FIXME: When compiling for a 32-bit target, we should use 32-bit
+    // offsets.
+    uint64_t Offset64 = Offset.getQuantity();
+    uint64_t ElemSize64 = ElementSize.getQuantity();
+    uint64_t Index64 = Index.extOrTrunc(64).getZExtValue();
+    Offset = CharUnits::fromQuantity(Offset64 + ElemSize64 * Index64);
+
+    if (checkNullPointer(Info, E, CSK_ArrayIndex))
+      Designator.adjustIndex(Info, E, Index, *this);
+    clearIsNullPointer();
+  }
+  void adjustOffset(CharUnits N) {
+    Offset += N;
+    if (N.getQuantity())
       clearIsNullPointer();
-    }
-    void adjustOffset(CharUnits N) {
-      Offset += N;
-      if (N.getQuantity())
-        clearIsNullPointer();
-    }
-  };
+  }
+};
 
-  struct MemberPtr {
-    MemberPtr() {}
-    explicit MemberPtr(const ValueDecl *Decl)
-        : DeclAndIsDerivedMember(Decl, false) {}
-
-    /// The member or (direct or indirect) field referred to by this member
-    /// pointer, or 0 if this is a null member pointer.
-    const ValueDecl *getDecl() const {
-      return DeclAndIsDerivedMember.getPointer();
-    }
-    /// Is this actually a member of some type derived from the relevant class?
-    bool isDerivedMember() const {
-      return DeclAndIsDerivedMember.getInt();
-    }
-    /// Get the class which the declaration actually lives in.
-    const CXXRecordDecl *getContainingRecord() const {
-      return cast<CXXRecordDecl>(
-          DeclAndIsDerivedMember.getPointer()->getDeclContext());
-    }
-
-    void moveInto(APValue &V) const {
-      V = APValue(getDecl(), isDerivedMember(), Path);
-    }
-    void setFrom(const APValue &V) {
-      assert(V.isMemberPointer());
-      DeclAndIsDerivedMember.setPointer(V.getMemberPointerDecl());
-      DeclAndIsDerivedMember.setInt(V.isMemberPointerToDerivedMember());
-      Path.clear();
-      llvm::append_range(Path, V.getMemberPointerPath());
-    }
-
-    /// DeclAndIsDerivedMember - The member declaration, and a flag indicating
-    /// whether the member is a member of some class derived from the class type
-    /// of the member pointer.
-    llvm::PointerIntPair<const ValueDecl*, 1, bool> DeclAndIsDerivedMember;
-    /// Path - The path of base/derived classes from the member declaration's
-    /// class (exclusive) to the class type of the member pointer (inclusive).
-    SmallVector<const CXXRecordDecl*, 4> Path;
-
-    /// Perform a cast towards the class of the Decl (either up or down the
-    /// hierarchy).
-    bool castBack(const CXXRecordDecl *Class) {
-      assert(!Path.empty());
-      const CXXRecordDecl *Expected;
-      if (Path.size() >= 2)
-        Expected = Path[Path.size() - 2];
-      else
-        Expected = getContainingRecord();
-      if (Expected->getCanonicalDecl() != Class->getCanonicalDecl()) {
-        // C++11 [expr.static.cast]p12: In a conversion from (D::*) to (B::*),
-        // if B does not contain the original member and is not a base or
-        // derived class of the class containing the original member, the result
-        // of the cast is undefined.
-        // C++11 [conv.mem]p2 does not cover this case for a cast from (B::*) to
-        // (D::*). We consider that to be a language defect.
-        return false;
-      }
-      Path.pop_back();
-      return true;
+struct MemberPtr {
+  MemberPtr() {}
+  explicit MemberPtr(const ValueDecl *Decl)
+      : DeclAndIsDerivedMember(Decl, false) {}
+
+  /// The member or (direct or indirect) field referred to by this member
+  /// pointer, or 0 if this is a null member pointer.
+  const ValueDecl *getDecl() const {
+    return DeclAndIsDerivedMember.getPointer();
+  }
+  /// Is this actually a member of some type derived from the relevant class?
+  bool isDerivedMember() const { return DeclAndIsDerivedMember.getInt(); }
+  /// Get the class which the declaration actually lives in.
+  const CXXRecordDecl *getContainingRecord() const {
+    return cast<CXXRecordDecl>(
+        DeclAndIsDerivedMember.getPointer()->getDeclContext());
+  }
+
+  void moveInto(APValue &V) const {
+    V = APValue(getDecl(), isDerivedMember(), Path);
+  }
+  void setFrom(const APValue &V) {
+    assert(V.isMemberPointer());
+    DeclAndIsDerivedMember.setPointer(V.getMemberPointerDecl());
+    DeclAndIsDerivedMember.setInt(V.isMemberPointerToDerivedMember());
+    Path.clear();
+    llvm::append_range(Path, V.getMemberPointerPath());
+  }
+
+  /// DeclAndIsDerivedMember - The member declaration, and a flag indicating
+  /// whether the member is a member of some class derived from the class type
+  /// of the member pointer.
+  llvm::PointerIntPair<const ValueDecl *, 1, bool> DeclAndIsDerivedMember;
+  /// Path - The path of base/derived classes from the member declaration's
+  /// class (exclusive) to the class type of the member pointer (inclusive).
+  SmallVector<const CXXRecordDecl *, 4> Path;
+
+  /// Perform a cast towards the class of the Decl (either up or down the
+  /// hierarchy).
+  bool castBack(const CXXRecordDecl *Class) {
+    assert(!Path.empty());
+    const CXXRecordDecl *Expected;
+    if (Path.size() >= 2)
+      Expected = Path[Path.size() - 2];
+    else
+      Expected = getContainingRecord();
+    if (Expected->getCanonicalDecl() != Class->getCanonicalDecl()) {
+      // C++11 [expr.static.cast]p12: In a conversion from (D::*) to (B::*),
+      // if B does not contain the original member and is not a base or
+      // derived class of the class containing the original member, the result
+      // of the cast is undefined.
+      // C++11 [conv.mem]p2 does not cover this case for a cast from (B::*) to
+      // (D::*). We consider that to be a language defect.
+      return false;
     }
-    /// Perform a base-to-derived member pointer cast.
-    bool castToDerived(const CXXRecordDecl *Derived) {
-      if (!getDecl())
-        return true;
-      if (!isDerivedMember()) {
-        Path.push_back(Derived);
-        return true;
-      }
-      if (!castBack(Derived))
-        return false;
-      if (Path.empty())
-        DeclAndIsDerivedMember.setInt(false);
+    Path.pop_back();
+    return true;
+  }
+  /// Perform a base-to-derived member pointer cast.
+  bool castToDerived(const CXXRecordDecl *Derived) {
+    if (!getDecl())
+      return true;
+    if (!isDerivedMember()) {
+      Path.push_back(Derived);
       return true;
     }
-    /// Perform a derived-to-base member pointer cast.
-    bool castToBase(const CXXRecordDecl *Base) {
-      if (!getDecl())
-        return true;
-      if (Path.empty())
-        DeclAndIsDerivedMember.setInt(true);
-      if (isDerivedMember()) {
-        Path.push_back(Base);
-        return true;
-      }
-      return castBack(Base);
-    }
-  };
-
-  /// Compare two member pointers, which are assumed to be of the same type.
-  static bool operator==(const MemberPtr &LHS, const MemberPtr &RHS) {
-    if (!LHS.getDecl() || !RHS.getDecl())
-      return !LHS.getDecl() && !RHS.getDecl();
-    if (LHS.getDecl()->getCanonicalDecl() != RHS.getDecl()->getCanonicalDecl())
+    if (!castBack(Derived))
       return false;
-    return LHS.Path == RHS.Path;
+    if (Path.empty())
+      DeclAndIsDerivedMember.setInt(false);
+    return true;
   }
+  /// Perform a derived-to-base member pointer cast.
+  bool castToBase(const CXXRecordDecl *Base) {
+    if (!getDecl())
+      return true;
+    if (Path.empty())
+      DeclAndIsDerivedMember.setInt(true);
+    if (isDerivedMember()) {
+      Path.push_back(Base);
+      return true;
+    }
+    return castBack(Base);
+  }
+};
+
+/// Compare two member pointers, which are assumed to be of the same type.
+static bool operator==(const MemberPtr &LHS, const MemberPtr &RHS) {
+  if (!LHS.getDecl() || !RHS.getDecl())
+    return !LHS.getDecl() && !RHS.getDecl();
+  if (LHS.getDecl()->getCanonicalDecl() != RHS.getDecl()->getCanonicalDecl())
+    return false;
+  return LHS.Path == RHS.Path;
 }
+} // namespace
 
 void SubobjectDesignator::adjustIndex(EvalInfo &Info, const Expr *E, APSInt N,
                                       const LValue &LV) {
@@ -1758,9 +1722,8 @@ void SubobjectDesignator::adjustIndex(EvalInfo &Info, const Expr *E, APSInt N,
 }
 
 static bool Evaluate(APValue &Result, EvalInfo &Info, const Expr *E);
-static bool EvaluateInPlace(APValue &Result, EvalInfo &Info,
-                            const LValue &This, const Expr *E,
-                            bool AllowNonLiteralTypes = false);
+static bool EvaluateInPlace(APValue &Result, EvalInfo &Info, const LValue &This,
+                            const Expr *E, bool AllowNonLiteralTypes = false);
 static bool EvaluateLValue(const Expr *E, LValue &Result, EvalInfo &Info,
                            bool InvalidBaseOK = false);
 static bool EvaluatePointer(const Expr *E, LValue &Result, EvalInfo &Info,
@@ -1803,7 +1766,7 @@ static void negateAsSigned(APSInt &Int) {
   Int = -Int;
 }
 
-template<typename KeyT>
+template <typename KeyT>
 APValue &CallStackFrame::createTemporary(const KeyT *Key, QualType T,
                                          ScopeKind Scope, LValue &LV) {
   unsigned Version = getTempVersion();
@@ -1878,9 +1841,9 @@ void CallStackFrame::describe(raw_ostream &Out) const {
       Object->printPretty(Out, /*Helper=*/nullptr, Info.Ctx.getPrintingPolicy(),
                           /*Indentation=*/0);
       if (Object->getType()->isPointerType())
-          Out << "->";
+        Out << "->";
       else
-          Out << ".";
+        Out << ".";
     } else if (const auto *OCE =
                    dyn_cast_if_present<CXXOperatorCallExpr>(CallExpr)) {
       OCE->getArg(0)->printPretty(Out, /*Helper=*/nullptr,
@@ -1951,7 +1914,7 @@ static bool IsGlobalLValue(APValue::LValueBase B) {
   if (!B)
     return true;
 
-  if (const ValueDecl *D = B.dyn_cast<const ValueDecl*>()) {
+  if (const ValueDecl *D = B.dyn_cast<const ValueDecl *>()) {
     // ... the address of an object with static storage duration,
     if (const VarDecl *VD = dyn_cast<VarDecl>(D))
       return VD->hasGlobalStorage();
@@ -1966,7 +1929,7 @@ static bool IsGlobalLValue(APValue::LValueBase B) {
   if (B.is<TypeInfoLValue>() || B.is<DynamicAllocLValue>())
     return true;
 
-  const Expr *E = B.get<const Expr*>();
+  const Expr *E = B.get<const Expr *>();
   switch (E->getStmtClass()) {
   default:
     return false;
@@ -2013,7 +1976,7 @@ static bool IsGlobalLValue(APValue::LValueBase B) {
 }
 
 static const ValueDecl *GetLValueBaseDecl(const LValue &LVal) {
-  return LVal.Base.dyn_cast<const ValueDecl*>();
+  return LVal.Base.dyn_cast<const ValueDecl *>();
 }
 
 // Information about an LValueBase that is some kind of string.
@@ -2130,8 +2093,7 @@ static bool HasSameBase(const LValue &A, const LValue &B) {
   if (!B.getLValueBase())
     return false;
 
-  if (A.getLValueBase().getOpaqueValue() !=
-      B.getLValueBase().getOpaqueValue())
+  if (A.getLValueBase().getOpaqueValue() != B.getLValueBase().getOpaqueValue())
     return false;
 
   return A.getLValueCallIndex() == B.getLValueCallIndex() &&
@@ -2140,7 +2102,7 @@ static bool HasSameBase(const LValue &A, const LValue &B) {
 
 static void NoteLValueLocation(EvalInfo &Info, APValue::LValueBase Base) {
   assert(Base && "no location for a null lvalue");
-  const ValueDecl *VD = Base.dyn_cast<const ValueDecl*>();
+  const ValueDecl *VD = Base.dyn_cast<const ValueDecl *>();
 
   // For a parameter, find the corresponding call stack frame (if it still
   // exists), and point at the parameter of the function definition we actually
@@ -2159,7 +2121,7 @@ static void NoteLValueLocation(EvalInfo &Info, APValue::LValueBase Base) {
 
   if (VD)
     Info.Note(VD->getLocation(), diag::note_declared_at);
-  else if (const Expr *E = Base.dyn_cast<const Expr*>())
+  else if (const Expr *E = Base.dyn_cast<const Expr *>())
     Info.Note(E->getExprLoc(), diag::note_constexpr_temporary_here);
   else if (DynamicAllocLValue DA = Base.dyn_cast<DynamicAllocLValue>()) {
     // FIXME: Produce a note for dangling pointers too.
@@ -2201,7 +2163,7 @@ static bool CheckLValueConstantExpression(EvalInfo &Info, SourceLocation Loc,
   const SubobjectDesignator &Designator = LVal.getLValueDesignator();
 
   const Expr *BaseE = Base.dyn_cast<const Expr *>();
-  const ValueDecl *BaseVD = Base.dyn_cast<const ValueDecl*>();
+  const ValueDecl *BaseVD = Base.dyn_cast<const ValueDecl *>();
 
   // Additional restrictions apply in a template argument. We only enforce the
   // C++20 restrictions here; additional syntactic and semantic restrictions
@@ -2363,7 +2325,7 @@ static bool CheckLValueConstantExpression(EvalInfo &Info, SourceLocation Loc,
   // Does this refer one past the end of some object?
   if (!Designator.Invalid && Designator.isOnePastTheEnd()) {
     Info.FFDiag(Loc, diag::note_constexpr_past_end, 1)
-      << !Designator.Entries.empty() << !!BaseVD << BaseVD;
+        << !Designator.Entries.empty() << !!BaseVD << BaseVD;
     NoteLValueLocation(Info, Base);
   }
 
@@ -2419,8 +2381,7 @@ static bool CheckLiteralType(EvalInfo &Info, const Expr *E,
 
   // Prvalue constant expressions must be of literal types.
   if (Info.getLangOpts().CPlusPlus11)
-    Info.FFDiag(E, diag::note_constexpr_nonliteral)
-      << E->getType();
+    Info.FFDiag(E, diag::note_constexpr_nonliteral) << E->getType();
   else
     Info.FFDiag(E, diag::note_invalid_subexpr_in_const_expr);
   return false;
@@ -2474,7 +2435,7 @@ static bool CheckEvaluationResult(CheckEvaluationResultKind CERK,
   }
   if (Value.isStruct()) {
     if (Type->isMetaInfoType())
-        return true;
+      return true;
     auto *RD = Type->castAsRecordDecl();
     if (const CXXRecordDecl *CD = dyn_cast<CXXRecordDecl>(RD)) {
       unsigned BaseIndex = 0;
@@ -2514,7 +2475,8 @@ static bool CheckEvaluationResult(CheckEvaluationResultKind CERK,
 
   if (Value.isMemberPointer() &&
       CERK == CheckEvaluationResultKind::ConstantExpression)
-    return CheckMemberPointerConstantExpression(Info, DiagLoc, Type, Value, Kind);
+    return CheckMemberPointerConstantExpression(Info, DiagLoc, Type, Value,
+                                                Kind);
 
   // Everything else is fine.
   return true;
@@ -2572,7 +2534,7 @@ static bool EvalPointerValueAsBool(const APValue &Value, bool &Result) {
   // We have a non-null base.  These are generally known to be true, but if it's
   // a weak declaration it can be null at runtime.
   Result = true;
-  const ValueDecl *Decl = Value.getLValueBase().dyn_cast<const ValueDecl*>();
+  const ValueDecl *Decl = Value.getLValueBase().dyn_cast<const ValueDecl *>();
   return !Decl || !Decl->isWeak();
 }
 
@@ -2629,9 +2591,9 @@ static bool EvaluateAsBooleanCondition(const Expr *E, bool &Result,
   return HandleConversionToBool(Val, Result);
 }
 
-template<typename T>
-static bool HandleOverflow(EvalInfo &Info, const Expr *E,
-                           const T &SrcValue, QualType DestType) {
+template <typename T>
+static bool HandleOverflow(EvalInfo &Info, const Expr *E, const T &SrcValue,
+                           QualType DestType) {
   Info.CCEDiag(E, diag::note_constexpr_overflow) << SrcValue << DestType;
   if (const auto *OBT = DestType->getAs<OverflowBehaviorType>();
       OBT && OBT->isTrapKind()) {
@@ -2649,8 +2611,8 @@ static bool HandleFloatToIntCast(EvalInfo &Info, const Expr *E,
 
   Result = APSInt(DestWidth, !DestSigned);
   bool ignored;
-  if (Value.convertToInteger(Result, llvm::APFloat::rmTowardZero, &ignored)
-      & APFloat::opInvalidOp)
+  if (Value.convertToInteger(Result, llvm::APFloat::rmTowardZero, &ignored) &
+      APFloat::opInvalidOp)
     return HandleOverflow(Info, E, Value, DestType);
   return true;
 }
@@ -2739,17 +2701,17 @@ static APSInt HandleIntToIntCast(EvalInfo &Info, const Expr *E,
 }
 
 static bool HandleIntToFloatCast(EvalInfo &Info, const Expr *E,
-                                 const FPOptions FPO,
-                                 QualType SrcType, const APSInt &Value,
-                                 QualType DestType, APFloat &Result) {
+                                 const FPOptions FPO, QualType SrcType,
+                                 const APSInt &Value, QualType DestType,
+                                 APFloat &Result) {
   Result = APFloat(Info.Ctx.getFloatTypeSemantics(DestType), 1);
   llvm::RoundingMode RM = getActiveRoundingMode(Info, E);
   APFloat::opStatus St = Result.convertFromAPInt(Value, Value.isSigned(), RM);
   return checkFloatingPointResult(Info, E, St);
 }
 
-static bool truncateBitfieldValue(EvalInfo &Info, const Expr *E,
-                                  APValue &Value, const FieldDecl *FD) {
+static bool truncateBitfieldValue(EvalInfo &Info, const Expr *E, APValue &Value,
+                                  const FieldDecl *FD) {
   assert(FD->isBitField() && "truncateBitfieldValue on non-bitfield");
 
   if (!Value.isInt()) {
@@ -2772,7 +2734,7 @@ static bool truncateBitfieldValue(EvalInfo &Info, const Expr *E,
 /// Perform the given integer operation, which is known to need at most BitWidth
 /// bits, and check for overflow in the original type (if that type was not an
 /// unsigned type).
-template<typename Operation>
+template <typename Operation>
 static bool CheckedIntArithmetic(EvalInfo &Info, const Expr *E,
                                  const APSInt &LHS, const APSInt &RHS,
                                  unsigned BitWidth, Operation Op,
@@ -2814,9 +2776,15 @@ static bool handleIntIntBinOp(EvalInfo &Info, const BinaryOperator *E,
   case BO_Sub:
     return CheckedIntArithmetic(Info, E, LHS, RHS, LHS.getBitWidth() + 1,
                                 std::minus<APSInt>(), Result);
-  case BO_And: Result = LHS & RHS; return true;
-  case BO_Xor: Result = LHS ^ RHS; return true;
-  case BO_Or:  Result = LHS | RHS; return true;
+  case BO_And:
+    Result = LHS & RHS;
+    return true;
+  case BO_Xor:
+    Result = LHS ^ RHS;
+    return true;
+  case BO_Or:
+    Result = LHS | RHS;
+    return true;
   case BO_Div:
   case BO_Rem:
     if (RHS == 0) {
@@ -2836,7 +2804,7 @@ static bool handleIntIntBinOp(EvalInfo &Info, const BinaryOperator *E,
     if (Info.getLangOpts().OpenCL)
       // OpenCL 6.3j: shift values are effectively % word size of LHS.
       RHS &= APSInt(llvm::APInt(RHS.getBitWidth(),
-                    static_cast<uint64_t>(LHS.getBitWidth() - 1)),
+                                static_cast<uint64_t>(LHS.getBitWidth() - 1)),
                     RHS.isUnsigned());
     else if (RHS.isSigned() && RHS.isNegative()) {
       // During constant-folding, a negative shift is an opposite shift. Such
@@ -2850,10 +2818,10 @@ static bool handleIntIntBinOp(EvalInfo &Info, const BinaryOperator *E,
   shift_left:
     // C++11 [expr.shift]p1: Shift width must be less than the bit width of
     // the shifted type.
-    unsigned SA = (unsigned) RHS.getLimitedValue(LHS.getBitWidth()-1);
+    unsigned SA = (unsigned)RHS.getLimitedValue(LHS.getBitWidth() - 1);
     if (SA != RHS) {
       Info.CCEDiag(E, diag::note_constexpr_large_shift)
-        << RHS << E->getType() << LHS.getBitWidth();
+          << RHS << E->getType() << LHS.getBitWidth();
       if (!Info.noteUndefinedBehavior())
         return false;
     } else if (LHS.isSigned() && !Info.getLangOpts().CPlusPlus20) {
@@ -2878,7 +2846,7 @@ static bool handleIntIntBinOp(EvalInfo &Info, const BinaryOperator *E,
     if (Info.getLangOpts().OpenCL)
       // OpenCL 6.3j: shift values are effectively % word size of LHS.
       RHS &= APSInt(llvm::APInt(RHS.getBitWidth(),
-                    static_cast<uint64_t>(LHS.getBitWidth() - 1)),
+                                static_cast<uint64_t>(LHS.getBitWidth() - 1)),
                     RHS.isUnsigned());
     else if (RHS.isSigned() && RHS.isNegative()) {
       // During constant-folding, a negative shift is an opposite shift. Such a
@@ -2892,24 +2860,36 @@ static bool handleIntIntBinOp(EvalInfo &Info, const BinaryOperator *E,
   shift_right:
     // C++11 [expr.shift]p1: Shift width must be less than the bit width of the
     // shifted type.
-    unsigned SA = (unsigned) RHS.getLimitedValue(LHS.getBitWidth()-1);
+    unsigned SA = (unsigned)RHS.getLimitedValue(LHS.getBitWidth() - 1);
     if (SA != RHS) {
       Info.CCEDiag(E, diag::note_constexpr_large_shift)
-        << RHS << E->getType() << LHS.getBitWidth();
+          << RHS << E->getType() << LHS.getBitWidth();
       if (!Info.noteUndefinedBehavior())
         return false;
     }
 
     Result = LHS >> SA;
     return true;
-  }
-
-  case BO_LT: Result = LHS < RHS; return true;
-  case BO_GT: Result = LHS > RHS; return true;
-  case BO_LE: Result = LHS <= RHS; return true;
-  case BO_GE: Result = LHS >= RHS; return true;
-  case BO_EQ: Result = LHS == RHS; return true;
-  case BO_NE: Result = LHS != RHS; return true;
+  }
+
+  case BO_LT:
+    Result = LHS < RHS;
+    return true;
+  case BO_GT:
+    Result = LHS > RHS;
+    return true;
+  case BO_LE:
+    Result = LHS <= RHS;
+    return true;
+  case BO_GE:
+    Result = LHS >= RHS;
+    return true;
+  case BO_EQ:
+    Result = LHS == RHS;
+    return true;
+  case BO_NE:
+    Result = LHS != RHS;
+    return true;
   case BO_Cmp:
     llvm_unreachable("BO_Cmp should be handled elsewhere");
   }
@@ -3127,7 +3107,8 @@ static bool CastToDerivedClass(EvalInfo &Info, const Expr *E, LValue &Result,
   // Truncate the path to the subobject, and remove any derived-to-base offsets.
   const RecordDecl *RD = TruncatedType;
   for (unsigned I = TruncatedElements, N = D.Entries.size(); I != N; ++I) {
-    if (RD->isInvalidDecl()) return false;
+    if (RD->isInvalidDecl())
+      return false;
     const ASTRecordLayout &Layout = Info.Ctx.getASTRecordLayout(RD);
     const CXXRecordDecl *Base = getAsBaseClass(D.Entries[I]);
     if (isVirtualBaseClass(D.Entries[I]))
@@ -3145,7 +3126,8 @@ static bool HandleLValueDirectBase(EvalInfo &Info, const Expr *E, LValue &Obj,
                                    const CXXRecordDecl *Base,
                                    const ASTRecordLayout *RL = nullptr) {
   if (!RL) {
-    if (Derived->isInvalidDecl()) return false;
+    if (Derived->isInvalidDecl())
+      return false;
     RL = &Info.Ctx.getASTRecordLayout(Derived);
   }
 
@@ -3176,7 +3158,8 @@ static bool HandleLValueBase(EvalInfo &Info, const Expr *E, LValue &Obj,
     return false;
 
   // Find the virtual base class.
-  if (DerivedDecl->isInvalidDecl()) return false;
+  if (DerivedDecl->isInvalidDecl())
+    return false;
   const ASTRecordLayout &Layout = Info.Ctx.getASTRecordLayout(DerivedDecl);
   Obj.addDecl(Info, E, BaseDecl, /*Virtual*/ true);
   Obj.getLValueOffset() += Layout.getVBaseClassOffset(BaseDecl);
@@ -3188,8 +3171,7 @@ static bool HandleLValueBasePath(EvalInfo &Info, const CastExpr *E,
   for (CastExpr::path_const_iterator PathI = E->path_begin(),
                                      PathE = E->path_end();
        PathI != PathE; ++PathI) {
-    if (!HandleLValueBase(Info, E, Result, Type->getAsCXXRecordDecl(),
-                          *PathI))
+    if (!HandleLValueBase(Info, E, Result, Type->getAsCXXRecordDecl(), *PathI))
       return false;
     Type = (*PathI)->getType();
   }
@@ -3217,7 +3199,8 @@ static bool HandleLValueMember(EvalInfo &Info, const Expr *E, LValue &LVal,
                                const FieldDecl *FD,
                                const ASTRecordLayout *RL = nullptr) {
   if (!RL) {
-    if (FD->getParent()->isInvalidDecl()) return false;
+    if (FD->getParent()->isInvalidDecl())
+      return false;
     RL = &Info.Ctx.getASTRecordLayout(FD->getParent());
   }
 
@@ -3412,8 +3395,7 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const Expr *E,
         !Info.CurrentCall->Callee ||
         !Info.CurrentCall->Callee->Equals(VD->getDeclContext())) {
       if (Info.getLangOpts().CPlusPlus11) {
-        Info.FFDiag(E, diag::note_constexpr_function_param_value_unknown)
-            << VD;
+        Info.FFDiag(E, diag::note_constexpr_function_param_value_unknown) << VD;
         NoteLValueLocation(Info, Base);
       } else {
         Info.FFDiag(E);
@@ -3437,8 +3419,7 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const Expr *E,
     // Don't diagnose during potential constant expression checking; an
     // initializer might be added later.
     if (!Info.checkingPotentialConstantExpression()) {
-      Info.FFDiag(E, diag::note_constexpr_var_init_unknown, 1)
-        << VD;
+      Info.FFDiag(E, diag::note_constexpr_var_init_unknown, 1) << VD;
       NoteLValueLocation(Info, Base);
     }
     return false;
@@ -3456,9 +3437,11 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const Expr *E,
     // have been value-dependent too), so diagnose that.
     assert(!VD->mightBeUsableInConstantExpressions(Info.Ctx));
     if (!Info.checkingPotentialConstantExpression()) {
-      Info.FFDiag(E, Info.getLangOpts().CPlusPlus11
-                         ? diag::note_constexpr_ltor_non_constexpr
-                         : diag::note_constexpr_ltor_non_integral, 1)
+      Info.FFDiag(E,
+                  Info.getLangOpts().CPlusPlus11
+                      ? diag::note_constexpr_ltor_non_constexpr
+                      : diag::note_constexpr_ltor_non_integral,
+                  1)
           << VD << VD->getType();
       NoteLValueLocation(Info, Base);
     }
@@ -3522,7 +3505,8 @@ static unsigned getBaseIndex(const CXXRecordDecl *Derived,
   Base = Base->getCanonicalDecl();
   unsigned Index = 0;
   for (CXXRecordDecl::base_class_const_iterator I = Derived->bases_begin(),
-         E = Derived->bases_end(); I != E; ++I, ++Index) {
+                                                E = Derived->bases_end();
+       I != E; ++I, ++Index) {
     if (I->getType()->getAsCXXRecordDecl()->getCanonicalDecl() == Base)
       return Index;
   }
@@ -3547,8 +3531,7 @@ static APSInt extractStringLiteralCharacter(EvalInfo &Info, const Expr *Lit,
   if (auto PE = dyn_cast<PredefinedExpr>(Lit))
     Lit = PE->getFunctionName();
   const StringLiteral *S = cast<StringLiteral>(Lit);
-  const ConstantArrayType *CAT =
-      Info.Ctx.getAsConstantArrayType(S->getType());
+  const ConstantArrayType *CAT = Info.Ctx.getAsConstantArrayType(S->getType());
   assert(CAT && "string literal isn't an array");
   QualType CharType = CAT->getElementType();
   assert(CharType->isIntegerType() && "unexpected character type");
@@ -3573,8 +3556,8 @@ static void expandStringLiteral(EvalInfo &Info, const StringLiteral *S,
   assert(CharType->isIntegerType() && "unexpected character type");
 
   unsigned Elts = CAT->getZExtSize();
-  Result = APValue(APValue::UninitArray(),
-                   std::min(S->getLength(), Elts), Elts);
+  Result =
+      APValue(APValue::UninitArray(), std::min(S->getLength(), Elts), Elts);
   APSInt Value(Info.Ctx.getTypeSize(CharType),
                CharType->isUnsignedIntegerType());
   if (Result.hasArrayFiller())
@@ -3592,7 +3575,7 @@ static void expandArray(APValue &Array, unsigned Index) {
 
   // Always at least double the number of elements for which we store a value.
   unsigned OldElts = Array.getArrayInitializedElts();
-  unsigned NewElts = std::max(Index+1, OldElts * 2);
+  unsigned NewElts = std::max(Index + 1, OldElts * 2);
   NewElts = std::min(Size, std::max(NewElts, 8u));
 
   // Copy the data across.
@@ -4126,7 +4109,7 @@ struct CompleteObject {
     if (!Info.getLangOpts().CPlusPlus14 &&
         AK != AccessKinds::AK_IsWithinLifetime)
       return false;
-    return lifetimeStartedInEvaluation(Info, Base, /*MutableSubobject*/true);
+    return lifetimeStartedInEvaluation(Info, Base, /*MutableSubobject*/ true);
   }
 
   explicit operator bool() const { return !Type.isNull(); }
@@ -4173,7 +4156,8 @@ findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj,
 
   // Walk the designator's path to find the subobject.
   for (unsigned I = 0, N = Sub.Entries.size(); /**/; ++I) {
-    // Reading an indeterminate value is undefined, but assigning over one is OK.
+    // Reading an indeterminate value is undefined, but assigning over one is
+    // OK.
     if ((O->isAbsent() && !(handler.AccessKind == AK_Construct && I == N)) ||
         (O->isIndeterminate() &&
          !isValidIndeterminateAccess(handler.AccessKind))) {
@@ -4215,7 +4199,7 @@ findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj,
             DiagKind = 2;
             Loc = VolatileField->getLocation();
             Decl = VolatileField;
-          } else if (auto *VD = Obj.Base.dyn_cast<const ValueDecl*>()) {
+          } else if (auto *VD = Obj.Base.dyn_cast<const ValueDecl *>()) {
             DiagKind = 1;
             Loc = VD->getLocation();
             Decl = VD;
@@ -4248,8 +4232,8 @@ findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj,
         return false;
 
       // If we modified a bit-field, truncate it to the right width.
-      if (isModification(handler.AccessKind) &&
-          LastField && LastField->isBitField() &&
+      if (isModification(handler.AccessKind) && LastField &&
+          LastField->isBitField() &&
           !truncateBitfieldValue(Info, E, *O, LastField))
         return false;
 
@@ -4269,7 +4253,7 @@ findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj,
         // designator which points more than one past the end of the array.
         if (Info.getLangOpts().CPlusPlus11)
           Info.FFDiag(E, diag::note_constexpr_access_past_end)
-            << handler.AccessKind;
+              << handler.AccessKind;
         else
           Info.FFDiag(E);
         return handler.failed();
@@ -4294,7 +4278,7 @@ findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj,
       if (Index > 1) {
         if (Info.getLangOpts().CPlusPlus11)
           Info.FFDiag(E, diag::note_constexpr_access_past_end)
-            << handler.AccessKind;
+              << handler.AccessKind;
         else
           Info.FFDiag(E);
         return handler.failed();
@@ -4305,12 +4289,13 @@ findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj,
 
       assert(I == N - 1 && "extracting subobject of scalar?");
       if (O->isComplexInt()) {
-        return handler.found(Index ? O->getComplexIntImag()
-                                   : O->getComplexIntReal(), ObjType);
+        return handler.found(
+            Index ? O->getComplexIntImag() : O->getComplexIntReal(), ObjType);
       } else {
         assert(O->isComplexFloat());
         return handler.found(Index ? O->getComplexFloatImag()
-                                   : O->getComplexFloatReal(), ObjType);
+                                   : O->getComplexFloatReal(),
+                             ObjType);
       }
     } else if (const auto *VT = ObjType->getAs<VectorType>()) {
       uint64_t Index = Sub.Entries[I].getAsArrayIndex();
@@ -4346,7 +4331,7 @@ findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj,
       if (Field->isMutable() &&
           !Obj.mayAccessMutableMembers(Info, handler.AccessKind)) {
         Info.FFDiag(E, diag::note_constexpr_access_mutable, 1)
-          << handler.AccessKind << Field;
+            << handler.AccessKind << Field;
         Info.Note(Field->getLocation(), diag::note_declared_at);
         return handler.failed();
       }
@@ -4479,9 +4464,8 @@ const AccessKinds ModifySubobjectHandler::AccessKind;
 /// Update the designated sub-object of an rvalue to the given value.
 static bool modifySubobject(EvalInfo &Info, const Expr *E,
                             const CompleteObject &Obj,
-                            const SubobjectDesignator &Sub,
-                            APValue &NewVal) {
-  ModifySubobjectHandler Handler = { Info, NewVal, E };
+                            const SubobjectDesignator &Sub, APValue &NewVal) {
+  ModifySubobjectHandler Handler = {Info, NewVal, E};
   return findSubobject(Info, E, Obj, Sub, Handler);
 }
 
@@ -4582,7 +4566,7 @@ static CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E,
   if (isFormalAccess(AK) && LValType.isVolatileQualified()) {
     if (Info.getLangOpts().CPlusPlus)
       Info.FFDiag(E, diag::note_constexpr_access_volatile_type)
-        << AK << LValType;
+          << AK << LValType;
     else
       Info.FFDiag(E);
     return CompleteObject();
@@ -4702,9 +4686,11 @@ static CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E,
         // folding of const floating-point types, in order to make static const
         // data members of such types (supported as an extension) more useful.
         if (Info.getLangOpts().CPlusPlus) {
-          Info.CCEDiag(E, Info.getLangOpts().CPlusPlus11
-                              ? diag::note_constexpr_ltor_non_constexpr
-                              : diag::note_constexpr_ltor_non_integral, 1)
+          Info.CCEDiag(E,
+                       Info.getLangOpts().CPlusPlus11
+                           ? diag::note_constexpr_ltor_non_constexpr
+                           : diag::note_constexpr_ltor_non_integral,
+                       1)
               << VD << BaseType;
           Info.Note(VD->getLocation(), diag::note_declared_at);
         } else {
@@ -4713,9 +4699,11 @@ static CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E,
       } else {
         // Never allow reading a non-const value.
         if (Info.getLangOpts().CPlusPlus) {
-          Info.FFDiag(E, Info.getLangOpts().CPlusPlus11
-                             ? diag::note_constexpr_ltor_non_constexpr
-                             : diag::note_constexpr_ltor_non_integral, 1)
+          Info.FFDiag(E,
+                      Info.getLangOpts().CPlusPlus11
+                          ? diag::note_constexpr_ltor_non_constexpr
+                          : diag::note_constexpr_ltor_non_integral,
+                      1)
               << VD << BaseType;
           Info.Note(VD->getLocation(), diag::note_declared_at);
         } else {
@@ -4754,7 +4742,7 @@ static CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E,
   // When binding to a reference, the variable does not need to be
   // within its lifetime.
   else if (AK != clang::AK_Dereference) {
-    const Expr *Base = LVal.Base.dyn_cast<const Expr*>();
+    const Expr *Base = LVal.Base.dyn_cast<const Expr *>();
 
     if (!Frame) {
       if (const MaterializeTemporaryExpr *MTE =
@@ -4881,7 +4869,7 @@ handleLValueToRValueConversion(EvalInfo &Info, const Expr *Conv, QualType Type,
     return false;
 
   // Check for special cases where there is no existing APValue to look at.
-  const Expr *Base = LVal.Base.dyn_cast<const Expr*>();
+  const Expr *Base = LVal.Base.dyn_cast<const Expr *>();
 
   AccessKinds AK =
       WantObjectRepresentation ? AK_ReadObjectRepresentation : AK_Read;
@@ -5034,8 +5022,7 @@ struct CompoundAssignSubobjectHandler {
       Value = HandleIntToIntCast(Info, E, SubobjType, PromotedLHSType, LHS);
       return true;
     } else if (RHS.isFloat()) {
-      const FPOptions FPO = E->getFPFeaturesInEffect(
-                                    Info.Ctx.getLangOpts());
+      const FPOptions FPO = E->getFPFeaturesInEffect(Info.Ctx.getLangOpts());
       APFloat FValue(0.0);
       return HandleIntToFloatCast(Info, E, FPO, SubobjType, Value,
                                   PromotedLHSType, FValue) &&
@@ -5100,8 +5087,8 @@ static bool handleCompoundAssignment(EvalInfo &Info,
   }
 
   CompleteObject Obj = findCompleteObject(Info, E, AK_Assign, LVal, LValType);
-  CompoundAssignSubobjectHandler Handler = { Info, E, PromotedLValType, Opcode,
-                                             RVal };
+  CompoundAssignSubobjectHandler Handler = {Info, E, PromotedLValType, Opcode,
+                                            RVal};
   return Obj && findSubobject(Info, E, Obj, LVal.Designator, Handler);
 }
 
@@ -5138,13 +5125,15 @@ struct IncDecSubobjectHandler {
     case APValue::Float:
       return found(Subobj.getFloat(), SubobjType);
     case APValue::ComplexInt:
-      return found(Subobj.getComplexIntReal(),
-                   SubobjType->castAs<ComplexType>()->getElementType()
-                     .withCVRQualifiers(SubobjType.getCVRQualifiers()));
+      return found(
+          Subobj.getComplexIntReal(),
+          SubobjType->castAs<ComplexType>()->getElementType().withCVRQualifiers(
+              SubobjType.getCVRQualifiers()));
     case APValue::ComplexFloat:
-      return found(Subobj.getComplexFloatReal(),
-                   SubobjType->castAs<ComplexType>()->getElementType()
-                     .withCVRQualifiers(SubobjType.getCVRQualifiers()));
+      return found(
+          Subobj.getComplexFloatReal(),
+          SubobjType->castAs<ComplexType>()->getElementType().withCVRQualifiers(
+              SubobjType.getCVRQualifiers()));
     case APValue::LValue:
       return foundPointer(Subobj, SubobjType);
     default:
@@ -5164,7 +5153,8 @@ struct IncDecSubobjectHandler {
       return false;
     }
 
-    if (Old) *Old = APValue(Value);
+    if (Old)
+      *Old = APValue(Value);
 
     // bool arithmetic promotes to int, and the conversion back to bool
     // doesn't reduce mod 2^n, so special-case it.
@@ -5182,7 +5172,7 @@ struct IncDecSubobjectHandler {
 
       if (!WasNegative && Value.isNegative() && E->canOverflow() &&
           !SubobjType.isWrapType()) {
-        APSInt ActualValue(Value, /*IsUnsigned*/true);
+        APSInt ActualValue(Value, /*IsUnsigned*/ true);
         return HandleOverflow(Info, E, ActualValue, SubobjType);
       }
     } else {
@@ -5191,7 +5181,7 @@ struct IncDecSubobjectHandler {
       if (WasNegative && !Value.isNegative() && E->canOverflow() &&
           !SubobjType.isWrapType()) {
         unsigned BitWidth = Value.getBitWidth();
-        APSInt ActualValue(Value.sext(BitWidth + 1), /*IsUnsigned*/false);
+        APSInt ActualValue(Value.sext(BitWidth + 1), /*IsUnsigned*/ false);
         ActualValue.setBit(BitWidth);
         return HandleOverflow(Info, E, ActualValue, SubobjType);
       }
@@ -5202,7 +5192,8 @@ struct IncDecSubobjectHandler {
     if (!checkConst(SubobjType))
       return false;
 
-    if (Old) *Old = APValue(Value);
+    if (Old)
+      *Old = APValue(Value);
 
     APFloat One(Value.getSemantics(), 1);
     llvm::RoundingMode RM = getActiveRoundingMode(Info, E);
@@ -5284,8 +5275,7 @@ static bool EvaluateObjectArgument(EvalInfo &Info, const Expr *Object,
 /// \return The field or method declaration to which the member pointer refers,
 ///         or 0 if evaluation fails.
 static const ValueDecl *HandleMemberPointerAccess(EvalInfo &Info,
-                                                  QualType LVType,
-                                                  LValue &LV,
+                                                  QualType LVType, LValue &LV,
                                                   const Expr *RHS,
                                                   bool IncludeMember = true) {
   MemberPtr MemPtr;
@@ -5315,8 +5305,8 @@ static const ValueDecl *HandleMemberPointerAccess(EvalInfo &Info,
     unsigned PathLengthToMember =
         LV.Designator.Entries.size() - MemPtr.Path.size();
     for (unsigned I = 0, N = MemPtr.Path.size(); I != N; ++I) {
-      const CXXRecordDecl *LVDecl = getAsBaseClass(
-          LV.Designator.Entries[PathLengthToMember + I]);
+      const CXXRecordDecl *LVDecl =
+          getAsBaseClass(LV.Designator.Entries[PathLengthToMember + I]);
       const CXXRecordDecl *MPDecl = MemPtr.Path[I];
       if (LVDecl->getCanonicalDecl() != MPDecl->getCanonicalDecl()) {
         Info.FFDiag(RHS);
@@ -5375,7 +5365,7 @@ static const ValueDecl *HandleMemberPointerAccess(EvalInfo &Info,
       if (!HandleLValueMember(Info, RHS, LV, FD))
         return nullptr;
     } else if (const IndirectFieldDecl *IFD =
-                 dyn_cast<IndirectFieldDecl>(MemPtr.getDecl())) {
+                   dyn_cast<IndirectFieldDecl>(MemPtr.getDecl())) {
       if (!HandleLValueIndirectMember(Info, RHS, LV, IFD))
         return nullptr;
     } else {
@@ -5646,12 +5636,10 @@ struct TempVersionRAII {
     Frame.pushTempVersion();
   }
 
-  ~TempVersionRAII() {
-    Frame.popTempVersion();
-  }
+  ~TempVersionRAII() { Frame.popTempVersion(); }
 };
 
-}
+} // namespace
 
 static EvalStmtResult EvaluateStmt(StmtResult &Result, EvalInfo &Info,
                                    const Stmt *S,
@@ -5898,8 +5886,7 @@ static EvalStmtResult EvaluateStmt(StmtResult &Result, EvalInfo &Info,
         }
       }
 
-      EvalStmtResult ESR =
-          EvaluateLoopBody(Result, Info, FS->getBody(), Case);
+      EvalStmtResult ESR = EvaluateLoopBody(Result, Info, FS->getBody(), Case);
       if (ShouldPropagateBreakContinue(Info, FS, /*Scopes=*/{}, ESR))
         return ESR;
       if (ESR != ESR_Continue)
@@ -5990,10 +5977,9 @@ static EvalStmtResult EvaluateStmt(StmtResult &Result, EvalInfo &Info,
       // We know we returned, but we don't know what the value is.
       return ESR_Failed;
     }
-    if (RetExpr &&
-        !(Result.Slot
-              ? EvaluateInPlace(Result.Value, Info, *Result.Slot, RetExpr)
-              : Evaluate(Result.Value, Info, RetExpr)))
+    if (RetExpr && !(Result.Slot ? EvaluateInPlace(Result.Value, Info,
+                                                   *Result.Slot, RetExpr)
+                                 : Evaluate(Result.Value, Info, RetExpr)))
       return ESR_Failed;
     return Scope.destroy() ? ESR_Returned : ESR_Failed;
   }
@@ -6318,7 +6304,7 @@ static bool CheckTrivialDefaultConstructor(EvalInfo &Info, SourceLocation Loc,
       // FIXME: If DiagDecl is an implicitly-declared special member function,
       // we should be much more explicit about why it's not constexpr.
       Info.CCEDiag(Loc, diag::note_constexpr_invalid_function, 1)
-        << /*IsConstexpr*/0 << /*IsConstructor*/1 << CD;
+          << /*IsConstexpr*/ 0 << /*IsConstructor*/ 1 << CD;
       Info.Note(CD->getLocation(), diag::note_declared_at);
     } else {
       Info.CCEDiag(Loc, diag::note_invalid_subexpr_in_const_expr);
@@ -6362,7 +6348,7 @@ static bool CheckConstexprFunction(EvalInfo &Info, SourceLocation CallLoc,
   // Can we evaluate this function call?
   if (Definition && Body &&
       (Definition->isConstexpr() || (Info.CurrentCall->CanEvalMSConstexpr &&
-                                        Definition->hasAttr<MSConstexprAttr>())))
+                                     Definition->hasAttr<MSConstexprAttr>())))
     return true;
 
   const FunctionDecl *DiagDecl = Definition ? Definition : Declaration;
@@ -6395,10 +6381,10 @@ static bool CheckConstexprFunction(EvalInfo &Info, SourceLocation CallLoc,
     // it's not constexpr.
     if (CD && CD->isInheritingConstructor())
       Info.FFDiag(CallLoc, diag::note_constexpr_invalid_inhctor, 1)
-        << CD->getInheritedConstructor().getConstructor()->getParent();
+          << CD->getInheritedConstructor().getConstructor()->getParent();
     else
       Info.FFDiag(CallLoc, diag::note_constexpr_invalid_function, 1)
-        << DiagDecl->isConstexpr() << (bool)CD << DiagDecl;
+          << DiagDecl->isConstexpr() << (bool)CD << DiagDecl;
     Info.Note(DiagDecl->getLocation(), diag::note_declared_at);
   } else {
     Info.FFDiag(CallLoc, diag::note_invalid_subexpr_in_const_expr);
@@ -6481,8 +6467,8 @@ struct DynamicType {
 
 static const CXXRecordDecl *getBaseClassType(SubobjectDesignator &Designator,
                                              unsigned PathLength) {
-  assert(PathLength >= Designator.MostDerivedPathLength && PathLength <=
-      Designator.Entries.size() && "invalid path length");
+  assert(PathLength >= Designator.MostDerivedPathLength &&
+         PathLength <= Designator.Entries.size() && "invalid path length");
   return (PathLength == Designator.MostDerivedPathLength)
              ? Designator.MostDerivedType->getAsCXXRecordDecl()
              : getAsBaseClass(Designator.Entries[PathLength - 1]);
@@ -6686,7 +6672,7 @@ static bool HandleDynamicCast(EvalInfo &Info, const ExplicitCastExpr *E,
   assert(C && "dynamic_cast target is not void pointer nor class");
   CanQualType CQT = Info.Ctx.getCanonicalTagType(C);
 
-  auto RuntimeCheckFailed = [&] (CXXBasePaths *Paths) {
+  auto RuntimeCheckFailed = [&](CXXBasePaths *Paths) {
     // C++ [expr.dynamic.cast]p9:
     if (!E->isGLValue()) {
       //   The value of a failed cast to pointer type is the null pointer value
@@ -6810,7 +6796,7 @@ static bool MaybeHandleUnionActiveMemberChange(EvalInfo &Info,
   if (LHS.InvalidBase || LHS.Designator.Invalid)
     return false;
 
-  llvm::SmallVector<std::pair<unsigned, const FieldDecl*>, 4> UnionPathLengths;
+  llvm::SmallVector<std::pair<unsigned, const FieldDecl *>, 4> UnionPathLengths;
   // C++ [class.union]p5:
   //   define the set S(E) of subexpressions of E as follows:
   unsigned PathLength = LHS.Designator.Entries.size();
@@ -6836,9 +6822,9 @@ static bool MaybeHandleUnionActiveMemberChange(EvalInfo &Info,
 
       E = ME->getBase();
       --PathLength;
-      assert(declaresSameEntity(FD,
-                                LHS.Designator.Entries[PathLength]
-                                    .getAsBaseOrMember().getPointer()));
+      assert(declaresSameEntity(
+          FD,
+          LHS.Designator.Entries[PathLength].getAsBaseOrMember().getPointer()));
 
       //   -- If E is of the form A[B] and is interpreted as a built-in array
       //      subscripting operator, S(E) is [S(the array operand, if any)].
@@ -6871,10 +6857,11 @@ static bool MaybeHandleUnionActiveMemberChange(EvalInfo &Info,
         --PathLength;
         assert(declaresSameEntity(Elt->getType()->getAsCXXRecordDecl(),
                                   LHS.Designator.Entries[PathLength]
-                                      .getAsBaseOrMember().getPointer()));
+                                      .getAsBaseOrMember()
+                                      .getPointer()));
       }
 
-    //   -- Otherwise, S(E) is empty.
+      //   -- Otherwise, S(E) is empty.
     } else {
       break;
     }
@@ -6891,7 +6878,7 @@ static bool MaybeHandleUnionActiveMemberChange(EvalInfo &Info,
   if (!Obj)
     return false;
   for (std::pair<unsigned, const FieldDecl *> LengthAndField :
-           llvm::reverse(UnionPathLengths)) {
+       llvm::reverse(UnionPathLengths)) {
     // Form a designator for the union object.
     SubobjectDesignator D = LHS.Designator;
     D.truncate(Info.Ctx, LHS.Base, LengthAndField.first);
@@ -7121,10 +7108,11 @@ static bool HandleConstructorCall(const Expr *E, const LValue &This,
                        RD->getNumFields());
     else
       // A union starts with no active member.
-      Result = APValue((const FieldDecl*)nullptr);
+      Result = APValue((const FieldDecl *)nullptr);
   }
 
-  if (RD->isInvalidDecl()) return false;
+  if (RD->isInvalidDecl())
+    return false;
   const ASTRecordLayout &Layout = Info.Ctx.getASTRecordLayout(RD);
 
   // A scope for temporaries lifetime-extended by reference members.
@@ -7283,7 +7271,7 @@ static bool HandleConstructorCall(const Expr *E, const LValue &This,
 }
 
 static bool HandleConstructorCall(const Expr *E, const LValue &This,
-                                  ArrayRef<const Expr*> Args,
+                                  ArrayRef<const Expr *> Args,
                                   const CXXConstructorDecl *Definition,
                                   EvalInfo &Info, APValue &Result) {
   CallScopeRAII CallScope(Info);
@@ -7430,7 +7418,7 @@ static bool HandleDestructionImpl(EvalInfo &Info, SourceRange CallRange,
 
   // We don't have a good way to iterate fields in reverse, so collect all the
   // fields first and then walk them backwards.
-  SmallVector<FieldDecl*, 16> Fields(RD->fields());
+  SmallVector<FieldDecl *, 16> Fields(RD->fields());
   for (const FieldDecl *FD : llvm::reverse(Fields)) {
     if (FD->isUnnamedBitField())
       continue;
@@ -7492,12 +7480,12 @@ struct DestroyObjectHandler {
     return false;
   }
 };
-}
+} // namespace
 
 /// Perform a destructor or pseudo-destructor call on the given object, which
 /// might in general not be a complete object.
-static bool HandleDestruction(EvalInfo &Info, const Expr *E,
-                              const LValue &This, QualType ThisType) {
+static bool HandleDestruction(EvalInfo &Info, const Expr *E, const LValue &This,
+                              QualType ThisType) {
   CompleteObject Obj = findCompleteObject(Info, E, AK_Destroy, This, ThisType);
   DestroyObjectHandler Handler = {Info, E, This, AK_Destroy};
   return Obj && findSubobject(Info, E, Obj, This.Designator, Handler);
@@ -7701,8 +7689,8 @@ class BitCastBuffer {
 
 public:
   BitCastBuffer(CharUnits Width, bool TargetIsLittleEndian)
-      : Bytes(Width.getQuantity()),
-        TargetIsLittleEndian(TargetIsLittleEndian) {}
+      : Bytes(Width.getQuantity()), TargetIsLittleEndian(TargetIsLittleEndian) {
+  }
 
   [[nodiscard]] bool readObject(CharUnits Offset, CharUnits Width,
                                 SmallVectorImpl<unsigned char> &Output) const {
@@ -8025,8 +8013,7 @@ class BufferToAPValueConverter {
                          T->isSpecificBuiltinType(BuiltinType::Char_U));
       if (!IsStdByte && !IsUChar) {
         QualType DisplayType(EnumSugar ? (const Type *)EnumSugar : T, 0);
-        Info.FFDiag(BCE->getExprLoc(),
-                    diag::note_constexpr_bit_cast_indet_dest)
+        Info.FFDiag(BCE->getExprLoc(), diag::note_constexpr_bit_cast_indet_dest)
             << DisplayType << Info.Ctx.getLangOpts().CharIsSigned;
         return std::nullopt;
       }
@@ -8379,10 +8366,9 @@ static bool handleLValueToRValueBitCast(EvalInfo &Info, APValue &DestValue,
 }
 
 template <class Derived>
-class ExprEvaluatorBase
-  : public ConstStmtVisitor<Derived, bool> {
+class ExprEvaluatorBase : public ConstStmtVisitor<Derived, bool> {
 private:
-  Derived &getDerived() { return static_cast<Derived&>(*this); }
+  Derived &getDerived() { return static_cast<Derived &>(*this); }
   bool DerivedSuccess(const APValue &V, const Expr *E) {
     return getDerived().Success(V, E);
   }
@@ -8393,7 +8379,7 @@ class ExprEvaluatorBase
   // Check whether a conditional operator with a non-constant condition is a
   // potential constant expression. If neither arm is a potential constant
   // expression, then the conditional operator is not either.
-  template<typename ConditionalOperator>
+  template <typename ConditionalOperator>
   void CheckPotentialConstantConditional(const ConditionalOperator *E) {
     assert(Info.checkingPotentialConstantExpression());
 
@@ -8417,8 +8403,7 @@ class ExprEvaluatorBase
     Error(E, diag::note_constexpr_conditional_never_const);
   }
 
-
-  template<typename ConditionalOperator>
+  template <typename ConditionalOperator>
   bool HandleConditionalOperator(const ConditionalOperator *E) {
     bool BoolResult;
     if (!EvaluateAsBooleanCondition(E->getCond(), BoolResult, Info)) {
@@ -8472,9 +8457,7 @@ class ExprEvaluatorBase
   bool VisitStmt(const Stmt *) {
     llvm_unreachable("Expression evaluator should not be called on stmts");
   }
-  bool VisitExpr(const Expr *E) {
-    return Error(E);
-  }
+  bool VisitExpr(const Expr *E) { return Error(E); }
 
   bool VisitEmbedExpr(const EmbedExpr *E) {
     const auto It = E->begin();
@@ -8491,18 +8474,25 @@ class ExprEvaluatorBase
     return StmtVisitorTy::Visit(E->getSubExpr());
   }
 
-  bool VisitParenExpr(const ParenExpr *E)
-    { return StmtVisitorTy::Visit(E->getSubExpr()); }
-  bool VisitUnaryExtension(const UnaryOperator *E)
-    { return StmtVisitorTy::Visit(E->getSubExpr()); }
-  bool VisitUnaryPlus(const UnaryOperator *E)
-    { return StmtVisitorTy::Visit(E->getSubExpr()); }
-  bool VisitChooseExpr(const ChooseExpr *E)
-    { return StmtVisitorTy::Visit(E->getChosenSubExpr()); }
-  bool VisitGenericSelectionExpr(const GenericSelectionExpr *E)
-    { return StmtVisitorTy::Visit(E->getResultExpr()); }
-  bool VisitSubstNonTypeTemplateParmExpr(const SubstNonTypeTemplateParmExpr *E)
-    { return StmtVisitorTy::Visit(E->getReplacement()); }
+  bool VisitParenExpr(const ParenExpr *E) {
+    return StmtVisitorTy::Visit(E->getSubExpr());
+  }
+  bool VisitUnaryExtension(const UnaryOperator *E) {
+    return StmtVisitorTy::Visit(E->getSubExpr());
+  }
+  bool VisitUnaryPlus(const UnaryOperator *E) {
+    return StmtVisitorTy::Visit(E->getSubExpr());
+  }
+  bool VisitChooseExpr(const ChooseExpr *E) {
+    return StmtVisitorTy::Visit(E->getChosenSubExpr());
+  }
+  bool VisitGenericSelectionExpr(const GenericSelectionExpr *E) {
+    return StmtVisitorTy::Visit(E->getResultExpr());
+  }
+  bool
+  VisitSubstNonTypeTemplateParmExpr(const SubstNonTypeTemplateParmExpr *E) {
+    return StmtVisitorTy::Visit(E->getReplacement());
+  }
   bool VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *E) {
     TempVersionRAII RAII(*Info.CurrentCall);
     SourceLocExprScopeGuard Guard(E, Info.CurrentCall->CurSourceLocExprScope);
@@ -8531,16 +8521,16 @@ class ExprEvaluatorBase
   bool VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *E) {
     CCEDiag(E, diag::note_constexpr_invalid_cast)
         << diag::ConstexprInvalidCastKind::Reinterpret;
-    return static_cast<Derived*>(this)->VisitCastExpr(E);
+    return static_cast<Derived *>(this)->VisitCastExpr(E);
   }
   bool VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *E) {
     if (!Info.Ctx.getLangOpts().CPlusPlus20)
       CCEDiag(E, diag::note_constexpr_invalid_cast)
           << diag::ConstexprInvalidCastKind::Dynamic;
-    return static_cast<Derived*>(this)->VisitCastExpr(E);
+    return static_cast<Derived *>(this)->VisitCastExpr(E);
   }
   bool VisitBuiltinBitCastExpr(const BuiltinBitCastExpr *E) {
-    return static_cast<Derived*>(this)->VisitCastExpr(E);
+    return static_cast<Derived *>(this)->VisitCastExpr(E);
   }
 
   bool VisitBinaryOperator(const BinaryOperator *E) {
@@ -8590,7 +8580,7 @@ class ExprEvaluatorBase
     // side-effects. This is an important GNU extension. See GCC PR38377
     // for discussion.
     if (const CallExpr *CallCE =
-          dyn_cast<CallExpr>(E->getCond()->IgnoreParenCasts()))
+            dyn_cast<CallExpr>(E->getCond()->IgnoreParenCasts()))
       if (CallCE->getBuiltinCallee() == Builtin::BI__builtin_constant_p)
         IsBcpCall = true;
 
@@ -8664,7 +8654,7 @@ class ExprEvaluatorBase
   }
 
   bool handleCallExpr(const CallExpr *E, APValue &Result,
-                     const LValue *ResultSlot) {
+                      const LValue *ResultSlot) {
     CallScopeRAII CallScope(Info);
 
     const Expr *Callee = E->getCallee()->IgnoreParens();
@@ -8726,7 +8716,7 @@ class ExprEvaluatorBase
       // Don't call function pointers which have been cast to some other type.
       // Per DR (no number yet), the caller and callee can differ in noexcept.
       if (!Info.Ctx.hasSameFunctionTypeIgnoringExceptionSpec(
-        CalleeType->getPointeeType(), FD->getType())) {
+              CalleeType->getPointeeType(), FD->getType())) {
         return Error(E);
       }
 
@@ -8909,7 +8899,8 @@ class ExprEvaluatorBase
     QualType BaseTy = E->getBase()->getType();
 
     const FieldDecl *FD = dyn_cast<FieldDecl>(E->getMemberDecl());
-    if (!FD) return Error(E);
+    if (!FD)
+      return Error(E);
     assert(!FD->getType()->isReferenceType() && "prvalue reference?");
     assert(BaseTy->castAsCanonical<RecordType>()->getDecl() ==
                FD->getParent()->getCanonicalDecl() &&
@@ -9066,7 +9057,7 @@ class ExprEvaluatorBase
       }
 
       APValue ReturnValue;
-      StmtResult Result = { ReturnValue, nullptr };
+      StmtResult Result = {ReturnValue, nullptr};
       EvalStmtResult ESR = EvaluateStmt(Result, Info, *BI);
       if (ESR != ESR_Succeeded) {
         // FIXME: If the statement-expression terminated due to 'return',
@@ -9087,9 +9078,7 @@ class ExprEvaluatorBase
   }
 
   /// Visit a value which is evaluated, but whose value is ignored.
-  void VisitIgnoredValue(const Expr *E) {
-    EvaluateIgnoredValue(Info, E);
-  }
+  void VisitIgnoredValue(const Expr *E) { EvaluateIgnoredValue(Info, E); }
 
   /// Potentially visit a MemberExpr's base expression.
   void VisitIgnoredBaseExpression(const Expr *E) {
@@ -9107,9 +9096,8 @@ class ExprEvaluatorBase
 // Common base class for lvalue and temporary evaluation.
 //===----------------------------------------------------------------------===//
 namespace {
-template<class Derived>
-class LValueExprEvaluatorBase
-  : public ExprEvaluatorBase<Derived> {
+template <class Derived>
+class LValueExprEvaluatorBase : public ExprEvaluatorBase<Derived> {
 protected:
   LValue &Result;
   bool InvalidBaseOK;
@@ -9209,7 +9197,7 @@ class LValueExprEvaluatorBase
     }
   }
 };
-}
+} // namespace
 
 //===----------------------------------------------------------------------===//
 // LValue Evaluation
@@ -9246,10 +9234,10 @@ class LValueExprEvaluatorBase
 //===----------------------------------------------------------------------===//
 namespace {
 class LValueExprEvaluator
-  : public LValueExprEvaluatorBase<LValueExprEvaluator> {
+    : public LValueExprEvaluatorBase<LValueExprEvaluator> {
 public:
-  LValueExprEvaluator(EvalInfo &Info, LValue &Result, bool InvalidBaseOK) :
-    LValueExprEvaluatorBaseTy(Info, Result, InvalidBaseOK) {}
+  LValueExprEvaluator(EvalInfo &Info, LValue &Result, bool InvalidBaseOK)
+      : LValueExprEvaluatorBaseTy(Info, Result, InvalidBaseOK) {}
 
   bool VisitVarDecl(const Expr *E, const VarDecl *VD);
   bool VisitUnaryPreIncDec(const UnaryOperator *UO);
@@ -9366,7 +9354,8 @@ static bool EvaluateLValue(const Expr *E, LValue &Result, EvalInfo &Info,
                            bool InvalidBaseOK) {
   assert(!E->isValueDependent());
   assert(E->isGLValue() || E->getType()->isFunctionType() ||
-         E->getType()->isVoidType() || isa<ObjCSelectorExpr>(E->IgnoreParens()));
+         E->getType()->isVoidType() ||
+         isa<ObjCSelectorExpr>(E->IgnoreParens()));
   return LValueExprEvaluator(Info, Result, InvalidBaseOK).Visit(E);
 }
 
@@ -9548,8 +9537,8 @@ bool LValueExprEvaluator::VisitMaterializeTemporaryExpr(
   return true;
 }
 
-bool
-LValueExprEvaluator::VisitCompoundLiteralExpr(const CompoundLiteralExpr *E) {
+bool LValueExprEvaluator::VisitCompoundLiteralExpr(
+    const CompoundLiteralExpr *E) {
   assert((!Info.getLangOpts().CPlusPlus || E->isFileScope()) &&
          "lvalue compound literal in c++?");
   APValue *Lit;
@@ -9588,8 +9577,8 @@ bool LValueExprEvaluator::VisitCXXTypeidExpr(const CXXTypeidExpr *E) {
   } else {
     if (!Info.Ctx.getLangOpts().CPlusPlus20) {
       Info.CCEDiag(E, diag::note_constexpr_typeid_polymorphic)
-        << E->getExprOperand()->getType()
-        << E->getExprOperand()->getSourceRange();
+          << E->getExprOperand()->getType()
+          << E->getExprOperand()->getSourceRange();
     }
 
     if (!Visit(E->getExprOperand()))
@@ -9744,9 +9733,8 @@ bool LValueExprEvaluator::VisitUnaryPreIncDec(const UnaryOperator *UO) {
   if (!this->Visit(UO->getSubExpr()))
     return false;
 
-  return handleIncDec(
-      this->Info, UO, Result, UO->getSubExpr()->getType(),
-      UO->isIncrementOp(), nullptr);
+  return handleIncDec(this->Info, UO, Result, UO->getSubExpr()->getType(),
+                      UO->isIncrementOp(), nullptr);
 }
 
 bool LValueExprEvaluator::VisitCompoundAssignOperator(
@@ -9769,8 +9757,8 @@ bool LValueExprEvaluator::VisitCompoundAssignOperator(
     return false;
 
   return handleCompoundAssignment(
-      this->Info, CAO,
-      Result, CAO->getLHS()->getType(), CAO->getComputationLHSType(),
+      this->Info, CAO, Result, CAO->getLHS()->getType(),
+      CAO->getComputationLHSType(),
       CAO->getOpForCompoundAssignment(CAO->getOpcode()), RHS);
 }
 
@@ -9858,8 +9846,7 @@ static bool evaluateLValueAsAllocSize(EvalInfo &Info, APValue::LValueBase Base,
 }
 
 namespace {
-class PointerExprEvaluator
-  : public ExprEvaluatorBase<PointerExprEvaluator> {
+class PointerExprEvaluator : public ExprEvaluatorBase<PointerExprEvaluator> {
   LValue &Result;
   bool InvalidBaseOK;
 
@@ -9877,8 +9864,8 @@ class PointerExprEvaluator
   }
 
   bool visitNonBuiltinCallExpr(const CallExpr *E);
-public:
 
+public:
   PointerExprEvaluator(EvalInfo &info, LValue &Result, bool InvalidBaseOK)
       : ExprEvaluatorBaseTy(info), Result(Result),
         InvalidBaseOK(InvalidBaseOK) {}
@@ -9893,10 +9880,9 @@ class PointerExprEvaluator
   }
 
   bool VisitBinaryOperator(const BinaryOperator *E);
-  bool VisitCastExpr(const CastExpr* E);
+  bool VisitCastExpr(const CastExpr *E);
   bool VisitUnaryAddrOf(const UnaryOperator *E);
-  bool VisitObjCStringLiteral(const ObjCStringLiteral *E)
-      { return Success(E); }
+  bool VisitObjCStringLiteral(const ObjCStringLiteral *E) { return Success(E); }
   bool VisitObjCBoxedExpr(const ObjCBoxedExpr *E) {
     if (E->isExpressibleAsConstantInitializer())
       return Success(E);
@@ -9910,8 +9896,7 @@ class PointerExprEvaluator
   bool VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E) {
     return E->isExpressibleAsConstantInitializer() ? Success(E) : Error(E);
   }
-  bool VisitAddrLabelExpr(const AddrLabelExpr *E)
-      { return Success(E); }
+  bool VisitAddrLabelExpr(const AddrLabelExpr *E) { return Success(E); }
   bool VisitCallExpr(const CallExpr *E);
   bool VisitBuiltinCallExpr(const CallExpr *E, unsigned BuiltinOp);
   bool VisitBlockExpr(const BlockExpr *E) {
@@ -10001,7 +9986,7 @@ class PointerExprEvaluator
 };
 } // end anonymous namespace
 
-static bool EvaluatePointer(const Expr* E, LValue& Result, EvalInfo &Info,
+static bool EvaluatePointer(const Expr *E, LValue &Result, EvalInfo &Info,
                             bool InvalidBaseOK) {
   assert(!E->isValueDependent());
   assert(E->isPRValue() && E->getType()->hasPointerRepresentation());
@@ -10009,8 +9994,7 @@ static bool EvaluatePointer(const Expr* E, LValue& Result, EvalInfo &Info,
 }
 
 bool PointerExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
-  if (E->getOpcode() != BO_Add &&
-      E->getOpcode() != BO_Sub)
+  if (E->getOpcode() != BO_Add && E->getOpcode() != BO_Sub)
     return ExprEvaluatorBaseTy::VisitBinaryOperator(E);
 
   const Expr *PExp = E->getLHS();
@@ -10132,9 +10116,10 @@ bool PointerExprEvaluator::VisitCastExpr(const CastExpr *E) {
 
     // Now figure out the necessary offset to add to the base LV to get from
     // the derived class to the base class.
-    return HandleLValueBasePath(Info, E, E->getSubExpr()->getType()->
-                                  castAs<PointerType>()->getPointeeType(),
-                                Result);
+    return HandleLValueBasePath(
+        Info, E,
+        E->getSubExpr()->getType()->castAs<PointerType>()->getPointeeType(),
+        Result);
 
   case CK_BaseToDerived:
     if (!Visit(E->getSubExpr()))
@@ -10460,8 +10445,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
     if (!EvaluateInteger(E->getArg(1), Desired, Info))
       return false;
     uint64_t MaxLength = uint64_t(-1);
-    if (BuiltinOp != Builtin::BIstrchr &&
-        BuiltinOp != Builtin::BIwcschr &&
+    if (BuiltinOp != Builtin::BIstrchr && BuiltinOp != Builtin::BIwcschr &&
         BuiltinOp != Builtin::BI__builtin_strchr &&
         BuiltinOp != Builtin::BI__builtin_wcschr) {
       APSInt N;
@@ -10478,9 +10462,8 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
     QualType CharTy = Result.Designator.getType(Info.Ctx);
     bool IsRawByte = BuiltinOp == Builtin::BImemchr ||
                      BuiltinOp == Builtin::BI__builtin_memchr;
-    assert(IsRawByte ||
-           Info.Ctx.hasSameUnqualifiedType(
-               CharTy, E->getArg(0)->getType()->getPointeeType()));
+    assert(IsRawByte || Info.Ctx.hasSameUnqualifiedType(
+                            CharTy, E->getArg(0)->getType()->getPointeeType()));
     // Pointers to const void may point to objects of incomplete type.
     if (IsRawByte && CharTy->isIncompleteType()) {
       Info.FFDiag(E, diag::note_constexpr_ltor_incomplete_type) << CharTy;
@@ -10631,7 +10614,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
       llvm::APInt::udivrem(OrigN, TSize, N, Remainder);
       if (Remainder) {
         Info.FFDiag(E, diag::note_constexpr_memcpy_unsupported)
-            << Move << WChar << 0 << T << toString(OrigN, 10, /*Signed*/false)
+            << Move << WChar << 0 << T << toString(OrigN, 10, /*Signed*/ false)
             << (unsigned)TSize;
         return false;
       }
@@ -10645,7 +10628,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
     if (N.ugt(RemainingSrcSize) || N.ugt(RemainingDestSize)) {
       Info.FFDiag(E, diag::note_constexpr_memcpy_unsupported)
           << Move << WChar << (N.ugt(RemainingSrcSize) ? 1 : 2) << T
-          << toString(N, 10, /*Signed*/false);
+          << toString(N, 10, /*Signed*/ false);
       return false;
     }
     uint64_t NElems = N.getZExtValue();
@@ -10841,8 +10824,7 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
     AllocType = Info.Ctx.getConstantArrayType(AllocType, ArrayBound, nullptr,
                                               ArraySizeModifier::Normal, 0);
   } else {
-    assert(!AllocType->isArrayType() &&
-           "array allocation with non-array new");
+    assert(!AllocType->isArrayType() && "array allocation with non-array new");
   }
 
   APValue *Val;
@@ -10945,15 +10927,15 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
 //===----------------------------------------------------------------------===//
 
 namespace {
-class ReflectionEvaluator
-  : public ExprEvaluatorBase<ReflectionEvaluator> {
+class ReflectionEvaluator : public ExprEvaluatorBase<ReflectionEvaluator> {
 
   using BaseType = ExprEvaluatorBase<ReflectionEvaluator>;
 
   APValue &Result;
+
 public:
   ReflectionEvaluator(EvalInfo &E, APValue &Result)
-    : ExprEvaluatorBaseTy(E), Result(Result) {}
+      : ExprEvaluatorBaseTy(E), Result(Result) {}
 
   bool Success(const APValue &V, const Expr *E) {
     Result = V;
@@ -10965,14 +10947,14 @@ class ReflectionEvaluator
 
 bool ReflectionEvaluator::VisitCXXReflectExpr(const CXXReflectExpr *E) {
   switch (E->getKind()) {
-    case ReflectionKind::Type: {
-      APValue Result(ReflectionKind::Type, E->getOpaqueValue());
-      return Success(Result, E);
-    }
+  case ReflectionKind::Type: {
+    APValue Result(ReflectionKind::Type, E->getOpaqueValue());
+    return Success(Result, E);
+  }
   }
   llvm_unreachable("invalid reflection");
 }
-}  // end anonymous namespace
+} // end anonymous namespace
 
 static bool EvaluateReflection(const Expr *E, APValue &Result, EvalInfo &Info) {
   assert(E->isPRValue() && E->getType()->isMetaInfoType());
@@ -10985,24 +10967,24 @@ static bool EvaluateReflection(const Expr *E, APValue &Result, EvalInfo &Info) {
 
 namespace {
 class MemberPointerExprEvaluator
-  : public ExprEvaluatorBase<MemberPointerExprEvaluator> {
+    : public ExprEvaluatorBase<MemberPointerExprEvaluator> {
   MemberPtr &Result;
 
   bool Success(const ValueDecl *D) {
     Result = MemberPtr(D);
     return true;
   }
-public:
 
+public:
   MemberPointerExprEvaluator(EvalInfo &Info, MemberPtr &Result)
-    : ExprEvaluatorBaseTy(Info), Result(Result) {}
+      : ExprEvaluatorBaseTy(Info), Result(Result) {}
 
   bool Success(const APValue &V, const Expr *E) {
     Result.setFrom(V);
     return true;
   }
   bool ZeroInitialization(const Expr *E) {
-    return Success((const ValueDecl*)nullptr);
+    return Success((const ValueDecl *)nullptr);
   }
 
   bool VisitCastExpr(const CastExpr *E);
@@ -11053,7 +11035,8 @@ bool MemberPointerExprEvaluator::VisitCastExpr(const CastExpr *E) {
     if (!Visit(E->getSubExpr()))
       return false;
     for (CastExpr::path_const_iterator PathI = E->path_begin(),
-         PathE = E->path_end(); PathI != PathE; ++PathI) {
+                                       PathE = E->path_end();
+         PathI != PathE; ++PathI) {
       assert(!(*PathI)->isVirtual() && "memptr cast through vbase");
       const CXXRecordDecl *Base = (*PathI)->getType()->getAsCXXRecordDecl();
       if (!Result.castToBase(Base))
@@ -11074,42 +11057,41 @@ bool MemberPointerExprEvaluator::VisitUnaryAddrOf(const UnaryOperator *E) {
 //===----------------------------------------------------------------------===//
 
 namespace {
-  class RecordExprEvaluator
-  : public ExprEvaluatorBase<RecordExprEvaluator> {
-    const LValue &This;
-    APValue &Result;
-  public:
+class RecordExprEvaluator : public ExprEvaluatorBase<RecordExprEvaluator> {
+  const LValue &This;
+  APValue &Result;
 
-    RecordExprEvaluator(EvalInfo &info, const LValue &This, APValue &Result)
+public:
+  RecordExprEvaluator(EvalInfo &info, const LValue &This, APValue &Result)
       : ExprEvaluatorBaseTy(info), This(This), Result(Result) {}
 
-    bool Success(const APValue &V, const Expr *E) {
-      Result = V;
-      return true;
-    }
-    bool ZeroInitialization(const Expr *E) {
-      return ZeroInitialization(E, E->getType());
-    }
-    bool ZeroInitialization(const Expr *E, QualType T);
+  bool Success(const APValue &V, const Expr *E) {
+    Result = V;
+    return true;
+  }
+  bool ZeroInitialization(const Expr *E) {
+    return ZeroInitialization(E, E->getType());
+  }
+  bool ZeroInitialization(const Expr *E, QualType T);
 
-    bool VisitCallExpr(const CallExpr *E) {
-      return handleCallExpr(E, Result, &This);
-    }
-    bool VisitCastExpr(const CastExpr *E);
-    bool VisitInitListExpr(const InitListExpr *E);
-    bool VisitCXXConstructExpr(const CXXConstructExpr *E) {
-      return VisitCXXConstructExpr(E, E->getType());
-    }
-    bool VisitLambdaExpr(const LambdaExpr *E);
-    bool VisitCXXInheritedCtorInitExpr(const CXXInheritedCtorInitExpr *E);
-    bool VisitCXXConstructExpr(const CXXConstructExpr *E, QualType T);
-    bool VisitCXXStdInitializerListExpr(const CXXStdInitializerListExpr *E);
-    bool VisitBinCmp(const BinaryOperator *E);
-    bool VisitCXXParenListInitExpr(const CXXParenListInitExpr *E);
-    bool VisitCXXParenListOrInitListExpr(const Expr *ExprToVisit,
-                                         ArrayRef<Expr *> Args);
-  };
-}
+  bool VisitCallExpr(const CallExpr *E) {
+    return handleCallExpr(E, Result, &This);
+  }
+  bool VisitCastExpr(const CastExpr *E);
+  bool VisitInitListExpr(const InitListExpr *E);
+  bool VisitCXXConstructExpr(const CXXConstructExpr *E) {
+    return VisitCXXConstructExpr(E, E->getType());
+  }
+  bool VisitLambdaExpr(const LambdaExpr *E);
+  bool VisitCXXInheritedCtorInitExpr(const CXXInheritedCtorInitExpr *E);
+  bool VisitCXXConstructExpr(const CXXConstructExpr *E, QualType T);
+  bool VisitCXXStdInitializerListExpr(const CXXStdInitializerListExpr *E);
+  bool VisitBinCmp(const BinaryOperator *E);
+  bool VisitCXXParenListInitExpr(const CXXParenListInitExpr *E);
+  bool VisitCXXParenListOrInitListExpr(const Expr *ExprToVisit,
+                                       ArrayRef<Expr *> Args);
+};
+} // namespace
 
 /// Perform zero-initialization on an object of non-union class type.
 /// C++11 [dcl.init]p5:
@@ -11126,13 +11108,15 @@ static bool HandleClassZeroInitialization(EvalInfo &Info, const Expr *E,
   Result = APValue(APValue::UninitStruct(), CD ? CD->getNumBases() : 0,
                    RD->getNumFields());
 
-  if (RD->isInvalidDecl()) return false;
+  if (RD->isInvalidDecl())
+    return false;
   const ASTRecordLayout &Layout = Info.Ctx.getASTRecordLayout(RD);
 
   if (CD) {
     unsigned Index = 0;
     for (CXXRecordDecl::base_class_const_iterator I = CD->bases_begin(),
-           End = CD->bases_end(); I != End; ++I, ++Index) {
+                                                  End = CD->bases_end();
+         I != End; ++I, ++Index) {
       const CXXRecordDecl *Base = I->getType()->getAsCXXRecordDecl();
       LValue Subobject = This;
       if (!HandleLValueDirectBase(Info, E, Subobject, CD, Base, &Layout))
@@ -11153,8 +11137,8 @@ static bool HandleClassZeroInitialization(EvalInfo &Info, const Expr *E,
       return false;
 
     ImplicitValueInitExpr VIE(I->getType());
-    if (!EvaluateInPlace(
-          Result.getStructField(I->getFieldIndex()), Info, Subobject, &VIE))
+    if (!EvaluateInPlace(Result.getStructField(I->getFieldIndex()), Info,
+                         Subobject, &VIE))
       return false;
   }
 
@@ -11163,7 +11147,8 @@ static bool HandleClassZeroInitialization(EvalInfo &Info, const Expr *E,
 
 bool RecordExprEvaluator::ZeroInitialization(const Expr *E, QualType T) {
   const auto *RD = T->castAsRecordDecl();
-  if (RD->isInvalidDecl()) return false;
+  if (RD->isInvalidDecl())
+    return false;
   if (RD->isUnion()) {
     // C++11 [dcl.init]p5: If T is a (possibly cv-qualified) union type, the
     // object's first non-static named data member is zero-initialized
@@ -11171,7 +11156,7 @@ bool RecordExprEvaluator::ZeroInitialization(const Expr *E, QualType T) {
     while (I != RD->field_end() && (*I)->isUnnamedBitField())
       ++I;
     if (I == RD->field_end()) {
-      Result = APValue((const FieldDecl*)nullptr);
+      Result = APValue((const FieldDecl *)nullptr);
       return true;
     }
 
@@ -11211,7 +11196,8 @@ bool RecordExprEvaluator::VisitCastExpr(const CastExpr *E) {
     APValue *Value = &DerivedObject;
     const CXXRecordDecl *RD = E->getSubExpr()->getType()->getAsCXXRecordDecl();
     for (CastExpr::path_const_iterator PathI = E->path_begin(),
-         PathE = E->path_end(); PathI != PathE; ++PathI) {
+                                       PathE = E->path_end();
+         PathI != PathE; ++PathI) {
       assert(!(*PathI)->isVirtual() && "record rvalue with virtual base");
       const CXXRecordDecl *Base = (*PathI)->getType()->getAsCXXRecordDecl();
       Value = &Value->getStructBase(getBaseIndex(RD, Base));
@@ -11268,7 +11254,8 @@ bool RecordExprEvaluator::VisitInitListExpr(const InitListExpr *E) {
 bool RecordExprEvaluator::VisitCXXParenListOrInitListExpr(
     const Expr *ExprToVisit, ArrayRef<Expr *> Args) {
   const auto *RD = ExprToVisit->getType()->castAsRecordDecl();
-  if (RD->isInvalidDecl()) return false;
+  if (RD->isInvalidDecl())
+    return false;
   const ASTRecordLayout &Layout = Info.Ctx.getASTRecordLayout(RD);
   auto *CXXRD = dyn_cast<CXXRecordDecl>(RD);
 
@@ -11411,7 +11398,8 @@ bool RecordExprEvaluator::VisitCXXConstructExpr(const CXXConstructExpr *E,
   // Note that E's type is not necessarily the type of our class here; we might
   // be initializing an array element instead.
   const CXXConstructorDecl *FD = E->getConstructor();
-  if (FD->isInvalidDecl() || FD->getParent()->isInvalidDecl()) return false;
+  if (FD->isInvalidDecl() || FD->getParent()->isInvalidDecl())
+    return false;
 
   bool ZeroInit = E->requiresZeroInitialization();
   if (CheckTrivialDefaultConstructor(Info, E->getExprLoc(), FD, ZeroInit)) {
@@ -11446,9 +11434,8 @@ bool RecordExprEvaluator::VisitCXXConstructExpr(const CXXConstructExpr *E,
     return false;
 
   auto Args = ArrayRef(E->getArgs(), E->getNumArgs());
-  return HandleConstructorCall(E, This, Args,
-                               cast<CXXConstructorDecl>(Definition), Info,
-                               Result);
+  return HandleConstructorCall(
+      E, This, Args, cast<CXXConstructorDecl>(Definition), Info, Result);
 }
 
 bool RecordExprEvaluator::VisitCXXInheritedCtorInitExpr(
@@ -11534,7 +11521,7 @@ bool RecordExprEvaluator::VisitLambdaExpr(const LambdaExpr *E) {
          "The number of lambda capture initializers should equal the number of "
          "fields within the closure type");
 
-  Result = APValue(APValue::UninitStruct(), /*NumBases*/0, NumFields);
+  Result = APValue(APValue::UninitStruct(), /*NumBases*/ 0, NumFields);
   // Iterate through all the lambda's closure object's fields and initialize
   // them.
   auto *CaptureInitIt = E->capture_init_begin();
@@ -11565,8 +11552,8 @@ bool RecordExprEvaluator::VisitLambdaExpr(const LambdaExpr *E) {
   return Success;
 }
 
-static bool EvaluateRecord(const Expr *E, const LValue &This,
-                           APValue &Result, EvalInfo &Info) {
+static bool EvaluateRecord(const Expr *E, const LValue &This, APValue &Result,
+                           EvalInfo &Info) {
   assert(!E->isValueDependent());
   assert(E->isPRValue() && E->getType()->isRecordType() &&
          "can't evaluate expression as a record rvalue");
@@ -11582,10 +11569,10 @@ static bool EvaluateRecord(const Expr *E, const LValue &This,
 //===----------------------------------------------------------------------===//
 namespace {
 class TemporaryExprEvaluator
-  : public LValueExprEvaluatorBase<TemporaryExprEvaluator> {
+    : public LValueExprEvaluatorBase<TemporaryExprEvaluator> {
 public:
-  TemporaryExprEvaluator(EvalInfo &Info, LValue &Result) :
-    LValueExprEvaluatorBaseTy(Info, Result, false) {}
+  TemporaryExprEvaluator(EvalInfo &Info, LValue &Result)
+      : LValueExprEvaluatorBaseTy(Info, Result, false) {}
 
   /// Visit an expression which constructs the value of this temporary.
   bool VisitConstructExpr(const Expr *E) {
@@ -11609,15 +11596,11 @@ class TemporaryExprEvaluator
   bool VisitCXXConstructExpr(const CXXConstructExpr *E) {
     return VisitConstructExpr(E);
   }
-  bool VisitCallExpr(const CallExpr *E) {
-    return VisitConstructExpr(E);
-  }
+  bool VisitCallExpr(const CallExpr *E) { return VisitConstructExpr(E); }
   bool VisitCXXStdInitializerListExpr(const CXXStdInitializerListExpr *E) {
     return VisitConstructExpr(E);
   }
-  bool VisitLambdaExpr(const LambdaExpr *E) {
-    return VisitConstructExpr(E);
-  }
+  bool VisitLambdaExpr(const LambdaExpr *E) { return VisitConstructExpr(E); }
 };
 } // end anonymous namespace
 
@@ -11633,44 +11616,42 @@ static bool EvaluateTemporary(const Expr *E, LValue &Result, EvalInfo &Info) {
 //===----------------------------------------------------------------------===//
 
 namespace {
-  class VectorExprEvaluator
-  : public ExprEvaluatorBase<VectorExprEvaluator> {
-    APValue &Result;
-  public:
+class VectorExprEvaluator : public ExprEvaluatorBase<VectorExprEvaluator> {
+  APValue &Result;
 
-    VectorExprEvaluator(EvalInfo &info, APValue &Result)
+public:
+  VectorExprEvaluator(EvalInfo &info, APValue &Result)
       : ExprEvaluatorBaseTy(info), Result(Result) {}
 
-    bool Success(ArrayRef<APValue> V, const Expr *E) {
-      assert(V.size() == E->getType()->castAs<VectorType>()->getNumElements());
-      // FIXME: remove this APValue copy.
-      Result = APValue(V.data(), V.size());
-      return true;
-    }
-    bool Success(const APValue &V, const Expr *E) {
-      assert(V.isVector());
-      Result = V;
-      return true;
-    }
-    bool ZeroInitialization(const Expr *E);
-
-    bool VisitUnaryReal(const UnaryOperator *E)
-      { return Visit(E->getSubExpr()); }
-    bool VisitCastExpr(const CastExpr* E);
-    bool VisitInitListExpr(const InitListExpr *E);
-    bool VisitUnaryImag(const UnaryOperator *E);
-    bool VisitBinaryOperator(const BinaryOperator *E);
-    bool VisitUnaryOperator(const UnaryOperator *E);
-    bool VisitCallExpr(const CallExpr *E);
-    bool VisitConvertVectorExpr(const ConvertVectorExpr *E);
-    bool VisitShuffleVectorExpr(const ShuffleVectorExpr *E);
-
-    // FIXME: Missing: conditional operator (for GNU
-    //                 conditional select), ExtVectorElementExpr
-  };
+  bool Success(ArrayRef<APValue> V, const Expr *E) {
+    assert(V.size() == E->getType()->castAs<VectorType>()->getNumElements());
+    // FIXME: remove this APValue copy.
+    Result = APValue(V.data(), V.size());
+    return true;
+  }
+  bool Success(const APValue &V, const Expr *E) {
+    assert(V.isVector());
+    Result = V;
+    return true;
+  }
+  bool ZeroInitialization(const Expr *E);
+
+  bool VisitUnaryReal(const UnaryOperator *E) { return Visit(E->getSubExpr()); }
+  bool VisitCastExpr(const CastExpr *E);
+  bool VisitInitListExpr(const InitListExpr *E);
+  bool VisitUnaryImag(const UnaryOperator *E);
+  bool VisitBinaryOperator(const BinaryOperator *E);
+  bool VisitUnaryOperator(const UnaryOperator *E);
+  bool VisitCallExpr(const CallExpr *E);
+  bool VisitConvertVectorExpr(const ConvertVectorExpr *E);
+  bool VisitShuffleVectorExpr(const ShuffleVectorExpr *E);
+
+  // FIXME: Missing: conditional operator (for GNU
+  //                 conditional select), ExtVectorElementExpr
+};
 } // end anonymous namespace
 
-static bool EvaluateVector(const Expr* E, APValue& Result, EvalInfo &Info) {
+static bool EvaluateVector(const Expr *E, APValue &Result, EvalInfo &Info) {
   assert(E->isPRValue() && E->getType()->isVectorType() &&
          "not a vector prvalue");
   return VectorExprEvaluator(Info, Result).Visit(E);
@@ -11800,8 +11781,7 @@ bool VectorExprEvaluator::VisitCastExpr(const CastExpr *E) {
   }
 }
 
-bool
-VectorExprEvaluator::VisitInitListExpr(const InitListExpr *E) {
+bool VectorExprEvaluator::VisitInitListExpr(const InitListExpr *E) {
   const VectorType *VT = E->getType()->castAs<VectorType>();
   unsigned NumInits = E->getNumInits();
   unsigned NumElements = VT->getNumElements();
@@ -11821,8 +11801,8 @@ VectorExprEvaluator::VisitInitListExpr(const InitListExpr *E) {
   unsigned CountInits = 0, CountElts = 0;
   while (CountElts < NumElements) {
     // Handle nested vector initialization.
-    if (CountInits < NumInits
-        && E->getInit(CountInits)->getType()->isVectorType()) {
+    if (CountInits < NumInits &&
+        E->getInit(CountInits)->getType()->isVectorType()) {
       APValue v;
       if (!EvaluateVector(E->getInit(CountInits), v, Info))
         return Error(E);
@@ -11854,8 +11834,7 @@ VectorExprEvaluator::VisitInitListExpr(const InitListExpr *E) {
   return Success(Elements, E);
 }
 
-bool
-VectorExprEvaluator::ZeroInitialization(const Expr *E) {
+bool VectorExprEvaluator::ZeroInitialization(const Expr *E) {
   const auto *VT = E->getType()->castAs<VectorType>();
   QualType EltTy = VT->getElementType();
   APValue ZeroElement;
@@ -14882,73 +14861,71 @@ bool MatrixExprEvaluator::VisitInitListExpr(const InitListExpr *E) {
 //===----------------------------------------------------------------------===//
 
 namespace {
-  class ArrayExprEvaluator
-  : public ExprEvaluatorBase<ArrayExprEvaluator> {
-    const LValue &This;
-    APValue &Result;
-  public:
+class ArrayExprEvaluator : public ExprEvaluatorBase<ArrayExprEvaluator> {
+  const LValue &This;
+  APValue &Result;
 
-    ArrayExprEvaluator(EvalInfo &Info, const LValue &This, APValue &Result)
+public:
+  ArrayExprEvaluator(EvalInfo &Info, const LValue &This, APValue &Result)
       : ExprEvaluatorBaseTy(Info), This(This), Result(Result) {}
 
-    bool Success(const APValue &V, const Expr *E) {
-      assert(V.isArray() && "expected array");
-      Result = V;
-      return true;
-    }
-
-    bool ZeroInitialization(const Expr *E) {
-      const ConstantArrayType *CAT =
-          Info.Ctx.getAsConstantArrayType(E->getType());
-      if (!CAT) {
-        if (E->getType()->isIncompleteArrayType()) {
-          // We can be asked to zero-initialize a flexible array member; this
-          // is represented as an ImplicitValueInitExpr of incomplete array
-          // type. In this case, the array has zero elements.
-          Result = APValue(APValue::UninitArray(), 0, 0);
-          return true;
-        }
-        // FIXME: We could handle VLAs here.
-        return Error(E);
-      }
+  bool Success(const APValue &V, const Expr *E) {
+    assert(V.isArray() && "expected array");
+    Result = V;
+    return true;
+  }
 
-      Result = APValue(APValue::UninitArray(), 0, CAT->getZExtSize());
-      if (!Result.hasArrayFiller())
+  bool ZeroInitialization(const Expr *E) {
+    const ConstantArrayType *CAT =
+        Info.Ctx.getAsConstantArrayType(E->getType());
+    if (!CAT) {
+      if (E->getType()->isIncompleteArrayType()) {
+        // We can be asked to zero-initialize a flexible array member; this
+        // is represented as an ImplicitValueInitExpr of incomplete array
+        // type. In this case, the array has zero elements.
+        Result = APValue(APValue::UninitArray(), 0, 0);
         return true;
+      }
+      // FIXME: We could handle VLAs here.
+      return Error(E);
+    }
 
-      // Zero-initialize all elements.
-      LValue Subobject = This;
-      Subobject.addArray(Info, E, CAT);
-      ImplicitValueInitExpr VIE(CAT->getElementType());
-      return EvaluateInPlace(Result.getArrayFiller(), Info, Subobject, &VIE);
-    }
-
-    bool VisitCallExpr(const CallExpr *E) {
-      return handleCallExpr(E, Result, &This);
-    }
-    bool VisitCastExpr(const CastExpr *E);
-    bool VisitInitListExpr(const InitListExpr *E,
-                           QualType AllocType = QualType());
-    bool VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E);
-    bool VisitCXXConstructExpr(const CXXConstructExpr *E);
-    bool VisitCXXConstructExpr(const CXXConstructExpr *E,
-                               const LValue &Subobject,
-                               APValue *Value, QualType Type);
-    bool VisitStringLiteral(const StringLiteral *E,
-                            QualType AllocType = QualType()) {
-      expandStringLiteral(Info, E, Result, AllocType);
+    Result = APValue(APValue::UninitArray(), 0, CAT->getZExtSize());
+    if (!Result.hasArrayFiller())
       return true;
-    }
-    bool VisitCXXParenListInitExpr(const CXXParenListInitExpr *E);
-    bool VisitCXXParenListOrInitListExpr(const Expr *ExprToVisit,
-                                         ArrayRef<Expr *> Args,
-                                         const Expr *ArrayFiller,
-                                         QualType AllocType = QualType());
-  };
+
+    // Zero-initialize all elements.
+    LValue Subobject = This;
+    Subobject.addArray(Info, E, CAT);
+    ImplicitValueInitExpr VIE(CAT->getElementType());
+    return EvaluateInPlace(Result.getArrayFiller(), Info, Subobject, &VIE);
+  }
+
+  bool VisitCallExpr(const CallExpr *E) {
+    return handleCallExpr(E, Result, &This);
+  }
+  bool VisitCastExpr(const CastExpr *E);
+  bool VisitInitListExpr(const InitListExpr *E,
+                         QualType AllocType = QualType());
+  bool VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E);
+  bool VisitCXXConstructExpr(const CXXConstructExpr *E);
+  bool VisitCXXConstructExpr(const CXXConstructExpr *E, const LValue &Subobject,
+                             APValue *Value, QualType Type);
+  bool VisitStringLiteral(const StringLiteral *E,
+                          QualType AllocType = QualType()) {
+    expandStringLiteral(Info, E, Result, AllocType);
+    return true;
+  }
+  bool VisitCXXParenListInitExpr(const CXXParenListInitExpr *E);
+  bool VisitCXXParenListOrInitListExpr(const Expr *ExprToVisit,
+                                       ArrayRef<Expr *> Args,
+                                       const Expr *ArrayFiller,
+                                       QualType AllocType = QualType());
+};
 } // end anonymous namespace
 
-static bool EvaluateArray(const Expr *E, const LValue &This,
-                          APValue &Result, EvalInfo &Info) {
+static bool EvaluateArray(const Expr *E, const LValue &This, APValue &Result,
+                          EvalInfo &Info) {
   assert(!E->isValueDependent());
   assert(E->isPRValue() && E->getType()->isArrayType() &&
          "not an array prvalue");
@@ -15202,10 +15179,10 @@ bool ArrayExprEvaluator::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E) {
     // array element, if any.
     FullExpressionRAII Scope(Info);
 
-    if (!EvaluateInPlace(Result.getArrayInitializedElt(Index),
-                         Info, Subobject, E->getSubExpr()) ||
-        !HandleLValueArrayAdjustment(Info, E, Subobject,
-                                     CAT->getElementType(), 1)) {
+    if (!EvaluateInPlace(Result.getArrayInitializedElt(Index), Info, Subobject,
+                         E->getSubExpr()) ||
+        !HandleLValueArrayAdjustment(Info, E, Subobject, CAT->getElementType(),
+                                     1)) {
       if (!Info.noteFailure())
         return false;
       Success = false;
@@ -15224,17 +15201,16 @@ bool ArrayExprEvaluator::VisitCXXConstructExpr(const CXXConstructExpr *E) {
 
 bool ArrayExprEvaluator::VisitCXXConstructExpr(const CXXConstructExpr *E,
                                                const LValue &Subobject,
-                                               APValue *Value,
-                                               QualType Type) {
+                                               APValue *Value, QualType Type) {
   bool HadZeroInit = Value->hasValue();
 
   if (const ConstantArrayType *CAT = Info.Ctx.getAsConstantArrayType(Type)) {
     unsigned FinalSize = CAT->getZExtSize();
 
     // Preserve the array filler if we had prior zero-initialization.
-    APValue Filler =
-      HadZeroInit && Value->hasArrayFiller() ? Value->getArrayFiller()
-                                             : APValue();
+    APValue Filler = HadZeroInit && Value->hasArrayFiller()
+                         ? Value->getArrayFiller()
+                         : APValue();
 
     *Value = APValue(APValue::UninitArray(), 0, FinalSize);
     if (FinalSize == 0)
@@ -15296,7 +15272,7 @@ bool ArrayExprEvaluator::VisitCXXConstructExpr(const CXXConstructExpr *E,
     return Error(E);
 
   return RecordExprEvaluator(Info, Subobject, *Value)
-             .VisitCXXConstructExpr(E, Type);
+      .VisitCXXConstructExpr(E, Type);
 }
 
 bool ArrayExprEvaluator::VisitCXXParenListInitExpr(
@@ -15317,9 +15293,9 @@ bool ArrayExprEvaluator::VisitCXXParenListInitExpr(
 //===----------------------------------------------------------------------===//
 
 namespace {
-class IntExprEvaluator
-        : public ExprEvaluatorBase<IntExprEvaluator> {
+class IntExprEvaluator : public ExprEvaluatorBase<IntExprEvaluator> {
   APValue &Result;
+
 public:
   IntExprEvaluator(EvalInfo &info, APValue &result)
       : ExprEvaluatorBaseTy(info), Result(result) {}
@@ -15345,7 +15321,7 @@ class IntExprEvaluator
            "Invalid evaluation result.");
     Result = APValue(APSInt(I));
     Result.getInt().setIsUnsigned(
-                            E->getType()->isUnsignedIntegerOrEnumerationType());
+        E->getType()->isUnsignedIntegerOrEnumerationType());
     return true;
   }
   bool Success(const llvm::APInt &I, const Expr *E) {
@@ -15415,7 +15391,7 @@ class IntExprEvaluator
   bool VisitOffsetOfExpr(const OffsetOfExpr *E);
   bool VisitUnaryOperator(const UnaryOperator *E);
 
-  bool VisitCastExpr(const CastExpr* E);
+  bool VisitCastExpr(const CastExpr *E);
   bool VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *E);
 
   bool VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *E) {
@@ -15437,9 +15413,7 @@ class IntExprEvaluator
   }
 
   // Note, GNU defines __null as an integer, not a pointer.
-  bool VisitGNUNullExpr(const GNUNullExpr *E) {
-    return ZeroInitialization(E);
-  }
+  bool VisitGNUNullExpr(const GNUNullExpr *E) { return ZeroInitialization(E); }
 
   bool VisitTypeTraitExpr(const TypeTraitExpr *E) {
     if (E->isStoredAsBoolean())
@@ -15480,7 +15454,7 @@ class FixedPointExprEvaluator
     : public ExprEvaluatorBase<FixedPointExprEvaluator> {
   APValue &Result;
 
- public:
+public:
   FixedPointExprEvaluator(EvalInfo &info, APValue &result)
       : ExprEvaluatorBaseTy(info), Result(result) {}
 
@@ -15506,9 +15480,7 @@ class FixedPointExprEvaluator
     return true;
   }
 
-  bool ZeroInitialization(const Expr *E) {
-    return Success(0, E);
-  }
+  bool ZeroInitialization(const Expr *E) { return Success(0, E); }
 
   //===--------------------------------------------------------------------===//
   //                            Visitor Methods
@@ -15595,14 +15567,14 @@ static bool EvaluateFixedPointOrInteger(const Expr *E, APFixedPoint &Result,
 /// Check whether the given declaration can be directly converted to an integral
 /// rvalue. If not, no diagnostic is produced; there are other things we can
 /// try.
-bool IntExprEvaluator::CheckReferencedDecl(const Expr* E, const Decl* D) {
+bool IntExprEvaluator::CheckReferencedDecl(const Expr *E, const Decl *D) {
   // Enums are integer constant exprs.
   if (const EnumConstantDecl *ECD = dyn_cast<EnumConstantDecl>(D)) {
     // Check for signedness/width mismatches between E type and ECD value.
-    bool SameSign = (ECD->getInitVal().isSigned()
-                     == E->getType()->isSignedIntegerOrEnumerationType());
-    bool SameWidth = (ECD->getInitVal().getBitWidth()
-                      == Info.Ctx.getIntWidth(E->getType()));
+    bool SameSign = (ECD->getInitVal().isSigned() ==
+                     E->getType()->isSignedIntegerOrEnumerationType());
+    bool SameWidth =
+        (ECD->getInitVal().getBitWidth() == Info.Ctx.getIntWidth(E->getType()));
     if (SameSign && SameWidth)
       return Success(ECD->getInitVal(), E);
     else {
@@ -15635,17 +15607,20 @@ GCCTypeClass EvaluateBuiltinClassifyType(QualType T,
 #include "clang/AST/TypeNodes.inc"
   case Type::Auto:
   case Type::DeducedTemplateSpecialization:
-      llvm_unreachable("unexpected non-canonical or dependent type");
+    llvm_unreachable("unexpected non-canonical or dependent type");
 
   case Type::Builtin:
-      switch (cast<BuiltinType>(CanTy)->getKind()) {
+    switch (cast<BuiltinType>(CanTy)->getKind()) {
 #define BUILTIN_TYPE(ID, SINGLETON_ID)
-#define SIGNED_TYPE(ID, SINGLETON_ID) \
-    case BuiltinType::ID: return GCCTypeClass::Integer;
-#define FLOATING_TYPE(ID, SINGLETON_ID) \
-    case BuiltinType::ID: return GCCTypeClass::RealFloat;
-#define PLACEHOLDER_TYPE(ID, SINGLETON_ID) \
-    case BuiltinType::ID: break;
+#define SIGNED_TYPE(ID, SINGLETON_ID)                                          \
+  case BuiltinType::ID:                                                        \
+    return GCCTypeClass::Integer;
+#define FLOATING_TYPE(ID, SINGLETON_ID)                                        \
+  case BuiltinType::ID:                                                        \
+    return GCCTypeClass::RealFloat;
+#define PLACEHOLDER_TYPE(ID, SINGLETON_ID)                                     \
+  case BuiltinType::ID:                                                        \
+    break;
 #include "clang/AST/BuiltinTypes.def"
     case BuiltinType::Void:
       return GCCTypeClass::Void;
@@ -15685,22 +15660,19 @@ GCCTypeClass EvaluateBuiltinClassifyType(QualType T,
     case BuiltinType::ObjCId:
     case BuiltinType::ObjCClass:
     case BuiltinType::ObjCSel:
-#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
-    case BuiltinType::Id:
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix)                   \
+  case BuiltinType::Id:
 #include "clang/Basic/OpenCLImageTypes.def"
-#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
-    case BuiltinType::Id:
+#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) case BuiltinType::Id:
 #include "clang/Basic/OpenCLExtensionTypes.def"
     case BuiltinType::OCLSampler:
     case BuiltinType::OCLEvent:
     case BuiltinType::OCLClkEvent:
     case BuiltinType::OCLQueue:
     case BuiltinType::OCLReserveID:
-#define SVE_TYPE(Name, Id, SingletonId) \
-    case BuiltinType::Id:
+#define SVE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
 #include "clang/Basic/AArch64ACLETypes.def"
-#define PPC_VECTOR_TYPE(Name, Id, Size) \
-    case BuiltinType::Id:
+#define PPC_VECTOR_TYPE(Name, Id, Size) case BuiltinType::Id:
 #include "clang/Basic/PPCTypes.def"
 #define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
 #include "clang/Basic/RISCVVTypes.def"
@@ -15776,8 +15748,8 @@ GCCTypeClass EvaluateBuiltinClassifyType(QualType T,
 
 /// EvaluateBuiltinClassifyType - Evaluate __builtin_classify_type the same way
 /// as GCC.
-static GCCTypeClass
-EvaluateBuiltinClassifyType(const CallExpr *E, const LangOptions &LangOpts) {
+static GCCTypeClass EvaluateBuiltinClassifyType(const CallExpr *E,
+                                                const LangOptions &LangOpts) {
   // If no argument was supplied, default to None. This isn't
   // ideal, however it is what gcc does.
   if (E->getNumArgs() == 0)
@@ -15865,10 +15837,10 @@ static bool EvaluateBuiltinConstantP(EvalInfo &Info, const Expr *Arg) {
 /// Retrieves the "underlying object type" of the given expression,
 /// as used by __builtin_object_size.
 static QualType getObjectType(APValue::LValueBase B) {
-  if (const ValueDecl *D = B.dyn_cast<const ValueDecl*>()) {
+  if (const ValueDecl *D = B.dyn_cast<const ValueDecl *>()) {
     if (const VarDecl *VD = dyn_cast<VarDecl>(D))
       return VD->getType();
-  } else if (const Expr *E = B.dyn_cast<const Expr*>()) {
+  } else if (const Expr *E = B.dyn_cast<const Expr *>()) {
     if (isa<CompoundLiteralExpr>(E))
       return E->getType();
   } else if (B.is<TypeInfoLValue>()) {
@@ -16663,10 +16635,18 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
       return false;
     unsigned Arg;
     switch (Val.getCategory()) {
-    case APFloat::fcNaN: Arg = 0; break;
-    case APFloat::fcInfinity: Arg = 1; break;
-    case APFloat::fcNormal: Arg = Val.isDenormal() ? 3 : 2; break;
-    case APFloat::fcZero: Arg = 4; break;
+    case APFloat::fcNaN:
+      Arg = 0;
+      break;
+    case APFloat::fcInfinity:
+      Arg = 1;
+      break;
+    case APFloat::fcNormal:
+      Arg = Val.isDenormal() ? 3 : 2;
+      break;
+    case APFloat::fcZero:
+      Arg = 4;
+      break;
     }
     return Visit(E->getArg(Arg));
   }
@@ -16972,8 +16952,7 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
       return false;
 
     uint64_t MaxLength = uint64_t(-1);
-    if (BuiltinOp != Builtin::BIstrcmp &&
-        BuiltinOp != Builtin::BIwcscmp &&
+    if (BuiltinOp != Builtin::BIstrcmp && BuiltinOp != Builtin::BIwcscmp &&
         BuiltinOp != Builtin::BI__builtin_strcmp &&
         BuiltinOp != Builtin::BI__builtin_wcscmp) {
       APSInt N;
@@ -17115,8 +17094,8 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
       }
     }
 
-    return BuiltinOp == Builtin::BI__atomic_always_lock_free ?
-        Success(0, E) : Error(E);
+    return BuiltinOp == Builtin::BI__atomic_always_lock_free ? Success(0, E)
+                                                             : Error(E);
   }
   case Builtin::BI__builtin_addcb:
   case Builtin::BI__builtin_addcs:
@@ -17211,7 +17190,7 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
       bool IsSigned = LHS.isSigned() || RHS.isSigned() ||
                       ResultType->isSignedIntegerOrEnumerationType();
       bool AllSigned = LHS.isSigned() && RHS.isSigned() &&
-                      ResultType->isSignedIntegerOrEnumerationType();
+                       ResultType->isSignedIntegerOrEnumerationType();
       uint64_t LHSSize = LHS.getBitWidth();
       uint64_t RHSSize = RHS.getBitWidth();
       uint64_t ResultSize = Info.Ctx.getTypeSize(ResultType);
@@ -17929,7 +17908,7 @@ class DataRecursiveIntBinOpEvaluator {
 
 public:
   DataRecursiveIntBinOpEvaluator(IntExprEvaluator &IntEval, APValue &Result)
-    : IntEval(IntEval), Info(IntEval.getEvalInfo()), FinalResult(Result) { }
+      : IntEval(IntEval), Info(IntEval.getEvalInfo()), FinalResult(Result) {}
 
   /// True if \param E is a binary operator that we are going to handle
   /// data recursively.
@@ -17948,7 +17927,8 @@ class DataRecursiveIntBinOpEvaluator {
     while (!Queue.empty())
       process(PrevResult);
 
-    if (PrevResult.Failed) return false;
+    if (PrevResult.Failed)
+      return false;
 
     FinalResult.swap(PrevResult.Val);
     return true;
@@ -17961,12 +17941,8 @@ class DataRecursiveIntBinOpEvaluator {
   bool Success(const APSInt &Value, const Expr *E, APValue &Result) {
     return IntEval.Success(Value, E, Result);
   }
-  bool Error(const Expr *E) {
-    return IntEval.Error(E);
-  }
-  bool Error(const Expr *E, diag::kind D) {
-    return IntEval.Error(E, D);
-  }
+  bool Error(const Expr *E) { return IntEval.Error(E); }
+  bool Error(const Expr *E, diag::kind D) { return IntEval.Error(E, D); }
 
   OptionalDiagnostic CCEDiag(const Expr *E, diag::kind D) {
     return Info.CCEDiag(E, D);
@@ -17989,17 +17965,17 @@ class DataRecursiveIntBinOpEvaluator {
 
   void enqueue(const Expr *E) {
     E = E->IgnoreParens();
-    Queue.resize(Queue.size()+1);
+    Queue.resize(Queue.size() + 1);
     Queue.back().E = E;
     Queue.back().Kind = Job::AnyExprKind;
   }
 };
 
-}
+} // namespace
 
-bool DataRecursiveIntBinOpEvaluator::
-       VisitBinOpLHSOnly(EvalResult &LHSResult, const BinaryOperator *E,
-                         bool &SuppressRHSDiags) {
+bool DataRecursiveIntBinOpEvaluator::VisitBinOpLHSOnly(EvalResult &LHSResult,
+                                                       const BinaryOperator *E,
+                                                       bool &SuppressRHSDiags) {
   if (E->getOpcode() == BO_Comma) {
     // Ignore LHS but note if we could not evaluate it.
     if (LHSResult.Failed)
@@ -18051,13 +18027,14 @@ static void addOrSubLValueAsInteger(APValue &LVal, const APSInt &Index,
   CharUnits &Offset = LVal.getLValueOffset();
   uint64_t Offset64 = Offset.getQuantity();
   uint64_t Index64 = Index.extOrTrunc(64).getZExtValue();
-  Offset = CharUnits::fromQuantity(IsSub ? Offset64 - Index64
-                                         : Offset64 + Index64);
+  Offset =
+      CharUnits::fromQuantity(IsSub ? Offset64 - Index64 : Offset64 + Index64);
 }
 
-bool DataRecursiveIntBinOpEvaluator::
-       VisitBinOp(const EvalResult &LHSResult, const EvalResult &RHSResult,
-                  const BinaryOperator *E, APValue &Result) {
+bool DataRecursiveIntBinOpEvaluator::VisitBinOp(const EvalResult &LHSResult,
+                                                const EvalResult &RHSResult,
+                                                const BinaryOperator *E,
+                                                APValue &Result) {
   if (E->getOpcode() == BO_Comma) {
     if (RHSResult.Failed)
       return false;
@@ -18106,10 +18083,9 @@ bool DataRecursiveIntBinOpEvaluator::
   }
 
   // Handle cases like 4 + (unsigned long)&a
-  if (E->getOpcode() == BO_Add &&
-      RHSVal.isLValue() && LHSVal.isInt()) {
+  if (E->getOpcode() == BO_Add && RHSVal.isLValue() && LHSVal.isInt()) {
     Result = RHSVal;
-    addOrSubLValueAsInteger(Result, LHSVal.getInt(), /*IsSub*/false);
+    addOrSubLValueAsInteger(Result, LHSVal.getInt(), /*IsSub*/ false);
     return true;
   }
 
@@ -18118,8 +18094,8 @@ bool DataRecursiveIntBinOpEvaluator::
     if (!LHSVal.getLValueOffset().isZero() ||
         !RHSVal.getLValueOffset().isZero())
       return false;
-    const Expr *LHSExpr = LHSVal.getLValueBase().dyn_cast<const Expr*>();
-    const Expr *RHSExpr = RHSVal.getLValueBase().dyn_cast<const Expr*>();
+    const Expr *LHSExpr = LHSVal.getLValueBase().dyn_cast<const Expr *>();
+    const Expr *RHSExpr = RHSVal.getLValueBase().dyn_cast<const Expr *>();
     if (!LHSExpr || !RHSExpr)
       return false;
     const AddrLabelExpr *LHSAddrExpr = dyn_cast<AddrLabelExpr>(LHSExpr);
@@ -18153,43 +18129,43 @@ void DataRecursiveIntBinOpEvaluator::process(EvalResult &Result) {
   Job &job = Queue.back();
 
   switch (job.Kind) {
-    case Job::AnyExprKind: {
-      if (const BinaryOperator *Bop = dyn_cast<BinaryOperator>(job.E)) {
-        if (shouldEnqueue(Bop)) {
-          job.Kind = Job::BinOpKind;
-          enqueue(Bop->getLHS());
-          return;
-        }
-      }
-
-      EvaluateExpr(job.E, Result);
-      Queue.pop_back();
-      return;
-    }
-
-    case Job::BinOpKind: {
-      const BinaryOperator *Bop = cast<BinaryOperator>(job.E);
-      bool SuppressRHSDiags = false;
-      if (!VisitBinOpLHSOnly(Result, Bop, SuppressRHSDiags)) {
-        Queue.pop_back();
+  case Job::AnyExprKind: {
+    if (const BinaryOperator *Bop = dyn_cast<BinaryOperator>(job.E)) {
+      if (shouldEnqueue(Bop)) {
+        job.Kind = Job::BinOpKind;
+        enqueue(Bop->getLHS());
         return;
       }
-      if (SuppressRHSDiags)
-        job.startSpeculativeEval(Info);
-      job.LHSResult.swap(Result);
-      job.Kind = Job::BinOpVisitedLHSKind;
-      enqueue(Bop->getRHS());
-      return;
     }
 
-    case Job::BinOpVisitedLHSKind: {
-      const BinaryOperator *Bop = cast<BinaryOperator>(job.E);
-      EvalResult RHS;
-      RHS.swap(Result);
-      Result.Failed = !VisitBinOp(job.LHSResult, RHS, Bop, Result.Val);
+    EvaluateExpr(job.E, Result);
+    Queue.pop_back();
+    return;
+  }
+
+  case Job::BinOpKind: {
+    const BinaryOperator *Bop = cast<BinaryOperator>(job.E);
+    bool SuppressRHSDiags = false;
+    if (!VisitBinOpLHSOnly(Result, Bop, SuppressRHSDiags)) {
       Queue.pop_back();
       return;
     }
+    if (SuppressRHSDiags)
+      job.startSpeculativeEval(Info);
+    job.LHSResult.swap(Result);
+    job.Kind = Job::BinOpVisitedLHSKind;
+    enqueue(Bop->getRHS());
+    return;
+  }
+
+  case Job::BinOpVisitedLHSKind: {
+    const BinaryOperator *Bop = cast<BinaryOperator>(job.E);
+    EvalResult RHS;
+    RHS.swap(Result);
+    Result.Failed = !VisitBinOp(job.LHSResult, RHS, Bop, Result.Val);
+    Queue.pop_back();
+    return;
+  }
   }
 
   llvm_unreachable("Invalid Job::Kind!");
@@ -18285,9 +18261,9 @@ EvaluateComparisonBinaryOperator(EvalInfo &Info, const BinaryOperator *E,
 
     if (LHS.isComplexFloat()) {
       APFloat::cmpResult CR_r =
-        LHS.getComplexFloatReal().compare(RHS.getComplexFloatReal());
+          LHS.getComplexFloatReal().compare(RHS.getComplexFloatReal());
       APFloat::cmpResult CR_i =
-        LHS.getComplexFloatImag().compare(RHS.getComplexFloatImag());
+          LHS.getComplexFloatImag().compare(RHS.getComplexFloatImag());
       bool IsEqual = CR_r == APFloat::cmpEqual && CR_i == APFloat::cmpEqual;
       return Success(IsEqual ? CmpResult::Equal : CmpResult::Unequal, E);
     } else {
@@ -18298,8 +18274,7 @@ EvaluateComparisonBinaryOperator(EvalInfo &Info, const BinaryOperator *E,
     }
   }
 
-  if (LHSTy->isRealFloatingType() &&
-      RHSTy->isRealFloatingType()) {
+  if (LHSTy->isRealFloatingType() && RHSTy->isRealFloatingType()) {
     APFloat RHS(0.0), LHS(0.0);
 
     bool LHSOK = EvaluateFloat(E->getRHS(), RHS, Info);
@@ -18311,8 +18286,7 @@ EvaluateComparisonBinaryOperator(EvalInfo &Info, const BinaryOperator *E,
 
     assert(E->isComparisonOp() && "Invalid binary operator!");
     llvm::APFloatBase::cmpResult APFloatCmpResult = LHS.compare(RHS);
-    if (!Info.InConstantContext &&
-        APFloatCmpResult == APFloat::cmpUnordered &&
+    if (!Info.InConstantContext && APFloatCmpResult == APFloat::cmpUnordered &&
         E->getFPFeaturesInEffect(Info.Ctx.getLangOpts()).isFPConstrained()) {
       // Note: Compares may raise invalid in some cases involving NaN or sNaN.
       Info.FFDiag(E, diag::note_constexpr_float_arithmetic_strict);
@@ -18352,7 +18326,7 @@ EvaluateComparisonBinaryOperator(EvalInfo &Info, const BinaryOperator *E,
       if (Info.checkingPotentialConstantExpression() &&
           (LHSValue.AllowConstexprUnknown || RHSValue.AllowConstexprUnknown))
         return false;
-      auto DiagComparison = [&] (unsigned DiagID, bool Reversed = false) {
+      auto DiagComparison = [&](unsigned DiagID, bool Reversed = false) {
         std::string LHS = LHSValue.toString(Info.Ctx, E->getLHS()->getType());
         std::string RHS = RHSValue.toString(Info.Ctx, E->getRHS()->getType());
         Info.FFDiag(E, DiagID)
@@ -18401,7 +18375,7 @@ EvaluateComparisonBinaryOperator(EvalInfo &Info, const BinaryOperator *E,
         return DiagComparison(diag::note_constexpr_pointer_comparison_past_end,
                               true);
       if (RHSValue.Base && RHSValue.Offset.isZero() &&
-           isOnePastTheEndOfCompleteObject(Info.Ctx, LHSValue))
+          isOnePastTheEndOfCompleteObject(Info.Ctx, LHSValue))
         return DiagComparison(diag::note_constexpr_pointer_comparison_past_end,
                               false);
       // We can't tell whether an object is at the same address as another
@@ -18647,8 +18621,7 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
     auto OnSuccess = [&](CmpResult CR, const BinaryOperator *E) {
       assert((CR != CmpResult::Unequal || E->isEqualityOp()) &&
              "should only produce Unequal for equality comparisons");
-      bool IsEqual   = CR == CmpResult::Equal,
-           IsLess    = CR == CmpResult::Less,
+      bool IsEqual = CR == CmpResult::Equal, IsLess = CR == CmpResult::Less,
            IsGreater = CR == CmpResult::Greater;
       auto Op = E->getOpcode();
       switch (Op) {
@@ -18781,8 +18754,8 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
 /// VisitUnaryExprOrTypeTraitExpr - Evaluate a sizeof, alignof or vec_step with
 /// a result as the expression's type.
 bool IntExprEvaluator::VisitUnaryExprOrTypeTraitExpr(
-                                    const UnaryExprOrTypeTraitExpr *E) {
-  switch(E->getKind()) {
+    const UnaryExprOrTypeTraitExpr *E) {
+  switch (E->getKind()) {
   case UETT_PreferredAlignOf:
   case UETT_AlignOf: {
     if (E->isArgumentType())
@@ -18833,11 +18806,11 @@ bool IntExprEvaluator::VisitUnaryExprOrTypeTraitExpr(
   }
   case UETT_OpenMPRequiredSimdAlign:
     assert(E->isArgumentType());
-    return Success(
-        Info.Ctx.toCharUnitsFromBits(
-                    Info.Ctx.getOpenMPDefaultSimdAlign(E->getArgumentType()))
-            .getQuantity(),
-        E);
+    return Success(Info.Ctx
+                       .toCharUnitsFromBits(Info.Ctx.getOpenMPDefaultSimdAlign(
+                           E->getArgumentType()))
+                       .getQuantity(),
+                   E);
   case UETT_VectorElements: {
     QualType Ty = E->getTypeOfArgument();
     // If the vector has a fixed size, we can determine the number of elements
@@ -18929,7 +18902,8 @@ bool IntExprEvaluator::VisitOffsetOfExpr(const OffsetOfExpr *OOE) {
       const auto *RD = CurrentType->getAsRecordDecl();
       if (!RD)
         return Error(OOE);
-      if (RD->isInvalidDecl()) return false;
+      if (RD->isInvalidDecl())
+        return false;
       const ASTRecordLayout &RL = Info.Ctx.getASTRecordLayout(RD);
       unsigned i = MemberDecl->getFieldIndex();
       assert(i < RL.getFieldCount() && "offsetof field in wrong type");
@@ -18950,7 +18924,8 @@ bool IntExprEvaluator::VisitOffsetOfExpr(const OffsetOfExpr *OOE) {
       const auto *RD = CurrentType->getAsCXXRecordDecl();
       if (!RD)
         return Error(OOE);
-      if (RD->isInvalidDecl()) return false;
+      if (RD->isInvalidDecl())
+        return false;
       const ASTRecordLayout &RL = Info.Ctx.getASTRecordLayout(RD);
 
       // Find the base class itself.
@@ -18984,7 +18959,8 @@ bool IntExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {
   case UO_Minus: {
     if (!Visit(E->getSubExpr()))
       return false;
-    if (!Result.isInt()) return Error(E);
+    if (!Result.isInt())
+      return Error(E);
     const APSInt &Value = Result.getInt();
     if (Value.isSigned() && Value.isMinSignedValue() && E->canOverflow() &&
         !E->getType().isWrapType()) {
@@ -19004,7 +18980,8 @@ bool IntExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {
   case UO_Not: {
     if (!Visit(E->getSubExpr()))
       return false;
-    if (!Result.isInt()) return Error(E);
+    if (!Result.isInt())
+      return Error(E);
     return Success(~Result.getInt(), E);
   }
   case UO_LNot: {
@@ -19173,8 +19150,8 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) {
       }
     }
 
-    return Success(HandleIntToIntCast(Info, E, DestType, SrcType,
-                                      Result.getInt()), E);
+    return Success(
+        HandleIntToIntCast(Info, E, DestType, SrcType, Result.getInt()), E);
   }
 
   case CK_PointerToIntegral: {
@@ -19293,7 +19270,7 @@ bool IntExprEvaluator::VisitCXXNoexceptExpr(const CXXNoexceptExpr *E) {
 }
 
 bool IntExprEvaluator::VisitConceptSpecializationExpr(
-       const ConceptSpecializationExpr *E) {
+    const ConceptSpecializationExpr *E) {
   return Success(E->isSatisfied(), E);
 }
 
@@ -19303,28 +19280,29 @@ bool IntExprEvaluator::VisitRequiresExpr(const RequiresExpr *E) {
 
 bool FixedPointExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {
   switch (E->getOpcode()) {
-    default:
-      // Invalid unary operators
+  default:
+    // Invalid unary operators
+    return Error(E);
+  case UO_Plus:
+    // The result is just the value.
+    return Visit(E->getSubExpr());
+  case UO_Minus: {
+    if (!Visit(E->getSubExpr()))
+      return false;
+    if (!Result.isFixedPoint())
       return Error(E);
-    case UO_Plus:
-      // The result is just the value.
-      return Visit(E->getSubExpr());
-    case UO_Minus: {
-      if (!Visit(E->getSubExpr())) return false;
-      if (!Result.isFixedPoint())
-        return Error(E);
-      bool Overflowed;
-      APFixedPoint Negated = Result.getFixedPoint().negate(&Overflowed);
-      if (Overflowed && !HandleOverflow(Info, E, Negated, E->getType()))
-        return false;
-      return Success(Negated, E);
-    }
-    case UO_LNot: {
-      bool bres;
-      if (!EvaluateAsBooleanCondition(E->getSubExpr(), bres, Info))
-        return false;
-      return Success(!bres, E);
-    }
+    bool Overflowed;
+    APFixedPoint Negated = Result.getFixedPoint().negate(&Overflowed);
+    if (Overflowed && !HandleOverflow(Info, E, Negated, E->getType()))
+      return false;
+    return Success(Negated, E);
+  }
+  case UO_LNot: {
+    bool bres;
+    if (!EvaluateAsBooleanCondition(E->getSubExpr(), bres, Info))
+      return false;
+    return Success(!bres, E);
+  }
   }
 }
 
@@ -19344,9 +19322,9 @@ bool FixedPointExprEvaluator::VisitCastExpr(const CastExpr *E) {
     APFixedPoint Result = Src.convert(DestFXSema, &Overflowed);
     if (Overflowed) {
       if (Info.checkingForUndefinedBehavior())
-        Info.Ctx.getDiagnostics().Report(E->getExprLoc(),
-                                         diag::warn_fixedpoint_constant_overflow)
-          << Result.toString() << E->getType();
+        Info.Ctx.getDiagnostics().Report(
+            E->getExprLoc(), diag::warn_fixedpoint_constant_overflow)
+            << Result.toString() << E->getType();
       if (!HandleOverflow(Info, E, Result, E->getType()))
         return false;
     }
@@ -19363,9 +19341,9 @@ bool FixedPointExprEvaluator::VisitCastExpr(const CastExpr *E) {
 
     if (Overflowed) {
       if (Info.checkingForUndefinedBehavior())
-        Info.Ctx.getDiagnostics().Report(E->getExprLoc(),
-                                         diag::warn_fixedpoint_constant_overflow)
-          << IntResult.toString() << E->getType();
+        Info.Ctx.getDiagnostics().Report(
+            E->getExprLoc(), diag::warn_fixedpoint_constant_overflow)
+            << IntResult.toString() << E->getType();
       if (!HandleOverflow(Info, E, IntResult, E->getType()))
         return false;
     }
@@ -19383,9 +19361,9 @@ bool FixedPointExprEvaluator::VisitCastExpr(const CastExpr *E) {
 
     if (Overflowed) {
       if (Info.checkingForUndefinedBehavior())
-        Info.Ctx.getDiagnostics().Report(E->getExprLoc(),
-                                         diag::warn_fixedpoint_constant_overflow)
-          << Result.toString() << E->getType();
+        Info.Ctx.getDiagnostics().Report(
+            E->getExprLoc(), diag::warn_fixedpoint_constant_overflow)
+            << Result.toString() << E->getType();
       if (!HandleOverflow(Info, E, Result, E->getType()))
         return false;
     }
@@ -19421,17 +19399,17 @@ bool FixedPointExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
   switch (E->getOpcode()) {
   case BO_Add: {
     Result = LHSFX.add(RHSFX, &OpOverflow)
-                  .convert(ResultFXSema, &ConversionOverflow);
+                 .convert(ResultFXSema, &ConversionOverflow);
     break;
   }
   case BO_Sub: {
     Result = LHSFX.sub(RHSFX, &OpOverflow)
-                  .convert(ResultFXSema, &ConversionOverflow);
+                 .convert(ResultFXSema, &ConversionOverflow);
     break;
   }
   case BO_Mul: {
     Result = LHSFX.mul(RHSFX, &OpOverflow)
-                  .convert(ResultFXSema, &ConversionOverflow);
+                 .convert(ResultFXSema, &ConversionOverflow);
     break;
   }
   case BO_Div: {
@@ -19440,7 +19418,7 @@ bool FixedPointExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
       return false;
     }
     Result = LHSFX.div(RHSFX, &OpOverflow)
-                  .convert(ResultFXSema, &ConversionOverflow);
+                 .convert(ResultFXSema, &ConversionOverflow);
     break;
   }
   case BO_Shl:
@@ -19473,7 +19451,7 @@ bool FixedPointExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
     if (Info.checkingForUndefinedBehavior())
       Info.Ctx.getDiagnostics().Report(E->getExprLoc(),
                                        diag::warn_fixedpoint_constant_overflow)
-        << Result.toString() << E->getType();
+          << Result.toString() << E->getType();
     if (!HandleOverflow(Info, E, Result, E->getType()))
       return false;
   }
@@ -19485,12 +19463,12 @@ bool FixedPointExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
 //===----------------------------------------------------------------------===//
 
 namespace {
-class FloatExprEvaluator
-  : public ExprEvaluatorBase<FloatExprEvaluator> {
+class FloatExprEvaluator : public ExprEvaluatorBase<FloatExprEvaluator> {
   APFloat &Result;
+
 public:
   FloatExprEvaluator(EvalInfo &info, APFloat &result)
-    : ExprEvaluatorBaseTy(info), Result(result) {}
+      : ExprEvaluatorBaseTy(info), Result(result) {}
 
   bool Success(const APValue &V, const Expr *e) {
     Result = V.getFloat();
@@ -19516,19 +19494,18 @@ class FloatExprEvaluator
 };
 } // end anonymous namespace
 
-static bool EvaluateFloat(const Expr* E, APFloat& Result, EvalInfo &Info) {
+static bool EvaluateFloat(const Expr *E, APFloat &Result, EvalInfo &Info) {
   assert(!E->isValueDependent());
   assert(E->isPRValue() && E->getType()->isRealFloatingType());
   return FloatExprEvaluator(Info, Result).Visit(E);
 }
 
-static bool TryEvaluateBuiltinNaN(const ASTContext &Context,
-                                  QualType ResultTy,
-                                  const Expr *Arg,
-                                  bool SNaN,
+static bool TryEvaluateBuiltinNaN(const ASTContext &Context, QualType ResultTy,
+                                  const Expr *Arg, bool SNaN,
                                   llvm::APFloat &Result) {
   const StringLiteral *S = dyn_cast<StringLiteral>(Arg->IgnoreParenCasts());
-  if (!S) return false;
+  if (!S)
+    return false;
 
   const llvm::fltSemantics &Sem = Context.getFloatTypeSemantics(ResultTy);
 
@@ -19579,7 +19556,7 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr *E) {
   case Builtin::BI__builtin_inff16:
   case Builtin::BI__builtin_inff128: {
     const llvm::fltSemantics &Sem =
-      Info.Ctx.getFloatTypeSemantics(E->getType());
+        Info.Ctx.getFloatTypeSemantics(E->getType());
     Result = llvm::APFloat::getInf(Sem);
     return true;
   }
@@ -19589,8 +19566,8 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr *E) {
   case Builtin::BI__builtin_nansl:
   case Builtin::BI__builtin_nansf16:
   case Builtin::BI__builtin_nansf128:
-    if (!TryEvaluateBuiltinNaN(Info.Ctx, E->getType(), E->getArg(0),
-                               true, Result))
+    if (!TryEvaluateBuiltinNaN(Info.Ctx, E->getType(), E->getArg(0), true,
+                               Result))
       return Error(E);
     return true;
 
@@ -19601,8 +19578,8 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr *E) {
   case Builtin::BI__builtin_nanf128:
     // If this is __builtin_nan() turn this into a nan, otherwise we
     // can't constant fold it.
-    if (!TryEvaluateBuiltinNaN(Info.Ctx, E->getType(), E->getArg(0),
-                               false, Result))
+    if (!TryEvaluateBuiltinNaN(Info.Ctx, E->getType(), E->getArg(0), false,
+                               Result))
       return Error(E);
     return true;
 
@@ -19626,9 +19603,9 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr *E) {
   case Builtin::BI__arithmetic_fence:
     return EvaluateFloat(E->getArg(0), Result, Info);
 
-  // FIXME: Builtin::BI__builtin_powi
-  // FIXME: Builtin::BI__builtin_powif
-  // FIXME: Builtin::BI__builtin_powil
+    // FIXME: Builtin::BI__builtin_powi
+    // FIXME: Builtin::BI__builtin_powif
+    // FIXME: Builtin::BI__builtin_powil
 
   case Builtin::BI__builtin_copysign:
   case Builtin::BI__builtin_copysignf:
@@ -19751,7 +19728,8 @@ bool FloatExprEvaluator::VisitUnaryImag(const UnaryOperator *E) {
 
 bool FloatExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {
   switch (E->getOpcode()) {
-  default: return Error(E);
+  default:
+    return Error(E);
   case UO_Plus:
     return EvaluateFloat(E->getSubExpr(), Result, Info);
   case UO_Minus:
@@ -19783,7 +19761,7 @@ bool FloatExprEvaluator::VisitFloatingLiteral(const FloatingLiteral *E) {
 }
 
 bool FloatExprEvaluator::VisitCastExpr(const CastExpr *E) {
-  const Expr* SubExpr = E->getSubExpr();
+  const Expr *SubExpr = E->getSubExpr();
 
   switch (E->getCastKind()) {
   default:
@@ -19794,11 +19772,10 @@ bool FloatExprEvaluator::VisitCastExpr(const CastExpr *E) {
 
   case CK_IntegralToFloating: {
     APSInt IntResult;
-    const FPOptions FPO = E->getFPFeaturesInEffect(
-                                  Info.Ctx.getLangOpts());
+    const FPOptions FPO = E->getFPFeaturesInEffect(Info.Ctx.getLangOpts());
     return EvaluateInteger(SubExpr, IntResult, Info) &&
-           HandleIntToFloatCast(Info, E, FPO, SubExpr->getType(),
-                                IntResult, E->getType(), Result);
+           HandleIntToFloatCast(Info, E, FPO, SubExpr->getType(), IntResult,
+                                E->getType(), Result);
   }
 
   case CK_FixedPointToFloating: {
@@ -19861,13 +19838,12 @@ bool FloatExprEvaluator::VisitCastExpr(const CastExpr *E) {
 //===----------------------------------------------------------------------===//
 
 namespace {
-class ComplexExprEvaluator
-  : public ExprEvaluatorBase<ComplexExprEvaluator> {
+class ComplexExprEvaluator : public ExprEvaluatorBase<ComplexExprEvaluator> {
   ComplexValue &Result;
 
 public:
   ComplexExprEvaluator(EvalInfo &info, ComplexValue &Result)
-    : ExprEvaluatorBaseTy(info), Result(Result) {}
+      : ExprEvaluatorBaseTy(info), Result(Result) {}
 
   bool Success(const APValue &V, const Expr *e) {
     Result.setFrom(V);
@@ -19913,7 +19889,7 @@ bool ComplexExprEvaluator::ZeroInitialization(const Expr *E) {
 }
 
 bool ComplexExprEvaluator::VisitImaginaryLiteral(const ImaginaryLiteral *E) {
-  const Expr* SubExpr = E->getSubExpr();
+  const Expr *SubExpr = E->getSubExpr();
 
   if (SubExpr->getType()->isRealFloatingType()) {
     Result.makeComplexFloat();
@@ -20025,8 +20001,8 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
       return false;
 
     QualType To = E->getType()->castAs<ComplexType>()->getElementType();
-    QualType From
-      = E->getSubExpr()->getType()->castAs<ComplexType>()->getElementType();
+    QualType From =
+        E->getSubExpr()->getType()->castAs<ComplexType>()->getElementType();
 
     return HandleFloatToFloatCast(Info, E, From, To, Result.FloatReal) &&
            HandleFloatToFloatCast(Info, E, From, To, Result.FloatImag);
@@ -20037,13 +20013,13 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
       return false;
 
     QualType To = E->getType()->castAs<ComplexType>()->getElementType();
-    QualType From
-      = E->getSubExpr()->getType()->castAs<ComplexType>()->getElementType();
+    QualType From =
+        E->getSubExpr()->getType()->castAs<ComplexType>()->getElementType();
     Result.makeComplexInt();
-    return HandleFloatToIntCast(Info, E, From, Result.FloatReal,
-                                To, Result.IntReal) &&
-           HandleFloatToIntCast(Info, E, From, Result.FloatImag,
-                                To, Result.IntImag);
+    return HandleFloatToIntCast(Info, E, From, Result.FloatReal, To,
+                                Result.IntReal) &&
+           HandleFloatToIntCast(Info, E, From, Result.FloatImag, To,
+                                Result.IntImag);
   }
 
   case CK_IntegralRealToComplex: {
@@ -20061,8 +20037,8 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
       return false;
 
     QualType To = E->getType()->castAs<ComplexType>()->getElementType();
-    QualType From
-      = E->getSubExpr()->getType()->castAs<ComplexType>()->getElementType();
+    QualType From =
+        E->getSubExpr()->getType()->castAs<ComplexType>()->getElementType();
 
     Result.IntReal = HandleIntToIntCast(Info, E, To, From, Result.IntReal);
     Result.IntImag = HandleIntToIntCast(Info, E, To, From, Result.IntImag);
@@ -20073,16 +20049,15 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
     if (!Visit(E->getSubExpr()))
       return false;
 
-    const FPOptions FPO = E->getFPFeaturesInEffect(
-                                  Info.Ctx.getLangOpts());
+    const FPOptions FPO = E->getFPFeaturesInEffect(Info.Ctx.getLangOpts());
     QualType To = E->getType()->castAs<ComplexType>()->getElementType();
-    QualType From
-      = E->getSubExpr()->getType()->castAs<ComplexType>()->getElementType();
+    QualType From =
+        E->getSubExpr()->getType()->castAs<ComplexType>()->getElementType();
     Result.makeComplexFloat();
-    return HandleIntToFloatCast(Info, E, FPO, From, Result.IntReal,
-                                To, Result.FloatReal) &&
-           HandleIntToFloatCast(Info, E, FPO, From, Result.IntImag,
-                                To, Result.FloatImag);
+    return HandleIntToFloatCast(Info, E, FPO, From, Result.IntReal, To,
+                                Result.FloatReal) &&
+           HandleIntToFloatCast(Info, E, FPO, From, Result.IntImag, To,
+                                Result.FloatImag);
   }
   }
 
@@ -20346,7 +20321,8 @@ bool ComplexExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
   assert(!(LHSReal && RHSReal) &&
          "Cannot have both operands of a complex operation be real.");
   switch (E->getOpcode()) {
-  default: return Error(E);
+  default:
+    return Error(E);
   case BO_Add:
     if (Result.isComplexFloat()) {
       Result.getComplexFloatReal().add(RHS.getComplexFloatReal(),
@@ -20413,11 +20389,11 @@ bool ComplexExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
     } else {
       ComplexValue LHS = Result;
       Result.getComplexIntReal() =
-        (LHS.getComplexIntReal() * RHS.getComplexIntReal() -
-         LHS.getComplexIntImag() * RHS.getComplexIntImag());
+          (LHS.getComplexIntReal() * RHS.getComplexIntReal() -
+           LHS.getComplexIntImag() * RHS.getComplexIntImag());
       Result.getComplexIntImag() =
-        (LHS.getComplexIntReal() * RHS.getComplexIntImag() +
-         LHS.getComplexIntImag() * RHS.getComplexIntReal());
+          (LHS.getComplexIntReal() * RHS.getComplexIntImag() +
+           LHS.getComplexIntImag() * RHS.getComplexIntReal());
     }
     break;
   case BO_Div:
@@ -20451,16 +20427,18 @@ bool ComplexExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
     } else {
       ComplexValue LHS = Result;
       APSInt Den = RHS.getComplexIntReal() * RHS.getComplexIntReal() +
-        RHS.getComplexIntImag() * RHS.getComplexIntImag();
+                   RHS.getComplexIntImag() * RHS.getComplexIntImag();
       if (Den.isZero())
         return Error(E, diag::note_expr_divide_by_zero);
 
       Result.getComplexIntReal() =
-        (LHS.getComplexIntReal() * RHS.getComplexIntReal() +
-         LHS.getComplexIntImag() * RHS.getComplexIntImag()) / Den;
+          (LHS.getComplexIntReal() * RHS.getComplexIntReal() +
+           LHS.getComplexIntImag() * RHS.getComplexIntImag()) /
+          Den;
       Result.getComplexIntImag() =
-        (LHS.getComplexIntImag() * RHS.getComplexIntReal() -
-         LHS.getComplexIntReal() * RHS.getComplexIntImag()) / Den;
+          (LHS.getComplexIntImag() * RHS.getComplexIntReal() -
+           LHS.getComplexIntReal() * RHS.getComplexIntImag()) /
+          Den;
     }
     break;
   }
@@ -20485,8 +20463,7 @@ bool ComplexExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {
     if (Result.isComplexFloat()) {
       Result.getComplexFloatReal().changeSign();
       Result.getComplexFloatImag().changeSign();
-    }
-    else {
+    } else {
       Result.getComplexIntReal() = -Result.getComplexIntReal();
       Result.getComplexIntImag() = -Result.getComplexIntImag();
     }
@@ -20544,10 +20521,10 @@ bool ComplexExprEvaluator::VisitCallExpr(const CallExpr *E) {
 //===----------------------------------------------------------------------===//
 
 namespace {
-class AtomicExprEvaluator :
-    public ExprEvaluatorBase<AtomicExprEvaluator> {
+class AtomicExprEvaluator : public ExprEvaluatorBase<AtomicExprEvaluator> {
   const LValue *This;
   APValue &Result;
+
 public:
   AtomicExprEvaluator(EvalInfo &Info, const LValue *This, APValue &Result)
       : ExprEvaluatorBaseTy(Info), This(This), Result(Result) {}
@@ -20594,8 +20571,7 @@ static bool EvaluateAtomic(const Expr *E, const LValue *This, APValue &Result,
 //===----------------------------------------------------------------------===//
 
 namespace {
-class VoidExprEvaluator
-  : public ExprEvaluatorBase<VoidExprEvaluator> {
+class VoidExprEvaluator : public ExprEvaluatorBase<VoidExprEvaluator> {
 public:
   VoidExprEvaluator(EvalInfo &Info) : ExprEvaluatorBaseTy(Info) {}
 
@@ -20740,7 +20716,7 @@ static bool Evaluate(APValue &Result, EvalInfo &Info, const Expr *E) {
     if (!IntExprEvaluator(Info, Result).Visit(E))
       return false;
   } else if (T->isMetaInfoType()) {
-    if(!EvaluateReflection(E, Result, Info))
+    if (!EvaluateReflection(E, Result, Info))
       return false;
   } else if (T->hasPointerRepresentation()) {
     LValue LV;
@@ -20758,7 +20734,8 @@ static bool Evaluate(APValue &Result, EvalInfo &Info, const Expr *E) {
       return false;
     C.moveInto(Result);
   } else if (T->isFixedPointType()) {
-    if (!FixedPointExprEvaluator(Info, Result).Visit(E)) return false;
+    if (!FixedPointExprEvaluator(Info, Result).Visit(E))
+      return false;
   } else if (T->isMemberPointerType()) {
     MemberPtr P;
     if (!EvaluateMemberPointer(E, P, Info))
@@ -20781,8 +20758,7 @@ static bool Evaluate(APValue &Result, EvalInfo &Info, const Expr *E) {
     Result = Value;
   } else if (T->isVoidType()) {
     if (!Info.getLangOpts().CPlusPlus11)
-      Info.CCEDiag(E, diag::note_constexpr_nonliteral)
-        << E->getType();
+      Info.CCEDiag(E, diag::note_constexpr_nonliteral) << E->getType();
     if (!EvaluateVoid(E, Info))
       return false;
   } else if (T->isAtomicType()) {
@@ -21135,7 +21111,7 @@ bool Expr::EvaluateAsConstantExpr(EvalResult &Result, const ASTContext &Ctx,
   // If we're evaluating a prvalue, fake up a MaterializeTemporaryExpr to
   // represent the result of the evaluation. CheckConstantExpression ensures
   // this doesn't escape.
-  MaterializeTemporaryExpr BaseMTE(T, const_cast<Expr*>(this), true);
+  MaterializeTemporaryExpr BaseMTE(T, const_cast<Expr *>(this), true);
   APValue::LValueBase Base(&BaseMTE);
   Info.setEvaluatingDecl(Base, Result.Val);
 
@@ -21372,13 +21348,13 @@ struct ICEDiag {
   ICEDiag(ICEKind IK, SourceLocation l) : Kind(IK), Loc(l) {}
 };
 
-}
+} // namespace
 
 static ICEDiag NoDiag() { return ICEDiag(IK_ICE, SourceLocation()); }
 
 static ICEDiag Worst(ICEDiag A, ICEDiag B) { return A.Kind >= B.Kind ? A : B; }
 
-static ICEDiag CheckEvalInICE(const Expr* E, const ASTContext &Ctx) {
+static ICEDiag CheckEvalInICE(const Expr *E, const ASTContext &Ctx) {
   Expr::EvalResult EVResult;
   Expr::EvalStatus Status;
   EvalInfo Info(Ctx, Status, EvaluationMode::ConstantExpression);
@@ -21391,7 +21367,7 @@ static ICEDiag CheckEvalInICE(const Expr* E, const ASTContext &Ctx) {
   return NoDiag();
 }
 
-static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
+static ICEDiag CheckICE(const Expr *E, const ASTContext &Ctx) {
   assert(!E->isValueDependent() && "Should not see value dependent exprs!");
   if (!E->getType()->isIntegralOrEnumerationType())
     return ICEDiag(IK_NotICE, E->getBeginLoc());
@@ -21528,8 +21504,8 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
     return CheckICE(cast<PackIndexingExpr>(E)->getSelectedExpr(), Ctx);
 
   case Expr::SubstNonTypeTemplateParmExprClass:
-    return
-      CheckICE(cast<SubstNonTypeTemplateParmExpr>(E)->getReplacement(), Ctx);
+    return CheckICE(cast<SubstNonTypeTemplateParmExpr>(E)->getReplacement(),
+                    Ctx);
 
   case Expr::ConstantExprClass:
     return CheckICE(cast<ConstantExpr>(E)->getSubExpr(), Ctx);
@@ -21622,7 +21598,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
   }
   case Expr::UnaryExprOrTypeTraitExprClass: {
     const UnaryExprOrTypeTraitExpr *Exp = cast<UnaryExprOrTypeTraitExpr>(E);
-    if ((Exp->getKind() ==  UETT_SizeOf) &&
+    if ((Exp->getKind() == UETT_SizeOf) &&
         Exp->getTypeOfArgument()->isVariableArrayType())
       return ICEDiag(IK_NotICE, E->getBeginLoc());
     if (Exp->getKind() == UETT_CountOf) {
@@ -21685,8 +21661,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
     case BO_Cmp: {
       ICEDiag LHSResult = CheckICE(Exp->getLHS(), Ctx);
       ICEDiag RHSResult = CheckICE(Exp->getRHS(), Ctx);
-      if (Exp->getOpcode() == BO_Div ||
-          Exp->getOpcode() == BO_Rem) {
+      if (Exp->getOpcode() == BO_Div || Exp->getOpcode() == BO_Rem) {
         // EvaluateAsRValue gives an error for undefined Div/Rem, so make sure
         // we don't evaluate one.
         if (LHSResult.Kind == IK_ICE && RHSResult.Kind == IK_ICE) {
@@ -21741,8 +21716,8 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
   case Expr::ObjCBridgedCastExprClass: {
     const Expr *SubExpr = cast<CastExpr>(E)->getSubExpr();
     if (isa<ExplicitCastExpr>(E)) {
-      if (const FloatingLiteral *FL
-            = dyn_cast<FloatingLiteral>(SubExpr->IgnoreParenImpCasts())) {
+      if (const FloatingLiteral *FL =
+              dyn_cast<FloatingLiteral>(SubExpr->IgnoreParenImpCasts())) {
         unsigned DestWidth = Ctx.getIntWidth(E->getType());
         bool DestSigned = E->getType()->isSignedIntegerOrEnumerationType();
         APSInt IgnoredVal(DestWidth, !DestSigned);
@@ -21750,9 +21725,9 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
         // If the value does not fit in the destination type, the behavior is
         // undefined, so we are not required to treat it as a constant
         // expression.
-        if (FL->getValue().convertToInteger(IgnoredVal,
-                                            llvm::APFloat::rmTowardZero,
-                                            &Ignored) & APFloat::opInvalidOp)
+        if (FL->getValue().convertToInteger(
+                IgnoredVal, llvm::APFloat::rmTowardZero, &Ignored) &
+            APFloat::opInvalidOp)
           return ICEDiag(IK_NotICE, E->getBeginLoc());
         return NoDiag();
       }
@@ -21772,12 +21747,16 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
   case Expr::BinaryConditionalOperatorClass: {
     const BinaryConditionalOperator *Exp = cast<BinaryConditionalOperator>(E);
     ICEDiag CommonResult = CheckICE(Exp->getCommon(), Ctx);
-    if (CommonResult.Kind == IK_NotICE) return CommonResult;
+    if (CommonResult.Kind == IK_NotICE)
+      return CommonResult;
     ICEDiag FalseResult = CheckICE(Exp->getFalseExpr(), Ctx);
-    if (FalseResult.Kind == IK_NotICE) return FalseResult;
-    if (CommonResult.Kind == IK_ICEIfUnevaluated) return CommonResult;
+    if (FalseResult.Kind == IK_NotICE)
+      return FalseResult;
+    if (CommonResult.Kind == IK_ICEIfUnevaluated)
+      return CommonResult;
     if (FalseResult.Kind == IK_ICEIfUnevaluated &&
-        Exp->getCommon()->EvaluateKnownConstInt(Ctx) != 0) return NoDiag();
+        Exp->getCommon()->EvaluateKnownConstInt(Ctx) != 0)
+      return NoDiag();
     return FalseResult;
   }
   case Expr::ConditionalOperatorClass: {
@@ -21786,8 +21765,8 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
     // then only the true side is actually considered in an integer constant
     // expression, and it is fully evaluated.  This is an important GNU
     // extension.  See GCC PR38377 for discussion.
-    if (const CallExpr *CallCE
-        = dyn_cast<CallExpr>(Exp->getCond()->IgnoreParenCasts()))
+    if (const CallExpr *CallCE =
+            dyn_cast<CallExpr>(Exp->getCond()->IgnoreParenCasts()))
       if (CallCE->getBuiltinCallee() == Builtin::BI__builtin_constant_p)
         return CheckEvalInICE(E, Ctx);
     ICEDiag CondResult = CheckICE(Exp->getCond(), Ctx);
@@ -21843,7 +21822,8 @@ static bool EvaluateCPlusPlus11IntegralConstantExpr(const ASTContext &Ctx,
   if (!Result.isInt())
     return false;
 
-  if (Value) *Value = Result.getInt();
+  if (Value)
+    *Value = Result.getInt();
   return true;
 }
 
@@ -21934,7 +21914,7 @@ bool Expr::isCXX11ConstantExpr(const ASTContext &Ctx, APValue *Result) const {
 
 bool Expr::EvaluateWithSubstitution(APValue &Value, ASTContext &Ctx,
                                     const FunctionDecl *Callee,
-                                    ArrayRef<const Expr*> Args,
+                                    ArrayRef<const Expr *> Args,
                                     const Expr *This) const {
   assert(!isValueDependent() &&
          "Expression evaluator can't be called on a dependent expression.");
@@ -21971,14 +21951,13 @@ bool Expr::EvaluateWithSubstitution(APValue &Value, ASTContext &Ctx,
   }
 
   CallRef Call = Info.CurrentCall->createCall(Callee);
-  for (ArrayRef<const Expr*>::iterator I = Args.begin(), E = Args.end();
+  for (ArrayRef<const Expr *>::iterator I = Args.begin(), E = Args.end();
        I != E; ++I) {
     unsigned Idx = I - Args.begin();
     if (Idx >= Callee->getNumParams())
       break;
     const ParmVarDecl *PVD = Callee->getParamDecl(Idx);
-    if ((*I)->isValueDependent() ||
-        !EvaluateCallArg(PVD, *I, Call, Info) ||
+    if ((*I)->isValueDependent() || !EvaluateCallArg(PVD, *I, Call, Info) ||
         Info.EvalStatus.HasSideEffects) {
       // If evaluation fails, throw away the argument entirely.
       if (APValue *Slot = Info.getParamSlot(Call, PVD))
@@ -22004,9 +21983,8 @@ bool Expr::EvaluateWithSubstitution(APValue &Value, ASTContext &Ctx,
          !Info.EvalStatus.HasSideEffects;
 }
 
-bool Expr::isPotentialConstantExpr(const FunctionDecl *FD,
-                                   SmallVectorImpl<
-                                     PartialDiagnosticAt> &Diags) {
+bool Expr::isPotentialConstantExpr(
+    const FunctionDecl *FD, SmallVectorImpl<PartialDiagnosticAt> &Diags) {
   // FIXME: It would be useful to check constexpr function templates, but at the
   // moment the constant expression evaluator cannot cope with the non-rigorous
   // ASTs which we build for dependent expressions.
@@ -22045,7 +22023,7 @@ bool Expr::isPotentialConstantExpr(const FunctionDecl *FD,
                                : Info.Ctx.IntTy);
   This.set({&VIE, Info.CurrentCall->Index});
 
-  ArrayRef<const Expr*> Args;
+  ArrayRef<const Expr *> Args;
 
   APValue Scratch;
   if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(FD)) {
@@ -22064,10 +22042,9 @@ bool Expr::isPotentialConstantExpr(const FunctionDecl *FD,
   return Diags.empty();
 }
 
-bool Expr::isPotentialConstantExprUnevaluated(Expr *E,
-                                              const FunctionDecl *FD,
-                                              SmallVectorImpl<
-                                                PartialDiagnosticAt> &Diags) {
+bool Expr::isPotentialConstantExprUnevaluated(
+    Expr *E, const FunctionDecl *FD,
+    SmallVectorImpl<PartialDiagnosticAt> &Diags) {
   assert(!E->isValueDependent() &&
          "Expression evaluator can't be called on a dependent expression.");
 
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index e93397d149f0b..59b61e13772d1 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -3119,7 +3119,7 @@ bool Type::isLiteralType(const ASTContext &Ctx) const {
   // -- std::meta::info is a scalar type
   // C++26 [basic.types]p10:
   // -- a scalar type is a literal type
-  if(isMetaInfoType())
+  if (isMetaInfoType())
     return true;
 
   // We treat _Atomic T as a literal type if T is a literal type.
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index e1c86e56b5255..7e53e0ad214ae 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -141,7 +141,7 @@ void Sema::NoteDeletedFunction(FunctionDecl *Decl) {
     return NoteDeletedInheritingConstructor(Ctor);
 
   Diag(Decl->getLocation(), diag::note_availability_specified_here)
-    << Decl << 1;
+      << Decl << 1;
 }
 
 /// Determine whether a FunctionDecl was ever declared with an
@@ -219,7 +219,7 @@ void Sema::MaybeSuggestAddingStaticToDecl(const FunctionDecl *Cur) {
   if (!hasAnyExplicitStorageClass(First)) {
     SourceLocation DeclBegin = First->getSourceRange().getBegin();
     Diag(DeclBegin, diag::note_convert_inline_to_static)
-      << Cur << FixItHint::CreateInsertion(DeclBegin, "static ");
+        << Cur << FixItHint::CreateInsertion(DeclBegin, "static ");
   }
 }
 
@@ -258,7 +258,7 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, ArrayRef<SourceLocation> Locs,
   if (ParsingInitForAutoVars.count(D)) {
     if (isa<BindingDecl>(D)) {
       Diag(Loc, diag::err_binding_cannot_appear_in_own_initializer)
-        << D->getDeclName();
+          << D->getDeclName();
     } else {
       Diag(Loc, diag::err_auto_variable_cannot_appear_in_own_initializer)
           << diag::ParsingInitFor::Var << D->getDeclName()
@@ -300,8 +300,7 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, ArrayRef<SourceLocation> Locs,
         // constraint expression, for example)
         return true;
       if (!Satisfaction.IsSatisfied) {
-        Diag(Loc,
-             diag::err_reference_to_function_with_unsatisfied_constraints)
+        Diag(Loc, diag::err_reference_to_function_with_unsatisfied_constraints)
             << D;
         DiagnoseUnsatisfiedConstraint(Satisfaction);
         return true;
@@ -316,7 +315,6 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, ArrayRef<SourceLocation> Locs,
 
     if (getLangOpts().CUDA && !CUDA().CheckCall(Loc, FD))
       return true;
-
   }
 
   if (auto *Concept = dyn_cast<ConceptDecl>(D);
@@ -330,12 +328,12 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, ArrayRef<SourceLocation> Locs,
           cast<CXXConstructorDecl>(MD)->isDefaultConstructor()) ||
          MD->isCopyAssignmentOperator() || MD->isMoveAssignmentOperator())) {
       Diag(Loc, diag::warn_cxx17_compat_lambda_def_ctor_assign)
-        << !isa<CXXConstructorDecl>(MD);
+          << !isa<CXXConstructorDecl>(MD);
     }
   }
 
-  auto getReferencedObjCProp = [](const NamedDecl *D) ->
-                                      const ObjCPropertyDecl * {
+  auto getReferencedObjCProp =
+      [](const NamedDecl *D) -> const ObjCPropertyDecl * {
     if (const auto *MD = dyn_cast<ObjCMethodDecl>(D))
       return MD->findPropertyDecl();
     return nullptr;
@@ -344,7 +342,7 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, ArrayRef<SourceLocation> Locs,
     if (diagnoseArgIndependentDiagnoseIfAttrs(ObjCPDecl, Loc))
       return true;
   } else if (diagnoseArgIndependentDiagnoseIfAttrs(D, Loc)) {
-      return true;
+    return true;
   }
 
   // [OpenMP 4.0], 2.15 declare reduction Directive, Restrictions
@@ -521,7 +519,8 @@ ExprResult Sema::DefaultFunctionArrayConversion(Expr *E, bool Diagnose) {
   // Handle any placeholder expressions which made it here.
   if (E->hasPlaceholderType()) {
     ExprResult result = CheckPlaceholderExpr(E);
-    if (result.isInvalid()) return ExprError();
+    if (result.isInvalid())
+      return ExprError();
     E = result.get();
   }
 
@@ -535,7 +534,8 @@ ExprResult Sema::DefaultFunctionArrayConversion(Expr *E, bool Diagnose) {
           return ExprError();
 
     E = ImpCastExprToType(E, Context.getPointerType(Ty),
-                          CK_FunctionToPointerDecay).get();
+                          CK_FunctionToPointerDecay)
+            .get();
   } else if (Ty->isArrayType()) {
     // In C90 mode, arrays only promote to pointers if the array expression is
     // an lvalue.  The relevant legalese is C90 6.2.2.1p3: "an lvalue that has
@@ -585,8 +585,7 @@ static void CheckForNullPointerDereference(Sema &S, Expr *E) {
 }
 
 static void DiagnoseDirectIsaAccess(Sema &S, const ObjCIvarRefExpr *OIRE,
-                                    SourceLocation AssignLoc,
-                                    const Expr* RHS) {
+                                    SourceLocation AssignLoc, const Expr *RHS) {
   const ObjCIvarDecl *IV = OIRE->getDecl();
   if (!IV)
     return;
@@ -604,13 +603,12 @@ static void DiagnoseDirectIsaAccess(Sema &S, const ObjCIvarRefExpr *OIRE,
     if (ObjCInterfaceDecl *IDecl = OTy->getInterface()) {
       ObjCInterfaceDecl *ClassDeclared = nullptr;
       ObjCIvarDecl *IV = IDecl->lookupInstanceVariable(Member, ClassDeclared);
-      if (!ClassDeclared->getSuperClass()
-          && (*ClassDeclared->ivar_begin()) == IV) {
+      if (!ClassDeclared->getSuperClass() &&
+          (*ClassDeclared->ivar_begin()) == IV) {
         if (RHS) {
-          NamedDecl *ObjectSetClass =
-            S.LookupSingleName(S.TUScope,
-                               &S.Context.Idents.get("object_setClass"),
-                               SourceLocation(), S.LookupOrdinaryName);
+          NamedDecl *ObjectSetClass = S.LookupSingleName(
+              S.TUScope, &S.Context.Idents.get("object_setClass"),
+              SourceLocation(), S.LookupOrdinaryName);
           if (ObjectSetClass) {
             SourceLocation RHSLocEnd = S.getLocForEndOfToken(RHS->getEndLoc());
             S.Diag(OIRE->getExprLoc(), diag::warn_objc_isa_assign)
@@ -619,14 +617,12 @@ static void DiagnoseDirectIsaAccess(Sema &S, const ObjCIvarRefExpr *OIRE,
                 << FixItHint::CreateReplacement(
                        SourceRange(OIRE->getOpLoc(), AssignLoc), ",")
                 << FixItHint::CreateInsertion(RHSLocEnd, ")");
-          }
-          else
+          } else
             S.Diag(OIRE->getLocation(), diag::warn_objc_isa_assign);
         } else {
-          NamedDecl *ObjectGetClass =
-            S.LookupSingleName(S.TUScope,
-                               &S.Context.Idents.get("object_getClass"),
-                               SourceLocation(), S.LookupOrdinaryName);
+          NamedDecl *ObjectGetClass = S.LookupSingleName(
+              S.TUScope, &S.Context.Idents.get("object_getClass"),
+              SourceLocation(), S.LookupOrdinaryName);
           if (ObjectGetClass)
             S.Diag(OIRE->getExprLoc(), diag::warn_objc_isa_use)
                 << FixItHint::CreateInsertion(OIRE->getBeginLoc(),
@@ -645,14 +641,16 @@ ExprResult Sema::DefaultLvalueConversion(Expr *E) {
   // Handle any placeholder expressions which made it here.
   if (E->hasPlaceholderType()) {
     ExprResult result = CheckPlaceholderExpr(E);
-    if (result.isInvalid()) return ExprError();
+    if (result.isInvalid())
+      return ExprError();
     E = result.get();
   }
 
   // C++ [conv.lval]p1:
   //   A glvalue of a non-function, non-array type T can be
   //   converted to a prvalue.
-  if (!E->isGLValue()) return E;
+  if (!E->isGLValue())
+    return E;
 
   QualType T = E->getType();
   assert(!T.isNull() && "r-value conversion on typeless expression?");
@@ -683,16 +681,15 @@ ExprResult Sema::DefaultLvalueConversion(Expr *E) {
   if (getLangOpts().OpenCL &&
       !getOpenCLOptions().isAvailableOption("cl_khr_fp16", getLangOpts()) &&
       T->isHalfType()) {
-    Diag(E->getExprLoc(), diag::err_opencl_half_load_store)
-      << 0 << T;
+    Diag(E->getExprLoc(), diag::err_opencl_half_load_store) << 0 << T;
     return ExprError();
   }
 
   CheckForNullPointerDereference(*this, E);
   if (const ObjCIsaExpr *OISA = dyn_cast<ObjCIsaExpr>(E->IgnoreParenCasts())) {
-    NamedDecl *ObjectGetClass = LookupSingleName(TUScope,
-                                     &Context.Idents.get("object_getClass"),
-                                     SourceLocation(), LookupOrdinaryName);
+    NamedDecl *ObjectGetClass =
+        LookupSingleName(TUScope, &Context.Idents.get("object_getClass"),
+                         SourceLocation(), LookupOrdinaryName);
     if (ObjectGetClass)
       Diag(E->getExprLoc(), diag::warn_objc_isa_use)
           << FixItHint::CreateInsertion(OISA->getBeginLoc(), "object_getClass(")
@@ -700,10 +697,9 @@ ExprResult Sema::DefaultLvalueConversion(Expr *E) {
                  SourceRange(OISA->getOpLoc(), OISA->getIsaMemberLoc()), ")");
     else
       Diag(E->getExprLoc(), diag::warn_objc_isa_use);
-  }
-  else if (const ObjCIvarRefExpr *OIRE =
-            dyn_cast<ObjCIvarRefExpr>(E->IgnoreParenCasts()))
-    DiagnoseDirectIsaAccess(*this, OIRE, SourceLocation(), /* Expr*/nullptr);
+  } else if (const ObjCIvarRefExpr *OIRE =
+                 dyn_cast<ObjCIvarRefExpr>(E->IgnoreParenCasts()))
+    DiagnoseDirectIsaAccess(*this, OIRE, SourceLocation(), /* Expr*/ nullptr);
 
   // C++ [conv.lval]p1:
   //   [...] If T is a non-class type, the type of the prvalue is the
@@ -727,8 +723,8 @@ ExprResult Sema::DefaultLvalueConversion(Expr *E) {
     return Res;
   E = Res.get();
 
-  // Loading a __weak object implicitly retains the value, so we need a cleanup to
-  // balance that.
+  // Loading a __weak object implicitly retains the value, so we need a cleanup
+  // to balance that.
   if (E->getType().getObjCLifetime() == Qualifiers::OCL_Weak)
     Cleanup.setExprNeedsCleanups(true);
 
@@ -937,8 +933,8 @@ ExprResult Sema::DefaultArgumentPromotion(Expr *E) {
   // potentially potentially evaluated contexts.
   if (getLangOpts().CPlusPlus && E->isGLValue() && !isUnevaluatedContext()) {
     ExprResult Temp = PerformCopyInitialization(
-                       InitializedEntity::InitializeTemporary(E->getType()),
-                                                E->getExprLoc(), E);
+        InitializedEntity::InitializeTemporary(E->getType()), E->getExprLoc(),
+        E);
     if (Temp.isInvalid())
       return ExprError();
     E = Temp.get();
@@ -1134,8 +1130,10 @@ static bool handleComplexIntegerToFloatConversion(Sema &S, ExprResult &IntExpr,
                                                   QualType IntTy,
                                                   QualType ComplexTy,
                                                   bool SkipCast) {
-  if (IntTy->isComplexType() || IntTy->isRealFloatingType()) return true;
-  if (SkipCast) return false;
+  if (IntTy->isComplexType() || IntTy->isRealFloatingType())
+    return true;
+  if (SkipCast)
+    return false;
   if (IntTy->isIntegerType()) {
     QualType fpTy = ComplexTy->castAs<ComplexType>()->getElementType();
     IntExpr = S.ImpCastExprToType(IntExpr.get(), fpTy, CK_IntegralToFloating);
@@ -1211,8 +1209,8 @@ static QualType handleIntToFloatConversion(Sema &S, ExprResult &FloatExpr,
   if (IntTy->isIntegerType()) {
     if (ConvertInt)
       // Convert intExpr to the lhs floating point type.
-      IntExpr = S.ImpCastExprToType(IntExpr.get(), FloatTy,
-                                    CK_IntegralToFloating);
+      IntExpr =
+          S.ImpCastExprToType(IntExpr.get(), FloatTy, CK_IntegralToFloating);
     return FloatTy;
   }
 
@@ -1227,17 +1225,17 @@ static QualType handleIntToFloatConversion(Sema &S, ExprResult &FloatExpr,
 
   // float -> _Complex float
   if (ConvertFloat)
-    FloatExpr = S.ImpCastExprToType(FloatExpr.get(), result,
-                                    CK_FloatingRealToComplex);
+    FloatExpr =
+        S.ImpCastExprToType(FloatExpr.get(), result, CK_FloatingRealToComplex);
 
   return result;
 }
 
 /// Handle arithmethic conversion with floating point types.  Helper
 /// function of UsualArithmeticConversions()
-static QualType handleFloatConversion(Sema &S, ExprResult &LHS,
-                                      ExprResult &RHS, QualType LHSType,
-                                      QualType RHSType, bool IsCompAssign) {
+static QualType handleFloatConversion(Sema &S, ExprResult &LHS, ExprResult &RHS,
+                                      QualType LHSType, QualType RHSType,
+                                      bool IsCompAssign) {
   bool LHSFloat = LHSType->isRealFloatingType();
   bool RHSFloat = RHSType->isRealFloatingType();
 
@@ -1274,11 +1272,11 @@ static QualType handleFloatConversion(Sema &S, ExprResult &LHS,
 
     return handleIntToFloatConversion(S, LHS, RHS, LHSType, RHSType,
                                       /*ConvertFloat=*/!IsCompAssign,
-                                      /*ConvertInt=*/ true);
+                                      /*ConvertInt=*/true);
   }
   assert(RHSFloat);
   return handleIntToFloatConversion(S, RHS, LHS, RHSType, LHSType,
-                                    /*ConvertFloat=*/ true,
+                                    /*ConvertFloat=*/true,
                                     /*ConvertInt=*/!IsCompAssign);
 }
 
@@ -1323,7 +1321,7 @@ ExprResult doComplexIntegralCast(Sema &S, Expr *op, QualType toType) {
   return S.ImpCastExprToType(op, S.Context.getComplexType(toType),
                              CK_IntegralComplexCast);
 }
-}
+} // namespace
 
 /// Handle integer arithmetic conversions.  Helper function of
 /// UsualArithmeticConversions()
@@ -1368,7 +1366,7 @@ static QualType handleIntegerConversion(Sema &S, ExprResult &LHS,
     // on most 32-bit systems).  Use the unsigned type corresponding
     // to the signed type.
     QualType result =
-      S.Context.getCorrespondingUnsignedType(LHSSigned ? LHSType : RHSType);
+        S.Context.getCorrespondingUnsignedType(LHSSigned ? LHSType : RHSType);
     RHS = (*doRHSCast)(S, RHS.get(), result);
     if (!IsCompAssign)
       LHS = (*doLHSCast)(S, LHS.get(), result);
@@ -1389,8 +1387,8 @@ static QualType handleComplexIntConversion(Sema &S, ExprResult &LHS,
     QualType LHSEltType = LHSComplexInt->getElementType();
     QualType RHSEltType = RHSComplexInt->getElementType();
     QualType ScalarType =
-      handleIntegerConversion<doComplexIntegralCast, doComplexIntegralCast>
-        (S, LHS, RHS, LHSEltType, RHSEltType, IsCompAssign);
+        handleIntegerConversion<doComplexIntegralCast, doComplexIntegralCast>(
+            S, LHS, RHS, LHSEltType, RHSEltType, IsCompAssign);
 
     return S.Context.getComplexType(ScalarType);
   }
@@ -1398,11 +1396,10 @@ static QualType handleComplexIntConversion(Sema &S, ExprResult &LHS,
   if (LHSComplexInt) {
     QualType LHSEltType = LHSComplexInt->getElementType();
     QualType ScalarType =
-      handleIntegerConversion<doComplexIntegralCast, doIntegralCast>
-        (S, LHS, RHS, LHSEltType, RHSType, IsCompAssign);
+        handleIntegerConversion<doComplexIntegralCast, doIntegralCast>(
+            S, LHS, RHS, LHSEltType, RHSType, IsCompAssign);
     QualType ComplexType = S.Context.getComplexType(ScalarType);
-    RHS = S.ImpCastExprToType(RHS.get(), ComplexType,
-                              CK_IntegralRealToComplex);
+    RHS = S.ImpCastExprToType(RHS.get(), ComplexType, CK_IntegralRealToComplex);
 
     return ComplexType;
   }
@@ -1411,13 +1408,12 @@ static QualType handleComplexIntConversion(Sema &S, ExprResult &LHS,
 
   QualType RHSEltType = RHSComplexInt->getElementType();
   QualType ScalarType =
-    handleIntegerConversion<doIntegralCast, doComplexIntegralCast>
-      (S, LHS, RHS, LHSType, RHSEltType, IsCompAssign);
+      handleIntegerConversion<doIntegralCast, doComplexIntegralCast>(
+          S, LHS, RHS, LHSType, RHSEltType, IsCompAssign);
   QualType ComplexType = S.Context.getComplexType(ScalarType);
 
   if (!IsCompAssign)
-    LHS = S.ImpCastExprToType(LHS.get(), ComplexType,
-                              CK_IntegralRealToComplex);
+    LHS = S.ImpCastExprToType(LHS.get(), ComplexType, CK_IntegralRealToComplex);
   return ComplexType;
 }
 
@@ -1788,7 +1784,6 @@ QualType Sema::UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS,
 //  Semantic Analysis for various Expression Types
 //===----------------------------------------------------------------------===//
 
-
 ExprResult Sema::ActOnGenericSelectionExpr(
     SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc,
     bool PredicateIsExpr, void *ControllingExprOrType,
@@ -1796,10 +1791,10 @@ ExprResult Sema::ActOnGenericSelectionExpr(
   unsigned NumAssocs = ArgTypes.size();
   assert(NumAssocs == ArgExprs.size());
 
-  TypeSourceInfo **Types = new TypeSourceInfo*[NumAssocs];
+  TypeSourceInfo **Types = new TypeSourceInfo *[NumAssocs];
   for (unsigned i = 0; i < NumAssocs; ++i) {
     if (ArgTypes[i])
-      (void) GetTypeFromParser(ArgTypes[i], &Types[i]);
+      (void)GetTypeFromParser(ArgTypes[i], &Types[i]);
     else
       Types[i] = nullptr;
   }
@@ -1817,7 +1812,7 @@ ExprResult Sema::ActOnGenericSelectionExpr(
   ExprResult ER = CreateGenericSelectionExpr(
       KeyLoc, DefaultLoc, RParenLoc, PredicateIsExpr, ControllingExprOrType,
       llvm::ArrayRef(Types, NumAssocs), ArgExprs);
-  delete [] Types;
+  delete[] Types;
   return ER;
 }
 
@@ -1966,19 +1961,17 @@ ExprResult Sema::CreateGenericSelectionExpr(
 
         // C11 6.5.1.1p2 "No two generic associations in the same generic
         // selection shall specify compatible types."
-        for (unsigned j = i+1; j < NumAssocs; ++j)
+        for (unsigned j = i + 1; j < NumAssocs; ++j)
           if (Types[j] && !Types[j]->getType()->isDependentType() &&
               areTypesCompatibleForGeneric(Context, Types[i]->getType(),
                                            Types[j]->getType())) {
             Diag(Types[j]->getTypeLoc().getBeginLoc(),
                  diag::err_assoc_compatible_types)
-              << Types[j]->getTypeLoc().getSourceRange()
-              << Types[j]->getType()
-              << Types[i]->getType();
-            Diag(Types[i]->getTypeLoc().getBeginLoc(),
-                 diag::note_compat_assoc)
-              << Types[i]->getTypeLoc().getSourceRange()
-              << Types[i]->getType();
+                << Types[j]->getTypeLoc().getSourceRange()
+                << Types[j]->getType() << Types[i]->getType();
+            Diag(Types[i]->getTypeLoc().getBeginLoc(), diag::note_compat_assoc)
+                << Types[i]->getTypeLoc().getSourceRange()
+                << Types[i]->getType();
             TypeErrorFound = true;
           }
       }
@@ -2047,10 +2040,8 @@ ExprResult Sema::CreateGenericSelectionExpr(
     Diag(SR.getBegin(), diag::err_generic_sel_multi_match)
         << SR << P.second << (unsigned)CompatIndices.size();
     for (unsigned I : CompatIndices) {
-      Diag(Types[I]->getTypeLoc().getBeginLoc(),
-           diag::note_compat_assoc)
-        << Types[I]->getTypeLoc().getSourceRange()
-        << Types[I]->getType();
+      Diag(Types[I]->getTypeLoc().getBeginLoc(), diag::note_compat_assoc)
+          << Types[I]->getTypeLoc().getSourceRange() << Types[I]->getType();
     }
     return ExprError();
   }
@@ -2071,8 +2062,7 @@ ExprResult Sema::CreateGenericSelectionExpr(
   // then the result expression of the generic selection is the expression
   // in that generic association. Otherwise, the result expression of the
   // generic selection is the expression in the default generic association."
-  unsigned ResultIndex =
-    CompatIndices.size() ? CompatIndices[0] : DefaultIndex;
+  unsigned ResultIndex = CompatIndices.size() ? CompatIndices[0] : DefaultIndex;
 
   if (ControllingExpr) {
     return GenericSelectionExpr::Create(
@@ -2127,7 +2117,7 @@ static SourceLocation getUDSuffixLoc(Sema &S, SourceLocation TokLoc,
 static ExprResult BuildCookedLiteralOperatorCall(Sema &S, Scope *Scope,
                                                  IdentifierInfo *UDSuffix,
                                                  SourceLocation UDSuffixLoc,
-                                                 ArrayRef<Expr*> Args,
+                                                 ArrayRef<Expr *> Args,
                                                  SourceLocation LitEndLoc) {
   assert(Args.size() <= 2 && "too many arguments for literal operator");
 
@@ -2139,7 +2129,7 @@ static ExprResult BuildCookedLiteralOperatorCall(Sema &S, Scope *Scope,
   }
 
   DeclarationName OpName =
-    S.Context.DeclarationNames.getCXXLiteralOperatorName(UDSuffix);
+      S.Context.DeclarationNames.getCXXLiteralOperatorName(UDSuffix);
   DeclarationNameInfo OpNameInfo(OpName, UDSuffixLoc);
   OpNameInfo.setCXXLiteralOperatorNameLoc(UDSuffixLoc);
 
@@ -2231,8 +2221,8 @@ Sema::ExpandFunctionLocalPredefinedMacros(ArrayRef<Token> Toks) {
   return ExpandedToks;
 }
 
-ExprResult
-Sema::ActOnStringLiteral(ArrayRef<Token> StringToks, Scope *UDLScope) {
+ExprResult Sema::ActOnStringLiteral(ArrayRef<Token> StringToks,
+                                    Scope *UDLScope) {
   assert(!StringToks.empty() && "Must have at least one string!");
 
   // StringToks needs backing storage as it doesn't hold array elements itself
@@ -2312,8 +2302,8 @@ Sema::ActOnStringLiteral(ArrayRef<Token> StringToks, Scope *UDLScope) {
   // We're building a user-defined literal.
   IdentifierInfo *UDSuffix = &Context.Idents.get(Literal.getUDSuffix());
   SourceLocation UDSuffixLoc =
-    getUDSuffixLoc(*this, StringTokLocs[Literal.getUDSuffixToken()],
-                   Literal.getUDSuffixOffset());
+      getUDSuffixLoc(*this, StringTokLocs[Literal.getUDSuffixToken()],
+                     Literal.getUDSuffixOffset());
 
   // Make sure we're allowed user-defined literals here.
   if (!UDLScope)
@@ -2324,13 +2314,11 @@ Sema::ActOnStringLiteral(ArrayRef<Token> StringToks, Scope *UDLScope) {
   QualType SizeType = Context.getSizeType();
 
   DeclarationName OpName =
-    Context.DeclarationNames.getCXXLiteralOperatorName(UDSuffix);
+      Context.DeclarationNames.getCXXLiteralOperatorName(UDSuffix);
   DeclarationNameInfo OpNameInfo(OpName, UDSuffixLoc);
   OpNameInfo.setCXXLiteralOperatorNameLoc(UDSuffixLoc);
 
-  QualType ArgTy[] = {
-    Context.getArrayDecayedType(StrTy), SizeType
-  };
+  QualType ArgTy[] = {Context.getArrayDecayedType(StrTy), SizeType};
 
   LookupResult R(*this, OpName, UDSuffixLoc, LookupOrdinaryName);
   switch (LookupLiteralOperator(UDLScope, R, ArgTy,
@@ -2340,9 +2328,9 @@ Sema::ActOnStringLiteral(ArrayRef<Token> StringToks, Scope *UDLScope) {
 
   case LOLR_Cooked: {
     llvm::APInt Len(Context.getIntWidth(SizeType), Literal.GetNumStringChars());
-    IntegerLiteral *LenArg = IntegerLiteral::Create(Context, Len, SizeType,
-                                                    StringTokLocs[0]);
-    Expr *Args[] = { Lit, LenArg };
+    IntegerLiteral *LenArg =
+        IntegerLiteral::Create(Context, Len, SizeType, StringTokLocs[0]);
+    Expr *Args[] = {Lit, LenArg};
 
     return BuildLiteralOperatorCall(R, OpNameInfo, Args, StringTokLocs.back());
   }
@@ -2364,7 +2352,8 @@ Sema::ActOnStringLiteral(ArrayRef<Token> StringToks, Scope *UDLScope) {
     llvm::APSInt Value(CharBits, CharIsUnsigned);
 
     TemplateArgument TypeArg(CharTy);
-    TemplateArgumentLocInfo TypeArgInfo(Context.getTrivialTypeSourceInfo(CharTy));
+    TemplateArgumentLocInfo TypeArgInfo(
+        Context.getTrivialTypeSourceInfo(CharTy));
     ExplicitArgs.addArgument(TemplateArgumentLoc(TypeArg, TypeArgInfo));
 
     SourceLocation Loc = StringTokLocs.back();
@@ -2385,10 +2374,9 @@ Sema::ActOnStringLiteral(ArrayRef<Token> StringToks, Scope *UDLScope) {
   llvm_unreachable("unexpected literal operator lookup result");
 }
 
-DeclRefExpr *
-Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK,
-                       SourceLocation Loc,
-                       const CXXScopeSpec *SS) {
+DeclRefExpr *Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK,
+                                    SourceLocation Loc,
+                                    const CXXScopeSpec *SS) {
   DeclarationNameInfo NameInfo(D->getDeclName(), Loc);
   return BuildDeclRefExpr(D, Ty, VK, NameInfo, SS);
 }
@@ -2519,11 +2507,10 @@ Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK,
   return E;
 }
 
-void
-Sema::DecomposeUnqualifiedId(const UnqualifiedId &Id,
-                             TemplateArgumentListInfo &Buffer,
-                             DeclarationNameInfo &NameInfo,
-                             const TemplateArgumentListInfo *&TemplateArgs) {
+void Sema::DecomposeUnqualifiedId(
+    const UnqualifiedId &Id, TemplateArgumentListInfo &Buffer,
+    DeclarationNameInfo &NameInfo,
+    const TemplateArgumentListInfo *&TemplateArgs) {
   if (Id.getKind() == UnqualifiedIdKind::IK_TemplateId) {
     Buffer.setLAngleLoc(Id.TemplateId->LAngleLoc);
     Buffer.setRAngleLoc(Id.TemplateId->RAngleLoc);
@@ -2680,15 +2667,14 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
                                  OverloadCandidateSet::CSK_Normal);
         OverloadCandidateSet::iterator Best;
         for (NamedDecl *CD : Corrected) {
-          if (FunctionTemplateDecl *FTD =
-                   dyn_cast<FunctionTemplateDecl>(CD))
-            AddTemplateOverloadCandidate(
-                FTD, DeclAccessPair::make(FTD, AS_none), ExplicitTemplateArgs,
-                Args, OCS);
+          if (FunctionTemplateDecl *FTD = dyn_cast<FunctionTemplateDecl>(CD))
+            AddTemplateOverloadCandidate(FTD,
+                                         DeclAccessPair::make(FTD, AS_none),
+                                         ExplicitTemplateArgs, Args, OCS);
           else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(CD))
             if (!ExplicitTemplateArgs || ExplicitTemplateArgs->size() == 0)
-              AddOverloadCandidate(FD, DeclAccessPair::make(FD, AS_none),
-                                   Args, OCS);
+              AddOverloadCandidate(FD, DeclAccessPair::make(FD, AS_none), Args,
+                                   OCS);
         }
         switch (OCS.BestViableFunction(*this, R.getNameLoc(), Best)) {
         case OR_Success:
@@ -2706,8 +2692,8 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
         CXXRecordDecl *Record =
             Corrected.getCorrectionSpecifier().getAsRecordDecl();
         if (!Record)
-          Record = cast<CXXRecordDecl>(
-              ND->getDeclContext()->getRedeclContext());
+          Record =
+              cast<CXXRecordDecl>(ND->getDeclContext()->getRedeclContext());
         R.setNamingClass(Record);
       }
 
@@ -2814,12 +2800,13 @@ recoverFromMSUnqualifiedLookup(Sema &S, ASTContext &Context,
       TemplateArgs);
 }
 
-ExprResult
-Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS,
-                        SourceLocation TemplateKWLoc, UnqualifiedId &Id,
-                        bool HasTrailingLParen, bool IsAddressOfOperand,
-                        CorrectionCandidateCallback *CCC,
-                        bool IsInlineAsmIdentifier, Token *KeywordReplacement) {
+ExprResult Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS,
+                                   SourceLocation TemplateKWLoc,
+                                   UnqualifiedId &Id, bool HasTrailingLParen,
+                                   bool IsAddressOfOperand,
+                                   CorrectionCandidateCallback *CCC,
+                                   bool IsInlineAsmIdentifier,
+                                   Token *KeywordReplacement) {
   assert(!(IsAddressOfOperand && HasTrailingLParen) &&
          "cannot be direct & operand and have a trailing lparen");
   if (SS.isInvalid())
@@ -2910,7 +2897,8 @@ Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS,
   if (R.empty() && HasTrailingLParen && II &&
       getLangOpts().implicitFunctionsAllowed()) {
     NamedDecl *D = ImplicitlyDefineFunction(NameLoc, *II, S);
-    if (D) R.addDecl(D);
+    if (D)
+      R.addDecl(D);
   }
 
   // Determine whether this name might be a candidate for
@@ -3036,7 +3024,7 @@ ExprResult Sema::BuildQualifiedDeclarationNameExpr(
       if (CD->isInvalidDecl() || CD->isBeingDefined())
         return ExprError();
     Diag(NameInfo.getLoc(), diag::err_no_member)
-      << NameInfo.getName() << DC << SS.getRange();
+        << NameInfo.getName() << DC << SS.getRange();
     return ExprError();
   }
 
@@ -3201,14 +3189,15 @@ ExprResult Sema::PerformObjectMemberConversion(Expr *From,
     // Otherwise build the appropriate casts.
     if (IsDerivedFrom(FromLoc, FromRecordType, QRecordType)) {
       CXXCastPath BasePath;
-      if (CheckDerivedToBaseConversion(FromRecordType, QRecordType,
-                                       FromLoc, FromRange, &BasePath))
+      if (CheckDerivedToBaseConversion(FromRecordType, QRecordType, FromLoc,
+                                       FromRange, &BasePath))
         return ExprError();
 
       if (PointerConversions)
         QType = Context.getPointerType(QType);
-      From = ImpCastExprToType(From, QType, CK_UncheckedDerivedToBase,
-                               VK, &BasePath).get();
+      From = ImpCastExprToType(From, QType, CK_UncheckedDerivedToBase, VK,
+                               &BasePath)
+                 .get();
 
       FromType = QType;
       FromRecordType = QRecordType;
@@ -3221,8 +3210,8 @@ ExprResult Sema::PerformObjectMemberConversion(Expr *From,
   }
 
   CXXCastPath BasePath;
-  if (CheckDerivedToBaseConversion(FromRecordType, DestRecordType,
-                                   FromLoc, FromRange, &BasePath,
+  if (CheckDerivedToBaseConversion(FromRecordType, DestRecordType, FromLoc,
+                                   FromRange, &BasePath,
                                    /*IgnoreAccess=*/true))
     return ExprError();
 
@@ -3288,7 +3277,6 @@ bool Sema::UseArgumentDependentLookup(const CXXScopeSpec &SS,
   return true;
 }
 
-
 /// Diagnoses obvious problems with the use of the given declaration
 /// as an expression.  This is only actually called for lookups that
 /// were not overloaded, and it doesn't promise that the declaration
@@ -3694,7 +3682,7 @@ ExprResult Sema::ActOnCharacterConstant(const Token &Tok, Scope *UDLScope) {
   else if (Literal.isUTF32())
     Ty = Context.Char32Ty; // U'x' -> char32_t in C11 and C++11.
   else if (!getLangOpts().CPlusPlus || Literal.isMultiChar())
-    Ty = Context.IntTy;   // 'x' -> int in C, 'wxyz' -> int in C++.
+    Ty = Context.IntTy; // 'x' -> int in C, 'wxyz' -> int in C++.
   else
     Ty = Context.CharTy; // 'x' -> char in C++;
                          // u8'x' -> char in C11-C17 and in C++ without char8_t.
@@ -3709,8 +3697,8 @@ ExprResult Sema::ActOnCharacterConstant(const Token &Tok, Scope *UDLScope) {
   else if (Literal.isUTF8())
     Kind = CharacterLiteralKind::UTF8;
 
-  Expr *Lit = new (Context) CharacterLiteral(Literal.getValue(), Kind, Ty,
-                                             Tok.getLocation());
+  Expr *Lit = new (Context)
+      CharacterLiteral(Literal.getValue(), Kind, Ty, Tok.getLocation());
 
   if (Literal.getUDSuffix().empty())
     return Lit;
@@ -3718,7 +3706,7 @@ ExprResult Sema::ActOnCharacterConstant(const Token &Tok, Scope *UDLScope) {
   // We're building a user-defined literal.
   IdentifierInfo *UDSuffix = &Context.Idents.get(Literal.getUDSuffix());
   SourceLocation UDSuffixLoc =
-    getUDSuffixLoc(*this, Tok.getLocation(), Literal.getUDSuffixOffset());
+      getUDSuffixLoc(*this, Tok.getLocation(), Literal.getUDSuffixOffset());
 
   // Make sure we're allowed user-defined literals here.
   if (!UDLScope)
@@ -3835,7 +3823,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
     // We're building a user-defined literal.
     const IdentifierInfo *UDSuffix = &Context.Idents.get(Literal.getUDSuffix());
     SourceLocation UDSuffixLoc =
-      getUDSuffixLoc(*this, Tok.getLocation(), Literal.getUDSuffixOffset());
+        getUDSuffixLoc(*this, Tok.getLocation(), Literal.getUDSuffixOffset());
 
     // Make sure we're allowed user-defined literals here.
     if (!UDLScope)
@@ -3855,7 +3843,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
     }
 
     DeclarationName OpName =
-      Context.DeclarationNames.getCXXLiteralOperatorName(UDSuffix);
+        Context.DeclarationNames.getCXXLiteralOperatorName(UDSuffix);
     DeclarationNameInfo OpNameInfo(OpName, UDSuffixLoc);
     OpNameInfo.setCXXLiteralOperatorNameLoc(UDSuffixLoc);
 
@@ -3949,7 +3937,8 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
       }
     }
 
-    if (Literal.isUnsigned) Ty = Context.getCorrespondingUnsignedType(Ty);
+    if (Literal.isUnsigned)
+      Ty = Context.getCorrespondingUnsignedType(Ty);
 
     bool isSigned = !Literal.isUnsigned;
     unsigned scale = Context.getFixedPointScale(Ty);
@@ -3973,7 +3962,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
                                               Tok.getLocation(), scale);
   } else if (Literal.isFloatingLiteral()) {
     QualType Ty;
-    if (Literal.isHalf){
+    if (Literal.isHalf) {
       if (getLangOpts().HLSL ||
           getOpenCLOptions().isAvailableOption("cl_khr_fp16", getLangOpts()))
         Ty = Context.HalfTy;
@@ -4145,7 +4134,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
         // Does it fit in a unsigned int?
         if (ResultVal.isIntN(IntSize)) {
           // Does it fit in a signed int?
-          if (!Literal.isUnsigned && ResultVal[IntSize-1] == 0)
+          if (!Literal.isUnsigned && ResultVal[IntSize - 1] == 0)
             Ty = Context.IntTy;
           else if (AllowUnsigned)
             Ty = Context.UnsignedIntTy;
@@ -4160,7 +4149,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
         // Does it fit in a unsigned long?
         if (ResultVal.isIntN(LongSize)) {
           // Does it fit in a signed long?
-          if (!Literal.isUnsigned && ResultVal[LongSize-1] == 0)
+          if (!Literal.isUnsigned && ResultVal[LongSize - 1] == 0)
             Ty = Context.LongTy;
           else if (AllowUnsigned)
             Ty = Context.UnsignedLongTy;
@@ -4193,8 +4182,9 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
           // Does it fit in a signed long long?
           // To be compatible with MSVC, hex integer literals ending with the
           // LL or i64 suffix are always signed in Microsoft mode.
-          if (!Literal.isUnsigned && (ResultVal[LongLongSize-1] == 0 ||
-              (getLangOpts().MSVCCompat && Literal.isLongLong)))
+          if (!Literal.isUnsigned &&
+              (ResultVal[LongLongSize - 1] == 0 ||
+               (getLangOpts().MSVCCompat && Literal.isLongLong)))
             Ty = Context.LongLongTy;
           else if (AllowUnsigned)
             Ty = Context.UnsignedLongLongTy;
@@ -4233,8 +4223,8 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
 
   // If this is an imaginary literal, create the ImaginaryLiteral wrapper.
   if (Literal.isImaginary) {
-    Res = new (Context) ImaginaryLiteral(Res,
-                                        Context.getComplexType(Res->getType()));
+    Res = new (Context)
+        ImaginaryLiteral(Res, Context.getComplexType(Res->getType()));
 
     // In C++, this is a GNU extension. In C, it's a C2y extension.
     unsigned DiagId;
@@ -4266,8 +4256,7 @@ static bool CheckVecStepTraitOperandType(Sema &S, QualType T,
   // Every built-in scalar type (OpenCL 1.1 6.1.1) is either an arithmetic
   // type (C99 6.2.5p18) or void.
   if (!(T->isArithmeticType() || T->isVoidType() || T->isVectorType())) {
-    S.Diag(Loc, diag::err_vecstep_non_scalar_vector_type)
-      << T << ArgRange;
+    S.Diag(Loc, diag::err_vecstep_non_scalar_vector_type) << T << ArgRange;
     return true;
   }
 
@@ -4282,8 +4271,7 @@ static bool CheckVectorElementsTraitOperandType(Sema &S, QualType T,
   // builtin_vectorelements supports both fixed-sized and scalable vectors.
   if (!T->isVectorType() && !T->isSizelessVectorType())
     return S.Diag(Loc, diag::err_builtin_non_vector_type)
-           << ""
-           << "__builtin_vectorelements" << T << ArgRange;
+           << "" << "__builtin_vectorelements" << T << ArgRange;
 
   if (auto *FD = dyn_cast<FunctionDecl>(S.CurContext)) {
     if (T->isSVESizelessBuiltinType()) {
@@ -4350,8 +4338,7 @@ static bool CheckObjCTraitOperandConstraints(Sema &S, QualType T,
   // runtime doesn't allow it.
   if (!S.LangOpts.ObjCRuntime.allowsSizeofAlignof() && T->isObjCObjectType()) {
     S.Diag(Loc, diag::err_sizeof_nonfragile_interface)
-      << T << (TraitKind == UETT_SizeOf)
-      << ArgRange;
+        << T << (TraitKind == UETT_SizeOf) << ArgRange;
     return true;
   }
 
@@ -4371,9 +4358,9 @@ static void warnOnSizeofOnArrayDecay(Sema &S, SourceLocation Loc, QualType T,
   if (!ICE || ICE->getCastKind() != CK_ArrayToPointerDecay)
     return;
 
-  S.Diag(Loc, diag::warn_sizeof_array_decay) << ICE->getSourceRange()
-                                             << ICE->getType()
-                                             << ICE->getSubExpr()->getType();
+  S.Diag(Loc, diag::warn_sizeof_array_decay)
+      << ICE->getSourceRange() << ICE->getType()
+      << ICE->getSubExpr()->getType();
 }
 
 bool Sema::CheckUnaryExprOrTypeTraitOperand(Expr *E,
@@ -4398,8 +4385,7 @@ bool Sema::CheckUnaryExprOrTypeTraitOperand(Expr *E,
   // used to build SFINAE gadgets.
   // FIXME: Should we consider instantiation-dependent operands to 'alignof'?
   if (IsUnevaluatedOperand && !inTemplateInstantiation() &&
-      !E->isInstantiationDependent() &&
-      !E->getType()->isVariableArrayType() &&
+      !E->isInstantiationDependent() && !E->getType()->isVariableArrayType() &&
       E->HasSideEffects(Context, false))
     Diag(E->getExprLoc(), diag::warn_side_effects_unevaluated_context);
 
@@ -4477,8 +4463,7 @@ bool Sema::CheckUnaryExprOrTypeTraitOperand(Expr *E,
         QualType OType = PVD->getOriginalType();
         QualType Type = PVD->getType();
         if (Type->isPointerType() && OType->isArrayType()) {
-          Diag(E->getExprLoc(), diag::warn_sizeof_array_param)
-            << Type << OType;
+          Diag(E->getExprLoc(), diag::warn_sizeof_array_param) << Type << OType;
           Diag(PVD->getLocation(), diag::note_declared_at);
         }
       }
@@ -4505,7 +4490,7 @@ static bool CheckAlignOfExpr(Sema &S, Expr *E, UnaryExprOrTypeTrait ExprKind) {
 
   if (E->getObjectKind() == OK_BitField) {
     S.Diag(E->getExprLoc(), diag::err_sizeof_alignof_typeof_bitfield)
-       << 1 << E->getSourceRange();
+        << 1 << E->getSourceRange();
     return true;
   }
 
@@ -4539,7 +4524,7 @@ static bool CheckAlignOfExpr(Sema &S, Expr *E, UnaryExprOrTypeTrait ExprKind) {
     // definition if we can find a member of it.
     if (!FD->getParent()->isCompleteDefinition()) {
       S.Diag(E->getExprLoc(), diag::err_alignof_member_of_incomplete_type)
-        << E->getSourceRange();
+          << E->getSourceRange();
       return true;
     }
 
@@ -4823,9 +4808,8 @@ ExprResult Sema::CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo,
       ExprKind, TInfo, Context.getSizeType(), OpLoc, R.getEnd());
 }
 
-ExprResult
-Sema::CreateUnaryExprOrTypeTraitExpr(Expr *E, SourceLocation OpLoc,
-                                     UnaryExprOrTypeTrait ExprKind) {
+ExprResult Sema::CreateUnaryExprOrTypeTraitExpr(Expr *E, SourceLocation OpLoc,
+                                                UnaryExprOrTypeTrait ExprKind) {
   ExprResult PE = CheckPlaceholderExpr(E);
   if (PE.isInvalid())
     return ExprError();
@@ -4841,9 +4825,9 @@ Sema::CreateUnaryExprOrTypeTraitExpr(Expr *E, SourceLocation OpLoc,
   } else if (ExprKind == UETT_VecStep) {
     isInvalid = CheckVecStepExpr(E);
   } else if (ExprKind == UETT_OpenMPRequiredSimdAlign) {
-      Diag(E->getExprLoc(), diag::err_openmp_default_simd_align_expr);
-      isInvalid = true;
-  } else if (E->refersToBitField()) {  // C99 6.5.3.4p1.
+    Diag(E->getExprLoc(), diag::err_openmp_default_simd_align_expr);
+    isInvalid = true;
+  } else if (E->refersToBitField()) { // C99 6.5.3.4p1.
     Diag(E->getExprLoc(), diag::err_sizeof_alignof_typeof_bitfield) << 0;
     isInvalid = true;
   } else if (ExprKind == UETT_VectorElements || ExprKind == UETT_SizeOf ||
@@ -4857,7 +4841,8 @@ Sema::CreateUnaryExprOrTypeTraitExpr(Expr *E, SourceLocation OpLoc,
   if ((ExprKind == UETT_SizeOf || ExprKind == UETT_CountOf) &&
       E->getType()->isVariableArrayType()) {
     PE = TransformToPotentiallyEvaluated(E);
-    if (PE.isInvalid()) return ExprError();
+    if (PE.isInvalid())
+      return ExprError();
     E = PE.get();
   }
 
@@ -4866,16 +4851,17 @@ Sema::CreateUnaryExprOrTypeTraitExpr(Expr *E, SourceLocation OpLoc,
       ExprKind, E, Context.getSizeType(), OpLoc, E->getSourceRange().getEnd());
 }
 
-ExprResult
-Sema::ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc,
-                                    UnaryExprOrTypeTrait ExprKind, bool IsType,
-                                    void *TyOrEx, SourceRange ArgRange) {
+ExprResult Sema::ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc,
+                                               UnaryExprOrTypeTrait ExprKind,
+                                               bool IsType, void *TyOrEx,
+                                               SourceRange ArgRange) {
   // If error parsing type, ignore.
-  if (!TyOrEx) return ExprError();
+  if (!TyOrEx)
+    return ExprError();
 
   if (IsType) {
     TypeSourceInfo *TInfo;
-    (void) GetTypeFromParser(ParsedType::getFromOpaquePtr(TyOrEx), &TInfo);
+    (void)GetTypeFromParser(ParsedType::getFromOpaquePtr(TyOrEx), &TInfo);
     return CreateUnaryExprOrTypeTraitExpr(TInfo, OpLoc, ExprKind, ArgRange);
   }
 
@@ -4922,33 +4908,37 @@ static QualType CheckRealImagOperand(Sema &S, ExprResult &V, SourceLocation Loc,
 
   // Test for placeholders.
   ExprResult PR = S.CheckPlaceholderExpr(V.get());
-  if (PR.isInvalid()) return QualType();
+  if (PR.isInvalid())
+    return QualType();
   if (PR.get() != V.get()) {
     V = PR;
     return CheckRealImagOperand(S, V, Loc, IsReal);
   }
 
   // Reject anything else.
-  S.Diag(Loc, diag::err_realimag_invalid_type) << V.get()->getType()
-    << (IsReal ? "__real" : "__imag");
+  S.Diag(Loc, diag::err_realimag_invalid_type)
+      << V.get()->getType() << (IsReal ? "__real" : "__imag");
   return QualType();
 }
 
-
-
-ExprResult
-Sema::ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
-                          tok::TokenKind Kind, Expr *Input) {
+ExprResult Sema::ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
+                                     tok::TokenKind Kind, Expr *Input) {
   UnaryOperatorKind Opc;
   switch (Kind) {
-  default: llvm_unreachable("Unknown unary op!");
-  case tok::plusplus:   Opc = UO_PostInc; break;
-  case tok::minusminus: Opc = UO_PostDec; break;
+  default:
+    llvm_unreachable("Unknown unary op!");
+  case tok::plusplus:
+    Opc = UO_PostInc;
+    break;
+  case tok::minusminus:
+    Opc = UO_PostDec;
+    break;
   }
 
   // Since this might is a postfix expression, get rid of ParenListExprs.
   ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Input);
-  if (Result.isInvalid()) return ExprError();
+  if (Result.isInvalid())
+    return ExprError();
   Input = Result.get();
 
   return BuildUnaryOp(S, OpLoc, Opc, Input);
@@ -4957,8 +4947,7 @@ Sema::ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
 /// Diagnose if arithmetic on the given ObjC pointer is illegal.
 ///
 /// \return true on error
-static bool checkArithmeticOnObjCPointer(Sema &S,
-                                         SourceLocation opLoc,
+static bool checkArithmeticOnObjCPointer(Sema &S, SourceLocation opLoc,
                                          Expr *op) {
   assert(op->getType()->isObjCObjectPointerType());
   if (S.LangOpts.ObjCRuntime.allowsPointerArithmetic() &&
@@ -4966,8 +4955,8 @@ static bool checkArithmeticOnObjCPointer(Sema &S,
     return false;
 
   S.Diag(opLoc, diag::err_arithmetic_nonfragile_interface)
-    << op->getType()->castAs<ObjCObjectPointerType>()->getPointeeType()
-    << op->getSourceRange();
+      << op->getType()->castAs<ObjCObjectPointerType>()->getPointeeType()
+      << op->getSourceRange();
   return true;
 }
 
@@ -5375,9 +5364,9 @@ void Sema::CheckSubscriptAccessOfNoDeref(const ArraySubscriptExpr *E) {
   }
 }
 
-ExprResult
-Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
-                                      Expr *Idx, SourceLocation RLoc) {
+ExprResult Sema::CreateBuiltinArraySubscriptExpr(Expr *Base,
+                                                 SourceLocation LLoc, Expr *Idx,
+                                                 SourceLocation RLoc) {
   Expr *LHSExp = Base;
   Expr *RHSExp = Idx;
 
@@ -5424,7 +5413,7 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
     IndexExpr = RHSExp;
     ResultType = PTy->getPointeeType();
   } else if (const ObjCObjectPointerType *PTy =
-               LHSTy->getAs<ObjCObjectPointerType>()) {
+                 LHSTy->getAs<ObjCObjectPointerType>()) {
     BaseExpr = LHSExp;
     IndexExpr = RHSExp;
 
@@ -5436,19 +5425,19 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
 
     ResultType = PTy->getPointeeType();
   } else if (const PointerType *PTy = RHSTy->getAs<PointerType>()) {
-     // Handle the uncommon case of "123[Ptr]".
+    // Handle the uncommon case of "123[Ptr]".
     BaseExpr = RHSExp;
     IndexExpr = LHSExp;
     ResultType = PTy->getPointeeType();
   } else if (const ObjCObjectPointerType *PTy =
-               RHSTy->getAs<ObjCObjectPointerType>()) {
-     // Handle the uncommon case of "123[Ptr]".
+                 RHSTy->getAs<ObjCObjectPointerType>()) {
+    // Handle the uncommon case of "123[Ptr]".
     BaseExpr = RHSExp;
     IndexExpr = LHSExp;
     ResultType = PTy->getPointeeType();
     if (!LangOpts.isSubscriptPointerArithmetic()) {
       Diag(LLoc, diag::err_subscript_nonfragile_interface)
-        << ResultType << BaseExpr->getSourceRange();
+          << ResultType << BaseExpr->getSourceRange();
       return ExprError();
     }
   } else if (LHSTy->isSubscriptableVectorType()) {
@@ -5492,7 +5481,8 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
     Diag(LHSExp->getBeginLoc(), diag::ext_subscript_non_lvalue)
         << LHSExp->getSourceRange();
     LHSExp = ImpCastExprToType(LHSExp, Context.getArrayDecayedType(LHSTy),
-                               CK_ArrayToPointerDecay).get();
+                               CK_ArrayToPointerDecay)
+                 .get();
     LHSTy = LHSExp->getType();
 
     BaseExpr = LHSExp;
@@ -5503,7 +5493,8 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
     Diag(RHSExp->getBeginLoc(), diag::ext_subscript_non_lvalue)
         << RHSExp->getSourceRange();
     RHSExp = ImpCastExprToType(RHSExp, Context.getArrayDecayedType(RHSTy),
-                               CK_ArrayToPointerDecay).get();
+                               CK_ArrayToPointerDecay)
+                 .get();
     RHSTy = RHSExp->getType();
 
     BaseExpr = RHSExp;
@@ -5511,7 +5502,7 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
     ResultType = RHSTy->castAs<PointerType>()->getPointeeType();
   } else {
     return ExprError(Diag(LLoc, diag::err_typecheck_subscript_value)
-       << LHSExp->getSourceRange() << RHSExp->getSourceRange());
+                     << LHSExp->getSourceRange() << RHSExp->getSourceRange());
   }
   // C99 6.5.2.1p1
   if (!IndexExpr->getType()->isIntegerType() && !IndexExpr->isTypeDependent())
@@ -5540,8 +5531,7 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
 
   if (ResultType->isVoidType() && !getLangOpts().CPlusPlus) {
     // GNU extension: subscripting on pointer to void
-    Diag(LLoc, diag::ext_gnu_subscript_void_type)
-      << BaseExpr->getSourceRange();
+    Diag(LLoc, diag::ext_gnu_subscript_void_type) << BaseExpr->getSourceRange();
 
     // C forbids expressions of unqualified void type from being l-values.
     // See IsCForbiddenLValueType.
@@ -6008,7 +5998,7 @@ class FunctionCallCCC final : public FunctionCallFilterCCC {
 private:
   const IdentifierInfo *const FunctionName;
 };
-}
+} // namespace
 
 static TypoCorrection TryTypoCorrectionForCall(Sema &S, Expr *Fn,
                                                FunctionDecl *FDecl,
@@ -6068,13 +6058,12 @@ static bool isParenthetizedAndQualifiedAddressOfExpr(Expr *Fn) {
   return false;
 }
 
-bool
-Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
-                              FunctionDecl *FDecl,
-                              const FunctionProtoType *Proto,
-                              ArrayRef<Expr *> Args,
-                              SourceLocation RParenLoc,
-                              bool IsExecConfig) {
+bool Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
+                                   FunctionDecl *FDecl,
+                                   const FunctionProtoType *Proto,
+                                   ArrayRef<Expr *> Args,
+                                   SourceLocation RParenLoc,
+                                   bool IsExecConfig) {
   // Bail out early if calling a builtin with custom typechecking.
   if (FDecl)
     if (unsigned ID = FDecl->getBuiltinID())
@@ -6092,9 +6081,9 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
   bool Invalid = false;
   unsigned MinArgs = FDecl ? FDecl->getMinRequiredArguments() : NumParams;
   unsigned FnKind = Fn->getType()->isBlockPointerType()
-                       ? 1 /* block */
-                       : (IsExecConfig ? 3 /* kernel function (exec config) */
-                                       : 0 /* function */);
+                        ? 1                 /* block */
+                        : (IsExecConfig ? 3 /* kernel function (exec config) */
+                                        : 0 /* function */);
 
   // If too few arguments are available (and we don't have default
   // arguments for the remaining parameters), don't make the call.
@@ -6233,12 +6222,12 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl,
 
       // Strip the unbridged-cast placeholder expression off, if applicable.
       bool CFAudited = false;
-      if (Arg->getType() == Context.ARCUnbridgedCastTy &&
-          FDecl && FDecl->hasAttr<CFAuditedTransferAttr>() &&
+      if (Arg->getType() == Context.ARCUnbridgedCastTy && FDecl &&
+          FDecl->hasAttr<CFAuditedTransferAttr>() &&
           (!Param || !Param->hasAttr<CFConsumedAttr>()))
         Arg = ObjC().stripARCUnbridgedCast(Arg);
-      else if (getLangOpts().ObjCAutoRefCount &&
-               FDecl && FDecl->hasAttr<CFAuditedTransferAttr>() &&
+      else if (getLangOpts().ObjCAutoRefCount && FDecl &&
+               FDecl->hasAttr<CFAuditedTransferAttr>() &&
                (!Param || !Param->hasAttr<CFConsumedAttr>()))
         CFAudited = true;
 
@@ -6316,7 +6305,7 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl,
         AllArgs.push_back(arg.get());
       }
 
-    // Otherwise do argument promotion, (C99 6.5.2.2p7).
+      // Otherwise do argument promotion, (C99 6.5.2.2p7).
     } else {
       for (Expr *A : Args.slice(ArgIx)) {
         ExprResult Arg = DefaultVariadicArgumentPromotion(A, CallType, FDecl);
@@ -6338,13 +6327,11 @@ static void DiagnoseCalleeStaticArrayParam(Sema &S, ParmVarDecl *PVD) {
     TL = DTL.getOriginalLoc();
   if (ArrayTypeLoc ATL = TL.getAs<ArrayTypeLoc>())
     S.Diag(PVD->getLocation(), diag::note_callee_static_array)
-      << ATL.getLocalSourceRange();
+        << ATL.getLocalSourceRange();
 }
 
-void
-Sema::CheckStaticArrayArgument(SourceLocation CallLoc,
-                               ParmVarDecl *Param,
-                               const Expr *ArgExpr) {
+void Sema::CheckStaticArrayArgument(SourceLocation CallLoc, ParmVarDecl *Param,
+                                    const Expr *ArgExpr) {
   // Static array parameters are not supported in C++.
   if (!Param || getLangOpts().CPlusPlus)
     return;
@@ -6355,8 +6342,7 @@ Sema::CheckStaticArrayArgument(SourceLocation CallLoc,
   if (!AT || AT->getSizeModifier() != ArraySizeModifier::Static)
     return;
 
-  if (ArgExpr->isNullPointerConstant(Context,
-                                     Expr::NPC_NeverValueDependent)) {
+  if (ArgExpr->isNullPointerConstant(Context, Expr::NPC_NeverValueDependent)) {
     Diag(CallLoc, diag::warn_null_arg) << ArgExpr->getSourceRange();
     DiagnoseCalleeStaticArrayParam(*this, Param);
     return;
@@ -6367,7 +6353,7 @@ Sema::CheckStaticArrayArgument(SourceLocation CallLoc,
     return;
 
   const ConstantArrayType *ArgCAT =
-    Context.getAsConstantArrayType(ArgExpr->IgnoreParenCasts()->getType());
+      Context.getAsConstantArrayType(ArgExpr->IgnoreParenCasts()->getType());
   if (!ArgCAT)
     return;
 
@@ -6403,23 +6389,21 @@ static ExprResult rebuildUnknownAnyFunction(Sema &S, Expr *fn);
 static bool isPlaceholderToRemoveAsArg(QualType type) {
   // Placeholders are never sugared.
   const BuiltinType *placeholder = dyn_cast<BuiltinType>(type);
-  if (!placeholder) return false;
+  if (!placeholder)
+    return false;
 
   switch (placeholder->getKind()) {
-  // Ignore all the non-placeholder types.
-#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
+    // Ignore all the non-placeholder types.
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix)                   \
   case BuiltinType::Id:
 #include "clang/Basic/OpenCLImageTypes.def"
-#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
-  case BuiltinType::Id:
+#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) case BuiltinType::Id:
 #include "clang/Basic/OpenCLExtensionTypes.def"
-  // In practice we'll never use this, since all SVE types are sugared
-  // via TypedefTypes rather than exposed directly as BuiltinTypes.
-#define SVE_TYPE(Name, Id, SingletonId) \
-  case BuiltinType::Id:
+    // In practice we'll never use this, since all SVE types are sugared
+    // via TypedefTypes rather than exposed directly as BuiltinTypes.
+#define SVE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
 #include "clang/Basic/AArch64ACLETypes.def"
-#define PPC_VECTOR_TYPE(Name, Id, Size) \
-  case BuiltinType::Id:
+#define PPC_VECTOR_TYPE(Name, Id, Size) case BuiltinType::Id:
 #include "clang/Basic/PPCTypes.def"
 #define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
 #include "clang/Basic/RISCVVTypes.def"
@@ -6462,7 +6446,6 @@ static bool isPlaceholderToRemoveAsArg(QualType type) {
   case BuiltinType::OMPArrayShaping:
   case BuiltinType::OMPIterator:
     return true;
-
   }
   llvm_unreachable("bad builtin type kind");
 }
@@ -6474,8 +6457,10 @@ bool Sema::CheckArgsForPlaceholders(MultiExprArg args) {
   for (size_t i = 0, e = args.size(); i != e; i++) {
     if (isPlaceholderToRemoveAsArg(args[i]->getType())) {
       ExprResult result = CheckPlaceholderExpr(args[i]);
-      if (result.isInvalid()) hasInvalid = true;
-      else args[i] = result.get();
+      if (result.isInvalid())
+        hasInvalid = true;
+      else
+        args[i] = result.get();
     }
   }
   return hasInvalid;
@@ -6546,8 +6531,8 @@ static FunctionDecl *rewriteBuiltinFunctionDecl(Sema *Sema, ASTContext &Context,
 
   FunctionProtoType::ExtProtoInfo EPI;
   EPI.Variadic = FT->isVariadic();
-  QualType OverloadTy = Context.getFunctionType(FT->getReturnType(),
-                                                OverloadParams, EPI);
+  QualType OverloadTy =
+      Context.getFunctionType(FT->getReturnType(), OverloadParams, EPI);
   DeclContext *Parent = FDecl->getParent();
   FunctionDecl *OverloadDecl = FunctionDecl::Create(
       Context, Parent, FDecl->getLocation(), FDecl->getLocation(),
@@ -6555,14 +6540,14 @@ static FunctionDecl *rewriteBuiltinFunctionDecl(Sema *Sema, ASTContext &Context,
       /*TInfo=*/nullptr, SC_Extern, Sema->getCurFPFeatures().isFPConstrained(),
       false,
       /*hasPrototype=*/true);
-  SmallVector<ParmVarDecl*, 16> Params;
+  SmallVector<ParmVarDecl *, 16> Params;
   FT = cast<FunctionProtoType>(OverloadTy);
   for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) {
     QualType ParamType = FT->getParamType(i);
     ParmVarDecl *Parm =
         ParmVarDecl::Create(Context, OverloadDecl, SourceLocation(),
-                                SourceLocation(), nullptr, ParamType,
-                                /*TInfo=*/nullptr, SC_None, nullptr);
+                            SourceLocation(), nullptr, ParamType,
+                            /*TInfo=*/nullptr, SC_None, nullptr);
     Parm->setScopeInfo(0, i);
     Params.push_back(Parm);
   }
@@ -6668,7 +6653,6 @@ tryImplicitlyCaptureThisIfImplicitMemberFunctionAccessWithDependentArgs(
   if (!enclosingClassIsRelatedToClassInWhichMembersWereFound(UME, S))
     return;
 
-
   DeclContext *EnclosingFunctionCtx = S.CurContext->getParent()->getParent();
   // If the enclosing function is not dependent, then this lambda is
   // capture ready, so if we can capture this, do so.
@@ -6777,7 +6761,8 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
                                bool AllowRecovery) {
   // Since this might be a postfix expression, get rid of ParenListExprs.
   ExprResult Result = MaybeConvertParenListExprToParenExpr(Scope, Fn);
-  if (Result.isInvalid()) return ExprError();
+  if (Result.isInvalid())
+    return ExprError();
   Fn = Result.get();
 
   // The __builtin_amdgcn_is_invocable builtin is special, and will be resolved
@@ -6822,7 +6807,8 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
     }
     if (Fn->getType() == Context.PseudoObjectTy) {
       ExprResult result = CheckPlaceholderExpr(Fn);
-      if (result.isInvalid()) return ExprError();
+      if (result.isInvalid())
+        return ExprError();
       Fn = result.get();
     }
 
@@ -6860,7 +6846,8 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
 
     if (Fn->getType() == Context.UnknownAnyTy) {
       ExprResult result = rebuildUnknownAnyFunction(*this, Fn);
-      if (result.isInvalid()) return ExprError();
+      if (result.isInvalid())
+        return ExprError();
       Fn = result.get();
     }
 
@@ -6894,7 +6881,8 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
   // If we're directly calling a function, get the appropriate declaration.
   if (Fn->getType() == Context.UnknownAnyTy) {
     ExprResult result = rebuildUnknownAnyFunction(*this, Fn);
-    if (result.isInvalid()) return ExprError();
+    if (result.isInvalid())
+      return ExprError();
     Fn = result.get();
   }
 
@@ -6953,7 +6941,7 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
     // type.
     if (getLangOpts().HIP && FD && FD->getBuiltinID()) {
       for (unsigned Idx = 0; Idx < ArgExprs.size() && Idx < FD->param_size();
-          ++Idx) {
+           ++Idx) {
         ParmVarDecl *Param = FD->getParamDecl(Idx);
         if (!ArgExprs[Idx] || !Param || !Param->getType()->isPointerType() ||
             !ArgExprs[Idx]->getType()->isPointerType())
@@ -6966,10 +6954,14 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
 
         // Add address space cast if target address spaces are different
         bool NeedImplicitASC =
-          ParamAS != LangAS::Default &&       // Pointer params in generic AS don't need special handling.
-          ( ArgAS == LangAS::Default  ||      // We do allow implicit conversion from generic AS
-                                              // or from specific AS which has target AS matching that of Param.
-          getASTContext().getTargetAddressSpace(ArgAS) == getASTContext().getTargetAddressSpace(ParamAS));
+            ParamAS != LangAS::Default && // Pointer params in generic AS don't
+                                          // need special handling.
+            (ArgAS ==
+                 LangAS::Default || // We do allow implicit conversion from
+                                    // generic AS or from specific AS which has
+                                    // target AS matching that of Param.
+             getASTContext().getTargetAddressSpace(ArgAS) ==
+                 getASTContext().getTargetAddressSpace(ParamAS));
         if (!NeedImplicitASC)
           continue;
 
@@ -6986,9 +6978,8 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
         ArgPtQuals.setAddressSpace(ParamAS);
         auto NewArgPtTy =
             Context.getQualifiedType(ArgPtTy.getUnqualifiedType(), ArgPtQuals);
-        auto NewArgTy =
-            Context.getQualifiedType(Context.getPointerType(NewArgPtTy),
-                                     ArgTy.getQualifiers());
+        auto NewArgTy = Context.getQualifiedType(
+            Context.getPointerType(NewArgPtTy), ArgTy.getQualifiers());
 
         // Finally perform an implicit address space cast
         ArgExprs[Idx] = ImpCastExprToType(ArgExprs[Idx], NewArgTy,
@@ -7215,7 +7206,8 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
     if (Config) {
       // CUDA: Kernel calls must be to global functions
       if (FDecl && !FDecl->hasAttr<CUDAGlobalAttr>())
-        return ExprError(Diag(LParenLoc,diag::err_kern_call_not_global_function)
+        return ExprError(
+            Diag(LParenLoc, diag::err_kern_call_not_global_function)
             << FDecl << Fn->getSourceRange());
 
       // CUDA: Kernel function must have 'void' return type
@@ -7223,12 +7215,12 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
           !FuncT->getReturnType()->getAs<AutoType>() &&
           !FuncT->getReturnType()->isInstantiationDependentType())
         return ExprError(Diag(LParenLoc, diag::err_kern_type_not_void_return)
-            << Fn->getType() << Fn->getSourceRange());
+                         << Fn->getType() << Fn->getSourceRange());
     } else {
       // CUDA: Calls to global functions must be configured
       if (FDecl && FDecl->hasAttr<CUDAGlobalAttr>())
         return ExprError(Diag(LParenLoc, diag::err_global_call_not_config)
-            << FDecl << Fn->getSourceRange());
+                         << FDecl << Fn->getSourceRange());
     }
   }
 
@@ -7264,9 +7256,11 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
       const FunctionDecl *Def = nullptr;
       if (FDecl->hasBody(Def) && Args.size() != Def->param_size()) {
         Proto = Def->getType()->getAs<FunctionProtoType>();
-       if (!Proto || !(Proto->isVariadic() && Args.size() >= Def->param_size()))
+        if (!Proto ||
+            !(Proto->isVariadic() && Args.size() >= Def->param_size()))
           Diag(RParenLoc, diag::warn_call_wrong_number_of_arguments)
-          << (Args.size() > Def->param_size()) << FDecl << Fn->getSourceRange();
+              << (Args.size() > Def->param_size()) << FDecl
+              << Fn->getSourceRange();
       }
 
       // If the function we're calling isn't a function prototype, but we have
@@ -7365,9 +7359,9 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
   return CheckForImmediateInvocation(MaybeBindToTemporary(TheCall), FDecl);
 }
 
-ExprResult
-Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty,
-                           SourceLocation RParenLoc, Expr *InitExpr) {
+ExprResult Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty,
+                                      SourceLocation RParenLoc,
+                                      Expr *InitExpr) {
   assert(Ty && "ActOnCompoundLiteral(): missing type");
   assert(InitExpr && "ActOnCompoundLiteral(): missing expression");
 
@@ -7379,9 +7373,10 @@ Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty,
   return BuildCompoundLiteralExpr(LParenLoc, TInfo, RParenLoc, InitExpr);
 }
 
-ExprResult
-Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo,
-                               SourceLocation RParenLoc, Expr *LiteralExpr) {
+ExprResult Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc,
+                                          TypeSourceInfo *TInfo,
+                                          SourceLocation RParenLoc,
+                                          Expr *LiteralExpr) {
   QualType literalType = TInfo->getType();
 
   if (literalType->isArrayType()) {
@@ -7417,20 +7412,21 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo,
         return ExprError();
     }
   } else if (!literalType->isDependentType() &&
-             RequireCompleteType(LParenLoc, literalType,
-               diag::err_typecheck_decl_incomplete_type,
-               SourceRange(LParenLoc, LiteralExpr->getSourceRange().getEnd())))
+             RequireCompleteType(
+                 LParenLoc, literalType,
+                 diag::err_typecheck_decl_incomplete_type,
+                 SourceRange(LParenLoc,
+                             LiteralExpr->getSourceRange().getEnd())))
     return ExprError();
 
-  InitializedEntity Entity
-    = InitializedEntity::InitializeCompoundLiteralInit(TInfo);
-  InitializationKind Kind
-    = InitializationKind::CreateCStyleCast(LParenLoc,
-                                           SourceRange(LParenLoc, RParenLoc),
-                                           /*InitList=*/true);
+  InitializedEntity Entity =
+      InitializedEntity::InitializeCompoundLiteralInit(TInfo);
+  InitializationKind Kind = InitializationKind::CreateCStyleCast(
+      LParenLoc, SourceRange(LParenLoc, RParenLoc),
+      /*InitList=*/true);
   InitializationSequence InitSeq(*this, Entity, Kind, LiteralExpr);
-  ExprResult Result = InitSeq.Perform(*this, Entity, Kind, LiteralExpr,
-                                      &literalType);
+  ExprResult Result =
+      InitSeq.Perform(*this, Entity, Kind, LiteralExpr, &literalType);
   if (Result.isInvalid())
     return ExprError();
   LiteralExpr = Result.get();
@@ -7487,8 +7483,7 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo,
   auto *E = new (Context) CompoundLiteralExpr(LParenLoc, TInfo, literalType, VK,
                                               LiteralExpr, IsFileScope);
   if (IsFileScope) {
-    if (!LiteralExpr->isTypeDependent() &&
-        !LiteralExpr->isValueDependent() &&
+    if (!LiteralExpr->isTypeDependent() && !LiteralExpr->isValueDependent() &&
         !literalType->isDependentType()) // C99 6.5.2.5p3
       if (CheckForConstantInitializer(LiteralExpr))
         return ExprError();
@@ -7498,7 +7493,7 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo,
     //   "If the compound literal occurs inside the body of a function, the
     //   type name shall not be qualified by an address-space qualifier."
     Diag(LParenLoc, diag::err_compound_literal_with_address_space)
-      << SourceRange(LParenLoc, LiteralExpr->getSourceRange().getEnd());
+        << SourceRange(LParenLoc, LiteralExpr->getSourceRange().getEnd());
     return ExprError();
   }
 
@@ -7529,9 +7524,9 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo,
   return MaybeBindToTemporary(E);
 }
 
-ExprResult
-Sema::ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList,
-                    SourceLocation RBraceLoc) {
+ExprResult Sema::ActOnInitList(SourceLocation LBraceLoc,
+                               MultiExprArg InitArgList,
+                               SourceLocation RBraceLoc) {
   // Only produce each kind of designated initialization diagnostic once.
   SourceLocation FirstDesignator;
   bool DiagnosedArrayDesignator = false;
@@ -7551,14 +7546,14 @@ Sema::ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList,
       if (!DiagnosedNestedDesignator && DIE->size() > 1) {
         DiagnosedNestedDesignator = true;
         Diag(DIE->getBeginLoc(), diag::ext_designated_init_nested)
-          << DIE->getDesignatorsSourceRange();
+            << DIE->getDesignatorsSourceRange();
       }
 
       for (auto &Desig : DIE->designators()) {
         if (!Desig.isFieldDesignator() && !DiagnosedArrayDesignator) {
           DiagnosedArrayDesignator = true;
           Diag(Desig.getBeginLoc(), diag::ext_designated_init_array)
-            << Desig.getSourceRange();
+              << Desig.getSourceRange();
         }
       }
 
@@ -7566,18 +7561,18 @@ Sema::ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList,
           !isa<DesignatedInitExpr>(InitArgList[0])) {
         DiagnosedMixedDesignator = true;
         Diag(DIE->getBeginLoc(), diag::ext_designated_init_mixed)
-          << DIE->getSourceRange();
+            << DIE->getSourceRange();
         Diag(InitArgList[0]->getBeginLoc(), diag::note_designated_init_mixed)
-          << InitArgList[0]->getSourceRange();
+            << InitArgList[0]->getSourceRange();
       }
     } else if (getLangOpts().CPlusPlus && !DiagnosedMixedDesignator &&
                isa<DesignatedInitExpr>(InitArgList[0])) {
       DiagnosedMixedDesignator = true;
       auto *DIE = cast<DesignatedInitExpr>(InitArgList[0]);
       Diag(DIE->getBeginLoc(), diag::ext_designated_init_mixed)
-        << DIE->getSourceRange();
+          << DIE->getSourceRange();
       Diag(InitArgList[I]->getBeginLoc(), diag::note_designated_init_mixed)
-        << InitArgList[I]->getSourceRange();
+          << InitArgList[I]->getSourceRange();
     }
   }
 
@@ -7597,9 +7592,9 @@ Sema::ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList,
   return BuildInitList(LBraceLoc, InitArgList, RBraceLoc);
 }
 
-ExprResult
-Sema::BuildInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList,
-                    SourceLocation RBraceLoc) {
+ExprResult Sema::BuildInitList(SourceLocation LBraceLoc,
+                               MultiExprArg InitArgList,
+                               SourceLocation RBraceLoc) {
   // Semantic analysis for initializers is done by ActOnDeclarator() and
   // CheckInitializer() - it requires knowledge of the object being initialized.
 
@@ -7611,7 +7606,8 @@ Sema::BuildInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList,
 
       // Ignore failures; dropping the entire initializer list because
       // of one failure would be terrible for indexing/etc.
-      if (result.isInvalid()) continue;
+      if (result.isInvalid())
+        continue;
 
       InitArgList[I] = result.get();
     }
@@ -7628,7 +7624,8 @@ void Sema::maybeExtendBlockObject(ExprResult &E) {
   assert(E.get()->isPRValue());
 
   // Only do this in an r-value context.
-  if (!getLangOpts().ObjCAutoRefCount) return;
+  if (!getLangOpts().ObjCAutoRefCount)
+    return;
 
   E = ImplicitCastExpr::Create(
       Context, E.get()->getType(), CK_ARCExtendBlockObject, E.get(),
@@ -7664,7 +7661,8 @@ CastKind Sema::PrepareScalarCast(ExprResult &Src, QualType DestTy) {
     }
     case Type::STK_BlockPointer:
       return (SrcKind == Type::STK_BlockPointer
-                ? CK_BitCast : CK_AnyPointerToBlockPointerCast);
+                  ? CK_BitCast
+                  : CK_AnyPointerToBlockPointerCast);
     case Type::STK_ObjCObjectPointer:
       if (SrcKind == Type::STK_ObjCObjectPointer)
         return CK_BitCast;
@@ -7727,13 +7725,13 @@ CastKind Sema::PrepareScalarCast(ExprResult &Src, QualType DestTy) {
       return CK_IntegralToFloating;
     case Type::STK_IntegralComplex:
       Src = ImpCastExprToType(Src.get(),
-                      DestTy->castAs<ComplexType>()->getElementType(),
-                      CK_IntegralCast);
+                              DestTy->castAs<ComplexType>()->getElementType(),
+                              CK_IntegralCast);
       return CK_IntegralRealToComplex;
     case Type::STK_FloatingComplex:
       Src = ImpCastExprToType(Src.get(),
-                      DestTy->castAs<ComplexType>()->getElementType(),
-                      CK_IntegralToFloating);
+                              DestTy->castAs<ComplexType>()->getElementType(),
+                              CK_IntegralToFloating);
       return CK_FloatingRealToComplex;
     case Type::STK_MemberPointer:
       llvm_unreachable("member pointer type in C");
@@ -7855,7 +7853,8 @@ static bool breakDownVectorType(QualType type, uint64_t &len,
 
   // We allow lax conversion to and from non-vector types, but only if
   // they're real types (i.e. non-complex, non-pointer scalar types).
-  if (!type->isRealType()) return false;
+  if (!type->isRealType())
+    return false;
 
   len = 1;
   eltType = type;
@@ -7938,8 +7937,10 @@ bool Sema::areLaxCompatibleVectorTypes(QualType srcTy, QualType destTy) {
   // depend on them).  Most scalar OP ExtVector cases are handled by the
   // splat path anyway, which does what we want (convert, not bitcast).
   // What this rules out for ExtVectors is crazy things like char4*float.
-  if (srcTy->isScalarType() && destTy->isExtVectorType()) return false;
-  if (destTy->isScalarType() && srcTy->isExtVectorType()) return false;
+  if (srcTy->isScalarType() && destTy->isExtVectorType())
+    return false;
+  if (destTy->isScalarType() && srcTy->isExtVectorType())
+    return false;
 
   return areVectorTypesSameSize(srcTy, destTy);
 }
@@ -7965,7 +7966,7 @@ bool Sema::isLaxVectorConversion(QualType srcTy, QualType destTy) {
     // OK, integer (vector) -> integer (vector) bitcast.
     break;
 
-    case LangOptions::LaxVectorConversionKind::All:
+  case LangOptions::LaxVectorConversionKind::All:
     break;
   }
 
@@ -8000,14 +8001,14 @@ bool Sema::CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty,
   if (Ty->isVectorType() || Ty->isIntegralType(Context)) {
     if (!areLaxCompatibleVectorTypes(Ty, VectorTy))
       return Diag(R.getBegin(),
-                  Ty->isVectorType() ?
-                  diag::err_invalid_conversion_between_vectors :
-                  diag::err_invalid_conversion_between_vector_and_integer)
-        << VectorTy << Ty << R;
+                  Ty->isVectorType()
+                      ? diag::err_invalid_conversion_between_vectors
+                      : diag::err_invalid_conversion_between_vector_and_integer)
+             << VectorTy << Ty << R;
   } else
     return Diag(R.getBegin(),
                 diag::err_invalid_conversion_between_vector_and_scalar)
-      << VectorTy << Ty << R;
+           << VectorTy << Ty << R;
 
   Kind = CK_BitCast;
   return false;
@@ -8079,8 +8080,8 @@ ExprResult Sema::CheckExtVectorCast(SourceRange R, QualType DestTy,
         (getLangOpts().OpenCL &&
          !Context.hasSameUnqualifiedType(DestTy, SrcTy) &&
          !Context.areCompatibleVectorTypes(DestTy, SrcTy))) {
-      Diag(R.getBegin(),diag::err_invalid_conversion_between_ext_vectors)
-        << DestTy << SrcTy << R;
+      Diag(R.getBegin(), diag::err_invalid_conversion_between_ext_vectors)
+          << DestTy << SrcTy << R;
       return ExprError();
     }
     Kind = CK_BitCast;
@@ -8093,7 +8094,7 @@ ExprResult Sema::CheckExtVectorCast(SourceRange R, QualType DestTy,
   if (SrcTy->isPointerType())
     return Diag(R.getBegin(),
                 diag::err_invalid_conversion_between_vector_and_scalar)
-      << DestTy << SrcTy << R;
+           << DestTy << SrcTy << R;
 
   Kind = CK_VectorSplat;
   return prepareVectorSplat(DestTy, CastExpr);
@@ -8134,10 +8135,9 @@ static void CheckSufficientAllocSize(Sema &S, QualType DestType,
         << Size.getQuantity() << TargetType << LhsSize->getQuantity();
 }
 
-ExprResult
-Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
-                    Declarator &D, ParsedType &Ty,
-                    SourceLocation RParenLoc, Expr *CastExpr) {
+ExprResult Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
+                               Declarator &D, ParsedType &Ty,
+                               SourceLocation RParenLoc, Expr *CastExpr) {
   assert(!D.isInvalidType() && (CastExpr != nullptr) &&
          "ActOnCastExpr(): missing type or expr");
 
@@ -8161,8 +8161,9 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
   // i.e. all the elements are integer constants.
   ParenExpr *PE = dyn_cast<ParenExpr>(CastExpr);
   ParenListExpr *PLE = dyn_cast<ParenListExpr>(CastExpr);
-  if ((getLangOpts().AltiVec || getLangOpts().ZVector || getLangOpts().OpenCL)
-       && castType->isVectorType() && (PE || PLE)) {
+  if ((getLangOpts().AltiVec || getLangOpts().ZVector ||
+       getLangOpts().OpenCL) &&
+      castType->isVectorType() && (PE || PLE)) {
     if (PLE && PLE->getNumExprs() == 0) {
       Diag(PLE->getExprLoc(), diag::err_altivec_empty_initializer);
       return ExprError();
@@ -8171,8 +8172,7 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
       Expr *E = (PE ? PE->getSubExpr() : PLE->getExpr(0));
       if (!E->isTypeDependent() && !E->getType()->isVectorType())
         isVectorLiteral = true;
-    }
-    else
+    } else
       isVectorLiteral = true;
   }
 
@@ -8186,7 +8186,8 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
   // sequence of BinOp comma operators.
   if (isa<ParenListExpr>(CastExpr)) {
     ExprResult Result = MaybeConvertParenListExprToParenExpr(S, CastExpr);
-    if (Result.isInvalid()) return ExprError();
+    if (Result.isInvalid())
+      return ExprError();
     CastExpr = Result.get();
   }
 
@@ -8253,16 +8254,12 @@ ExprResult Sema::BuildVectorLiteral(SourceLocation LParenLoc,
       Literal = ImpCastExprToType(Literal.get(), ElemTy,
                                   PrepareScalarCast(Literal, ElemTy));
       return BuildCStyleCastExpr(LParenLoc, TInfo, RParenLoc, Literal.get());
-    }
-    else if (numExprs < numElems) {
-      Diag(E->getExprLoc(),
-           diag::err_incorrect_number_of_vector_initializers);
+    } else if (numExprs < numElems) {
+      Diag(E->getExprLoc(), diag::err_incorrect_number_of_vector_initializers);
       return ExprError();
-    }
-    else
+    } else
       initExprs.append(exprs, exprs + numExprs);
-  }
-  else {
+  } else {
     // For OpenCL, when the number of initializers is a single value,
     // it will be replicated to all components of the vector.
     if (getLangOpts().OpenCL && VTy->getVectorKind() == VectorKind::Generic &&
@@ -8287,14 +8284,14 @@ ExprResult Sema::BuildVectorLiteral(SourceLocation LParenLoc,
   }
   // FIXME: This means that pretty-printing the final AST will produce curly
   // braces instead of the original commas.
-  InitListExpr *initE = new (Context) InitListExpr(Context, LiteralLParenLoc,
-                                                   initExprs, LiteralRParenLoc);
+  InitListExpr *initE = new (Context)
+      InitListExpr(Context, LiteralLParenLoc, initExprs, LiteralRParenLoc);
   initE->setType(Ty);
   return BuildCompoundLiteralExpr(LParenLoc, TInfo, RParenLoc, initE);
 }
 
-ExprResult
-Sema::MaybeConvertParenListExprToParenExpr(Scope *S, Expr *OrigExpr) {
+ExprResult Sema::MaybeConvertParenListExprToParenExpr(Scope *S,
+                                                      Expr *OrigExpr) {
   ParenListExpr *E = dyn_cast<ParenListExpr>(OrigExpr);
   if (!E)
     return OrigExpr;
@@ -8302,16 +8299,16 @@ Sema::MaybeConvertParenListExprToParenExpr(Scope *S, Expr *OrigExpr) {
   ExprResult Result(E->getExpr(0));
 
   for (unsigned i = 1, e = E->getNumExprs(); i != e && !Result.isInvalid(); ++i)
-    Result = ActOnBinOp(S, E->getExprLoc(), tok::comma, Result.get(),
-                        E->getExpr(i));
+    Result =
+        ActOnBinOp(S, E->getExprLoc(), tok::comma, Result.get(), E->getExpr(i));
 
-  if (Result.isInvalid()) return ExprError();
+  if (Result.isInvalid())
+    return ExprError();
 
   return ActOnParenExpr(E->getLParenLoc(), E->getRParenLoc(), Result.get());
 }
 
-ExprResult Sema::ActOnParenListExpr(SourceLocation L,
-                                    SourceLocation R,
+ExprResult Sema::ActOnParenListExpr(SourceLocation L, SourceLocation R,
                                     MultiExprArg Val) {
   return ParenListExpr::Create(Context, L, Val, R);
 }
@@ -8329,16 +8326,14 @@ bool Sema::DiagnoseConditionalForNull(const Expr *LHSExpr, const Expr *RHSExpr,
                                       SourceLocation QuestionLoc) {
   const Expr *NullExpr = LHSExpr;
   const Expr *NonPointerExpr = RHSExpr;
-  Expr::NullPointerConstantKind NullKind =
-      NullExpr->isNullPointerConstant(Context,
-                                      Expr::NPC_ValueDependentIsNotNull);
+  Expr::NullPointerConstantKind NullKind = NullExpr->isNullPointerConstant(
+      Context, Expr::NPC_ValueDependentIsNotNull);
 
   if (NullKind == Expr::NPCK_NotNull) {
     NullExpr = RHSExpr;
     NonPointerExpr = LHSExpr;
-    NullKind =
-        NullExpr->isNullPointerConstant(Context,
-                                        Expr::NPC_ValueDependentIsNotNull);
+    NullKind = NullExpr->isNullPointerConstant(
+        Context, Expr::NPC_ValueDependentIsNotNull);
   }
 
   if (NullKind == Expr::NPCK_NotNull)
@@ -8371,15 +8366,16 @@ static bool checkCondition(Sema &S, const Expr *Cond,
   // OpenCL v1.1 s6.3.i says the condition cannot be a floating point type.
   if (S.getLangOpts().OpenCL && CondTy->isFloatingType()) {
     S.Diag(QuestionLoc, diag::err_typecheck_cond_expect_nonfloat)
-      << CondTy << Cond->getSourceRange();
+        << CondTy << Cond->getSourceRange();
     return true;
   }
 
   // C99 6.5.15p2
-  if (CondTy->isScalarType()) return false;
+  if (CondTy->isScalarType())
+    return false;
 
   S.Diag(QuestionLoc, diag::err_typecheck_cond_expect_scalar)
-    << CondTy << Cond->getSourceRange();
+      << CondTy << Cond->getSourceRange();
   return true;
 }
 
@@ -8389,7 +8385,7 @@ static bool checkConditionalNullPointer(Sema &S, ExprResult &NullExpr,
                                         QualType PointerTy) {
   if ((!PointerTy->isAnyPointerType() && !PointerTy->isBlockPointerType()) ||
       !NullExpr.get()->isNullPointerConstant(S.Context,
-                                            Expr::NPC_ValueDependentIsNull))
+                                             Expr::NPC_ValueDependentIsNull))
     return true;
 
   NullExpr = S.ImpCastExprToType(NullExpr.get(), PointerTy, CK_NullToPointer);
@@ -8451,7 +8447,8 @@ static QualType checkConditionalPointerCompatibility(Sema &S, ExprResult &LHS,
     return QualType();
   }
 
-  unsigned MergedCVRQual = lhQual.getCVRQualifiers() | rhQual.getCVRQualifiers();
+  unsigned MergedCVRQual =
+      lhQual.getCVRQualifiers() | rhQual.getCVRQualifiers();
   auto LHSCastKind = CK_BitCast, RHSCastKind = CK_BitCast;
   lhQual.removeCVRQualifiers();
   rhQual.removeCVRQualifiers();
@@ -8551,8 +8548,8 @@ static QualType checkConditionalBlockPointerCompatibility(Sema &S,
       return destType;
     }
     S.Diag(Loc, diag::err_typecheck_cond_incompatible_operands)
-      << LHSTy << RHSTy << LHS.get()->getSourceRange()
-      << RHS.get()->getSourceRange();
+        << LHSTy << RHSTy << LHS.get()->getSourceRange()
+        << RHS.get()->getSourceRange();
     return QualType();
   }
 
@@ -8561,10 +8558,8 @@ static QualType checkConditionalBlockPointerCompatibility(Sema &S,
 }
 
 /// Return the resulting type when the operands are both pointers.
-static QualType
-checkConditionalObjectPointersCompatibility(Sema &S, ExprResult &LHS,
-                                            ExprResult &RHS,
-                                            SourceLocation Loc) {
+static QualType checkConditionalObjectPointersCompatibility(
+    Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc) {
   // get the pointer types
   QualType LHSTy = LHS.get()->getType();
   QualType RHSTy = RHS.get()->getType();
@@ -8576,8 +8571,8 @@ checkConditionalObjectPointersCompatibility(Sema &S, ExprResult &LHS,
   // ignore qualifiers on void (C99 6.5.15p3, clause 6)
   if (lhptee->isVoidType() && rhptee->isIncompleteOrObjectType()) {
     // Figure out necessary qualifiers (C99 6.5.15p6)
-    QualType destPointee
-      = S.Context.getQualifiedType(lhptee, rhptee.getQualifiers());
+    QualType destPointee =
+        S.Context.getQualifiedType(lhptee, rhptee.getQualifiers());
     QualType destType = S.Context.getPointerType(destPointee);
     // Add qualifiers if necessary.
     LHS = S.ImpCastExprToType(LHS.get(), destType, CK_NoOp);
@@ -8586,8 +8581,8 @@ checkConditionalObjectPointersCompatibility(Sema &S, ExprResult &LHS,
     return destType;
   }
   if (rhptee->isVoidType() && lhptee->isIncompleteOrObjectType()) {
-    QualType destPointee
-      = S.Context.getQualifiedType(rhptee, lhptee.getQualifiers());
+    QualType destPointee =
+        S.Context.getQualifiedType(rhptee, lhptee.getQualifiers());
     QualType destType = S.Context.getPointerType(destPointee);
     // Add qualifiers if necessary.
     RHS = S.ImpCastExprToType(RHS.get(), destType, CK_NoOp);
@@ -8602,7 +8597,7 @@ checkConditionalObjectPointersCompatibility(Sema &S, ExprResult &LHS,
 /// Return false if the first expression is not an integer and the second
 /// expression is not a pointer, true otherwise.
 static bool checkPointerIntegerMismatch(Sema &S, ExprResult &Int,
-                                        Expr* PointerExpr, SourceLocation Loc,
+                                        Expr *PointerExpr, SourceLocation Loc,
                                         bool IsIntFirstExpr) {
   if (!PointerExpr->getType()->isPointerType() ||
       !Int.get()->getType()->isIntegerType())
@@ -8612,8 +8607,8 @@ static bool checkPointerIntegerMismatch(Sema &S, ExprResult &Int,
   Expr *Expr2 = IsIntFirstExpr ? PointerExpr : Int.get();
 
   S.Diag(Loc, diag::ext_typecheck_cond_pointer_integer_mismatch)
-    << Expr1->getType() << Expr2->getType()
-    << Expr1->getSourceRange() << Expr2->getSourceRange();
+      << Expr1->getType() << Expr2->getType() << Expr1->getSourceRange()
+      << Expr2->getSourceRange();
   Int = S.ImpCastExprToType(Int.get(), PointerExpr->getType(),
                             CK_IntegralToPointer);
   return true;
@@ -8644,19 +8639,19 @@ static QualType OpenCLArithmeticConversions(Sema &S, ExprResult &LHS,
   // For conversion purposes, we ignore any qualifiers.
   // For example, "const float" and "float" are equivalent.
   QualType LHSType =
-    S.Context.getCanonicalType(LHS.get()->getType()).getUnqualifiedType();
+      S.Context.getCanonicalType(LHS.get()->getType()).getUnqualifiedType();
   QualType RHSType =
-    S.Context.getCanonicalType(RHS.get()->getType()).getUnqualifiedType();
+      S.Context.getCanonicalType(RHS.get()->getType()).getUnqualifiedType();
 
   if (!LHSType->isIntegerType() && !LHSType->isRealFloatingType()) {
     S.Diag(QuestionLoc, diag::err_typecheck_cond_expect_int_float)
-      << LHSType << LHS.get()->getSourceRange();
+        << LHSType << LHS.get()->getSourceRange();
     return QualType();
   }
 
   if (!RHSType->isIntegerType() && !RHSType->isRealFloatingType()) {
     S.Diag(QuestionLoc, diag::err_typecheck_cond_expect_int_float)
-      << RHSType << RHS.get()->getSourceRange();
+        << RHSType << RHS.get()->getSourceRange();
     return QualType();
   }
 
@@ -8670,8 +8665,8 @@ static QualType OpenCLArithmeticConversions(Sema &S, ExprResult &LHS,
                                  /*IsCompAssign = */ false);
 
   // Finally, we have two differing integer types.
-  return handleIntegerConversion<doIntegralCast, doIntegralCast>
-  (S, LHS, RHS, LHSType, RHSType, /*IsCompAssign = */ false);
+  return handleIntegerConversion<doIntegralCast, doIntegralCast>(
+      S, LHS, RHS, LHSType, RHSType, /*IsCompAssign = */ false);
 }
 
 /// Convert scalar operands to a vector that matches the
@@ -8685,11 +8680,12 @@ static QualType OpenCLArithmeticConversions(Sema &S, ExprResult &LHS,
 /// into a vector of that type where the length matches the condition
 /// vector type. s6.11.6 requires that the element types of the result
 /// and the condition must have the same number of bits.
-static QualType
-OpenCLConvertScalarsToVectors(Sema &S, ExprResult &LHS, ExprResult &RHS,
-                              QualType CondTy, SourceLocation QuestionLoc) {
+static QualType OpenCLConvertScalarsToVectors(Sema &S, ExprResult &LHS,
+                                              ExprResult &RHS, QualType CondTy,
+                                              SourceLocation QuestionLoc) {
   QualType ResTy = OpenCLArithmeticConversions(S, LHS, RHS, QuestionLoc);
-  if (ResTy.isNull()) return QualType();
+  if (ResTy.isNull())
+    return QualType();
 
   const VectorType *CV = CondTy->getAs<VectorType>();
   assert(CV);
@@ -8699,8 +8695,8 @@ OpenCLConvertScalarsToVectors(Sema &S, ExprResult &LHS, ExprResult &RHS,
   QualType VectorTy = S.Context.getExtVectorType(ResTy, NumElements);
 
   // Ensure that all types have the same number of bits
-  if (S.Context.getTypeSize(CV->getElementType())
-      != S.Context.getTypeSize(ResTy)) {
+  if (S.Context.getTypeSize(CV->getElementType()) !=
+      S.Context.getTypeSize(ResTy)) {
     // Since VectorTy is created internally, it does not pretty print
     // with an OpenCL name. Instead, we just print a description.
     std::string EleTyName = ResTy.getUnqualifiedType().getAsString();
@@ -8708,7 +8704,7 @@ OpenCLConvertScalarsToVectors(Sema &S, ExprResult &LHS, ExprResult &RHS,
     llvm::raw_svector_ostream OS(Str);
     OS << "(vector of " << NumElements << " '" << EleTyName << "' values)";
     S.Diag(QuestionLoc, diag::err_conditional_vector_element_size)
-      << CondTy << OS.str();
+        << CondTy << OS.str();
     return QualType();
   }
 
@@ -8727,10 +8723,11 @@ static bool checkOpenCLConditionVector(Sema &S, Expr *Cond,
   const VectorType *CondTy = Cond->getType()->getAs<VectorType>();
   assert(CondTy);
   QualType EleTy = CondTy->getElementType();
-  if (EleTy->isIntegerType()) return false;
+  if (EleTy->isIntegerType())
+    return false;
 
   S.Diag(QuestionLoc, diag::err_typecheck_cond_expect_nonfloat)
-    << Cond->getType() << Cond->getSourceRange();
+      << Cond->getType() << Cond->getSourceRange();
   return true;
 }
 
@@ -8748,7 +8745,7 @@ static bool checkVectorResult(Sema &S, QualType CondTy, QualType VecResTy,
 
   if (CV->getNumElements() != RV->getNumElements()) {
     S.Diag(QuestionLoc, diag::err_conditional_vector_size)
-      << CondTy << VecResTy;
+        << CondTy << VecResTy;
     return true;
   }
 
@@ -8769,10 +8766,9 @@ static bool checkVectorResult(Sema &S, QualType CondTy, QualType VecResTy,
 /// Return the resulting type for the conditional operator in
 ///        OpenCL (aka "ternary selection operator", OpenCL v1.1
 ///        s6.3.i) when the condition is a vector type.
-static QualType
-OpenCLCheckVectorConditional(Sema &S, ExprResult &Cond,
-                             ExprResult &LHS, ExprResult &RHS,
-                             SourceLocation QuestionLoc) {
+static QualType OpenCLCheckVectorConditional(Sema &S, ExprResult &Cond,
+                                             ExprResult &LHS, ExprResult &RHS,
+                                             SourceLocation QuestionLoc) {
   Cond = S.DefaultFunctionArrayLvalueConversion(Cond.get());
   if (Cond.isInvalid())
     return QualType();
@@ -8833,11 +8829,13 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS,
                                         SourceLocation QuestionLoc) {
 
   ExprResult LHSResult = CheckPlaceholderExpr(LHS.get());
-  if (!LHSResult.isUsable()) return QualType();
+  if (!LHSResult.isUsable())
+    return QualType();
   LHS = LHSResult;
 
   ExprResult RHSResult = CheckPlaceholderExpr(RHS.get());
-  if (!RHSResult.isUsable()) return QualType();
+  if (!RHSResult.isUsable())
+    return QualType();
   RHS = RHSResult;
 
   // C++ is sufficiently different to merit its own checker.
@@ -8896,16 +8894,16 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS,
   // Diagnose attempts to convert between __ibm128, __float128 and long double
   // where such conversions currently can't be handled.
   if (unsupportedTypeConversion(*this, LHSTy, RHSTy)) {
-    Diag(QuestionLoc,
-         diag::err_typecheck_cond_incompatible_operands) << LHSTy << RHSTy
-      << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
+    Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands)
+        << LHSTy << RHSTy << LHS.get()->getSourceRange()
+        << RHS.get()->getSourceRange();
     return QualType();
   }
 
   // OpenCL v2.0 s6.12.5 - Blocks cannot be used as expressions of the ternary
   // selection operator (?:).
-  if (getLangOpts().OpenCL &&
-      ((int)checkBlockType(*this, LHS.get()) | (int)checkBlockType(*this, RHS.get()))) {
+  if (getLangOpts().OpenCL && ((int)checkBlockType(*this, LHS.get()) |
+                               (int)checkBlockType(*this, RHS.get()))) {
     return QualType();
   }
 
@@ -8964,8 +8962,10 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS,
 
   // C99 6.5.15p6 - "if one operand is a null pointer constant, the result has
   // the type of the other operand."
-  if (!checkConditionalNullPointer(*this, RHS, LHSTy)) return LHSTy;
-  if (!checkConditionalNullPointer(*this, LHS, RHSTy)) return RHSTy;
+  if (!checkConditionalNullPointer(*this, RHS, LHSTy))
+    return LHSTy;
+  if (!checkConditionalNullPointer(*this, LHS, RHSTy))
+    return RHSTy;
 
   // All objective-c pointer type analysis is done here.
   QualType compositeType =
@@ -8975,7 +8975,6 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS,
   if (!compositeType.isNull())
     return compositeType;
 
-
   // Handle block pointer types.
   if (LHSTy->isBlockPointerType() || RHSTy->isBlockPointerType())
     return checkConditionalBlockPointerCompatibility(*this, LHS, RHS,
@@ -8989,10 +8988,10 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS,
   // GCC compatibility: soften pointer/integer mismatch.  Note that
   // null pointers have been filtered out by this point.
   if (checkPointerIntegerMismatch(*this, LHS, RHS.get(), QuestionLoc,
-      /*IsIntFirstExpr=*/true))
+                                  /*IsIntFirstExpr=*/true))
     return RHSTy;
   if (checkPointerIntegerMismatch(*this, RHS, LHS.get(), QuestionLoc,
-      /*IsIntFirstExpr=*/false))
+                                  /*IsIntFirstExpr=*/false))
     return LHSTy;
 
   // Emit a better diagnostic if one of the expressions is a null pointer
@@ -9008,8 +9007,8 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS,
 
   // Otherwise, the operands are not compatible.
   Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands)
-    << LHSTy << RHSTy << LHS.get()->getSourceRange()
-    << RHS.get()->getSourceRange();
+      << LHSTy << RHSTy << LHS.get()->getSourceRange()
+      << RHS.get()->getSourceRange();
   return QualType();
 }
 
@@ -9021,9 +9020,9 @@ static void SuggestParentheses(Sema &Self, SourceLocation Loc,
   SourceLocation EndLoc = Self.getLocForEndOfToken(ParenRange.getEnd());
   if (ParenRange.getBegin().isFileID() && ParenRange.getEnd().isFileID() &&
       EndLoc.isValid()) {
-    Self.Diag(Loc, Note)
-      << FixItHint::CreateInsertion(ParenRange.getBegin(), "(")
-      << FixItHint::CreateInsertion(EndLoc, ")");
+    Self.Diag(Loc, Note) << FixItHint::CreateInsertion(ParenRange.getBegin(),
+                                                       "(")
+                         << FixItHint::CreateInsertion(EndLoc, ")");
   } else {
     // We can't display the parentheses, so just show the bare note.
     Self.Diag(Loc, Note) << ParenRange;
@@ -9072,8 +9071,8 @@ static bool IsArithmeticBinaryExpr(const Expr *E, BinaryOperatorKind *Opcode,
     // Make sure this is really a binary operator that is safe to pass into
     // BinaryOperator::getOverloadedOpcode(), e.g. it's not a subscript op.
     OverloadedOperatorKind OO = Call->getOperator();
-    if (OO < OO_Plus || OO > OO_Arrow ||
-        OO == OO_PlusPlus || OO == OO_MinusMinus)
+    if (OO < OO_Plus || OO > OO_Arrow || OO == OO_PlusPlus ||
+        OO == OO_MinusMinus)
       return false;
 
     BinaryOperatorKind OpKind = BinaryOperator::getOverloadedOpcode(OO);
@@ -9129,9 +9128,8 @@ static void DiagnoseConditionalPrecedence(Sema &Self, SourceLocation OpLoc,
                         ? diag::warn_precedence_bitwise_conditional
                         : diag::warn_precedence_conditional;
 
-  Self.Diag(OpLoc, DiagID)
-      << Condition->getSourceRange()
-      << BinaryOperator::getOpcodeStr(CondOpcode);
+  Self.Diag(OpLoc, DiagID) << Condition->getSourceRange()
+                           << BinaryOperator::getOpcodeStr(CondOpcode);
 
   SuggestParentheses(
       Self, OpLoc,
@@ -9171,7 +9169,7 @@ static QualType computeConditionalNullability(QualType ResTy, bool IsBin,
       MergedKind = NullabilityKind::NonNull;
     else
       MergedKind = RHSKind;
-  // Compute nullability of a normal conditional expression.
+    // Compute nullability of a normal conditional expression.
   } else {
     if (LHSKind == NullabilityKind::Nullable ||
         RHSKind == NullabilityKind::Nullable)
@@ -9197,9 +9195,8 @@ static QualType computeConditionalNullability(QualType ResTy, bool IsBin,
 }
 
 ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc,
-                                    SourceLocation ColonLoc,
-                                    Expr *CondExpr, Expr *LHSExpr,
-                                    Expr *RHSExpr) {
+                                    SourceLocation ColonLoc, Expr *CondExpr,
+                                    Expr *LHSExpr, Expr *RHSExpr) {
   // If this is the gnu "x ?: y" extension, analyze the types as though the LHS
   // was the condition.
   OpaqueValueExpr *opaqueValue = nullptr;
@@ -9211,18 +9208,17 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc,
     // as Objective-C++'s dictionary subscripting syntax.
     if (commonExpr->hasPlaceholderType()) {
       ExprResult result = CheckPlaceholderExpr(commonExpr);
-      if (!result.isUsable()) return ExprError();
+      if (!result.isUsable())
+        return ExprError();
       commonExpr = result.get();
     }
     // We usually want to apply unary conversions *before* saving, except
     // in the special case of a C++ l-value conditional.
-    if (!(getLangOpts().CPlusPlus
-          && !commonExpr->isTypeDependent()
-          && commonExpr->getValueKind() == RHSExpr->getValueKind()
-          && commonExpr->isGLValue()
-          && commonExpr->isOrdinaryOrBitFieldObject()
-          && RHSExpr->isOrdinaryOrBitFieldObject()
-          && Context.hasSameType(commonExpr->getType(), RHSExpr->getType()))) {
+    if (!(getLangOpts().CPlusPlus && !commonExpr->isTypeDependent() &&
+          commonExpr->getValueKind() == RHSExpr->getValueKind() &&
+          commonExpr->isGLValue() && commonExpr->isOrdinaryOrBitFieldObject() &&
+          RHSExpr->isOrdinaryOrBitFieldObject() &&
+          Context.hasSameType(commonExpr->getType(), RHSExpr->getType()))) {
       ExprResult commonRes = UsualUnaryConversions(commonExpr);
       if (commonRes.isInvalid())
         return ExprError();
@@ -9239,11 +9235,9 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc,
       commonExpr = MatExpr.get();
     }
 
-    opaqueValue = new (Context) OpaqueValueExpr(commonExpr->getExprLoc(),
-                                                commonExpr->getType(),
-                                                commonExpr->getValueKind(),
-                                                commonExpr->getObjectKind(),
-                                                commonExpr);
+    opaqueValue = new (Context) OpaqueValueExpr(
+        commonExpr->getExprLoc(), commonExpr->getType(),
+        commonExpr->getValueKind(), commonExpr->getObjectKind(), commonExpr);
     LHSExpr = CondExpr = opaqueValue;
   }
 
@@ -9251,10 +9245,9 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc,
   ExprValueKind VK = VK_PRValue;
   ExprObjectKind OK = OK_Ordinary;
   ExprResult Cond = CondExpr, LHS = LHSExpr, RHS = RHSExpr;
-  QualType result = CheckConditionalOperands(Cond, LHS, RHS,
-                                             VK, OK, QuestionLoc);
-  if (result.isNull() || Cond.isInvalid() || LHS.isInvalid() ||
-      RHS.isInvalid())
+  QualType result =
+      CheckConditionalOperands(Cond, LHS, RHS, VK, OK, QuestionLoc);
+  if (result.isNull() || Cond.isInvalid() || LHS.isInvalid() || RHS.isInvalid())
     return ExprError();
 
   DiagnoseConditionalPrecedence(*this, QuestionLoc, Cond.get(), LHS.get(),
@@ -9262,8 +9255,8 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc,
 
   CheckBoolLikeConversion(Cond.get(), QuestionLoc);
 
-  result = computeConditionalNullability(result, commonExpr, LHSTy, RHSTy,
-                                         Context);
+  result =
+      computeConditionalNullability(result, commonExpr, LHSTy, RHSTy, Context);
 
   if (!commonExpr)
     return new (Context)
@@ -9437,9 +9430,9 @@ static AssignConvertType checkPointerTypesForAssignment(Sema &S,
     if (isa<PointerType>(lhptee) && isa<PointerType>(rhptee)) {
       do {
         std::tie(lhptee, lhq) =
-          cast<PointerType>(lhptee)->getPointeeType().split().asPair();
+            cast<PointerType>(lhptee)->getPointeeType().split().asPair();
         std::tie(rhptee, rhq) =
-          cast<PointerType>(rhptee)->getPointeeType().split().asPair();
+            cast<PointerType>(rhptee)->getPointeeType().split().asPair();
 
         // Inconsistent address spaces at this point is invalid, even if the
         // address spaces would be compatible.
@@ -10045,8 +10038,8 @@ static void ConstructTransparentUnion(Sema &S, ASTContext &C,
   // Build an initializer list that designates the appropriate member
   // of the transparent union.
   Expr *E = EResult.get();
-  InitListExpr *Initializer = new (C) InitListExpr(C, SourceLocation(),
-                                                   E, SourceLocation());
+  InitListExpr *Initializer =
+      new (C) InitListExpr(C, SourceLocation(), E, SourceLocation());
   Initializer->setType(UnionType);
   Initializer->setInitializedFieldInUnion(Field);
 
@@ -10089,8 +10082,7 @@ Sema::CheckTransparentUnionArgumentConstraints(QualType ArgType,
 
       if (RHS.get()->isNullPointerConstant(Context,
                                            Expr::NPC_ValueDependentIsNull)) {
-        RHS = ImpCastExprToType(RHS.get(), it->getType(),
-                                CK_NullToPointer);
+        RHS = ImpCastExprToType(RHS.get(), it->getType(), CK_NullToPointer);
         InitField = it;
         break;
       }
@@ -10148,13 +10140,12 @@ AssignConvertType Sema::CheckSingleAssignmentConstraints(QualType LHSType,
         RHS = PerformImplicitConversion(RHS.get(), LHSType.getUnqualifiedType(),
                                         AssignmentAction::Assigning);
       } else {
-        ImplicitConversionSequence ICS =
-            TryImplicitConversion(RHS.get(), LHSType.getUnqualifiedType(),
-                                  /*SuppressUserConversions=*/false,
-                                  AllowedExplicit::None,
-                                  /*InOverloadResolution=*/false,
-                                  /*CStyle=*/false,
-                                  /*AllowObjCWritebackConversion=*/false);
+        ImplicitConversionSequence ICS = TryImplicitConversion(
+            RHS.get(), LHSType.getUnqualifiedType(),
+            /*SuppressUserConversions=*/false, AllowedExplicit::None,
+            /*InOverloadResolution=*/false,
+            /*CStyle=*/false,
+            /*AllowObjCWritebackConversion=*/false);
         if (ICS.isFailure())
           return AssignConvertType::Incompatible;
         RHS = PerformImplicitConversion(RHS.get(), LHSType.getUnqualifiedType(),
@@ -10356,27 +10347,27 @@ struct OriginalOperand {
   Expr *Orig;
   NamedDecl *Conversion;
 };
-}
+} // namespace
 
 QualType Sema::InvalidOperands(SourceLocation Loc, ExprResult &LHS,
                                ExprResult &RHS) {
   OriginalOperand OrigLHS(LHS.get()), OrigRHS(RHS.get());
 
   Diag(Loc, diag::err_typecheck_invalid_operands)
-    << OrigLHS.getType() << OrigRHS.getType()
-    << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
+      << OrigLHS.getType() << OrigRHS.getType() << LHS.get()->getSourceRange()
+      << RHS.get()->getSourceRange();
 
   // If a user-defined conversion was applied to either of the operands prior
   // to applying the built-in operator rules, tell the user about it.
   if (OrigLHS.Conversion) {
     Diag(OrigLHS.Conversion->getLocation(),
          diag::note_typecheck_invalid_operands_converted)
-      << 0 << LHS.get()->getType();
+        << 0 << LHS.get()->getType();
   }
   if (OrigRHS.Conversion) {
     Diag(OrigRHS.Conversion->getLocation(),
          diag::note_typecheck_invalid_operands_converted)
-      << 1 << RHS.get()->getType();
+        << 1 << RHS.get()->getType();
   }
 
   return QualType();
@@ -10419,10 +10410,8 @@ QualType Sema::InvalidLogicalVectorOperands(SourceLocation Loc, ExprResult &LHS,
 /// \param scalar - if non-null, actually perform the conversions
 /// \return true if the operation fails (but without diagnosing the failure)
 static bool tryVectorConvertAndSplat(Sema &S, ExprResult *scalar,
-                                     QualType scalarTy,
-                                     QualType vectorEltTy,
-                                     QualType vectorTy,
-                                     unsigned &DiagID) {
+                                     QualType scalarTy, QualType vectorEltTy,
+                                     QualType vectorTy, unsigned &DiagID) {
   // The conversion to apply to the scalar before splatting it,
   // if necessary.
   CastKind scalarCast = CK_NoOp;
@@ -10430,9 +10419,10 @@ static bool tryVectorConvertAndSplat(Sema &S, ExprResult *scalar,
   if (vectorEltTy->isBooleanType() && scalarTy->isIntegralType(S.Context)) {
     scalarCast = CK_IntegralToBoolean;
   } else if (vectorEltTy->isIntegralType(S.Context)) {
-    if (S.getLangOpts().OpenCL && (scalarTy->isRealFloatingType() ||
-        (scalarTy->isIntegerType() &&
-         S.Context.getIntegerTypeOrder(vectorEltTy, scalarTy) < 0))) {
+    if (S.getLangOpts().OpenCL &&
+        (scalarTy->isRealFloatingType() ||
+         (scalarTy->isIntegerType() &&
+          S.Context.getIntegerTypeOrder(vectorEltTy, scalarTy) < 0))) {
       DiagID = diag::err_opencl_scalar_type_rank_greater_than_vector_type;
       return true;
     }
@@ -10447,8 +10437,7 @@ static bool tryVectorConvertAndSplat(Sema &S, ExprResult *scalar,
         return true;
       }
       scalarCast = CK_FloatingCast;
-    }
-    else if (scalarTy->isIntegralType(S.Context))
+    } else if (scalarTy->isIntegralType(S.Context))
       scalarCast = CK_IntegralToFloating;
     else
       return true;
@@ -10878,11 +10867,11 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS,
     if (!IsCompAssign) {
       *OtherExpr = ImpCastExprToType(OtherExpr->get(), VecType, CK_BitCast);
       return VecType;
-    // In a compound assignment, lhs += rhs, 'lhs' is a lvalue src, forbidding
-    // any implicit cast. Here, the 'rhs' should be implicit casted to 'lhs'
-    // type. Note that this is already done by non-compound assignments in
-    // CheckAssignmentConstraints. If it's a scalar type, only bitcast for
-    // <1 x T> -> T. The result is also a vector type.
+      // In a compound assignment, lhs += rhs, 'lhs' is a lvalue src, forbidding
+      // any implicit cast. Here, the 'rhs' should be implicit casted to 'lhs'
+      // type. Note that this is already done by non-compound assignments in
+      // CheckAssignmentConstraints. If it's a scalar type, only bitcast for
+      // <1 x T> -> T. The result is also a vector type.
     } else if (OtherType->isExtVectorType() || OtherType->isVectorType() ||
                (OtherType->isScalarType() && VT->getNumElements() == 1)) {
       ExprResult *RHSExpr = &RHS;
@@ -10897,8 +10886,8 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS,
   if ((!RHSVecType && !RHSType->isRealType()) ||
       (!LHSVecType && !LHSType->isRealType())) {
     Diag(Loc, diag::err_typecheck_vector_not_convertable_non_scalar)
-      << LHSType << RHSType
-      << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
+        << LHSType << RHSType << LHS.get()->getSourceRange()
+        << RHS.get()->getSourceRange();
     return QualType();
   }
 
@@ -10906,15 +10895,13 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS,
   // If the operands are of more than one vector type, then an error shall
   // occur. Implicit conversions between vector types are not permitted, per
   // section 6.2.1.
-  if (getLangOpts().OpenCL &&
-      RHSVecType && isa<ExtVectorType>(RHSVecType) &&
+  if (getLangOpts().OpenCL && RHSVecType && isa<ExtVectorType>(RHSVecType) &&
       LHSVecType && isa<ExtVectorType>(LHSVecType)) {
-    Diag(Loc, diag::err_opencl_implicit_vector_conversion) << LHSType
-                                                           << RHSType;
+    Diag(Loc, diag::err_opencl_implicit_vector_conversion)
+        << LHSType << RHSType;
     return QualType();
   }
 
-
   // If there is a vector type that is not a ExtVector and a scalar, we reach
   // this point if scalar could not be converted to the vector's element type
   // without truncation.
@@ -10923,17 +10910,15 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS,
     QualType Scalar = LHSVecType ? RHSType : LHSType;
     QualType Vector = LHSVecType ? LHSType : RHSType;
     unsigned ScalarOrVector = LHSVecType && RHSVecType ? 1 : 0;
-    Diag(Loc,
-         diag::err_typecheck_vector_not_convertable_implict_truncation)
+    Diag(Loc, diag::err_typecheck_vector_not_convertable_implict_truncation)
         << ScalarOrVector << Scalar << Vector;
 
     return QualType();
   }
 
   // Otherwise, use the generic diagnostic.
-  Diag(Loc, DiagID)
-    << LHSType << RHSType
-    << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
+  Diag(Loc, DiagID) << LHSType << RHSType << LHS.get()->getSourceRange()
+                    << RHS.get()->getSourceRange();
   return QualType();
 }
 
@@ -11047,8 +11032,8 @@ static void checkArithmeticNull(Sema &S, ExprResult &LHS, ExprResult &RHS,
     return;
 
   S.Diag(Loc, diag::warn_null_in_comparison_operation)
-      << LHSNull /* LHS is NULL */ << NonNullType
-      << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
+      << LHSNull /* LHS is NULL */ << NonNullType << LHS.get()->getSourceRange()
+      << RHS.get()->getSourceRange();
 }
 
 static void DetectPrecisionLossInComplexDivision(Sema &S, QualType DivisorTy,
@@ -11091,7 +11076,7 @@ static void DetectPrecisionLossInComplexDivision(Sema &S, QualType DivisorTy,
 }
 
 static void DiagnoseDivisionSizeofPointerOrArray(Sema &S, Expr *LHS, Expr *RHS,
-                                          SourceLocation Loc) {
+                                                 SourceLocation Loc) {
   const auto *LUE = dyn_cast<UnaryExprOrTypeTraitExpr>(LHS);
   const auto *RUE = dyn_cast<UnaryExprOrTypeTraitExpr>(RHS);
   if (!LUE || !RUE)
@@ -11138,7 +11123,7 @@ static void DiagnoseDivisionSizeofPointerOrArray(Sema &S, Expr *LHS, Expr *RHS,
   }
 }
 
-static void DiagnoseBadDivideOrRemainderValues(Sema& S, ExprResult &LHS,
+static void DiagnoseBadDivideOrRemainderValues(Sema &S, ExprResult &LHS,
                                                ExprResult &RHS,
                                                SourceLocation Loc, bool IsDiv) {
   // Check for division/remainder by zero.
@@ -11148,7 +11133,7 @@ static void DiagnoseBadDivideOrRemainderValues(Sema& S, ExprResult &LHS,
       RHSValue.Val.getInt() == 0)
     S.DiagRuntimeBehavior(Loc, RHS.get(),
                           S.PDiag(diag::warn_remainder_division_by_zero)
-                            << IsDiv << RHS.get()->getSourceRange());
+                              << IsDiv << RHS.get()->getSourceRange());
 }
 
 static void diagnoseScopedEnums(Sema &S, const SourceLocation Loc,
@@ -11235,8 +11220,8 @@ QualType Sema::CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS,
   return compType;
 }
 
-QualType Sema::CheckRemainderOperands(
-  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign) {
+QualType Sema::CheckRemainderOperands(ExprResult &LHS, ExprResult &RHS,
+                                      SourceLocation Loc, bool IsCompAssign) {
   checkArithmeticNull(*this, LHS, RHS, Loc, /*IsCompare=*/false);
 
   // Note: This check is here to simplify the double exclusions of
@@ -11303,19 +11288,19 @@ QualType Sema::CheckRemainderOperands(
 static void diagnoseArithmeticOnTwoVoidPointers(Sema &S, SourceLocation Loc,
                                                 Expr *LHSExpr, Expr *RHSExpr) {
   S.Diag(Loc, S.getLangOpts().CPlusPlus
-                ? diag::err_typecheck_pointer_arith_void_type
-                : diag::ext_gnu_void_ptr)
-    << 1 /* two pointers */ << LHSExpr->getSourceRange()
-                            << RHSExpr->getSourceRange();
+                  ? diag::err_typecheck_pointer_arith_void_type
+                  : diag::ext_gnu_void_ptr)
+      << 1 /* two pointers */ << LHSExpr->getSourceRange()
+      << RHSExpr->getSourceRange();
 }
 
 /// Diagnose invalid arithmetic on a void pointer.
 static void diagnoseArithmeticOnVoidPointer(Sema &S, SourceLocation Loc,
                                             Expr *Pointer) {
   S.Diag(Loc, S.getLangOpts().CPlusPlus
-                ? diag::err_typecheck_pointer_arith_void_type
-                : diag::ext_gnu_void_ptr)
-    << 0 /* one pointer */ << Pointer->getSourceRange();
+                  ? diag::err_typecheck_pointer_arith_void_type
+                  : diag::ext_gnu_void_ptr)
+      << 0 /* one pointer */ << Pointer->getSourceRange();
 }
 
 /// Diagnose invalid arithmetic on a null pointer.
@@ -11326,11 +11311,10 @@ static void diagnoseArithmeticOnVoidPointer(Sema &S, SourceLocation Loc,
 static void diagnoseArithmeticOnNullPointer(Sema &S, SourceLocation Loc,
                                             Expr *Pointer, bool IsGNUIdiom) {
   if (IsGNUIdiom)
-    S.Diag(Loc, diag::warn_gnu_null_ptr_arith)
-      << Pointer->getSourceRange();
+    S.Diag(Loc, diag::warn_gnu_null_ptr_arith) << Pointer->getSourceRange();
   else
     S.Diag(Loc, diag::warn_pointer_arith_null_ptr)
-      << S.getLangOpts().CPlusPlus << Pointer->getSourceRange();
+        << S.getLangOpts().CPlusPlus << Pointer->getSourceRange();
 }
 
 /// Diagnose invalid subraction on a null pointer.
@@ -11357,14 +11341,15 @@ static void diagnoseArithmeticOnTwoFunctionPointers(Sema &S, SourceLocation Loc,
   assert(LHS->getType()->isAnyPointerType());
   assert(RHS->getType()->isAnyPointerType());
   S.Diag(Loc, S.getLangOpts().CPlusPlus
-                ? diag::err_typecheck_pointer_arith_function_type
-                : diag::ext_gnu_ptr_func_arith)
-    << 1 /* two pointers */ << LHS->getType()->getPointeeType()
-    // We only show the second type if it differs from the first.
-    << (unsigned)!S.Context.hasSameUnqualifiedType(LHS->getType(),
-                                                   RHS->getType())
-    << RHS->getType()->getPointeeType()
-    << LHS->getSourceRange() << RHS->getSourceRange();
+                  ? diag::err_typecheck_pointer_arith_function_type
+                  : diag::ext_gnu_ptr_func_arith)
+      << 1 /* two pointers */
+      << LHS->getType()->getPointeeType()
+      // We only show the second type if it differs from the first.
+      << (unsigned)!S.Context.hasSameUnqualifiedType(LHS->getType(),
+                                                     RHS->getType())
+      << RHS->getType()->getPointeeType() << LHS->getSourceRange()
+      << RHS->getSourceRange();
 }
 
 /// Diagnose invalid arithmetic on a function pointer.
@@ -11372,11 +11357,11 @@ static void diagnoseArithmeticOnFunctionPointer(Sema &S, SourceLocation Loc,
                                                 Expr *Pointer) {
   assert(Pointer->getType()->isAnyPointerType());
   S.Diag(Loc, S.getLangOpts().CPlusPlus
-                ? diag::err_typecheck_pointer_arith_function_type
-                : diag::ext_gnu_ptr_func_arith)
-    << 0 /* one pointer */ << Pointer->getType()->getPointeeType()
-    << 0 /* one pointer, so only one type */
-    << Pointer->getSourceRange();
+                  ? diag::err_typecheck_pointer_arith_function_type
+                  : diag::ext_gnu_ptr_func_arith)
+      << 0 /* one pointer */ << Pointer->getType()->getPointeeType()
+      << 0 /* one pointer, so only one type */
+      << Pointer->getSourceRange();
 }
 
 /// Emit error if Operand is incomplete pointer type
@@ -11410,7 +11395,8 @@ static bool checkArithmeticOpPointerOperand(Sema &S, SourceLocation Loc,
   if (const AtomicType *ResAtomicType = ResType->getAs<AtomicType>())
     ResType = ResAtomicType->getValueType();
 
-  if (!ResType->isAnyPointerType()) return true;
+  if (!ResType->isAnyPointerType())
+    return true;
 
   QualType PointeeTy = ResType->getPointeeType();
   if (PointeeTy->isVoidType()) {
@@ -11422,7 +11408,8 @@ static bool checkArithmeticOpPointerOperand(Sema &S, SourceLocation Loc,
     return !S.getLangOpts().CPlusPlus;
   }
 
-  if (checkArithmeticIncompletePointerType(S, Loc, Operand)) return false;
+  if (checkArithmeticIncompletePointerType(S, Loc, Operand))
+    return false;
 
   return true;
 }
@@ -11440,11 +11427,14 @@ static bool checkArithmeticBinOpPointerOperands(Sema &S, SourceLocation Loc,
                                                 Expr *LHSExpr, Expr *RHSExpr) {
   bool isLHSPointer = LHSExpr->getType()->isAnyPointerType();
   bool isRHSPointer = RHSExpr->getType()->isAnyPointerType();
-  if (!isLHSPointer && !isRHSPointer) return true;
+  if (!isLHSPointer && !isRHSPointer)
+    return true;
 
   QualType LHSPointeeTy, RHSPointeeTy;
-  if (isLHSPointer) LHSPointeeTy = LHSExpr->getType()->getPointeeType();
-  if (isRHSPointer) RHSPointeeTy = RHSExpr->getType()->getPointeeType();
+  if (isLHSPointer)
+    LHSPointeeTy = LHSExpr->getType()->getPointeeType();
+  if (isRHSPointer)
+    RHSPointeeTy = RHSExpr->getType()->getPointeeType();
 
   // if both are pointers check if operation is valid wrt address spaces
   if (isLHSPointer && isRHSPointer) {
@@ -11462,9 +11452,12 @@ static bool checkArithmeticBinOpPointerOperands(Sema &S, SourceLocation Loc,
   bool isLHSVoidPtr = isLHSPointer && LHSPointeeTy->isVoidType();
   bool isRHSVoidPtr = isRHSPointer && RHSPointeeTy->isVoidType();
   if (isLHSVoidPtr || isRHSVoidPtr) {
-    if (!isRHSVoidPtr) diagnoseArithmeticOnVoidPointer(S, Loc, LHSExpr);
-    else if (!isLHSVoidPtr) diagnoseArithmeticOnVoidPointer(S, Loc, RHSExpr);
-    else diagnoseArithmeticOnTwoVoidPointers(S, Loc, LHSExpr, RHSExpr);
+    if (!isRHSVoidPtr)
+      diagnoseArithmeticOnVoidPointer(S, Loc, LHSExpr);
+    else if (!isLHSVoidPtr)
+      diagnoseArithmeticOnVoidPointer(S, Loc, RHSExpr);
+    else
+      diagnoseArithmeticOnTwoVoidPointers(S, Loc, LHSExpr, RHSExpr);
 
     return !S.getLangOpts().CPlusPlus;
   }
@@ -11472,10 +11465,12 @@ static bool checkArithmeticBinOpPointerOperands(Sema &S, SourceLocation Loc,
   bool isLHSFuncPtr = isLHSPointer && LHSPointeeTy->isFunctionType();
   bool isRHSFuncPtr = isRHSPointer && RHSPointeeTy->isFunctionType();
   if (isLHSFuncPtr || isRHSFuncPtr) {
-    if (!isRHSFuncPtr) diagnoseArithmeticOnFunctionPointer(S, Loc, LHSExpr);
-    else if (!isLHSFuncPtr) diagnoseArithmeticOnFunctionPointer(S, Loc,
-                                                                RHSExpr);
-    else diagnoseArithmeticOnTwoFunctionPointers(S, Loc, LHSExpr, RHSExpr);
+    if (!isRHSFuncPtr)
+      diagnoseArithmeticOnFunctionPointer(S, Loc, LHSExpr);
+    else if (!isLHSFuncPtr)
+      diagnoseArithmeticOnFunctionPointer(S, Loc, RHSExpr);
+    else
+      diagnoseArithmeticOnTwoFunctionPointers(S, Loc, LHSExpr, RHSExpr);
 
     return !S.getLangOpts().CPlusPlus;
   }
@@ -11492,15 +11487,15 @@ static bool checkArithmeticBinOpPointerOperands(Sema &S, SourceLocation Loc,
 /// literal.
 static void diagnoseStringPlusInt(Sema &Self, SourceLocation OpLoc,
                                   Expr *LHSExpr, Expr *RHSExpr) {
-  StringLiteral* StrExpr = dyn_cast<StringLiteral>(LHSExpr->IgnoreImpCasts());
-  Expr* IndexExpr = RHSExpr;
+  StringLiteral *StrExpr = dyn_cast<StringLiteral>(LHSExpr->IgnoreImpCasts());
+  Expr *IndexExpr = RHSExpr;
   if (!StrExpr) {
     StrExpr = dyn_cast<StringLiteral>(RHSExpr->IgnoreImpCasts());
     IndexExpr = LHSExpr;
   }
 
-  bool IsStringPlusInt = StrExpr &&
-      IndexExpr->getType()->isIntegralOrUnscopedEnumerationType();
+  bool IsStringPlusInt =
+      StrExpr && IndexExpr->getType()->isIntegralOrUnscopedEnumerationType();
   if (!IsStringPlusInt || IndexExpr->isValueDependent())
     return;
 
@@ -11548,11 +11543,9 @@ static void diagnoseStringPlusChar(Sema &Self, SourceLocation OpLoc,
   SourceRange DiagRange(LHSExpr->getBeginLoc(), RHSExpr->getEndLoc());
 
   const QualType CharType = CharExpr->getType();
-  if (!CharType->isAnyCharacterType() &&
-      CharType->isIntegerType() &&
+  if (!CharType->isAnyCharacterType() && CharType->isIntegerType() &&
       llvm::isUIntN(Ctx.getCharWidth(), CharExpr->getValue())) {
-    Self.Diag(OpLoc, diag::warn_string_plus_char)
-        << DiagRange << Ctx.CharTy;
+    Self.Diag(OpLoc, diag::warn_string_plus_char) << DiagRange << Ctx.CharTy;
   } else {
     Self.Diag(OpLoc, diag::warn_string_plus_char)
         << DiagRange << CharExpr->getType();
@@ -11576,14 +11569,14 @@ static void diagnosePointerIncompatibility(Sema &S, SourceLocation Loc,
   assert(LHSExpr->getType()->isAnyPointerType());
   assert(RHSExpr->getType()->isAnyPointerType());
   S.Diag(Loc, diag::err_typecheck_sub_ptr_compatible)
-    << LHSExpr->getType() << RHSExpr->getType() << LHSExpr->getSourceRange()
-    << RHSExpr->getSourceRange();
+      << LHSExpr->getType() << RHSExpr->getType() << LHSExpr->getSourceRange()
+      << RHSExpr->getSourceRange();
 }
 
 // C99 6.5.6
 QualType Sema::CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS,
                                      SourceLocation Loc, BinaryOperatorKind Opc,
-                                     QualType* CompLHSTy) {
+                                     QualType *CompLHSTy) {
   checkArithmeticNull(*this, LHS, RHS, Loc, /*IsCompare=*/false);
 
   if (LHS.get()->getType()->isVectorType() ||
@@ -11594,7 +11587,8 @@ QualType Sema::CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS,
                             /*AllowBoolConversions*/ getLangOpts().ZVector,
                             /*AllowBooleanOperation*/ false,
                             /*ReportInvalid*/ true);
-    if (CompLHSTy) *CompLHSTy = compType;
+    if (CompLHSTy)
+      *CompLHSTy = compType;
     return compType;
   }
 
@@ -11630,7 +11624,8 @@ QualType Sema::CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS,
 
   // handle the common case first (both operands are arithmetic).
   if (!compType.isNull() && compType->isArithmeticType()) {
-    if (CompLHSTy) *CompLHSTy = compType;
+    if (CompLHSTy)
+      *CompLHSTy = compType;
     return compType;
   }
 
@@ -11665,10 +11660,9 @@ QualType Sema::CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS,
           Context, Expr::NPC_ValueDependentIsNotNull)) {
     // In C++ adding zero to a null pointer is defined.
     Expr::EvalResult KnownVal;
-    if (!getLangOpts().CPlusPlus ||
-        (!IExp->isValueDependent() &&
-         (!IExp->EvaluateAsInt(KnownVal, Context) ||
-          KnownVal.Val.getInt() != 0))) {
+    if (!getLangOpts().CPlusPlus || (!IExp->isValueDependent() &&
+                                     (!IExp->EvaluateAsInt(KnownVal, Context) ||
+                                      KnownVal.Val.getInt() != 0))) {
       // Check the conditions to see if this is the 'p = nullptr + n' idiom.
       bool IsGNUIdiom = BinaryOperator::isNullPointerArithmeticExtension(
           Context, BO_Add, PExp, IExp);
@@ -11721,7 +11715,8 @@ QualType Sema::CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS,
                             /*AllowBoolConversions*/ getLangOpts().ZVector,
                             /*AllowBooleanOperation*/ false,
                             /*ReportInvalid*/ true);
-    if (CompLHSTy) *CompLHSTy = compType;
+    if (CompLHSTy)
+      *CompLHSTy = compType;
     return compType;
   }
 
@@ -11753,7 +11748,8 @@ QualType Sema::CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS,
 
   // Handle the common case first (both operands are arithmetic).
   if (!compType.isNull() && compType->isArithmeticType()) {
-    if (CompLHSTy) *CompLHSTy = compType;
+    if (CompLHSTy)
+      *CompLHSTy = compType;
     return compType;
   }
 
@@ -11780,8 +11776,8 @@ QualType Sema::CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS,
       // Subtracting from a null pointer should produce a warning.
       // The last argument to the diagnose call says this doesn't match the
       // GNU int-to-pointer idiom.
-      if (LHS.get()->IgnoreParenCasts()->isNullPointerConstant(Context,
-                                           Expr::NPC_ValueDependentIsNotNull)) {
+      if (LHS.get()->IgnoreParenCasts()->isNullPointerConstant(
+              Context, Expr::NPC_ValueDependentIsNotNull)) {
         // In C++ adding zero to a null pointer is defined.
         Expr::EvalResult KnownVal;
         if (!getLangOpts().CPlusPlus ||
@@ -11796,16 +11792,17 @@ QualType Sema::CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS,
         return QualType();
 
       // Check array bounds for pointer arithemtic
-      CheckArrayAccess(LHS.get(), RHS.get(), /*ArraySubscriptExpr*/nullptr,
-                       /*AllowOnePastEnd*/true, /*IndexNegated*/true);
+      CheckArrayAccess(LHS.get(), RHS.get(), /*ArraySubscriptExpr*/ nullptr,
+                       /*AllowOnePastEnd*/ true, /*IndexNegated*/ true);
 
-      if (CompLHSTy) *CompLHSTy = LHS.get()->getType();
+      if (CompLHSTy)
+        *CompLHSTy = LHS.get()->getType();
       return LHS.get()->getType();
     }
 
     // Handle pointer-pointer subtractions.
-    if (const PointerType *RHSPTy
-          = RHS.get()->getType()->getAs<PointerType>()) {
+    if (const PointerType *RHSPTy =
+            RHS.get()->getType()->getAs<PointerType>()) {
       QualType rpointee = RHSPTy->getPointeeType();
 
       if (getLangOpts().CPlusPlus) {
@@ -11823,8 +11820,8 @@ QualType Sema::CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS,
         }
       }
 
-      if (!checkArithmeticBinOpPointerOperands(*this, Loc,
-                                               LHS.get(), RHS.get()))
+      if (!checkArithmeticBinOpPointerOperands(*this, Loc, LHS.get(),
+                                               RHS.get()))
         return QualType();
 
       bool LHSIsNullPtr = LHS.get()->IgnoreParenCasts()->isNullPointerConstant(
@@ -11844,13 +11841,14 @@ QualType Sema::CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS,
       if (!rpointee->isVoidType() && !rpointee->isFunctionType()) {
         CharUnits ElementSize = Context.getTypeSizeInChars(rpointee);
         if (ElementSize.isZero()) {
-          Diag(Loc,diag::warn_sub_ptr_zero_size_types)
-            << rpointee.getUnqualifiedType()
-            << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
+          Diag(Loc, diag::warn_sub_ptr_zero_size_types)
+              << rpointee.getUnqualifiedType() << LHS.get()->getSourceRange()
+              << RHS.get()->getSourceRange();
         }
       }
 
-      if (CompLHSTy) *CompLHSTy = LHS.get()->getType();
+      if (CompLHSTy)
+        *CompLHSTy = LHS.get()->getType();
       return Context.getPointerDiffType();
     }
   }
@@ -11866,11 +11864,12 @@ static bool isScopedEnumerationType(QualType T) {
   return false;
 }
 
-static void DiagnoseBadShiftValues(Sema& S, ExprResult &LHS, ExprResult &RHS,
+static void DiagnoseBadShiftValues(Sema &S, ExprResult &LHS, ExprResult &RHS,
                                    SourceLocation Loc, BinaryOperatorKind Opc,
                                    QualType LHSType) {
-  // OpenCL 6.3j: shift values are effectively % word size of LHS (more defined),
-  // so skip remaining warnings as we don't want to modify values within Sema.
+  // OpenCL 6.3j: shift values are effectively % word size of LHS (more
+  // defined), so skip remaining warnings as we don't want to modify values
+  // within Sema.
   if (S.getLangOpts().OpenCL)
     return;
 
@@ -11958,8 +11957,8 @@ static void DiagnoseBadShiftValues(Sema& S, ExprResult &LHS, ExprResult &RHS,
   // turned off separately if needed.
   if (ResultBits - 1 == LeftSize) {
     S.Diag(Loc, diag::warn_shift_result_sets_sign_bit)
-        << HexResult << LHSType
-        << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
+        << HexResult << LHSType << LHS.get()->getSourceRange()
+        << RHS.get()->getSourceRange();
     return;
   }
 
@@ -11977,18 +11976,20 @@ static QualType checkVectorShift(Sema &S, ExprResult &LHS, ExprResult &RHS,
   if ((S.LangOpts.OpenCL || S.LangOpts.ZVector) &&
       !LHS.get()->getType()->isVectorType()) {
     S.Diag(Loc, diag::err_shift_rhs_only_vector)
-      << RHS.get()->getType() << LHS.get()->getType()
-      << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
+        << RHS.get()->getType() << LHS.get()->getType()
+        << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
     return QualType();
   }
 
   if (!IsCompAssign) {
     LHS = S.UsualUnaryConversions(LHS.get());
-    if (LHS.isInvalid()) return QualType();
+    if (LHS.isInvalid())
+      return QualType();
   }
 
   RHS = S.UsualUnaryConversions(RHS.get());
-  if (RHS.isInvalid()) return QualType();
+  if (RHS.isInvalid())
+    return QualType();
 
   QualType LHSType = LHS.get()->getType();
   // Note that LHS might be a scalar because the routine calls not only in
@@ -12013,13 +12014,13 @@ static QualType checkVectorShift(Sema &S, ExprResult &LHS, ExprResult &RHS,
   // The operands need to be integers.
   if (!LHSEleType->isIntegerType()) {
     S.Diag(Loc, diag::err_typecheck_expect_int)
-      << LHS.get()->getType() << LHS.get()->getSourceRange();
+        << LHS.get()->getType() << LHS.get()->getSourceRange();
     return QualType();
   }
 
   if (!RHSEleType->isIntegerType()) {
     S.Diag(Loc, diag::err_typecheck_expect_int)
-      << RHS.get()->getType() << RHS.get()->getSourceRange();
+        << RHS.get()->getType() << RHS.get()->getSourceRange();
     return QualType();
   }
 
@@ -12028,7 +12029,7 @@ static QualType checkVectorShift(Sema &S, ExprResult &LHS, ExprResult &RHS,
     if (IsCompAssign)
       return RHSType;
     if (LHSEleType != RHSEleType) {
-      LHS = S.ImpCastExprToType(LHS.get(),RHSEleType, CK_IntegralCast);
+      LHS = S.ImpCastExprToType(LHS.get(), RHSEleType, CK_IntegralCast);
       LHSEleType = RHSEleType;
     }
     QualType VecTy =
@@ -12041,8 +12042,8 @@ static QualType checkVectorShift(Sema &S, ExprResult &LHS, ExprResult &RHS,
     // that the number of elements is the same as LHS...
     if (RHSVecTy->getNumElements() != LHSVecTy->getNumElements()) {
       S.Diag(Loc, diag::err_typecheck_vector_lengths_not_equal)
-        << LHS.get()->getType() << RHS.get()->getType()
-        << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
+          << LHS.get()->getType() << RHS.get()->getType()
+          << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
       return QualType();
     }
     if (!S.LangOpts.OpenCL && !S.LangOpts.ZVector) {
@@ -12058,7 +12059,7 @@ static QualType checkVectorShift(Sema &S, ExprResult &LHS, ExprResult &RHS,
   } else {
     // ...else expand RHS to match the number of elements in LHS.
     QualType VecTy =
-      S.Context.getExtVectorType(RHSEleType, LHSVecTy->getNumElements());
+        S.Context.getExtVectorType(RHSEleType, LHSVecTy->getNumElements());
     RHS = S.ImpCastExprToType(RHS.get(), VecTy, CK_VectorSplat);
   }
 
@@ -12193,7 +12194,8 @@ QualType Sema::CheckShiftOperands(ExprResult &LHS, ExprResult &RHS,
   if (LHS.isInvalid())
     return QualType();
   QualType LHSType = LHS.get()->getType();
-  if (IsCompAssign) LHS = OldLHS;
+  if (IsCompAssign)
+    LHS = OldLHS;
 
   // The RHS is simpler.
   RHS = UsualUnaryConversions(RHS.get());
@@ -12223,8 +12225,8 @@ static void diagnoseDistinctPointerComparison(Sema &S, SourceLocation Loc,
                                               bool IsError) {
   S.Diag(Loc, IsError ? diag::err_typecheck_comparison_of_distinct_pointers
                       : diag::ext_typecheck_comparison_of_distinct_pointers)
-    << LHS.get()->getType() << RHS.get()->getType()
-    << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
+      << LHS.get()->getType() << RHS.get()->getType()
+      << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
 }
 
 /// Returns false if the pointers are converted to a composite type,
@@ -12249,7 +12251,7 @@ static bool convertPointersToCompositeType(Sema &S, SourceLocation Loc,
   if (T.isNull()) {
     if ((LHSType->isAnyPointerType() || LHSType->isMemberPointerType()) &&
         (RHSType->isAnyPointerType() || RHSType->isMemberPointerType()))
-      diagnoseDistinctPointerComparison(S, Loc, LHS, RHS, /*isError*/true);
+      diagnoseDistinctPointerComparison(S, Loc, LHS, RHS, /*isError*/ true);
     else
       S.InvalidOperands(Loc, LHS, RHS);
     return true;
@@ -12264,8 +12266,8 @@ static void diagnoseFunctionPointerToVoidComparison(Sema &S, SourceLocation Loc,
                                                     bool IsError) {
   S.Diag(Loc, IsError ? diag::err_typecheck_comparison_of_fptr_to_void
                       : diag::ext_typecheck_comparison_of_fptr_to_void)
-    << LHS.get()->getType() << RHS.get()->getType()
-    << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
+      << LHS.get()->getType() << RHS.get()->getType()
+      << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
 }
 
 static bool isObjCObjectLiteral(ExprResult &E) {
@@ -12283,7 +12285,7 @@ static bool isObjCObjectLiteral(ExprResult &E) {
 
 static bool hasIsEqualMethod(Sema &S, const Expr *LHS, const Expr *RHS) {
   const ObjCObjectPointerType *Type =
-    LHS->getType()->getAs<ObjCObjectPointerType>();
+      LHS->getType()->getAs<ObjCObjectPointerType>();
 
   // If this is not actually an Objective-C object, bail out.
   if (!Type)
@@ -12330,7 +12332,7 @@ static bool hasIsEqualMethod(Sema &S, const Expr *LHS, const Expr *RHS) {
 
 static void diagnoseObjCLiteralComparison(Sema &S, SourceLocation Loc,
                                           ExprResult &LHS, ExprResult &RHS,
-                                          BinaryOperator::Opcode Opc){
+                                          BinaryOperator::Opcode Opc) {
   Expr *Literal;
   Expr *Other;
   if (isObjCObjectLiteral(LHS)) {
@@ -12358,22 +12360,22 @@ static void diagnoseObjCLiteralComparison(Sema &S, SourceLocation Loc,
 
   if (LiteralKind == SemaObjC::LK_String)
     S.Diag(Loc, diag::warn_objc_string_literal_comparison)
-      << Literal->getSourceRange();
+        << Literal->getSourceRange();
   else
     S.Diag(Loc, diag::warn_objc_literal_comparison)
-      << LiteralKind << Literal->getSourceRange();
+        << LiteralKind << Literal->getSourceRange();
 
   if (BinaryOperator::isEqualityOp(Opc) &&
       hasIsEqualMethod(S, LHS.get(), RHS.get())) {
     SourceLocation Start = LHS.get()->getBeginLoc();
     SourceLocation End = S.getLocForEndOfToken(RHS.get()->getEndLoc());
     CharSourceRange OpRange =
-      CharSourceRange::getCharRange(Loc, S.getLocForEndOfToken(Loc));
+        CharSourceRange::getCharRange(Loc, S.getLocForEndOfToken(Loc));
 
     S.Diag(Loc, diag::note_objc_literal_comparison_isequal)
-      << FixItHint::CreateInsertion(Start, Opc == BO_EQ ? "[" : "![")
-      << FixItHint::CreateReplacement(OpRange, " isEqual:")
-      << FixItHint::CreateInsertion(End, "]");
+        << FixItHint::CreateInsertion(Start, Opc == BO_EQ ? "[" : "![")
+        << FixItHint::CreateReplacement(OpRange, " isEqual:")
+        << FixItHint::CreateInsertion(End, "]");
   }
 }
 
@@ -12383,14 +12385,17 @@ static void diagnoseLogicalNotOnLHSofCheck(Sema &S, ExprResult &LHS,
                                            BinaryOperatorKind Opc) {
   // Check that left hand side is !something.
   UnaryOperator *UO = dyn_cast<UnaryOperator>(LHS.get()->IgnoreImpCasts());
-  if (!UO || UO->getOpcode() != UO_LNot) return;
+  if (!UO || UO->getOpcode() != UO_LNot)
+    return;
 
   // Only check if the right hand side is non-bool arithmetic type.
-  if (RHS.get()->isKnownToHaveBooleanValue()) return;
+  if (RHS.get()->isKnownToHaveBooleanValue())
+    return;
 
   // Make sure that the something in !something is not bool.
   Expr *SubExpr = UO->getSubExpr()->IgnoreImpCasts();
-  if (SubExpr->isKnownToHaveBooleanValue()) return;
+  if (SubExpr->isKnownToHaveBooleanValue())
+    return;
 
   // Emit warning.
   bool IsBitwiseOp = Opc == BO_And || Opc == BO_Or || Opc == BO_Xor;
@@ -12404,8 +12409,7 @@ static void diagnoseLogicalNotOnLHSofCheck(Sema &S, ExprResult &LHS,
   if (FirstClose.isInvalid())
     FirstOpen = SourceLocation();
   S.Diag(UO->getOperatorLoc(), diag::note_logical_not_fix)
-      << IsBitwiseOp
-      << FixItHint::CreateInsertion(FirstOpen, "(")
+      << IsBitwiseOp << FixItHint::CreateInsertion(FirstOpen, "(")
       << FixItHint::CreateInsertion(FirstClose, ")");
 
   // Second note suggests (!x) < y
@@ -12612,8 +12616,8 @@ static void diagnoseTautologicalComparison(Sema &S, SourceLocation Loc,
     LiteralStringStripped = LHSStripped;
   } else if ((isa<StringLiteral>(RHSStripped) ||
               isa<ObjCEncodeExpr>(RHSStripped)) &&
-             !LHSStripped->isNullPointerConstant(S.Context,
-                                          Expr::NPC_ValueDependentIsNull)) {
+             !LHSStripped->isNullPointerConstant(
+                 S.Context, Expr::NPC_ValueDependentIsNull)) {
     LiteralString = RHS;
     LiteralStringStripped = RHSStripped;
   }
@@ -12829,7 +12833,7 @@ void Sema::CheckPtrComparisonWithNullChar(ExprResult &E, ExprResult &NullE) {
   if (!E.get()->getType()->isAnyPointerType() &&
       E.get()->isNullPointerConstant(Context,
                                      Expr::NPC_ValueDependentIsNotNull) ==
-        Expr::NPCK_ZeroExpression) {
+          Expr::NPCK_ZeroExpression) {
     if (const auto *CL = dyn_cast<CharacterLiteral>(E.get())) {
       if (CL->getValue() == 0)
         Diag(E.get()->getExprLoc(), diag::warn_pointer_compare)
@@ -12837,14 +12841,14 @@ void Sema::CheckPtrComparisonWithNullChar(ExprResult &E, ExprResult &NullE) {
             << FixItHint::CreateReplacement(E.get()->getExprLoc(),
                                             NullValue ? "NULL" : "(void *)0");
     } else if (const auto *CE = dyn_cast<CStyleCastExpr>(E.get())) {
-        TypeSourceInfo *TI = CE->getTypeInfoAsWritten();
-        QualType T = Context.getCanonicalType(TI->getType()).getUnqualifiedType();
-        if (T == Context.CharTy)
-          Diag(E.get()->getExprLoc(), diag::warn_pointer_compare)
-              << NullValue
-              << FixItHint::CreateReplacement(E.get()->getExprLoc(),
-                                              NullValue ? "NULL" : "(void *)0");
-      }
+      TypeSourceInfo *TI = CE->getTypeInfoAsWritten();
+      QualType T = Context.getCanonicalType(TI->getType()).getUnqualifiedType();
+      if (T == Context.CharTy)
+        Diag(E.get()->getExprLoc(), diag::warn_pointer_compare)
+            << NullValue
+            << FixItHint::CreateReplacement(E.get()->getExprLoc(),
+                                            NullValue ? "NULL" : "(void *)0");
+    }
   }
 }
 
@@ -12946,8 +12950,8 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
         *CCT, Loc, ComparisonCategoryUsage::OperatorInExpression);
   };
 
-  if(LHSType->isMetaInfoType() && RHSType->isMetaInfoType()){
-    if(!BinaryOperator::isEqualityOp(Opc)) {
+  if (LHSType->isMetaInfoType() && RHSType->isMetaInfoType()) {
+    if (!BinaryOperator::isEqualityOp(Opc)) {
       return InvalidOperands(Loc, LHS, RHS);
     }
     return computeResultTy();
@@ -13028,9 +13032,9 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
     // All of the following pointer-related warnings are GCC extensions, except
     // when handling null pointer constants.
     QualType LCanPointeeTy =
-      LHSType->castAs<PointerType>()->getPointeeType().getCanonicalType();
+        LHSType->castAs<PointerType>()->getPointeeType().getCanonicalType();
     QualType RCanPointeeTy =
-      RHSType->castAs<PointerType>()->getPointeeType().getCanonicalType();
+        RHSType->castAs<PointerType>()->getPointeeType().getCanonicalType();
 
     // C99 6.5.9p2 and C99 6.5.8p2
     if (Context.typesAreCompatible(LCanPointeeTy.getUnqualifiedType(),
@@ -13049,13 +13053,15 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
     } else if (!IsRelational &&
                (LCanPointeeTy->isVoidType() || RCanPointeeTy->isVoidType())) {
       // Valid unless comparison between non-null pointer and function pointer
-      if ((LCanPointeeTy->isFunctionType() || RCanPointeeTy->isFunctionType())
-          && !LHSIsNull && !RHSIsNull)
+      if ((LCanPointeeTy->isFunctionType() ||
+           RCanPointeeTy->isFunctionType()) &&
+          !LHSIsNull && !RHSIsNull)
         diagnoseFunctionPointerToVoidComparison(*this, Loc, LHS, RHS,
-                                                /*isError*/false);
+                                                /*isError*/ false);
     } else {
       // Invalid
-      diagnoseDistinctPointerComparison(*this, Loc, LHS, RHS, /*isError*/false);
+      diagnoseDistinctPointerComparison(*this, Loc, LHS, RHS,
+                                        /*isError*/ false);
     }
     if (LCanPointeeTy != RCanPointeeTy) {
       // Treat NULL constant as a special case in OpenCL.
@@ -13070,8 +13076,8 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
       }
       LangAS AddrSpaceL = LCanPointeeTy.getAddressSpace();
       LangAS AddrSpaceR = RCanPointeeTy.getAddressSpace();
-      CastKind Kind = AddrSpaceL != AddrSpaceR ? CK_AddressSpaceConversion
-                                               : CK_BitCast;
+      CastKind Kind =
+          AddrSpaceL != AddrSpaceR ? CK_AddressSpaceConversion : CK_BitCast;
 
       const FunctionType *LFn = LCanPointeeTy->getAs<FunctionType>();
       const FunctionType *RFn = RCanPointeeTy->getAs<FunctionType>();
@@ -13088,7 +13094,6 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
     return computeResultTy();
   }
 
-
   // C++ [expr.eq]p4:
   //   Two operands of type std::nullptr_t or one operand of type
   //   std::nullptr_t and the other a null pointer constant compare
@@ -13183,34 +13188,36 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
     if (!LHSIsNull && !RHSIsNull &&
         !Context.typesAreCompatible(lpointee, rpointee)) {
       Diag(Loc, diag::err_typecheck_comparison_of_distinct_blocks)
-        << LHSType << RHSType << LHS.get()->getSourceRange()
-        << RHS.get()->getSourceRange();
+          << LHSType << RHSType << LHS.get()->getSourceRange()
+          << RHS.get()->getSourceRange();
     }
     RHS = ImpCastExprToType(RHS.get(), LHSType, CK_BitCast);
     return computeResultTy();
   }
 
   // Allow block pointers to be compared with null pointer constants.
-  if (!IsOrdered
-      && ((LHSType->isBlockPointerType() && RHSType->isPointerType())
-          || (LHSType->isPointerType() && RHSType->isBlockPointerType()))) {
+  if (!IsOrdered &&
+      ((LHSType->isBlockPointerType() && RHSType->isPointerType()) ||
+       (LHSType->isPointerType() && RHSType->isBlockPointerType()))) {
     if (!LHSIsNull && !RHSIsNull) {
-      if (!((RHSType->isPointerType() && RHSType->castAs<PointerType>()
-             ->getPointeeType()->isVoidType())
-            || (LHSType->isPointerType() && LHSType->castAs<PointerType>()
-                ->getPointeeType()->isVoidType())))
+      if (!((RHSType->isPointerType() &&
+             RHSType->castAs<PointerType>()->getPointeeType()->isVoidType()) ||
+            (LHSType->isPointerType() &&
+             LHSType->castAs<PointerType>()->getPointeeType()->isVoidType())))
         Diag(Loc, diag::err_typecheck_comparison_of_distinct_blocks)
-          << LHSType << RHSType << LHS.get()->getSourceRange()
-          << RHS.get()->getSourceRange();
+            << LHSType << RHSType << LHS.get()->getSourceRange()
+            << RHS.get()->getSourceRange();
     }
     if (LHSIsNull && !RHSIsNull)
       LHS = ImpCastExprToType(LHS.get(), RHSType,
-                              RHSType->isPointerType() ? CK_BitCast
-                                : CK_AnyPointerToBlockPointerCast);
+                              RHSType->isPointerType()
+                                  ? CK_BitCast
+                                  : CK_AnyPointerToBlockPointerCast);
     else
       RHS = ImpCastExprToType(RHS.get(), LHSType,
-                              LHSType->isPointerType() ? CK_BitCast
-                                : CK_AnyPointerToBlockPointerCast);
+                              LHSType->isPointerType()
+                                  ? CK_BitCast
+                                  : CK_AnyPointerToBlockPointerCast);
     return computeResultTy();
   }
 
@@ -13225,7 +13232,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
       if (!LPtrToVoid && !RPtrToVoid &&
           !Context.typesAreCompatible(LHSType, RHSType)) {
         diagnoseDistinctPointerComparison(*this, Loc, LHS, RHS,
-                                          /*isError*/false);
+                                          /*isError*/ false);
       }
       // FIXME: If LPtrToVoid, we should presumably convert the LHS rather than
       // the RHS, but we have test coverage for this behavior.
@@ -13235,18 +13242,17 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
         if (getLangOpts().ObjCAutoRefCount)
           ObjC().CheckObjCConversion(SourceRange(), RHSType, E,
                                      CheckedConversionKind::Implicit);
-        LHS = ImpCastExprToType(E, RHSType,
-                                RPT ? CK_BitCast :CK_CPointerToObjCPointerCast);
-      }
-      else {
+        LHS = ImpCastExprToType(
+            E, RHSType, RPT ? CK_BitCast : CK_CPointerToObjCPointerCast);
+      } else {
         Expr *E = RHS.get();
         if (getLangOpts().ObjCAutoRefCount)
           ObjC().CheckObjCConversion(SourceRange(), LHSType, E,
                                      CheckedConversionKind::Implicit,
                                      /*Diagnose=*/true,
                                      /*DiagnoseCFAudited=*/false, Opc);
-        RHS = ImpCastExprToType(E, LHSType,
-                                LPT ? CK_BitCast :CK_CPointerToObjCPointerCast);
+        RHS = ImpCastExprToType(
+            E, LHSType, LPT ? CK_BitCast : CK_CPointerToObjCPointerCast);
       }
       return computeResultTy();
     }
@@ -13254,7 +13260,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
         RHSType->isObjCObjectPointerType()) {
       if (!Context.areComparableObjCPointerTypes(LHSType, RHSType))
         diagnoseDistinctPointerComparison(*this, Loc, LHS, RHS,
-                                          /*isError*/false);
+                                          /*isError*/ false);
       if (isObjCObjectLiteral(LHS) || isObjCObjectLiteral(RHS))
         diagnoseObjCLiteralComparison(*this, Loc, LHS, RHS, Opc);
 
@@ -13290,8 +13296,9 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
       if (IsOrdered) {
         isError = getLangOpts().CPlusPlus;
         DiagID =
-          isError ? diag::err_typecheck_ordered_comparison_of_pointer_and_zero
-                  : diag::ext_typecheck_ordered_comparison_of_pointer_and_zero;
+            isError
+                ? diag::err_typecheck_ordered_comparison_of_pointer_and_zero
+                : diag::ext_typecheck_ordered_comparison_of_pointer_and_zero;
       }
     } else if (getLangOpts().CPlusPlus) {
       DiagID = diag::err_typecheck_comparison_of_pointer_integer;
@@ -13302,30 +13309,31 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
       DiagID = diag::ext_typecheck_comparison_of_pointer_integer;
 
     if (DiagID) {
-      Diag(Loc, DiagID)
-        << LHSType << RHSType << LHS.get()->getSourceRange()
-        << RHS.get()->getSourceRange();
+      Diag(Loc, DiagID) << LHSType << RHSType << LHS.get()->getSourceRange()
+                        << RHS.get()->getSourceRange();
       if (isError)
         return QualType();
     }
 
     if (LHSType->isIntegerType())
       LHS = ImpCastExprToType(LHS.get(), RHSType,
-                        LHSIsNull ? CK_NullToPointer : CK_IntegralToPointer);
+                              LHSIsNull ? CK_NullToPointer
+                                        : CK_IntegralToPointer);
     else
       RHS = ImpCastExprToType(RHS.get(), LHSType,
-                        RHSIsNull ? CK_NullToPointer : CK_IntegralToPointer);
+                              RHSIsNull ? CK_NullToPointer
+                                        : CK_IntegralToPointer);
     return computeResultTy();
   }
 
   // Handle block pointers.
-  if (!IsOrdered && RHSIsNull
-      && LHSType->isBlockPointerType() && RHSType->isIntegerType()) {
+  if (!IsOrdered && RHSIsNull && LHSType->isBlockPointerType() &&
+      RHSType->isIntegerType()) {
     RHS = ImpCastExprToType(RHS.get(), LHSType, CK_NullToPointer);
     return computeResultTy();
   }
-  if (!IsOrdered && LHSIsNull
-      && LHSType->isIntegerType() && RHSType->isBlockPointerType()) {
+  if (!IsOrdered && LHSIsNull && LHSType->isIntegerType() &&
+      RHSType->isBlockPointerType()) {
     LHS = ImpCastExprToType(LHS.get(), RHSType, CK_NullToPointer);
     return computeResultTy();
   }
@@ -13980,11 +13988,14 @@ inline QualType Sema::CheckLogicalOperands(ExprResult &LHS, ExprResult &RHS,
 
 static bool IsReadonlyMessage(Expr *E, Sema &S) {
   const MemberExpr *ME = dyn_cast<MemberExpr>(E);
-  if (!ME) return false;
-  if (!isa<FieldDecl>(ME->getMemberDecl())) return false;
+  if (!ME)
+    return false;
+  if (!isa<FieldDecl>(ME->getMemberDecl()))
+    return false;
   ObjCMessageExpr *Base = dyn_cast<ObjCMessageExpr>(
       ME->getBase()->IgnoreImplicit()->IgnoreParenImpCasts());
-  if (!Base) return false;
+  if (!Base)
+    return false;
   return Base->getMethodDecl() != nullptr;
 }
 
@@ -13998,8 +14009,10 @@ static NonConstCaptureKind isReferenceToNonConstCapture(Sema &S, Expr *E) {
 
   // Must be a reference to a declaration from an enclosing scope.
   DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E);
-  if (!DRE) return NCCK_None;
-  if (!DRE->refersToEnclosingVariableOrCapture()) return NCCK_None;
+  if (!DRE)
+    return NCCK_None;
+  if (!DRE->refersToEnclosingVariableOrCapture())
+    return NCCK_None;
 
   ValueDecl *Value = DRE->getDecl();
 
@@ -14138,8 +14151,8 @@ static void DiagnoseConstAssignment(Sema &S, const Expr *E,
     const FunctionDecl *FD = CE->getDirectCallee();
     if (FD && !IsTypeModifiable(FD->getReturnType(), IsDereference)) {
       if (!DiagnosticEmitted) {
-        S.Diag(Loc, diag::err_typecheck_assign_const) << ExprRange
-                                                      << ConstFunction << FD;
+        S.Diag(Loc, diag::err_typecheck_assign_const)
+            << ExprRange << ConstFunction << FD;
         DiagnosticEmitted = true;
       }
       S.Diag(FD->getReturnTypeSourceRange().getBegin(),
@@ -14183,11 +14196,7 @@ static void DiagnoseConstAssignment(Sema &S, const Expr *E,
   S.Diag(Loc, diag::err_typecheck_assign_const) << ExprRange << ConstUnknown;
 }
 
-enum OriginalExprKind {
-  OEK_Variable,
-  OEK_Member,
-  OEK_LValue
-};
+enum OriginalExprKind { OEK_Variable, OEK_Member, OEK_LValue };
 
 static void DiagnoseRecursiveConstFields(Sema &S, const ValueDecl *VD,
                                          const RecordType *Ty,
@@ -14210,13 +14219,12 @@ static void DiagnoseRecursiveConstFields(Sema &S, const ValueDecl *VD,
       if (FieldTy.isConstQualified()) {
         if (!DiagnosticEmitted) {
           S.Diag(Loc, diag::err_typecheck_assign_const)
-              << Range << NestedConstMember << OEK << VD
-              << IsNested << Field;
+              << Range << NestedConstMember << OEK << VD << IsNested << Field;
           DiagnosticEmitted = true;
         }
         S.Diag(Field->getLocation(), diag::note_typecheck_assign_const)
-            << NestedConstMember << IsNested << Field
-            << FieldTy << Field->getSourceRange();
+            << NestedConstMember << IsNested << Field << FieldTy
+            << Field->getSourceRange();
       }
 
       // Then we append it to the list to check next in order.
@@ -14241,14 +14249,14 @@ static void DiagnoseRecursiveConstFields(Sema &S, const Expr *E,
   bool DiagEmitted = false;
 
   if (const MemberExpr *ME = dyn_cast<MemberExpr>(E))
-    DiagnoseRecursiveConstFields(S, ME->getMemberDecl(), RTy, Loc,
-            Range, OEK_Member, DiagEmitted);
+    DiagnoseRecursiveConstFields(S, ME->getMemberDecl(), RTy, Loc, Range,
+                                 OEK_Member, DiagEmitted);
   else if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
-    DiagnoseRecursiveConstFields(S, DRE->getDecl(), RTy, Loc,
-            Range, OEK_Variable, DiagEmitted);
+    DiagnoseRecursiveConstFields(S, DRE->getDecl(), RTy, Loc, Range,
+                                 OEK_Variable, DiagEmitted);
   else
-    DiagnoseRecursiveConstFields(S, nullptr, RTy, Loc,
-            Range, OEK_LValue, DiagEmitted);
+    DiagnoseRecursiveConstFields(S, nullptr, RTy, Loc, Range, OEK_LValue,
+                                 DiagEmitted);
   if (!DiagEmitted)
     DiagnoseConstAssignment(S, E, Loc);
 }
@@ -14261,8 +14269,7 @@ static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) {
   S.CheckShadowingDeclModification(E, Loc);
 
   SourceLocation OrigLoc = Loc;
-  Expr::isModifiableLvalueResult IsLV = E->isModifiableLvalue(S.Context,
-                                                              &Loc);
+  Expr::isModifiableLvalueResult IsLV = E->isModifiableLvalue(S.Context, &Loc);
   if (IsLV == Expr::MLV_ClassTemporary && IsReadonlyMessage(E, S))
     IsLV = Expr::MLV_InvalidMessageExpression;
   if (IsLV == Expr::MLV_Valid)
@@ -14299,15 +14306,15 @@ static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) {
           ObjCMethodDecl *method = S.getCurMethodDecl();
           if (method && var == method->getSelfDecl()) {
             DiagID = method->isClassMethod()
-              ? diag::err_typecheck_arc_assign_self_class_method
-              : diag::err_typecheck_arc_assign_self;
+                         ? diag::err_typecheck_arc_assign_self_class_method
+                         : diag::err_typecheck_arc_assign_self;
 
-          //  - Objective-C externally_retained attribute.
+            //  - Objective-C externally_retained attribute.
           } else if (var->hasAttr<ObjCExternallyRetainedAttr>() ||
                      isa<ParmVarDecl>(var)) {
             DiagID = diag::err_typecheck_arc_assign_externally_retained;
 
-          //  - fast enumeration variables
+            //  - fast enumeration variables
           } else {
             DiagID = diag::err_typecheck_arr_assign_enumeration;
           }
@@ -14358,8 +14365,9 @@ static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) {
     break;
   case Expr::MLV_IncompleteType:
   case Expr::MLV_IncompleteVoidType:
-    return S.RequireCompleteType(Loc, E->getType(),
-             diag::err_typecheck_incomplete_type_not_modifiable_lvalue, E);
+    return S.RequireCompleteType(
+        Loc, E->getType(),
+        diag::err_typecheck_incomplete_type_not_modifiable_lvalue, E);
   case Expr::MLV_DuplicateVectorComponents:
     DiagID = diag::err_typecheck_duplicate_vector_components_not_mlvalue;
     break;
@@ -14387,8 +14395,7 @@ static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) {
 }
 
 static void CheckIdentityFieldAssignment(Expr *LHSExpr, Expr *RHSExpr,
-                                         SourceLocation Loc,
-                                         Sema &Sema) {
+                                         SourceLocation Loc, Sema &Sema) {
   if (Sema.inTemplateInstantiation())
     return;
   if (Sema.isUnevaluatedContext())
@@ -14442,8 +14449,8 @@ QualType Sema::CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS,
     return QualType();
 
   QualType LHSType = LHSExpr->getType();
-  QualType RHSType = CompoundType.isNull() ? RHS.get()->getType() :
-                                             CompoundType;
+  QualType RHSType =
+      CompoundType.isNull() ? RHS.get()->getType() : CompoundType;
 
   if (RHS.isUsable()) {
     // Even if this check fails don't return early to allow the best
@@ -14470,8 +14477,8 @@ QualType Sema::CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS,
   if (getLangOpts().OpenCL &&
       !getOpenCLOptions().isAvailableOption("cl_khr_fp16", getLangOpts()) &&
       LHSType->isHalfType()) {
-    Diag(Loc, diag::err_opencl_half_load_store) << 1
-        << LHSType.getUnqualifiedType();
+    Diag(Loc, diag::err_opencl_half_load_store)
+        << 1 << LHSType.getUnqualifiedType();
     return QualType();
   }
 
@@ -14517,8 +14524,8 @@ QualType Sema::CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS,
           Loc.getLocWithOffset(2) != UO->getSubExpr()->getBeginLoc() &&
           UO->getSubExpr()->getBeginLoc().isFileID()) {
         Diag(Loc, diag::warn_not_compound_assign)
-          << (UO->getOpcode() == UO_Plus ? "+" : "-")
-          << SourceRange(UO->getOperatorLoc(), UO->getOperatorLoc());
+            << (UO->getOpcode() == UO_Plus ? "+" : "-")
+            << SourceRange(UO->getOperatorLoc(), UO->getOperatorLoc());
       }
     }
 
@@ -14718,7 +14725,7 @@ static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op,
     // Increment of bool sets it to true, but is deprecated.
     S.Diag(OpLoc, S.getLangOpts().CPlusPlus17 ? diag::ext_increment_bool
                                               : diag::warn_increment_bool)
-      << Op->getSourceRange();
+        << Op->getSourceRange();
   } else if (S.getLangOpts().CPlusPlus && ResType->isEnumeralType()) {
     // Error on enum increments and decrements in C++ mode
     S.Diag(OpLoc, diag::err_increment_decrement_enum) << IsInc << ResType;
@@ -14744,9 +14751,10 @@ static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op,
         << IsInc << Op->getSourceRange();
   } else if (ResType->isPlaceholderType()) {
     ExprResult PR = S.CheckPlaceholderExpr(Op);
-    if (PR.isInvalid()) return QualType();
-    return CheckIncrementDecrementOperand(S, PR.get(), VK, OK, OpLoc,
-                                          IsInc, IsPrefix);
+    if (PR.isInvalid())
+      return QualType();
+    return CheckIncrementDecrementOperand(S, PR.get(), VK, OK, OpLoc, IsInc,
+                                          IsPrefix);
   } else if (S.getLangOpts().AltiVec && ResType->isVectorType()) {
     // OK! ( C/C++ Language Extensions for CBEA(Version 2.6) 10.3 )
   } else if (S.getLangOpts().ZVector && ResType->isVectorType() &&
@@ -14758,7 +14766,7 @@ static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op,
     // OpenCL V1.2 6.3 says dec/inc ops operate on integer vector types.
   } else {
     S.Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement)
-      << ResType << int(IsInc) << Op->getSourceRange();
+        << ResType << int(IsInc) << Op->getSourceRange();
     return QualType();
   }
   // At this point, we know we have a real, complex or pointer type.
@@ -14814,8 +14822,8 @@ static ValueDecl *getPrimaryDecl(Expr *E) {
   case Stmt::ArraySubscriptExprClass: {
     // FIXME: This code shouldn't be necessary!  We should catch the implicit
     // promotion of register arrays earlier.
-    Expr* Base = cast<ArraySubscriptExpr>(E)->getBase();
-    if (ImplicitCastExpr* ICE = dyn_cast<ImplicitCastExpr>(Base)) {
+    Expr *Base = cast<ArraySubscriptExpr>(E)->getBase();
+    if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Base)) {
       if (ICE->getSubExpr()->getType()->isArrayType())
         return getPrimaryDecl(ICE->getSubExpr());
     }
@@ -14824,7 +14832,7 @@ static ValueDecl *getPrimaryDecl(Expr *E) {
   case Stmt::UnaryOperatorClass: {
     UnaryOperator *UO = cast<UnaryOperator>(E);
 
-    switch(UO->getOpcode()) {
+    switch (UO->getOpcode()) {
     case UO_Real:
     case UO_Imag:
     case UO_Extension:
@@ -14859,8 +14867,8 @@ enum {
 /// Diagnose invalid operand for address of operations.
 ///
 /// \param Type The type of operand which cannot have its address taken.
-static void diagnoseAddressOfInvalidType(Sema &S, SourceLocation Loc,
-                                         Expr *E, unsigned Type) {
+static void diagnoseAddressOfInvalidType(Sema &S, SourceLocation Loc, Expr *E,
+                                         unsigned Type) {
   S.Diag(Loc, diag::err_typecheck_address_of) << Type << E->getSourceRange();
 }
 
@@ -14893,13 +14901,14 @@ bool Sema::CheckUseOfCXXMethodAsAddressOfOperand(SourceLocation OpLoc,
 }
 
 QualType Sema::CheckAddressOfOperand(ExprResult &OrigOp, SourceLocation OpLoc) {
-  if (const BuiltinType *PTy = OrigOp.get()->getType()->getAsPlaceholderType()){
+  if (const BuiltinType *PTy =
+          OrigOp.get()->getType()->getAsPlaceholderType()) {
     if (PTy->getKind() == BuiltinType::Overload) {
       Expr *E = OrigOp.get()->IgnoreParens();
       if (!isa<OverloadExpr>(E)) {
         assert(cast<UnaryOperator>(E)->getOpcode() == UO_AddrOf);
         Diag(OpLoc, diag::err_typecheck_invalid_lvalue_addrof_addrof_function)
-          << OrigOp.get()->getSourceRange();
+            << OrigOp.get()->getSourceRange();
         return QualType();
       }
 
@@ -14907,7 +14916,7 @@ QualType Sema::CheckAddressOfOperand(ExprResult &OrigOp, SourceLocation OpLoc) {
       if (isa<UnresolvedMemberExpr>(Ovl))
         if (!ResolveSingleFunctionTemplateSpecialization(Ovl)) {
           Diag(OpLoc, diag::err_invalid_form_pointer_member_function)
-            << OrigOp.get()->getSourceRange();
+              << OrigOp.get()->getSourceRange();
           return QualType();
         }
 
@@ -14919,12 +14928,13 @@ QualType Sema::CheckAddressOfOperand(ExprResult &OrigOp, SourceLocation OpLoc) {
 
     if (PTy->getKind() == BuiltinType::BoundMember) {
       Diag(OpLoc, diag::err_invalid_form_pointer_member_function)
-        << OrigOp.get()->getSourceRange();
+          << OrigOp.get()->getSourceRange();
       return QualType();
     }
 
     OrigOp = CheckPlaceholderExpr(OrigOp.get());
-    if (OrigOp.isInvalid()) return QualType();
+    if (OrigOp.isInvalid())
+      return QualType();
   }
 
   if (OrigOp.get()->isTypeDependent())
@@ -14941,7 +14951,7 @@ QualType Sema::CheckAddressOfOperand(ExprResult &OrigOp, SourceLocation OpLoc) {
   // depending on a vendor implementation. Thus preventing
   // taking an address of the capture to avoid invalid AS casts.
   if (LangOpts.OpenCL) {
-    auto* VarRef = dyn_cast<DeclRefExpr>(op);
+    auto *VarRef = dyn_cast<DeclRefExpr>(op);
     if (VarRef && VarRef->refersToEnclosingVariableOrCapture()) {
       Diag(op->getExprLoc(), diag::err_opencl_taking_address_capture);
       return QualType();
@@ -14950,7 +14960,7 @@ QualType Sema::CheckAddressOfOperand(ExprResult &OrigOp, SourceLocation OpLoc) {
 
   if (getLangOpts().C99) {
     // Implement C99-only parts of addressof rules.
-    if (UnaryOperator* uOp = dyn_cast<UnaryOperator>(op)) {
+    if (UnaryOperator *uOp = dyn_cast<UnaryOperator>(op)) {
       if (uOp->getOpcode() == UO_Deref)
         // Per C99 6.5.3.2, the address of a deref always returns a valid result
         // (assuming the deref expression is valid).
@@ -14988,7 +14998,7 @@ QualType Sema::CheckAddressOfOperand(ExprResult &OrigOp, SourceLocation OpLoc) {
     // If the underlying expression isn't a decl ref, give up.
     if (!isa<DeclRefExpr>(op)) {
       Diag(OpLoc, diag::err_invalid_form_pointer_member_function)
-        << OrigOp.get()->getSourceRange();
+          << OrigOp.get()->getSourceRange();
       return QualType();
     }
     DeclRefExpr *DRE = cast<DeclRefExpr>(op);
@@ -15043,7 +15053,7 @@ QualType Sema::CheckAddressOfOperand(ExprResult &OrigOp, SourceLocation OpLoc) {
         AddressOfError = AO_Property_Expansion;
       } else {
         Diag(OpLoc, diag::err_typecheck_invalid_lvalue_addrof)
-          << op->getType() << op->getSourceRange();
+            << op->getType() << op->getSourceRange();
         return QualType();
       }
     } else if (const auto *DRE = dyn_cast<DeclRefExpr>(op)) {
@@ -15066,8 +15076,7 @@ QualType Sema::CheckAddressOfOperand(ExprResult &OrigOp, SourceLocation OpLoc) {
     if (const VarDecl *vd = dyn_cast<VarDecl>(dcl)) {
       // in C++ it is not error to take address of a register
       // variable (c++03 7.1.1P3)
-      if (vd->getStorageClass() == SC_Register &&
-          !getLangOpts().CPlusPlus) {
+      if (vd->getStorageClass() == SC_Register && !getLangOpts().CPlusPlus) {
         AddressOfError = AO_Register_Variable;
       }
     } else if (isa<MSPropertyDecl>(dcl)) {
@@ -15091,7 +15100,7 @@ QualType Sema::CheckAddressOfOperand(ExprResult &OrigOp, SourceLocation OpLoc) {
           if (dcl->getType()->isReferenceType()) {
             Diag(OpLoc,
                  diag::err_cannot_form_pointer_to_member_of_reference_type)
-              << dcl->getDeclName() << dcl->getType();
+                << dcl->getDeclName() << dcl->getType();
             return QualType();
           }
 
@@ -15158,7 +15167,7 @@ static void RecordModifiableNonNullParam(Sema &S, const Expr *Exp) {
   const ParmVarDecl *Param = dyn_cast<ParmVarDecl>(D);
   if (!Param)
     return;
-  if (const FunctionDecl* FD = dyn_cast<FunctionDecl>(Param->getDeclContext()))
+  if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(Param->getDeclContext()))
     if (!FD->hasAttr<NonNullAttr>() && !Param->hasAttr<NonNullAttr>())
       return;
   if (FunctionScopeInfo *FD = S.getCurFunction())
@@ -15178,27 +15187,26 @@ static QualType CheckIndirectionOperand(Sema &S, Expr *Op, ExprValueKind &VK,
 
   if (isa<CXXReinterpretCastExpr>(Op->IgnoreParens())) {
     QualType OpOrigType = Op->IgnoreParenCasts()->getType();
-    S.CheckCompatibleReinterpretCast(OpOrigType, OpTy, /*IsDereference*/true,
+    S.CheckCompatibleReinterpretCast(OpOrigType, OpTy, /*IsDereference*/ true,
                                      Op->getSourceRange());
   }
 
-  if (const PointerType *PT = OpTy->getAs<PointerType>())
-  {
+  if (const PointerType *PT = OpTy->getAs<PointerType>()) {
     Result = PT->getPointeeType();
-  }
-  else if (const ObjCObjectPointerType *OPT =
-             OpTy->getAs<ObjCObjectPointerType>())
+  } else if (const ObjCObjectPointerType *OPT =
+                 OpTy->getAs<ObjCObjectPointerType>())
     Result = OPT->getPointeeType();
   else {
     ExprResult PR = S.CheckPlaceholderExpr(Op);
-    if (PR.isInvalid()) return QualType();
+    if (PR.isInvalid())
+      return QualType();
     if (PR.get() != Op)
       return CheckIndirectionOperand(S, PR.get(), VK, OpLoc);
   }
 
   if (Result.isNull()) {
     S.Diag(OpLoc, diag::err_typecheck_indirection_requires_pointer)
-      << OpTy << Op->getSourceRange();
+        << OpTy << Op->getSourceRange();
     return QualType();
   }
 
@@ -15228,60 +15236,150 @@ static QualType CheckIndirectionOperand(Sema &S, Expr *Op, ExprValueKind &VK,
 BinaryOperatorKind Sema::ConvertTokenKindToBinaryOpcode(tok::TokenKind Kind) {
   BinaryOperatorKind Opc;
   switch (Kind) {
-  default: llvm_unreachable("Unknown binop!");
-  case tok::periodstar:           Opc = BO_PtrMemD; break;
-  case tok::arrowstar:            Opc = BO_PtrMemI; break;
-  case tok::star:                 Opc = BO_Mul; break;
-  case tok::slash:                Opc = BO_Div; break;
-  case tok::percent:              Opc = BO_Rem; break;
-  case tok::plus:                 Opc = BO_Add; break;
-  case tok::minus:                Opc = BO_Sub; break;
-  case tok::lessless:             Opc = BO_Shl; break;
-  case tok::greatergreater:       Opc = BO_Shr; break;
-  case tok::lessequal:            Opc = BO_LE; break;
-  case tok::less:                 Opc = BO_LT; break;
-  case tok::greaterequal:         Opc = BO_GE; break;
-  case tok::greater:              Opc = BO_GT; break;
-  case tok::exclaimequal:         Opc = BO_NE; break;
-  case tok::equalequal:           Opc = BO_EQ; break;
-  case tok::spaceship:            Opc = BO_Cmp; break;
-  case tok::amp:                  Opc = BO_And; break;
-  case tok::caret:                Opc = BO_Xor; break;
-  case tok::pipe:                 Opc = BO_Or; break;
-  case tok::ampamp:               Opc = BO_LAnd; break;
-  case tok::pipepipe:             Opc = BO_LOr; break;
-  case tok::equal:                Opc = BO_Assign; break;
-  case tok::starequal:            Opc = BO_MulAssign; break;
-  case tok::slashequal:           Opc = BO_DivAssign; break;
-  case tok::percentequal:         Opc = BO_RemAssign; break;
-  case tok::plusequal:            Opc = BO_AddAssign; break;
-  case tok::minusequal:           Opc = BO_SubAssign; break;
-  case tok::lesslessequal:        Opc = BO_ShlAssign; break;
-  case tok::greatergreaterequal:  Opc = BO_ShrAssign; break;
-  case tok::ampequal:             Opc = BO_AndAssign; break;
-  case tok::caretequal:           Opc = BO_XorAssign; break;
-  case tok::pipeequal:            Opc = BO_OrAssign; break;
-  case tok::comma:                Opc = BO_Comma; break;
+  default:
+    llvm_unreachable("Unknown binop!");
+  case tok::periodstar:
+    Opc = BO_PtrMemD;
+    break;
+  case tok::arrowstar:
+    Opc = BO_PtrMemI;
+    break;
+  case tok::star:
+    Opc = BO_Mul;
+    break;
+  case tok::slash:
+    Opc = BO_Div;
+    break;
+  case tok::percent:
+    Opc = BO_Rem;
+    break;
+  case tok::plus:
+    Opc = BO_Add;
+    break;
+  case tok::minus:
+    Opc = BO_Sub;
+    break;
+  case tok::lessless:
+    Opc = BO_Shl;
+    break;
+  case tok::greatergreater:
+    Opc = BO_Shr;
+    break;
+  case tok::lessequal:
+    Opc = BO_LE;
+    break;
+  case tok::less:
+    Opc = BO_LT;
+    break;
+  case tok::greaterequal:
+    Opc = BO_GE;
+    break;
+  case tok::greater:
+    Opc = BO_GT;
+    break;
+  case tok::exclaimequal:
+    Opc = BO_NE;
+    break;
+  case tok::equalequal:
+    Opc = BO_EQ;
+    break;
+  case tok::spaceship:
+    Opc = BO_Cmp;
+    break;
+  case tok::amp:
+    Opc = BO_And;
+    break;
+  case tok::caret:
+    Opc = BO_Xor;
+    break;
+  case tok::pipe:
+    Opc = BO_Or;
+    break;
+  case tok::ampamp:
+    Opc = BO_LAnd;
+    break;
+  case tok::pipepipe:
+    Opc = BO_LOr;
+    break;
+  case tok::equal:
+    Opc = BO_Assign;
+    break;
+  case tok::starequal:
+    Opc = BO_MulAssign;
+    break;
+  case tok::slashequal:
+    Opc = BO_DivAssign;
+    break;
+  case tok::percentequal:
+    Opc = BO_RemAssign;
+    break;
+  case tok::plusequal:
+    Opc = BO_AddAssign;
+    break;
+  case tok::minusequal:
+    Opc = BO_SubAssign;
+    break;
+  case tok::lesslessequal:
+    Opc = BO_ShlAssign;
+    break;
+  case tok::greatergreaterequal:
+    Opc = BO_ShrAssign;
+    break;
+  case tok::ampequal:
+    Opc = BO_AndAssign;
+    break;
+  case tok::caretequal:
+    Opc = BO_XorAssign;
+    break;
+  case tok::pipeequal:
+    Opc = BO_OrAssign;
+    break;
+  case tok::comma:
+    Opc = BO_Comma;
+    break;
   }
   return Opc;
 }
 
-static inline UnaryOperatorKind ConvertTokenKindToUnaryOpcode(
-  tok::TokenKind Kind) {
+static inline UnaryOperatorKind
+ConvertTokenKindToUnaryOpcode(tok::TokenKind Kind) {
   UnaryOperatorKind Opc;
   switch (Kind) {
-  default: llvm_unreachable("Unknown unary op!");
-  case tok::plusplus:     Opc = UO_PreInc; break;
-  case tok::minusminus:   Opc = UO_PreDec; break;
-  case tok::amp:          Opc = UO_AddrOf; break;
-  case tok::star:         Opc = UO_Deref; break;
-  case tok::plus:         Opc = UO_Plus; break;
-  case tok::minus:        Opc = UO_Minus; break;
-  case tok::tilde:        Opc = UO_Not; break;
-  case tok::exclaim:      Opc = UO_LNot; break;
-  case tok::kw___real:    Opc = UO_Real; break;
-  case tok::kw___imag:    Opc = UO_Imag; break;
-  case tok::kw___extension__: Opc = UO_Extension; break;
+  default:
+    llvm_unreachable("Unknown unary op!");
+  case tok::plusplus:
+    Opc = UO_PreInc;
+    break;
+  case tok::minusminus:
+    Opc = UO_PreDec;
+    break;
+  case tok::amp:
+    Opc = UO_AddrOf;
+    break;
+  case tok::star:
+    Opc = UO_Deref;
+    break;
+  case tok::plus:
+    Opc = UO_Plus;
+    break;
+  case tok::minus:
+    Opc = UO_Minus;
+    break;
+  case tok::tilde:
+    Opc = UO_Not;
+    break;
+  case tok::exclaim:
+    Opc = UO_LNot;
+    break;
+  case tok::kw___real:
+    Opc = UO_Real;
+    break;
+  case tok::kw___imag:
+    Opc = UO_Imag;
+    break;
+  case tok::kw___extension__:
+    Opc = UO_Extension;
+    break;
   }
   return Opc;
 }
@@ -15334,14 +15432,13 @@ static void DiagnoseSelfAssignment(Sema &S, Expr *LHSExpr, Expr *RHSExpr,
   RHSExpr = RHSExpr->IgnoreParenImpCasts();
   const DeclRefExpr *LHSDeclRef = dyn_cast<DeclRefExpr>(LHSExpr);
   const DeclRefExpr *RHSDeclRef = dyn_cast<DeclRefExpr>(RHSExpr);
-  if (!LHSDeclRef || !RHSDeclRef ||
-      LHSDeclRef->getLocation().isMacroID() ||
+  if (!LHSDeclRef || !RHSDeclRef || LHSDeclRef->getLocation().isMacroID() ||
       RHSDeclRef->getLocation().isMacroID())
     return;
   const ValueDecl *LHSDecl =
-    cast<ValueDecl>(LHSDeclRef->getDecl()->getCanonicalDecl());
+      cast<ValueDecl>(LHSDeclRef->getDecl()->getCanonicalDecl());
   const ValueDecl *RHSDecl =
-    cast<ValueDecl>(RHSDeclRef->getDecl()->getCanonicalDecl());
+      cast<ValueDecl>(RHSDeclRef->getDecl()->getCanonicalDecl());
   if (LHSDecl != RHSDecl)
     return;
   if (LHSDecl->getType().isVolatileQualified())
@@ -15376,8 +15473,7 @@ static void checkObjCPointerIntrospection(Sema &S, ExprResult &L, ExprResult &R,
   if (LHS->IgnoreParenCasts()->getType()->isObjCObjectPointerType()) {
     ObjCPointerExpr = LHS;
     OtherExpr = RHS;
-  }
-  else if (RHS->IgnoreParenCasts()->getType()->isObjCObjectPointerType()) {
+  } else if (RHS->IgnoreParenCasts()->getType()->isObjCObjectPointerType()) {
     ObjCPointerExpr = RHS;
     OtherExpr = LHS;
   }
@@ -15400,8 +15496,7 @@ static void checkObjCPointerIntrospection(Sema &S, ExprResult &L, ExprResult &R,
         Diag = diag::warn_objc_pointer_masking_performSelector;
     }
 
-    S.Diag(OpLoc, Diag)
-      << ObjCPointerExpr->getSourceRange();
+    S.Diag(OpLoc, Diag) << ObjCPointerExpr->getSourceRange();
   }
 }
 
@@ -15488,7 +15583,7 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc,
   }
 
   ExprResult LHS = LHSExpr, RHS = RHSExpr;
-  QualType ResultTy;     // Result type of the binary operator.
+  QualType ResultTy; // Result type of the binary operator.
   // The following two variables are used for compound assignment operators
   QualType CompLHSTy;    // Type of LHS after promotions for computation
   QualType CompResultTy; // Type of computation result
@@ -15515,9 +15610,8 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc,
 
     // OpenCL special types - image, sampler, pipe, and blocks are to be used
     // only with a builtin functions and therefore should be disallowed here.
-    if (LHSTy->isImageType() || RHSTy->isImageType() ||
-        LHSTy->isSamplerT() || RHSTy->isSamplerT() ||
-        LHSTy->isPipeType() || RHSTy->isPipeType() ||
+    if (LHSTy->isImageType() || RHSTy->isImageType() || LHSTy->isSamplerT() ||
+        RHSTy->isSamplerT() || LHSTy->isPipeType() || RHSTy->isPipeType() ||
         LHSTy->isBlockPointerType() || RHSTy->isBlockPointerType()) {
       ResultTy = InvalidOperands(OpLoc, LHS, RHS);
       return ExprError();
@@ -15566,8 +15660,8 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc,
     break;
   case BO_PtrMemD:
   case BO_PtrMemI:
-    ResultTy = CheckPointerToMemberOperands(LHS, RHS, VK, OpLoc,
-                                            Opc == BO_PtrMemI);
+    ResultTy =
+        CheckPointerToMemberOperands(LHS, RHS, VK, OpLoc, Opc == BO_PtrMemI);
     break;
   case BO_Mul:
   case BO_Div:
@@ -15699,10 +15793,11 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc,
   CheckArrayAccess(LHS.get());
   CheckArrayAccess(RHS.get());
 
-  if (const ObjCIsaExpr *OISA = dyn_cast<ObjCIsaExpr>(LHS.get()->IgnoreParenCasts())) {
-    NamedDecl *ObjectSetClass = LookupSingleName(TUScope,
-                                                 &Context.Idents.get("object_setClass"),
-                                                 SourceLocation(), LookupOrdinaryName);
+  if (const ObjCIsaExpr *OISA =
+          dyn_cast<ObjCIsaExpr>(LHS.get()->IgnoreParenCasts())) {
+    NamedDecl *ObjectSetClass =
+        LookupSingleName(TUScope, &Context.Idents.get("object_setClass"),
+                         SourceLocation(), LookupOrdinaryName);
     if (ObjectSetClass && isa<ObjCIsaExpr>(LHS.get())) {
       SourceLocation RHSLocEnd = getLocForEndOfToken(RHS.get()->getEndLoc());
       Diag(LHS.get()->getExprLoc(), diag::warn_objc_isa_assign)
@@ -15711,12 +15806,10 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc,
           << FixItHint::CreateReplacement(SourceRange(OISA->getOpLoc(), OpLoc),
                                           ",")
           << FixItHint::CreateInsertion(RHSLocEnd, ")");
-    }
-    else
+    } else
       Diag(LHS.get()->getExprLoc(), diag::warn_objc_isa_assign);
-  }
-  else if (const ObjCIvarRefExpr *OIRE =
-           dyn_cast<ObjCIvarRefExpr>(LHS.get()->IgnoreParenCasts()))
+  } else if (const ObjCIvarRefExpr *OIRE =
+                 dyn_cast<ObjCIvarRefExpr>(LHS.get()->IgnoreParenCasts()))
     DiagnoseDirectIsaAccess(*this, OIRE, OpLoc, RHS.get());
 
   // Opc is not a compound assignment if CompResultTy is null.
@@ -15729,8 +15822,8 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc,
   }
 
   // Handle compound assignments.
-  if (getLangOpts().CPlusPlus && LHS.get()->getObjectKind() !=
-      OK_ObjCProperty) {
+  if (getLangOpts().CPlusPlus &&
+      LHS.get()->getObjectKind() != OK_ObjCProperty) {
     VK = VK_LValue;
     OK = LHS.get()->getObjectKind();
   }
@@ -15783,29 +15876,29 @@ static void DiagnoseBitwisePrecedence(Sema &Self, BinaryOperatorKind Opc,
           : SourceRange(LHSExpr->getBeginLoc(), RHSBO->getLHS()->getEndLoc());
 
   Self.Diag(OpLoc, diag::warn_precedence_bitwise_rel)
-    << DiagRange << BinaryOperator::getOpcodeStr(Opc) << OpStr;
+      << DiagRange << BinaryOperator::getOpcodeStr(Opc) << OpStr;
   SuggestParentheses(Self, OpLoc,
-    Self.PDiag(diag::note_precedence_silence) << OpStr,
-    (isLeftComp ? LHSExpr : RHSExpr)->getSourceRange());
+                     Self.PDiag(diag::note_precedence_silence) << OpStr,
+                     (isLeftComp ? LHSExpr : RHSExpr)->getSourceRange());
   SuggestParentheses(Self, OpLoc,
-    Self.PDiag(diag::note_precedence_bitwise_first)
-      << BinaryOperator::getOpcodeStr(Opc),
-    ParensRange);
+                     Self.PDiag(diag::note_precedence_bitwise_first)
+                         << BinaryOperator::getOpcodeStr(Opc),
+                     ParensRange);
 }
 
 /// It accepts a '&&' expr that is inside a '||' one.
 /// Emit a diagnostic together with a fixit hint that wraps the '&&' expression
 /// in parentheses.
-static void
-EmitDiagnosticForLogicalAndInLogicalOr(Sema &Self, SourceLocation OpLoc,
-                                       BinaryOperator *Bop) {
+static void EmitDiagnosticForLogicalAndInLogicalOr(Sema &Self,
+                                                   SourceLocation OpLoc,
+                                                   BinaryOperator *Bop) {
   assert(Bop->getOpcode() == BO_LAnd);
   Self.Diag(Bop->getOperatorLoc(), diag::warn_logical_and_in_logical_or)
       << Bop->getSourceRange() << OpLoc;
   SuggestParentheses(Self, Bop->getOperatorLoc(),
-    Self.PDiag(diag::note_precedence_silence)
-      << Bop->getOpcodeStr(),
-    Bop->getSourceRange());
+                     Self.PDiag(diag::note_precedence_silence)
+                         << Bop->getOpcodeStr(),
+                     Bop->getSourceRange());
 }
 
 /// Look for '&&' in the left hand of a '||' expr.
@@ -15850,12 +15943,12 @@ static void DiagnoseBitwiseOpInBitwiseOp(Sema &S, BinaryOperatorKind Opc,
   if (BinaryOperator *Bop = dyn_cast<BinaryOperator>(SubExpr)) {
     if (Bop->isBitwiseOp() && Bop->getOpcode() < Opc) {
       S.Diag(Bop->getOperatorLoc(), diag::warn_bitwise_op_in_bitwise_op)
-        << Bop->getOpcodeStr() << BinaryOperator::getOpcodeStr(Opc)
-        << Bop->getSourceRange() << OpLoc;
+          << Bop->getOpcodeStr() << BinaryOperator::getOpcodeStr(Opc)
+          << Bop->getSourceRange() << OpLoc;
       SuggestParentheses(S, Bop->getOperatorLoc(),
-        S.PDiag(diag::note_precedence_silence)
-          << Bop->getOpcodeStr(),
-        Bop->getSourceRange());
+                         S.PDiag(diag::note_precedence_silence)
+                             << Bop->getOpcodeStr(),
+                         Bop->getSourceRange());
     }
   }
 }
@@ -15868,14 +15961,14 @@ static void DiagnoseAdditionInShift(Sema &S, SourceLocation OpLoc,
       S.Diag(Bop->getOperatorLoc(), diag::warn_addition_in_bitshift)
           << Bop->getSourceRange() << OpLoc << Shift << Op;
       SuggestParentheses(S, Bop->getOperatorLoc(),
-          S.PDiag(diag::note_precedence_silence) << Op,
-          Bop->getSourceRange());
+                         S.PDiag(diag::note_precedence_silence) << Op,
+                         Bop->getSourceRange());
     }
   }
 }
 
-static void DiagnoseShiftCompare(Sema &S, SourceLocation OpLoc,
-                                 Expr *LHSExpr, Expr *RHSExpr) {
+static void DiagnoseShiftCompare(Sema &S, SourceLocation OpLoc, Expr *LHSExpr,
+                                 Expr *RHSExpr) {
   CXXOperatorCallExpr *OCE = dyn_cast<CXXOperatorCallExpr>(LHSExpr);
   if (!OCE)
     return;
@@ -15904,27 +15997,28 @@ static void DiagnoseShiftCompare(Sema &S, SourceLocation OpLoc,
 /// precedence.
 static void DiagnoseBinOpPrecedence(Sema &Self, BinaryOperatorKind Opc,
                                     SourceLocation OpLoc, Expr *LHSExpr,
-                                    Expr *RHSExpr){
+                                    Expr *RHSExpr) {
   // Diagnose "arg1 'bitwise' arg2 'eq' arg3".
   if (BinaryOperator::isBitwiseOp(Opc))
     DiagnoseBitwisePrecedence(Self, Opc, OpLoc, LHSExpr, RHSExpr);
 
   // Diagnose "arg1 & arg2 | arg3"
   if ((Opc == BO_Or || Opc == BO_Xor) &&
-      !OpLoc.isMacroID()/* Don't warn in macros. */) {
+      !OpLoc.isMacroID() /* Don't warn in macros. */) {
     DiagnoseBitwiseOpInBitwiseOp(Self, Opc, OpLoc, LHSExpr);
     DiagnoseBitwiseOpInBitwiseOp(Self, Opc, OpLoc, RHSExpr);
   }
 
   // Warn about arg1 || arg2 && arg3, as GCC 4.3+ does.
   // We don't warn for 'assert(a || b && "bad")' since this is safe.
-  if (Opc == BO_LOr && !OpLoc.isMacroID()/* Don't warn in macros. */) {
+  if (Opc == BO_LOr && !OpLoc.isMacroID() /* Don't warn in macros. */) {
     DiagnoseLogicalAndInLogicalOrLHS(Self, OpLoc, LHSExpr, RHSExpr);
     DiagnoseLogicalAndInLogicalOrRHS(Self, OpLoc, LHSExpr, RHSExpr);
   }
 
-  if ((Opc == BO_Shl && LHSExpr->getType()->isIntegralType(Self.getASTContext()))
-      || Opc == BO_Shr) {
+  if ((Opc == BO_Shl &&
+       LHSExpr->getType()->isIntegralType(Self.getASTContext())) ||
+      Opc == BO_Shr) {
     StringRef Shift = BinaryOperator::getOpcodeStr(Opc);
     DiagnoseAdditionInShift(Self, OpLoc, LHSExpr, Shift);
     DiagnoseAdditionInShift(Self, OpLoc, RHSExpr, Shift);
@@ -15937,8 +16031,7 @@ static void DiagnoseBinOpPrecedence(Sema &Self, BinaryOperatorKind Opc,
 }
 
 ExprResult Sema::ActOnBinOp(Scope *S, SourceLocation TokLoc,
-                            tok::TokenKind Kind,
-                            Expr *LHSExpr, Expr *RHSExpr) {
+                            tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr) {
   BinaryOperatorKind Opc = ConvertTokenKindToBinaryOpcode(Kind);
   assert(LHSExpr && "ActOnBinOp(): missing left expression");
   assert(RHSExpr && "ActOnBinOp(): missing right expression");
@@ -15971,8 +16064,8 @@ void Sema::LookupBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc,
 
 /// Build an overloaded binary operator expression in the given scope.
 static ExprResult BuildOverloadedBinOp(Sema &S, Scope *Sc, SourceLocation OpLoc,
-                                       BinaryOperatorKind Opc,
-                                       Expr *LHS, Expr *RHS) {
+                                       BinaryOperatorKind Opc, Expr *LHS,
+                                       Expr *RHS) {
   switch (Opc) {
   case BO_Assign:
     // In the non-overloaded case, we warn about self-assignment (x = x) for
@@ -16033,7 +16126,8 @@ ExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc,
       // that an overload set can be dependently-typed, but it never
       // instantiates to having an overloadable type.
       ExprResult resolvedRHS = CheckPlaceholderExpr(RHSExpr);
-      if (resolvedRHS.isInvalid()) return ExprError();
+      if (resolvedRHS.isInvalid())
+        return ExprError();
       RHSExpr = resolvedRHS.get();
 
       if (RHSExpr->isTypeDependent() ||
@@ -16064,7 +16158,8 @@ ExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc,
     }
 
     ExprResult LHS = CheckPlaceholderExpr(LHSExpr);
-    if (LHS.isInvalid()) return ExprError();
+    if (LHS.isInvalid())
+      return ExprError();
     LHSExpr = LHS.get();
   }
 
@@ -16088,7 +16183,8 @@ ExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc,
       return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr);
 
     ExprResult resolvedRHS = CheckPlaceholderExpr(RHSExpr);
-    if (!resolvedRHS.isUsable()) return ExprError();
+    if (!resolvedRHS.isUsable())
+      return ExprError();
     RHSExpr = resolvedRHS.get();
   }
 
@@ -16176,10 +16272,11 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc,
     QualType Ty = InputExpr->getType();
     // The only legal unary operation for atomics is '&'.
     if ((Opc != UO_AddrOf && Ty->isAtomicType()) ||
-    // OpenCL special types - image, sampler, pipe, and blocks are to be used
-    // only with a builtin functions and therefore should be disallowed here.
-        (Ty->isImageType() || Ty->isSamplerT() || Ty->isPipeType()
-        || Ty->isBlockPointerType())) {
+        // OpenCL special types - image, sampler, pipe, and blocks are to be
+        // used only with a builtin functions and therefore should be disallowed
+        // here.
+        (Ty->isImageType() || Ty->isSamplerT() || Ty->isPipeType() ||
+         Ty->isBlockPointerType())) {
       return ExprError(Diag(OpLoc, diag::err_typecheck_unary_expr)
                        << InputExpr->getType()
                        << Input.get()->getSourceRange());
@@ -16476,15 +16573,15 @@ ExprResult Sema::BuildUnaryOp(Scope *S, SourceLocation OpLoc,
 
     // & gets special logic for several kinds of placeholder.
     // The builtin code knows what to do.
-    if (Opc == UO_AddrOf &&
-        (pty->getKind() == BuiltinType::Overload ||
-         pty->getKind() == BuiltinType::UnknownAny ||
-         pty->getKind() == BuiltinType::BoundMember))
+    if (Opc == UO_AddrOf && (pty->getKind() == BuiltinType::Overload ||
+                             pty->getKind() == BuiltinType::UnknownAny ||
+                             pty->getKind() == BuiltinType::BoundMember))
       return CreateBuiltinUnaryOp(OpLoc, Opc, Input);
 
     // Anything else needs to be handled now.
     ExprResult Result = CheckPlaceholderExpr(Input);
-    if (Result.isInvalid()) return ExprError();
+    if (Result.isInvalid())
+      return ExprError();
     Input = Result.get();
   }
 
@@ -16622,32 +16719,32 @@ ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
   // a struct/union/class.
   if (!Dependent && !ArgTy->isRecordType())
     return ExprError(Diag(BuiltinLoc, diag::err_offsetof_record_type)
-                       << ArgTy << TypeRange);
+                     << ArgTy << TypeRange);
 
   // Type must be complete per C99 7.17p3 because a declaring a variable
   // with an incomplete type would be ill-formed.
-  if (!Dependent
-      && RequireCompleteType(BuiltinLoc, ArgTy,
-                             diag::err_offsetof_incomplete_type, TypeRange))
+  if (!Dependent &&
+      RequireCompleteType(BuiltinLoc, ArgTy, diag::err_offsetof_incomplete_type,
+                          TypeRange))
     return ExprError();
 
   bool DidWarnAboutNonPOD = false;
   QualType CurrentType = ArgTy;
   SmallVector<OffsetOfNode, 4> Comps;
-  SmallVector<Expr*, 4> Exprs;
+  SmallVector<Expr *, 4> Exprs;
   for (const OffsetOfComponent &OC : Components) {
     if (OC.isBrackets) {
       // Offset of an array sub-field.  TODO: Should we allow vector elements?
       if (!CurrentType->isDependentType()) {
         const ArrayType *AT = Context.getAsArrayType(CurrentType);
-        if(!AT)
+        if (!AT)
           return ExprError(Diag(OC.LocEnd, diag::err_offsetof_array_type)
                            << CurrentType);
         CurrentType = AT->getElementType();
       } else
         CurrentType = Context.DependentTy;
 
-      ExprResult IdxRval = DefaultLvalueConversion(static_cast<Expr*>(OC.U.E));
+      ExprResult IdxRval = DefaultLvalueConversion(static_cast<Expr *>(OC.U.E));
       if (IdxRval.isInvalid())
         return ExprError();
       Expr *Idx = IdxRval.get();
@@ -16694,9 +16791,10 @@ ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
     //   If type is not a standard-layout class (Clause 9), the results are
     //   undefined.
     if (CXXRecordDecl *CRD = dyn_cast<CXXRecordDecl>(RD)) {
-      bool IsSafe = LangOpts.CPlusPlus11? CRD->isStandardLayout() : CRD->isPOD();
-      unsigned DiagID =
-        LangOpts.CPlusPlus11? diag::ext_offsetof_non_standardlayout_type
+      bool IsSafe =
+          LangOpts.CPlusPlus11 ? CRD->isStandardLayout() : CRD->isPOD();
+      unsigned DiagID = LangOpts.CPlusPlus11
+                            ? diag::ext_offsetof_non_standardlayout_type
                             : diag::ext_offsetof_non_pod_type;
 
       if (!IsSafe && !DidWarnAboutNonPOD && !isUnevaluatedContext()) {
@@ -16732,8 +16830,7 @@ ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
     // We diagnose this as an error.
     if (MemberDecl->isBitField()) {
       Diag(OC.LocEnd, diag::err_offsetof_bitfield)
-        << MemberDecl->getDeclName()
-        << SourceRange(BuiltinLoc, RParenLoc);
+          << MemberDecl->getDeclName() << SourceRange(BuiltinLoc, RParenLoc);
       Diag(MemberDecl->getLocation(), diag::note_bitfield_decl);
       return ExprError();
     }
@@ -16749,8 +16846,7 @@ ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
                       Context.getCanonicalTagType(Parent), Paths)) {
       if (Paths.getDetectedVirtual()) {
         Diag(OC.LocEnd, diag::err_offsetof_field_of_virtual_base)
-          << MemberDecl->getDeclName()
-          << SourceRange(BuiltinLoc, RParenLoc);
+            << MemberDecl->getDeclName() << SourceRange(BuiltinLoc, RParenLoc);
         return ExprError();
       }
 
@@ -16762,8 +16858,8 @@ ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
     if (IndirectMemberDecl) {
       for (auto *FI : IndirectMemberDecl->chain()) {
         assert(isa<FieldDecl>(FI));
-        Comps.push_back(OffsetOfNode(OC.LocStart,
-                                     cast<FieldDecl>(FI), OC.LocEnd));
+        Comps.push_back(
+            OffsetOfNode(OC.LocStart, cast<FieldDecl>(FI), OC.LocEnd));
       }
     } else
       Comps.push_back(OffsetOfNode(OC.LocStart, MemberDecl, OC.LocEnd));
@@ -16775,8 +16871,7 @@ ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
                               Comps, Exprs, RParenLoc);
 }
 
-ExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
-                                      SourceLocation BuiltinLoc,
+ExprResult Sema::ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc,
                                       SourceLocation TypeLoc,
                                       ParsedType ParsedArgTy,
                                       ArrayRef<OffsetOfComponent> Components,
@@ -16793,9 +16888,7 @@ ExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
   return BuildBuiltinOffsetOf(BuiltinLoc, ArgTInfo, Components, RParenLoc);
 }
 
-
-ExprResult Sema::ActOnChooseExpr(SourceLocation BuiltinLoc,
-                                 Expr *CondExpr,
+ExprResult Sema::ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr,
                                  Expr *LHSExpr, Expr *RHSExpr,
                                  SourceLocation RPLoc) {
   assert((CondExpr && LHSExpr && RHSExpr) && "Missing type argument(s)");
@@ -16881,8 +16974,8 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
   // Look for an explicit signature in that function type.
   FunctionProtoTypeLoc ExplicitSignature;
 
-  if ((ExplicitSignature = Sig->getTypeLoc()
-                               .getAsAdjusted<FunctionProtoTypeLoc>())) {
+  if ((ExplicitSignature =
+           Sig->getTypeLoc().getAsAdjusted<FunctionProtoTypeLoc>())) {
 
     // Check whether that explicit signature was synthesized by
     // GetTypeForDeclarator.  If so, don't save that as part of the
@@ -16921,7 +17014,7 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
   }
 
   // Push block parameters from the declarator if we had them.
-  SmallVector<ParmVarDecl*, 8> Params;
+  SmallVector<ParmVarDecl *, 8> Params;
   if (ExplicitSignature) {
     for (unsigned I = 0, E = ExplicitSignature.getNumParams(); I != E; ++I) {
       ParmVarDecl *Param = ExplicitSignature.getParam(I);
@@ -16934,8 +17027,8 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
       Params.push_back(Param);
     }
 
-  // Fake up parameter variables if we have a typedef, like
-  //   ^ fntype { ... }
+    // Fake up parameter variables if we have a typedef, like
+    //   ^ fntype { ... }
   } else if (const FunctionProtoType *Fn = T->getAs<FunctionProtoType>()) {
     for (const auto &I : Fn->param_types()) {
       ParmVarDecl *Param = BuildParmVarDeclForTypedef(
@@ -16980,8 +17073,8 @@ void Sema::ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope) {
   PopFunctionScopeInfo();
 }
 
-ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
-                                    Stmt *Body, Scope *CurScope) {
+ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body,
+                                    Scope *CurScope) {
   // If blocks are disabled, emit an error.
   if (!LangOpts.Blocks)
     Diag(CaretLoc, diag::err_blocks_disable) << LangOpts.OpenCL;
@@ -17013,7 +17106,8 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
     const FunctionType *FTy = BSI->FunctionType->castAs<FunctionType>();
 
     FunctionType::ExtInfo Ext = FTy->getExtInfo();
-    if (NoReturn && !Ext.getNoReturn()) Ext = Ext.withNoReturn(true);
+    if (NoReturn && !Ext.getNoReturn())
+      Ext = Ext.withNoReturn(true);
 
     // Turn protoless block types into nullary block types.
     if (isa<FunctionNoProtoType>(FTy)) {
@@ -17027,7 +17121,7 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
                (!NoReturn || FTy->getNoReturnAttr())) {
       BlockTy = BSI->FunctionType;
 
-    // Otherwise, make the minimal modifications to the function type.
+      // Otherwise, make the minimal modifications to the function type.
     } else {
       const FunctionProtoType *FPT = cast<FunctionProtoType>(FTy);
       FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
@@ -17036,7 +17130,7 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
       BlockTy = Context.getFunctionType(RetTy, FPT->getParamTypes(), EPI);
     }
 
-  // If we don't have a function type, just build one from nothing.
+    // If we don't have a function type, just build one from nothing.
   } else {
     FunctionProtoType::ExtProtoInfo EPI;
     EPI.ExtInfo = FunctionType::ExtInfo().withNoReturn(NoReturn);
@@ -17047,8 +17141,7 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
   BlockTy = Context.getBlockPointerType(BlockTy);
 
   // If needed, diagnose invalid gotos and switches in the block.
-  if (getCurFunction()->NeedsScopeChecking() &&
-      !PP.isCodeCompletionEnabled())
+  if (getCurFunction()->NeedsScopeChecking() && !PP.isCodeCompletionEnabled())
     DiagnoseInvalidJumps(cast<CompoundStmt>(Body));
 
   BD->setBody(cast<CompoundStmt>(Body));
@@ -17123,9 +17216,9 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
         // Build a full-expression copy expression if initialization
         // succeeded and used a non-trivial constructor.  Recover from
         // errors by pretending that the copy isn't necessary.
-        if (!Result.isInvalid() &&
-            !cast<CXXConstructExpr>(Result.get())->getConstructor()
-                ->isTrivial()) {
+        if (!Result.isInvalid() && !cast<CXXConstructExpr>(Result.get())
+                                        ->getConstructor()
+                                        ->isTrivial()) {
           Result = MaybeCreateExprWithCleanups(Result);
           CopyExpr = Result.get();
         }
@@ -17182,9 +17275,8 @@ ExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty,
   return BuildVAArgExpr(BuiltinLoc, E, TInfo, RPLoc);
 }
 
-ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc,
-                                Expr *E, TypeSourceInfo *TInfo,
-                                SourceLocation RPLoc) {
+ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E,
+                                TypeSourceInfo *TInfo, SourceLocation RPLoc) {
   Expr *OrigExpr = E;
   bool IsMS = false;
 
@@ -17206,7 +17298,8 @@ ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc,
   // as Microsoft ABI on an actual Microsoft platform, where
   // __builtin_ms_va_list and __builtin_va_list are the same.)
   if (!E->isTypeDependent() && Context.getTargetInfo().hasBuiltinMSVaList() &&
-      Context.getTargetInfo().getBuiltinVaListKind() != TargetInfo::CharPtrBuiltinVaList) {
+      Context.getTargetInfo().getBuiltinVaListKind() !=
+          TargetInfo::CharPtrBuiltinVaList) {
     QualType MSVaListType = Context.getBuiltinMSVaListType();
     if (Context.hasSameType(MSVaListType, E->getType())) {
       if (CheckForModifiableLvalue(E, BuiltinLoc, *this))
@@ -17259,19 +17352,17 @@ ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc,
                             TInfo->getTypeLoc()))
       return ExprError();
 
-    if (RequireNonAbstractType(TInfo->getTypeLoc().getBeginLoc(),
-                               TInfo->getType(),
-                               diag::err_second_parameter_to_va_arg_abstract,
-                               TInfo->getTypeLoc()))
+    if (RequireNonAbstractType(
+            TInfo->getTypeLoc().getBeginLoc(), TInfo->getType(),
+            diag::err_second_parameter_to_va_arg_abstract, TInfo->getTypeLoc()))
       return ExprError();
 
     if (!TInfo->getType().isPODType(Context)) {
       Diag(TInfo->getTypeLoc().getBeginLoc(),
            TInfo->getType()->isObjCLifetimeType()
-             ? diag::warn_second_parameter_to_va_arg_ownership_qualified
-             : diag::warn_second_parameter_to_va_arg_not_pod)
-        << TInfo->getType()
-        << TInfo->getTypeLoc().getSourceRange();
+               ? diag::warn_second_parameter_to_va_arg_ownership_qualified
+               : diag::warn_second_parameter_to_va_arg_not_pod)
+          << TInfo->getType() << TInfo->getTypeLoc().getSourceRange();
     }
 
     if (TInfo->getType()->isArrayType()) {
@@ -17333,11 +17424,11 @@ ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc,
     if (TInfo->getType()->isSpecificBuiltinType(BuiltinType::Float))
       PromoteType = Context.DoubleTy;
     if (!PromoteType.isNull())
-      DiagRuntimeBehavior(TInfo->getTypeLoc().getBeginLoc(), E,
-                  PDiag(diag::warn_second_parameter_to_va_arg_never_compatible)
-                          << TInfo->getType()
-                          << PromoteType
-                          << TInfo->getTypeLoc().getSourceRange());
+      DiagRuntimeBehavior(
+          TInfo->getTypeLoc().getBeginLoc(), E,
+          PDiag(diag::warn_second_parameter_to_va_arg_never_compatible)
+              << TInfo->getType() << PromoteType
+              << TInfo->getTypeLoc().getSourceRange());
   }
 
   QualType T = TInfo->getType().getNonLValueExprType(Context);
@@ -17500,10 +17591,9 @@ static bool maybeDiagnoseAssignmentToFunction(Sema &S, QualType DstType,
 }
 
 bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
-                                    SourceLocation Loc,
-                                    QualType DstType, QualType SrcType,
-                                    Expr *SrcExpr, AssignmentAction Action,
-                                    bool *Complained) {
+                                    SourceLocation Loc, QualType DstType,
+                                    QualType SrcType, Expr *SrcExpr,
+                                    AssignmentAction Action, bool *Complained) {
   if (Complained)
     *Complained = false;
 
@@ -17572,7 +17662,7 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
       DiagKind = diag::ext_typecheck_convert_incompatible_pointer;
     }
     CheckInferredResultType = DstType->isObjCObjectPointerType() &&
-      SrcType->isObjCObjectPointerType();
+                              SrcType->isObjCObjectPointerType();
     if (CheckInferredResultType) {
       SrcType = SrcType.getUnqualifiedType();
       DstType = DstType.getUnqualifiedType();
@@ -17599,7 +17689,8 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
     break;
   case AssignConvertType::IncompatiblePointerDiscardsQualifiers: {
     // Perform array-to-pointer decay if necessary.
-    if (SrcType->isArrayType()) SrcType = Context.getArrayDecayedType(SrcType);
+    if (SrcType->isArrayType())
+      SrcType = Context.getArrayDecayedType(SrcType);
 
     isInvalid = true;
 
@@ -17639,10 +17730,10 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
         IsStringLiteralToNonConstPointerConversion(SrcExpr, DstType))
       return false;
     if (getLangOpts().CPlusPlus) {
-      DiagKind =  diag::err_typecheck_convert_discards_qualifiers;
+      DiagKind = diag::err_typecheck_convert_discards_qualifiers;
       isInvalid = true;
     } else {
-      DiagKind =  diag::ext_typecheck_convert_discards_qualifiers;
+      DiagKind = diag::ext_typecheck_convert_discards_qualifiers;
     }
 
     break;
@@ -17669,24 +17760,23 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
   case AssignConvertType::IncompatibleObjCQualifiedId: {
     if (SrcType->isObjCQualifiedIdType()) {
       const ObjCObjectPointerType *srcOPT =
-                SrcType->castAs<ObjCObjectPointerType>();
+          SrcType->castAs<ObjCObjectPointerType>();
       for (auto *srcProto : srcOPT->quals()) {
         PDecl = srcProto;
         break;
       }
       if (const ObjCInterfaceType *IFaceT =
-            DstType->castAs<ObjCObjectPointerType>()->getInterfaceType())
+              DstType->castAs<ObjCObjectPointerType>()->getInterfaceType())
         IFace = IFaceT->getDecl();
-    }
-    else if (DstType->isObjCQualifiedIdType()) {
+    } else if (DstType->isObjCQualifiedIdType()) {
       const ObjCObjectPointerType *dstOPT =
-        DstType->castAs<ObjCObjectPointerType>();
+          DstType->castAs<ObjCObjectPointerType>();
       for (auto *dstProto : dstOPT->quals()) {
         PDecl = dstProto;
         break;
       }
       if (const ObjCInterfaceType *IFaceT =
-            SrcType->castAs<ObjCObjectPointerType>()->getInterfaceType())
+              SrcType->castAs<ObjCObjectPointerType>()->getInterfaceType())
         IFace = IFaceT->getDecl();
     }
     if (getLangOpts().CPlusPlus) {
@@ -17790,7 +17880,9 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
       FDiag << H;
   }
 
-  if (MayHaveConvFixit) { FDiag << (unsigned) (ConvHints.Kind); }
+  if (MayHaveConvFixit) {
+    FDiag << (unsigned)(ConvHints.Kind);
+  }
 
   if (MayHaveFunctionDiff)
     HandleFunctionTypeMismatch(FDiag, SecondType, FirstType);
@@ -17803,8 +17895,8 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
         << IFace << PDecl;
 
   if (SecondType == Context.OverloadTy)
-    NoteAllOverloadCandidates(OverloadExpr::find(SrcExpr).Expression,
-                              FirstType, /*TakingAddress=*/true);
+    NoteAllOverloadCandidates(OverloadExpr::find(SrcExpr).Expression, FirstType,
+                              /*TakingAddress=*/true);
 
   if (CheckInferredResultType)
     ObjC().EmitRelatedResultTypeNote(SrcExpr);
@@ -17818,8 +17910,7 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
   return isInvalid;
 }
 
-ExprResult Sema::VerifyIntegerConstantExpression(Expr *E,
-                                                 llvm::APSInt *Result,
+ExprResult Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
                                                  AllowFoldKind CanFold) {
   class SimpleICEDiagnoser : public VerifyICEDiagnoser {
   public:
@@ -17836,8 +17927,7 @@ ExprResult Sema::VerifyIntegerConstantExpression(Expr *E,
   return VerifyIntegerConstantExpression(E, Result, Diagnoser, CanFold);
 }
 
-ExprResult Sema::VerifyIntegerConstantExpression(Expr *E,
-                                                 llvm::APSInt *Result,
+ExprResult Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
                                                  unsigned DiagID,
                                                  AllowFoldKind CanFold) {
   class IDDiagnoser : public VerifyICEDiagnoser {
@@ -17845,7 +17935,7 @@ ExprResult Sema::VerifyIntegerConstantExpression(Expr *E,
 
   public:
     IDDiagnoser(unsigned DiagID)
-      : VerifyICEDiagnoser(DiagID == 0), DiagID(DiagID) { }
+        : VerifyICEDiagnoser(DiagID == 0), DiagID(DiagID) {}
 
     SemaDiagnosticBuilder diagnoseNotICE(Sema &S, SourceLocation Loc) override {
       return S.Diag(Loc, DiagID);
@@ -17866,10 +17956,9 @@ Sema::VerifyICEDiagnoser::diagnoseFold(Sema &S, SourceLocation Loc) {
   return S.Diag(Loc, diag::ext_expr_not_ice) << S.LangOpts.CPlusPlus;
 }
 
-ExprResult
-Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
-                                      VerifyICEDiagnoser &Diagnoser,
-                                      AllowFoldKind CanFold) {
+ExprResult Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
+                                                 VerifyICEDiagnoser &Diagnoser,
+                                                 AllowFoldKind CanFold) {
   SourceLocation DiagLoc = E->getBeginLoc();
 
   if (getLangOpts().CPlusPlus11) {
@@ -17881,6 +17970,7 @@ Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
     ExprResult Converted;
     class CXX11ConvertDiagnoser : public ICEConvertDiagnoser {
       VerifyICEDiagnoser &BaseDiagnoser;
+
     public:
       CXX11ConvertDiagnoser(VerifyICEDiagnoser &BaseDiagnoser)
           : ICEConvertDiagnoser(/*AllowScopedEnumerations*/ false,
@@ -17892,41 +17982,43 @@ Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
         return BaseDiagnoser.diagnoseNotICEType(S, Loc, T);
       }
 
-      SemaDiagnosticBuilder diagnoseIncomplete(
-          Sema &S, SourceLocation Loc, QualType T) override {
+      SemaDiagnosticBuilder diagnoseIncomplete(Sema &S, SourceLocation Loc,
+                                               QualType T) override {
         return S.Diag(Loc, diag::err_ice_incomplete_type) << T;
       }
 
-      SemaDiagnosticBuilder diagnoseExplicitConv(
-          Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) override {
+      SemaDiagnosticBuilder diagnoseExplicitConv(Sema &S, SourceLocation Loc,
+                                                 QualType T,
+                                                 QualType ConvTy) override {
         return S.Diag(Loc, diag::err_ice_explicit_conversion) << T << ConvTy;
       }
 
-      SemaDiagnosticBuilder noteExplicitConv(
-          Sema &S, CXXConversionDecl *Conv, QualType ConvTy) override {
+      SemaDiagnosticBuilder noteExplicitConv(Sema &S, CXXConversionDecl *Conv,
+                                             QualType ConvTy) override {
         return S.Diag(Conv->getLocation(), diag::note_ice_conversion_here)
-                 << ConvTy->isEnumeralType() << ConvTy;
+               << ConvTy->isEnumeralType() << ConvTy;
       }
 
-      SemaDiagnosticBuilder diagnoseAmbiguous(
-          Sema &S, SourceLocation Loc, QualType T) override {
+      SemaDiagnosticBuilder diagnoseAmbiguous(Sema &S, SourceLocation Loc,
+                                              QualType T) override {
         return S.Diag(Loc, diag::err_ice_ambiguous_conversion) << T;
       }
 
-      SemaDiagnosticBuilder noteAmbiguous(
-          Sema &S, CXXConversionDecl *Conv, QualType ConvTy) override {
+      SemaDiagnosticBuilder noteAmbiguous(Sema &S, CXXConversionDecl *Conv,
+                                          QualType ConvTy) override {
         return S.Diag(Conv->getLocation(), diag::note_ice_conversion_here)
-                 << ConvTy->isEnumeralType() << ConvTy;
+               << ConvTy->isEnumeralType() << ConvTy;
       }
 
-      SemaDiagnosticBuilder diagnoseConversion(
-          Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) override {
+      SemaDiagnosticBuilder diagnoseConversion(Sema &S, SourceLocation Loc,
+                                               QualType T,
+                                               QualType ConvTy) override {
         llvm_unreachable("conversion functions are permitted");
       }
     } ConvertDiagnoser(Diagnoser);
 
-    Converted = PerformContextualImplicitConversion(DiagLoc, E,
-                                                    ConvertDiagnoser);
+    Converted =
+        PerformContextualImplicitConversion(DiagLoc, E, ConvertDiagnoser);
     if (Converted.isInvalid())
       return Converted;
     E = Converted.get();
@@ -17969,7 +18061,7 @@ Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
     // the caret at its location rather than producing an essentially
     // redundant note.
     if (Notes.size() == 1 && Notes[0].second.getDiagID() ==
-          diag::note_invalid_subexpr_in_const_expr) {
+                                 diag::note_invalid_subexpr_in_const_expr) {
       DiagLoc = Notes[0].first;
       Notes.clear();
     }
@@ -18016,8 +18108,8 @@ Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
   // If our only note is the usual "invalid subexpression" note, just point
   // the caret at its location rather than producing an essentially
   // redundant note.
-  if (Notes.size() == 1 && Notes[0].second.getDiagID() ==
-        diag::note_invalid_subexpr_in_const_expr) {
+  if (Notes.size() == 1 &&
+      Notes[0].second.getDiagID() == diag::note_invalid_subexpr_in_const_expr) {
     DiagLoc = Notes[0].first;
     Notes.clear();
   }
@@ -18042,58 +18134,57 @@ Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
 }
 
 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;
+// 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;
 
-  public:
-    TransformToPE(Sema &SemaRef) : BaseTransform(SemaRef) { }
+public:
+  TransformToPE(Sema &SemaRef) : BaseTransform(SemaRef) {}
 
-    // Make sure we redo semantic analysis
-    bool AlwaysRebuild() { return true; }
-    bool ReplacingOriginal() { return true; }
+  // Make sure we redo semantic analysis
+  bool AlwaysRebuild() { return true; }
+  bool ReplacingOriginal() { return true; }
 
-    // We need to special-case DeclRefExprs referring to FieldDecls which
-    // are not part of a member pointer formation; normal TreeTransforming
-    // doesn't catch this case because of the way we represent them in the AST.
-    // FIXME: This is a bit ugly; is it really the best way to handle this
-    // case?
-    //
-    // Error on DeclRefExprs referring to FieldDecls.
-    ExprResult TransformDeclRefExpr(DeclRefExpr *E) {
-      if (isa<FieldDecl>(E->getDecl()) &&
-          !SemaRef.isUnevaluatedContext())
-        return SemaRef.Diag(E->getLocation(),
-                            diag::err_invalid_non_static_member_use)
-            << E->getDecl() << E->getSourceRange();
+  // We need to special-case DeclRefExprs referring to FieldDecls which
+  // are not part of a member pointer formation; normal TreeTransforming
+  // doesn't catch this case because of the way we represent them in the AST.
+  // FIXME: This is a bit ugly; is it really the best way to handle this
+  // case?
+  //
+  // Error on DeclRefExprs referring to FieldDecls.
+  ExprResult TransformDeclRefExpr(DeclRefExpr *E) {
+    if (isa<FieldDecl>(E->getDecl()) && !SemaRef.isUnevaluatedContext())
+      return SemaRef.Diag(E->getLocation(),
+                          diag::err_invalid_non_static_member_use)
+             << E->getDecl() << E->getSourceRange();
 
-      return BaseTransform::TransformDeclRefExpr(E);
-    }
+    return BaseTransform::TransformDeclRefExpr(E);
+  }
 
-    // Exception: filter out member pointer formation
-    ExprResult TransformUnaryOperator(UnaryOperator *E) {
-      if (E->getOpcode() == UO_AddrOf && E->getType()->isMemberPointerType())
-        return E;
+  // Exception: filter out member pointer formation
+  ExprResult TransformUnaryOperator(UnaryOperator *E) {
+    if (E->getOpcode() == UO_AddrOf && E->getType()->isMemberPointerType())
+      return E;
 
-      return BaseTransform::TransformUnaryOperator(E);
-    }
+    return BaseTransform::TransformUnaryOperator(E);
+  }
 
-    // The body of a lambda-expression is in a separate expression evaluation
-    // context so never needs to be transformed.
-    // FIXME: Ideally we wouldn't transform the closure type either, and would
-    // just recreate the capture expressions and lambda expression.
-    StmtResult TransformLambdaBody(LambdaExpr *E, Stmt *Body) {
-      return SkipLambdaBody(E, Body);
-    }
-  };
-}
+  // The body of a lambda-expression is in a separate expression evaluation
+  // context so never needs to be transformed.
+  // FIXME: Ideally we wouldn't transform the closure type either, and would
+  // just recreate the capture expressions and lambda expression.
+  StmtResult TransformLambdaBody(LambdaExpr *E, Stmt *Body) {
+    return SkipLambdaBody(E, Body);
+  }
+};
+} // namespace
 
 ExprResult Sema::TransformToPotentiallyEvaluated(Expr *E) {
   assert(isUnevaluatedContext() &&
          "Should only transform unevaluated expressions");
   ExprEvalContexts.back().Context =
-      ExprEvalContexts[ExprEvalContexts.size()-2].Context;
+      ExprEvalContexts[ExprEvalContexts.size() - 2].Context;
   if (isUnevaluatedContext())
     return E;
   return TransformToPE(*this).TransformExpr(E);
@@ -18108,8 +18199,7 @@ TypeSourceInfo *Sema::TransformToPotentiallyEvaluated(TypeSourceInfo *TInfo) {
   return TransformToPE(*this).TransformType(TInfo);
 }
 
-void
-Sema::PushExpressionEvaluationContext(
+void Sema::PushExpressionEvaluationContext(
     ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl,
     ExpressionEvaluationContextRecord::ExpressionKind ExprContext) {
   ExprEvalContexts.emplace_back(NewContext, ExprCleanupObjects.size(), Cleanup,
@@ -18137,8 +18227,7 @@ Sema::PushExpressionEvaluationContext(
     std::swap(MaybeODRUseExprs, ExprEvalContexts.back().SavedMaybeODRUseExprs);
 }
 
-void
-Sema::PushExpressionEvaluationContext(
+void Sema::PushExpressionEvaluationContext(
     ExpressionEvaluationContext NewContext, ReuseLambdaContextDecl_t,
     ExpressionEvaluationContextRecord::ExpressionKind ExprContext) {
   Decl *ClosureContextDecl = ExprEvalContexts.back().ManglingContextDecl;
@@ -18407,7 +18496,7 @@ static void RemoveNestedImmediateInvocation(
                   SmallVector<Sema::ImmediateInvocationCandidate,
                               4>::reverse_iterator Current)
         : Base(SemaRef), DRSet(DR), IISet(II), CurrentII(Current) {}
-    void RemoveImmediateInvocation(ConstantExpr* E) {
+    void RemoveImmediateInvocation(ConstantExpr *E) {
       auto It = std::find_if(CurrentII, IISet.rend(),
                              [E](Sema::ImmediateInvocationCandidate Elem) {
                                return Elem.getPointer() == E;
@@ -18611,7 +18700,7 @@ HandleImmediateInvocations(Sema &SemaRef,
 }
 
 void Sema::PopExpressionEvaluationContext() {
-  ExpressionEvaluationContextRecord& Rec = ExprEvalContexts.back();
+  ExpressionEvaluationContextRecord &Rec = ExprEvalContexts.back();
   if (!Rec.Lambdas.empty()) {
     using ExpressionKind = ExpressionEvaluationContextRecord::ExpressionKind;
     if (!getLangOpts().CPlusPlus20 &&
@@ -18671,7 +18760,7 @@ void Sema::PopExpressionEvaluationContext() {
     Cleanup = Rec.ParentCleanup;
     CleanupVarDeclMarking();
     std::swap(MaybeODRUseExprs, Rec.SavedMaybeODRUseExprs);
-  // Otherwise, merge the contexts together.
+    // Otherwise, merge the contexts together.
   } else {
     Cleanup.mergeFrom(Rec.ParentCleanup);
     MaybeODRUseExprs.insert_range(Rec.SavedMaybeODRUseExprs);
@@ -18684,9 +18773,9 @@ void Sema::PopExpressionEvaluationContext() {
 }
 
 void Sema::DiscardCleanupsInEvaluationContext() {
-  ExprCleanupObjects.erase(
-         ExprCleanupObjects.begin() + ExprEvalContexts.back().NumCleanupObjects,
-         ExprCleanupObjects.end());
+  ExprCleanupObjects.erase(ExprCleanupObjects.begin() +
+                               ExprEvalContexts.back().NumCleanupObjects,
+                           ExprCleanupObjects.end());
   Cleanup.reset();
   MaybeODRUseExprs.clear();
 }
@@ -18707,27 +18796,27 @@ static bool isPotentiallyConstantEvaluatedContext(Sema &SemaRef) {
   /// C++2a [expr.const]p12:
   //   An expression or conversion is potentially constant evaluated if it is
   switch (SemaRef.ExprEvalContexts.back().Context) {
-    case Sema::ExpressionEvaluationContext::ConstantEvaluated:
-    case Sema::ExpressionEvaluationContext::ImmediateFunctionContext:
-
-      // -- a manifestly constant-evaluated expression,
-    case Sema::ExpressionEvaluationContext::PotentiallyEvaluated:
-    case Sema::ExpressionEvaluationContext::PotentiallyEvaluatedIfUsed:
-    case Sema::ExpressionEvaluationContext::DiscardedStatement:
-      // -- a potentially-evaluated expression,
-    case Sema::ExpressionEvaluationContext::UnevaluatedList:
-      // -- an immediate subexpression of a braced-init-list,
-
-      // -- [FIXME] an expression of the form & cast-expression that occurs
-      //    within a templated entity
-      // -- a subexpression of one of the above that is not a subexpression of
-      // a nested unevaluated operand.
-      return true;
+  case Sema::ExpressionEvaluationContext::ConstantEvaluated:
+  case Sema::ExpressionEvaluationContext::ImmediateFunctionContext:
+
+    // -- a manifestly constant-evaluated expression,
+  case Sema::ExpressionEvaluationContext::PotentiallyEvaluated:
+  case Sema::ExpressionEvaluationContext::PotentiallyEvaluatedIfUsed:
+  case Sema::ExpressionEvaluationContext::DiscardedStatement:
+    // -- a potentially-evaluated expression,
+  case Sema::ExpressionEvaluationContext::UnevaluatedList:
+    // -- an immediate subexpression of a braced-init-list,
+
+    // -- [FIXME] an expression of the form & cast-expression that occurs
+    //    within a templated entity
+    // -- a subexpression of one of the above that is not a subexpression of
+    // a nested unevaluated operand.
+    return true;
 
-    case Sema::ExpressionEvaluationContext::Unevaluated:
-    case Sema::ExpressionEvaluationContext::UnevaluatedAbstract:
-      // Expressions in this context are never evaluated.
-      return false;
+  case Sema::ExpressionEvaluationContext::Unevaluated:
+  case Sema::ExpressionEvaluationContext::UnevaluatedAbstract:
+    // Expressions in this context are never evaluated.
+    return false;
   }
   llvm_unreachable("Invalid context");
 }
@@ -19005,7 +19094,7 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func,
           PointOfInstantiation = Loc;
           if (auto *MSI = Func->getMemberSpecializationInfo())
             MSI->setPointOfInstantiation(Loc);
-            // FIXME: Notify listener.
+          // FIXME: Notify listener.
           else
             Func->setTemplateSpecializationKind(TSK, PointOfInstantiation);
         } else if (TSK != TSK_ImplicitInstantiation) {
@@ -19098,8 +19187,7 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func,
     if (!Func->isDefined() && !Func->isInAnotherModuleUnit()) {
       if (mightHaveNonExternalLinkage(Func))
         UndefinedButUsed.insert(std::make_pair(Func->getCanonicalDecl(), Loc));
-      else if (Func->getMostRecentDecl()->isInlined() &&
-               !LangOpts.GNUInline &&
+      else if (Func->getMostRecentDecl()->isInlined() && !LangOpts.GNUInline &&
                !Func->getMostRecentDecl()->hasAttr<GNUInlineAttr>())
         UndefinedButUsed.insert(std::make_pair(Func->getCanonicalDecl(), Loc));
       else if (isExternalWithNoLinkageType(Func))
@@ -19229,8 +19317,7 @@ static void diagnoseUncapturableValueReferenceOrBinding(Sema &S,
   //  If the parameter still belongs to the translation unit, then
   //  we're actually just using one parameter in the declaration of
   //  the next.
-  if (isa<ParmVarDecl>(var) &&
-      isa<TranslationUnitDecl>(VarDC))
+  if (isa<ParmVarDecl>(var) && isa<TranslationUnitDecl>(VarDC))
     return;
 
   // For C code, don't diagnose about capture if we're not actually in code
@@ -19255,9 +19342,8 @@ static void diagnoseUncapturableValueReferenceOrBinding(Sema &S,
   }
 
   S.Diag(loc, diag::err_reference_to_local_in_enclosing_context)
-    << var << ValueKind << ContextKind << VarDC;
-  S.Diag(var->getLocation(), diag::note_entity_declared_at)
-      << var;
+      << var << ValueKind << ContextKind << VarDC;
+  S.Diag(var->getLocation(), diag::note_entity_declared_at) << var;
 
   // FIXME: Add additional diagnostic info about class etc. which prevents
   // capture.
@@ -19421,8 +19507,7 @@ static bool captureInBlock(BlockScopeInfo *BSI, ValueDecl *Var,
   if (!Invalid &&
       CaptureType.getObjCLifetime() == Qualifiers::OCL_Autoreleasing) {
     if (BuildAndDiagnose) {
-      S.Diag(Loc, diag::err_arc_autoreleasing_capture)
-        << /*block*/ 0;
+      S.Diag(Loc, diag::err_arc_autoreleasing_capture) << /*block*/ 0;
       S.Diag(Var->getLocation(), diag::note_previous_decl) << Var;
       Invalid = true;
     } else {
@@ -19553,7 +19638,7 @@ static bool captureInLambda(LambdaScopeInfo *LSI, ValueDecl *Var,
     //   captured entity is a reference to a function, the
     //   corresponding data member is also a reference to a
     //   function. - end note ]
-    if (const ReferenceType *RefType = CaptureType->getAs<ReferenceType>()){
+    if (const ReferenceType *RefType = CaptureType->getAs<ReferenceType>()) {
       if (!RefType->getPointeeType()->isFunctionType())
         CaptureType = RefType->getPointeeType();
     }
@@ -19564,7 +19649,7 @@ static bool captureInLambda(LambdaScopeInfo *LSI, ValueDecl *Var,
       if (BuildAndDiagnose) {
         S.Diag(Loc, diag::err_arc_autoreleasing_capture) << /*lambda*/ 1;
         S.Diag(Var->getLocation(), diag::note_previous_decl)
-          << Var->getDeclName();
+            << Var->getDeclName();
         Invalid = true;
       } else {
         return false;
@@ -19751,7 +19836,8 @@ bool Sema::tryCaptureVariable(
   assert(VD && "Cannot capture a null variable");
 
   const unsigned MaxFunctionScopesIndex = FunctionScopeIndexToStopAt
-      ? *FunctionScopeIndexToStopAt : FunctionScopes.size() - 1;
+                                              ? *FunctionScopeIndexToStopAt
+                                              : FunctionScopes.size() - 1;
   // We need to sync up the Declaration Context with the
   // FunctionScopeIndexToStopAt
   if (FunctionScopeIndexToStopAt) {
@@ -19836,7 +19922,7 @@ bool Sema::tryCaptureVariable(
       return true;
     }
 
-    FunctionScopeInfo  *FSI = FunctionScopes[FunctionScopesIndex];
+    FunctionScopeInfo *FSI = FunctionScopes[FunctionScopesIndex];
     CapturingScopeInfo *CSI = cast<CapturingScopeInfo>(FSI);
 
     // Check whether we've already captured it.
@@ -19984,13 +20070,13 @@ bool Sema::tryCaptureVariable(
   // If the variable had already been captured previously, we start capturing
   // at the lambda nested within that one.
   bool Invalid = false;
-  for (unsigned I = ++FunctionScopesIndex, N = MaxFunctionScopesIndex + 1; I != N;
-       ++I) {
+  for (unsigned I = ++FunctionScopesIndex, N = MaxFunctionScopesIndex + 1;
+       I != N; ++I) {
     CapturingScopeInfo *CSI = cast<CapturingScopeInfo>(FunctionScopes[I]);
 
-    // Certain capturing entities (lambdas, blocks etc.) are not allowed to capture
-    // certain types of variables (unnamed, variably modified types etc.)
-    // so check for eligibility.
+    // Certain capturing entities (lambdas, blocks etc.) are not allowed to
+    // capture certain types of variables (unnamed, variably modified types
+    // etc.) so check for eligibility.
     if (!Invalid)
       Invalid =
           !isVariableCapturable(CSI, Var, ExprLoc, BuildAndDiagnose, *this);
@@ -20001,10 +20087,12 @@ bool Sema::tryCaptureVariable(
       return true;
 
     if (BlockScopeInfo *BSI = dyn_cast<BlockScopeInfo>(CSI)) {
-      Invalid = !captureInBlock(BSI, Var, ExprLoc, BuildAndDiagnose, CaptureType,
-                               DeclRefType, Nested, *this, Invalid);
+      Invalid =
+          !captureInBlock(BSI, Var, ExprLoc, BuildAndDiagnose, CaptureType,
+                          DeclRefType, Nested, *this, Invalid);
       Nested = true;
-    } else if (CapturedRegionScopeInfo *RSI = dyn_cast<CapturedRegionScopeInfo>(CSI)) {
+    } else if (CapturedRegionScopeInfo *RSI =
+                   dyn_cast<CapturedRegionScopeInfo>(CSI)) {
       Invalid = !captureInCapturedRegion(
           RSI, Var, ExprLoc, BuildAndDiagnose, CaptureType, DeclRefType, Nested,
           Kind, /*IsTopScope*/ I == N - 1, *this, Invalid);
@@ -20029,8 +20117,8 @@ bool Sema::tryCaptureVariable(ValueDecl *Var, SourceLocation Loc,
   QualType CaptureType;
   QualType DeclRefType;
   return tryCaptureVariable(Var, Loc, Kind, EllipsisLoc,
-                            /*BuildAndDiagnose=*/true, CaptureType,
-                            DeclRefType, nullptr);
+                            /*BuildAndDiagnose=*/true, CaptureType, DeclRefType,
+                            nullptr);
 }
 
 bool Sema::NeedToCaptureVariable(ValueDecl *Var, SourceLocation Loc) {
@@ -20064,23 +20152,24 @@ namespace {
 class CopiedTemplateArgs {
   bool HasArgs;
   TemplateArgumentListInfo TemplateArgStorage;
+
 public:
-  template<typename RefExpr>
+  template <typename RefExpr>
   CopiedTemplateArgs(RefExpr *E) : HasArgs(E->hasExplicitTemplateArgs()) {
     if (HasArgs)
       E->copyTemplateArgumentsInto(TemplateArgStorage);
   }
-  operator TemplateArgumentListInfo*()
+  operator TemplateArgumentListInfo *()
 #ifdef __has_cpp_attribute
 #if __has_cpp_attribute(clang::lifetimebound)
-  [[clang::lifetimebound]]
+      [[clang::lifetimebound]]
 #endif
 #endif
   {
     return HasArgs ? &TemplateArgStorage : nullptr;
   }
 };
-}
+} // namespace
 
 /// Walk the set of potential results of an expression and mark them all as
 /// non-odr-uses if they satisfy the side-conditions of the NonOdrUseReason.
@@ -20272,7 +20361,7 @@ static ExprResult rebuildPotentialResultsAsNonOdrUsed(Sema &S, Expr *E,
       if (!Sub.isUsable())
         return Sub;
       BO->setLHS(Sub.get());
-    //   -- If e is a comma expression, ...
+      //   -- If e is a comma expression, ...
     } else if (BO->getOpcode() == BO_Comma) {
       ExprResult Sub = Rebuild(RHS);
       if (!Sub.isUsable())
@@ -20469,8 +20558,8 @@ void Sema::CleanupVarDeclMarking() {
 
   for (Expr *E : LocalMaybeODRUseExprs) {
     if (auto *DRE = dyn_cast<DeclRefExpr>(E)) {
-      MarkVarDeclODRUsed(cast<VarDecl>(DRE->getDecl()),
-                         DRE->getLocation(), *this);
+      MarkVarDeclODRUsed(cast<VarDecl>(DRE->getDecl()), DRE->getLocation(),
+                         *this);
     } else if (auto *ME = dyn_cast<MemberExpr>(E)) {
       MarkVarDeclODRUsed(cast<VarDecl>(ME->getMemberDecl()), ME->getMemberLoc(),
                          *this);
@@ -20591,7 +20680,7 @@ static void DoMarkVarDeclReferenced(
         PointOfInstantiation = Loc;
         if (MSI)
           MSI->setPointOfInstantiation(PointOfInstantiation);
-          // FIXME: Notify listener.
+        // FIXME: Notify listener.
         else
           Var->setTemplateSpecializationKind(TSK, PointOfInstantiation);
       }
@@ -20617,8 +20706,8 @@ static void DoMarkVarDeclReferenced(
         else if (auto *ME = dyn_cast_or_null<MemberExpr>(E))
           ME->setMemberDecl(ME->getMemberDecl());
       } else if (FirstInstantiation) {
-        SemaRef.PendingInstantiations
-            .push_back(std::make_pair(Var, PointOfInstantiation));
+        SemaRef.PendingInstantiations.push_back(
+            std::make_pair(Var, PointOfInstantiation));
       } else {
         bool Inserted = false;
         for (auto &I : SemaRef.SavedPendingInstantiations) {
@@ -20640,8 +20729,8 @@ static void DoMarkVarDeclReferenced(
         // no direct way to avoid enqueueing the pending instantiation
         // multiple times.
         if (isa<VarTemplateSpecializationDecl>(Var) && !Inserted)
-          SemaRef.PendingInstantiations
-            .push_back(std::make_pair(Var, PointOfInstantiation));
+          SemaRef.PendingInstantiations.push_back(
+              std::make_pair(Var, PointOfInstantiation));
       }
     }
   }
@@ -20815,8 +20904,8 @@ MarkExprReferenced(Sema &SemaRef, SourceLocation Loc, Decl *D, Expr *E,
   if (!MD)
     return;
   // Only attempt to devirtualize if this is truly a virtual call.
-  bool IsVirtualCall = MD->isVirtual() &&
-                          ME->performsVirtualDispatch(SemaRef.getLangOpts());
+  bool IsVirtualCall =
+      MD->isVirtual() && ME->performsVirtualDispatch(SemaRef.getLangOpts());
   if (!IsVirtualCall)
     return;
 
@@ -20897,13 +20986,13 @@ void Sema::MarkAnyDeclReferenced(SourceLocation Loc, Decl *D,
 }
 
 namespace {
-  // Mark all of the declarations used by a type as referenced.
-  // FIXME: Not fully implemented yet! We need to have a better understanding
-  // of when we're entering a context we should not recurse into.
-  // FIXME: This is and EvaluatedExprMarker are more-or-less equivalent to
-  // TreeTransforms rebuilding the type in a new context. Rather than
-  // duplicating the TreeTransform logic, we should consider reusing it here.
-  // Currently that causes problems when rebuilding LambdaExprs.
+// Mark all of the declarations used by a type as referenced.
+// FIXME: Not fully implemented yet! We need to have a better understanding
+// of when we're entering a context we should not recurse into.
+// FIXME: This is and EvaluatedExprMarker are more-or-less equivalent to
+// TreeTransforms rebuilding the type in a new context. Rather than
+// duplicating the TreeTransform logic, we should consider reusing it here.
+// Currently that causes problems when rebuilding LambdaExprs.
 class MarkReferencedDecls : public DynamicRecursiveASTVisitor {
   Sema &S;
   SourceLocation Loc;
@@ -20913,7 +21002,7 @@ class MarkReferencedDecls : public DynamicRecursiveASTVisitor {
 
   bool TraverseTemplateArgument(const TemplateArgument &Arg) override;
 };
-}
+} // namespace
 
 bool MarkReferencedDecls::TraverseTemplateArgument(
     const TemplateArgument &Arg) {
@@ -20986,9 +21075,8 @@ class EvaluatedExprMarker : public UsedDeclVisitor<EvaluatedExprMarker> {
 };
 } // namespace
 
-void Sema::MarkDeclarationsReferencedInExpr(Expr *E,
-                                            bool SkipLocalVariables,
-                                            ArrayRef<const Expr*> StopAt) {
+void Sema::MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables,
+                                            ArrayRef<const Expr *> StopAt) {
   EvaluatedExprMarker(*this, SkipLocalVariables, StopAt).Visit(E);
 }
 
@@ -21045,7 +21133,7 @@ bool Sema::DiagIfReachable(SourceLocation Loc, ArrayRef<const Stmt *> Stmts,
 /// behavior of a program, such as passing a non-POD value through an ellipsis.
 /// Failure to do so will likely result in spurious diagnostics or failures
 /// during overload resolution or within sizeof/alignof/typeof/typeid.
-bool Sema::DiagRuntimeBehavior(SourceLocation Loc, ArrayRef<const Stmt*> Stmts,
+bool Sema::DiagRuntimeBehavior(SourceLocation Loc, ArrayRef<const Stmt *> Stmts,
                                const PartialDiagnostic &PD) {
 
   if (ExprEvalContexts.back().isDiscardedStatementContext())
@@ -21098,12 +21186,12 @@ bool Sema::CheckCallReturnType(QualType ReturnType, SourceLocation Loc,
 
   public:
     CallReturnIncompleteDiagnoser(FunctionDecl *FD, CallExpr *CE)
-      : FD(FD), CE(CE) { }
+        : FD(FD), CE(CE) {}
 
     void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
       if (!FD) {
         S.Diag(Loc, diag::err_call_incomplete_return)
-          << T << CE->getSourceRange();
+            << T << CE->getSourceRange();
         return;
       }
 
@@ -21135,8 +21223,8 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) {
     IsOrAssign = Op->getOpcode() == BO_OrAssign;
 
     // Greylist some idioms by putting them into a warning subcategory.
-    if (ObjCMessageExpr *ME
-          = dyn_cast<ObjCMessageExpr>(Op->getRHS()->IgnoreParenCasts())) {
+    if (ObjCMessageExpr *ME =
+            dyn_cast<ObjCMessageExpr>(Op->getRHS()->IgnoreParenCasts())) {
       Selector Sel = ME->getSelector();
 
       // self = [<foo> init...]
@@ -21167,15 +21255,15 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) {
   SourceLocation Open = E->getBeginLoc();
   SourceLocation Close = getLocForEndOfToken(E->getSourceRange().getEnd());
   Diag(Loc, diag::note_condition_assign_silence)
-        << FixItHint::CreateInsertion(Open, "(")
-        << FixItHint::CreateInsertion(Close, ")");
+      << FixItHint::CreateInsertion(Open, "(")
+      << FixItHint::CreateInsertion(Close, ")");
 
   if (IsOrAssign)
     Diag(Loc, diag::note_condition_or_assign_to_comparison)
-      << FixItHint::CreateReplacement(Loc, "!=");
+        << FixItHint::CreateReplacement(Loc, "!=");
   else
     Diag(Loc, diag::note_condition_assign_to_comparison)
-      << FixItHint::CreateReplacement(Loc, "==");
+        << FixItHint::CreateReplacement(Loc, "==");
 }
 
 void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *ParenE) {
@@ -21193,17 +21281,17 @@ void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *ParenE) {
 
   if (BinaryOperator *opE = dyn_cast<BinaryOperator>(E))
     if (opE->getOpcode() == BO_EQ &&
-        opE->getLHS()->IgnoreParenImpCasts()->isModifiableLvalue(Context)
-                                                           == Expr::MLV_Valid) {
+        opE->getLHS()->IgnoreParenImpCasts()->isModifiableLvalue(Context) ==
+            Expr::MLV_Valid) {
       SourceLocation Loc = opE->getOperatorLoc();
 
       Diag(Loc, diag::warn_equality_with_extra_parens) << E->getSourceRange();
       SourceRange ParenERange = ParenE->getSourceRange();
       Diag(Loc, diag::note_equality_comparison_silence)
-        << FixItHint::CreateRemoval(ParenERange.getBegin())
-        << FixItHint::CreateRemoval(ParenERange.getEnd());
+          << FixItHint::CreateRemoval(ParenERange.getBegin())
+          << FixItHint::CreateRemoval(ParenERange.getEnd());
       Diag(Loc, diag::note_equality_comparison_to_assign)
-        << FixItHint::CreateReplacement(Loc, "=");
+          << FixItHint::CreateReplacement(Loc, "=");
     }
 }
 
@@ -21214,7 +21302,8 @@ ExprResult Sema::CheckBooleanCondition(SourceLocation Loc, Expr *E,
     DiagnoseEqualityWithExtraParens(parenE);
 
   ExprResult result = CheckPlaceholderExpr(E);
-  if (result.isInvalid()) return ExprError();
+  if (result.isInvalid())
+    return ExprError();
   E = result.get();
 
   if (!E->isTypeDependent()) {
@@ -21232,7 +21321,7 @@ ExprResult Sema::CheckBooleanCondition(SourceLocation Loc, Expr *E,
     QualType T = E->getType();
     if (!T->isScalarType()) { // C99 6.8.4.1p1
       Diag(Loc, diag::err_typecheck_statement_requires_scalar)
-        << T << E->getSourceRange();
+          << T << E->getSourceRange();
       return ExprError();
     }
     CheckBoolLikeConversion(E, Loc);
@@ -21280,190 +21369,182 @@ Sema::ConditionResult Sema::ActOnCondition(Scope *S, SourceLocation Loc,
 }
 
 namespace {
-  /// A visitor for rebuilding a call to an __unknown_any expression
-  /// to have an appropriate type.
-  struct RebuildUnknownAnyFunction
+/// A visitor for rebuilding a call to an __unknown_any expression
+/// to have an appropriate type.
+struct RebuildUnknownAnyFunction
     : StmtVisitor<RebuildUnknownAnyFunction, ExprResult> {
 
-    Sema &S;
+  Sema &S;
 
-    RebuildUnknownAnyFunction(Sema &S) : S(S) {}
+  RebuildUnknownAnyFunction(Sema &S) : S(S) {}
 
-    ExprResult VisitStmt(Stmt *S) {
-      llvm_unreachable("unexpected statement!");
-    }
+  ExprResult VisitStmt(Stmt *S) { llvm_unreachable("unexpected statement!"); }
 
-    ExprResult VisitExpr(Expr *E) {
-      S.Diag(E->getExprLoc(), diag::err_unsupported_unknown_any_call)
+  ExprResult VisitExpr(Expr *E) {
+    S.Diag(E->getExprLoc(), diag::err_unsupported_unknown_any_call)
         << E->getSourceRange();
-      return ExprError();
-    }
+    return ExprError();
+  }
 
-    /// Rebuild an expression which simply semantically wraps another
-    /// expression which it shares the type and value kind of.
-    template <class T> ExprResult rebuildSugarExpr(T *E) {
-      ExprResult SubResult = Visit(E->getSubExpr());
-      if (SubResult.isInvalid()) return ExprError();
+  /// Rebuild an expression which simply semantically wraps another
+  /// expression which it shares the type and value kind of.
+  template <class T> ExprResult rebuildSugarExpr(T *E) {
+    ExprResult SubResult = Visit(E->getSubExpr());
+    if (SubResult.isInvalid())
+      return ExprError();
 
-      Expr *SubExpr = SubResult.get();
-      E->setSubExpr(SubExpr);
-      E->setType(SubExpr->getType());
-      E->setValueKind(SubExpr->getValueKind());
-      assert(E->getObjectKind() == OK_Ordinary);
-      return E;
-    }
+    Expr *SubExpr = SubResult.get();
+    E->setSubExpr(SubExpr);
+    E->setType(SubExpr->getType());
+    E->setValueKind(SubExpr->getValueKind());
+    assert(E->getObjectKind() == OK_Ordinary);
+    return E;
+  }
 
-    ExprResult VisitParenExpr(ParenExpr *E) {
-      return rebuildSugarExpr(E);
-    }
+  ExprResult VisitParenExpr(ParenExpr *E) { return rebuildSugarExpr(E); }
 
-    ExprResult VisitUnaryExtension(UnaryOperator *E) {
-      return rebuildSugarExpr(E);
-    }
+  ExprResult VisitUnaryExtension(UnaryOperator *E) {
+    return rebuildSugarExpr(E);
+  }
 
-    ExprResult VisitUnaryAddrOf(UnaryOperator *E) {
-      ExprResult SubResult = Visit(E->getSubExpr());
-      if (SubResult.isInvalid()) return ExprError();
+  ExprResult VisitUnaryAddrOf(UnaryOperator *E) {
+    ExprResult SubResult = Visit(E->getSubExpr());
+    if (SubResult.isInvalid())
+      return ExprError();
 
-      Expr *SubExpr = SubResult.get();
-      E->setSubExpr(SubExpr);
-      E->setType(S.Context.getPointerType(SubExpr->getType()));
-      assert(E->isPRValue());
-      assert(E->getObjectKind() == OK_Ordinary);
-      return E;
-    }
+    Expr *SubExpr = SubResult.get();
+    E->setSubExpr(SubExpr);
+    E->setType(S.Context.getPointerType(SubExpr->getType()));
+    assert(E->isPRValue());
+    assert(E->getObjectKind() == OK_Ordinary);
+    return E;
+  }
 
-    ExprResult resolveDecl(Expr *E, ValueDecl *VD) {
-      if (!isa<FunctionDecl>(VD)) return VisitExpr(E);
+  ExprResult resolveDecl(Expr *E, ValueDecl *VD) {
+    if (!isa<FunctionDecl>(VD))
+      return VisitExpr(E);
 
-      E->setType(VD->getType());
+    E->setType(VD->getType());
 
-      assert(E->isPRValue());
-      if (S.getLangOpts().CPlusPlus &&
-          !(isa<CXXMethodDecl>(VD) &&
-            cast<CXXMethodDecl>(VD)->isInstance()))
-        E->setValueKind(VK_LValue);
+    assert(E->isPRValue());
+    if (S.getLangOpts().CPlusPlus &&
+        !(isa<CXXMethodDecl>(VD) && cast<CXXMethodDecl>(VD)->isInstance()))
+      E->setValueKind(VK_LValue);
 
-      return E;
-    }
+    return E;
+  }
 
-    ExprResult VisitMemberExpr(MemberExpr *E) {
-      return resolveDecl(E, E->getMemberDecl());
-    }
+  ExprResult VisitMemberExpr(MemberExpr *E) {
+    return resolveDecl(E, E->getMemberDecl());
+  }
 
-    ExprResult VisitDeclRefExpr(DeclRefExpr *E) {
-      return resolveDecl(E, E->getDecl());
-    }
-  };
-}
+  ExprResult VisitDeclRefExpr(DeclRefExpr *E) {
+    return resolveDecl(E, E->getDecl());
+  }
+};
+} // namespace
 
 /// Given a function expression of unknown-any type, try to rebuild it
 /// to have a function type.
 static ExprResult rebuildUnknownAnyFunction(Sema &S, Expr *FunctionExpr) {
   ExprResult Result = RebuildUnknownAnyFunction(S).Visit(FunctionExpr);
-  if (Result.isInvalid()) return ExprError();
+  if (Result.isInvalid())
+    return ExprError();
   return S.DefaultFunctionArrayConversion(Result.get());
 }
 
 namespace {
-  /// A visitor for rebuilding an expression of type __unknown_anytype
-  /// into one which resolves the type directly on the referring
-  /// expression.  Strict preservation of the original source
-  /// structure is not a goal.
-  struct RebuildUnknownAnyExpr
-    : StmtVisitor<RebuildUnknownAnyExpr, ExprResult> {
+/// A visitor for rebuilding an expression of type __unknown_anytype
+/// into one which resolves the type directly on the referring
+/// expression.  Strict preservation of the original source
+/// structure is not a goal.
+struct RebuildUnknownAnyExpr : StmtVisitor<RebuildUnknownAnyExpr, ExprResult> {
 
-    Sema &S;
+  Sema &S;
 
-    /// The current destination type.
-    QualType DestType;
+  /// The current destination type.
+  QualType DestType;
 
-    RebuildUnknownAnyExpr(Sema &S, QualType CastType)
+  RebuildUnknownAnyExpr(Sema &S, QualType CastType)
       : S(S), DestType(CastType) {}
 
-    ExprResult VisitStmt(Stmt *S) {
-      llvm_unreachable("unexpected statement!");
-    }
+  ExprResult VisitStmt(Stmt *S) { llvm_unreachable("unexpected statement!"); }
 
-    ExprResult VisitExpr(Expr *E) {
-      S.Diag(E->getExprLoc(), diag::err_unsupported_unknown_any_expr)
+  ExprResult VisitExpr(Expr *E) {
+    S.Diag(E->getExprLoc(), diag::err_unsupported_unknown_any_expr)
         << E->getSourceRange();
-      return ExprError();
-    }
+    return ExprError();
+  }
 
-    ExprResult VisitCallExpr(CallExpr *E);
-    ExprResult VisitObjCMessageExpr(ObjCMessageExpr *E);
+  ExprResult VisitCallExpr(CallExpr *E);
+  ExprResult VisitObjCMessageExpr(ObjCMessageExpr *E);
 
-    /// Rebuild an expression which simply semantically wraps another
-    /// expression which it shares the type and value kind of.
-    template <class T> ExprResult rebuildSugarExpr(T *E) {
-      ExprResult SubResult = Visit(E->getSubExpr());
-      if (SubResult.isInvalid()) return ExprError();
-      Expr *SubExpr = SubResult.get();
-      E->setSubExpr(SubExpr);
-      E->setType(SubExpr->getType());
-      E->setValueKind(SubExpr->getValueKind());
-      assert(E->getObjectKind() == OK_Ordinary);
-      return E;
-    }
+  /// Rebuild an expression which simply semantically wraps another
+  /// expression which it shares the type and value kind of.
+  template <class T> ExprResult rebuildSugarExpr(T *E) {
+    ExprResult SubResult = Visit(E->getSubExpr());
+    if (SubResult.isInvalid())
+      return ExprError();
+    Expr *SubExpr = SubResult.get();
+    E->setSubExpr(SubExpr);
+    E->setType(SubExpr->getType());
+    E->setValueKind(SubExpr->getValueKind());
+    assert(E->getObjectKind() == OK_Ordinary);
+    return E;
+  }
 
-    ExprResult VisitParenExpr(ParenExpr *E) {
-      return rebuildSugarExpr(E);
-    }
+  ExprResult VisitParenExpr(ParenExpr *E) { return rebuildSugarExpr(E); }
 
-    ExprResult VisitUnaryExtension(UnaryOperator *E) {
-      return rebuildSugarExpr(E);
-    }
+  ExprResult VisitUnaryExtension(UnaryOperator *E) {
+    return rebuildSugarExpr(E);
+  }
 
-    ExprResult VisitUnaryAddrOf(UnaryOperator *E) {
-      const PointerType *Ptr = DestType->getAs<PointerType>();
-      if (!Ptr) {
-        S.Diag(E->getOperatorLoc(), diag::err_unknown_any_addrof)
+  ExprResult VisitUnaryAddrOf(UnaryOperator *E) {
+    const PointerType *Ptr = DestType->getAs<PointerType>();
+    if (!Ptr) {
+      S.Diag(E->getOperatorLoc(), diag::err_unknown_any_addrof)
           << E->getSourceRange();
-        return ExprError();
-      }
+      return ExprError();
+    }
 
-      if (isa<CallExpr>(E->getSubExpr())) {
-        S.Diag(E->getOperatorLoc(), diag::err_unknown_any_addrof_call)
+    if (isa<CallExpr>(E->getSubExpr())) {
+      S.Diag(E->getOperatorLoc(), diag::err_unknown_any_addrof_call)
           << E->getSourceRange();
-        return ExprError();
-      }
+      return ExprError();
+    }
 
-      assert(E->isPRValue());
-      assert(E->getObjectKind() == OK_Ordinary);
-      E->setType(DestType);
+    assert(E->isPRValue());
+    assert(E->getObjectKind() == OK_Ordinary);
+    E->setType(DestType);
 
-      // Build the sub-expression as if it were an object of the pointee type.
-      DestType = Ptr->getPointeeType();
-      ExprResult SubResult = Visit(E->getSubExpr());
-      if (SubResult.isInvalid()) return ExprError();
-      E->setSubExpr(SubResult.get());
-      return E;
-    }
+    // Build the sub-expression as if it were an object of the pointee type.
+    DestType = Ptr->getPointeeType();
+    ExprResult SubResult = Visit(E->getSubExpr());
+    if (SubResult.isInvalid())
+      return ExprError();
+    E->setSubExpr(SubResult.get());
+    return E;
+  }
 
-    ExprResult VisitImplicitCastExpr(ImplicitCastExpr *E);
+  ExprResult VisitImplicitCastExpr(ImplicitCastExpr *E);
 
-    ExprResult resolveDecl(Expr *E, ValueDecl *VD);
+  ExprResult resolveDecl(Expr *E, ValueDecl *VD);
 
-    ExprResult VisitMemberExpr(MemberExpr *E) {
-      return resolveDecl(E, E->getMemberDecl());
-    }
+  ExprResult VisitMemberExpr(MemberExpr *E) {
+    return resolveDecl(E, E->getMemberDecl());
+  }
 
-    ExprResult VisitDeclRefExpr(DeclRefExpr *E) {
-      return resolveDecl(E, E->getDecl());
-    }
-  };
-}
+  ExprResult VisitDeclRefExpr(DeclRefExpr *E) {
+    return resolveDecl(E, E->getDecl());
+  }
+};
+} // namespace
 
 /// Rebuilds a call expression which yielded __unknown_anytype.
 ExprResult RebuildUnknownAnyExpr::VisitCallExpr(CallExpr *E) {
   Expr *CalleeExpr = E->getCallee();
 
-  enum FnKind {
-    FK_MemberFunction,
-    FK_FunctionPointer,
-    FK_BlockPointer
-  };
+  enum FnKind { FK_MemberFunction, FK_FunctionPointer, FK_BlockPointer };
 
   FnKind Kind;
   QualType CalleeType = CalleeExpr->getType();
@@ -21487,8 +21568,7 @@ ExprResult RebuildUnknownAnyExpr::VisitCallExpr(CallExpr *E) {
     if (Kind == FK_BlockPointer)
       diagID = diag::err_block_returning_array_function;
 
-    S.Diag(E->getExprLoc(), diagID)
-      << DestType->isFunctionType() << DestType;
+    S.Diag(E->getExprLoc(), diagID) << DestType->isFunctionType() << DestType;
     return ExprError();
   }
 
@@ -21531,8 +21611,7 @@ ExprResult RebuildUnknownAnyExpr::VisitCallExpr(CallExpr *E) {
     DestType = S.Context.getFunctionType(DestType, ParamTypes,
                                          Proto->getExtProtoInfo());
   } else {
-    DestType = S.Context.getFunctionNoProtoType(DestType,
-                                                FnType->getExtInfo());
+    DestType = S.Context.getFunctionNoProtoType(DestType, FnType->getExtInfo());
   }
 
   // Rebuild the appropriate pointer-to-function type.
@@ -21552,7 +21631,8 @@ ExprResult RebuildUnknownAnyExpr::VisitCallExpr(CallExpr *E) {
 
   // Finally, we can recurse.
   ExprResult CalleeResult = Visit(CalleeExpr);
-  if (!CalleeResult.isUsable()) return ExprError();
+  if (!CalleeResult.isUsable())
+    return ExprError();
   E->setCallee(CalleeResult.get());
 
   // Bind a temporary if necessary.
@@ -21563,7 +21643,7 @@ ExprResult RebuildUnknownAnyExpr::VisitObjCMessageExpr(ObjCMessageExpr *E) {
   // Verify that this is a legal result type of a call.
   if (DestType->isArrayType() || DestType->isFunctionType()) {
     S.Diag(E->getExprLoc(), diag::err_func_returning_array_function)
-      << DestType->isFunctionType() << DestType;
+        << DestType->isFunctionType() << DestType;
     return ExprError();
   }
 
@@ -21592,7 +21672,8 @@ ExprResult RebuildUnknownAnyExpr::VisitImplicitCastExpr(ImplicitCastExpr *E) {
     DestType = DestType->castAs<PointerType>()->getPointeeType();
 
     ExprResult Result = Visit(E->getSubExpr());
-    if (!Result.isUsable()) return ExprError();
+    if (!Result.isUsable())
+      return ExprError();
 
     E->setSubExpr(Result.get());
     return E;
@@ -21608,7 +21689,8 @@ ExprResult RebuildUnknownAnyExpr::VisitImplicitCastExpr(ImplicitCastExpr *E) {
     DestType = S.Context.getLValueReferenceType(DestType);
 
     ExprResult Result = Visit(E->getSubExpr());
-    if (!Result.isUsable()) return ExprError();
+    if (!Result.isUsable())
+      return ExprError();
 
     E->setSubExpr(Result.get());
     return E;
@@ -21628,14 +21710,15 @@ ExprResult RebuildUnknownAnyExpr::resolveDecl(Expr *E, ValueDecl *VD) {
     if (const PointerType *Ptr = Type->getAs<PointerType>()) {
       DestType = Ptr->getPointeeType();
       ExprResult Result = resolveDecl(E, VD);
-      if (Result.isInvalid()) return ExprError();
+      if (Result.isInvalid())
+        return ExprError();
       return S.ImpCastExprToType(Result.get(), Type, CK_FunctionToPointerDecay,
                                  VK_PRValue);
     }
 
     if (!Type->isFunctionType()) {
       S.Diag(E->getExprLoc(), diag::err_unknown_any_function)
-        << VD << E->getSourceRange();
+          << VD << E->getSourceRange();
       return ExprError();
     }
     if (const FunctionProtoType *FT = Type->getAs<FunctionProtoType>()) {
@@ -21644,9 +21727,11 @@ ExprResult RebuildUnknownAnyExpr::resolveDecl(Expr *E, ValueDecl *VD) {
       // type. See the lengthy commentary in that routine.
       QualType FDT = FD->getType();
       const FunctionType *FnType = FDT->castAs<FunctionType>();
-      const FunctionProtoType *Proto = dyn_cast_or_null<FunctionProtoType>(FnType);
+      const FunctionProtoType *Proto =
+          dyn_cast_or_null<FunctionProtoType>(FnType);
       DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E);
-      if (DRE && Proto && Proto->getParamTypes().empty() && Proto->isVariadic()) {
+      if (DRE && Proto && Proto->getParamTypes().empty() &&
+          Proto->isVariadic()) {
         SourceLocation Loc = FD->getLocation();
         FunctionDecl *NewFD = FunctionDecl::Create(
             S.Context, FD->getDeclContext(), Loc, Loc,
@@ -21658,10 +21743,9 @@ ExprResult RebuildUnknownAnyExpr::resolveDecl(Expr *E, ValueDecl *VD) {
         if (FD->getQualifier())
           NewFD->setQualifierInfo(FD->getQualifierLoc());
 
-        SmallVector<ParmVarDecl*, 16> Params;
+        SmallVector<ParmVarDecl *, 16> Params;
         for (const auto &AI : FT->param_types()) {
-          ParmVarDecl *Param =
-            S.BuildParmVarDeclForTypedef(FD, Loc, AI);
+          ParmVarDecl *Param = S.BuildParmVarDeclForTypedef(FD, Loc, AI);
           Param->setScopeInfo(0, Params.size());
           Params.push_back(Param);
         }
@@ -21681,20 +21765,20 @@ ExprResult RebuildUnknownAnyExpr::resolveDecl(Expr *E, ValueDecl *VD) {
     if (!S.getLangOpts().CPlusPlus)
       ValueKind = VK_PRValue;
 
-  //  - variables
+    //  - variables
   } else if (isa<VarDecl>(VD)) {
     if (const ReferenceType *RefTy = Type->getAs<ReferenceType>()) {
       Type = RefTy->getPointeeType();
     } else if (Type->isFunctionType()) {
       S.Diag(E->getExprLoc(), diag::err_unknown_any_var_function_type)
-        << VD << E->getSourceRange();
+          << VD << E->getSourceRange();
       return ExprError();
     }
 
-  //  - nothing else
+    //  - nothing else
   } else {
     S.Diag(E->getExprLoc(), diag::err_unsupported_unknown_any_decl)
-      << VD << E->getSourceRange();
+        << VD << E->getSourceRange();
     return ExprError();
   }
 
@@ -21717,7 +21801,8 @@ ExprResult Sema::checkUnknownAnyCast(SourceRange TypeRange, QualType CastType,
 
   // Rewrite the casted expression from scratch.
   ExprResult result = RebuildUnknownAnyExpr(*this, CastType).Visit(CastExpr);
-  if (!result.isUsable()) return ExprError();
+  if (!result.isUsable())
+    return ExprError();
 
   CastExpr = result.get();
   VK = CastExpr->getValueKind();
@@ -21730,14 +21815,15 @@ ExprResult Sema::forceUnknownAnyToType(Expr *E, QualType ToType) {
   return RebuildUnknownAnyExpr(*this, ToType).Visit(E);
 }
 
-ExprResult Sema::checkUnknownAnyArg(SourceLocation callLoc,
-                                    Expr *arg, QualType &paramType) {
+ExprResult Sema::checkUnknownAnyArg(SourceLocation callLoc, Expr *arg,
+                                    QualType &paramType) {
   // If the syntactic form of the argument is not an explicit cast of
   // any sort, just do default argument promotion.
   ExplicitCastExpr *castArg = dyn_cast<ExplicitCastExpr>(arg->IgnoreParens());
   if (!castArg) {
     ExprResult result = DefaultArgumentPromotion(arg);
-    if (result.isInvalid()) return ExprError();
+    if (result.isInvalid())
+      return ExprError();
     paramType = result.get()->getType();
     return result;
   }
@@ -21748,8 +21834,8 @@ ExprResult Sema::checkUnknownAnyArg(SourceLocation callLoc,
 
   // Copy-initialize a parameter of that type.
   InitializedEntity entity =
-    InitializedEntity::InitializeParameter(Context, paramType,
-                                           /*consumed*/ false);
+      InitializedEntity::InitializeParameter(Context, paramType,
+                                             /*consumed*/ false);
   return PerformCopyInitialization(entity, callLoc, arg);
 }
 
@@ -21780,13 +21866,13 @@ static ExprResult diagnoseUnknownAnyExpr(Sema &S, Expr *E) {
     d = msg->getMethodDecl();
     if (!d) {
       S.Diag(loc, diag::err_uncasted_send_to_unknown_any_method)
-        << static_cast<unsigned>(msg->isClassMessage()) << msg->getSelector()
-        << orig->getSourceRange();
+          << static_cast<unsigned>(msg->isClassMessage()) << msg->getSelector()
+          << orig->getSourceRange();
       return ExprError();
     }
   } else {
     S.Diag(E->getExprLoc(), diag::err_unsupported_unknown_any_expr)
-      << E->getSourceRange();
+        << E->getSourceRange();
     return ExprError();
   }
 
@@ -21798,7 +21884,8 @@ static ExprResult diagnoseUnknownAnyExpr(Sema &S, Expr *E) {
 
 ExprResult Sema::CheckPlaceholderExpr(Expr *E) {
   const BuiltinType *placeholderType = E->getType()->getAsPlaceholderType();
-  if (!placeholderType) return E;
+  if (!placeholderType)
+    return E;
 
   switch (placeholderType->getKind()) {
   case BuiltinType::UnresolvedTemplate: {
@@ -21979,18 +22066,15 @@ ExprResult Sema::CheckPlaceholderExpr(Expr *E) {
   case BuiltinType::OMPIterator:
     return ExprError(Diag(E->getBeginLoc(), diag::err_omp_iterator_use));
 
-  // Everything else should be impossible.
-#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
+    // Everything else should be impossible.
+#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix)                   \
   case BuiltinType::Id:
 #include "clang/Basic/OpenCLImageTypes.def"
-#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
-  case BuiltinType::Id:
+#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) case BuiltinType::Id:
 #include "clang/Basic/OpenCLExtensionTypes.def"
-#define SVE_TYPE(Name, Id, SingletonId) \
-  case BuiltinType::Id:
+#define SVE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
 #include "clang/Basic/AArch64ACLETypes.def"
-#define PPC_VECTOR_TYPE(Name, Id, Size) \
-  case BuiltinType::Id:
+#define PPC_VECTOR_TYPE(Name, Id, Size) case BuiltinType::Id:
 #include "clang/Basic/PPCTypes.def"
 #define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
 #include "clang/Basic/RISCVVTypes.def"
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 94a58870fa016..61aa1fc815b3d 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -90,33 +90,27 @@ static ExprResult CreateFunctionRefExpr(
                              CK_FunctionToPointerDecay);
 }
 
-static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
+static bool IsStandardConversion(Sema &S, Expr *From, QualType ToType,
                                  bool InOverloadResolution,
-                                 StandardConversionSequence &SCS,
-                                 bool CStyle,
+                                 StandardConversionSequence &SCS, bool CStyle,
                                  bool AllowObjCWritebackConversion);
 
-static bool IsTransparentUnionStandardConversion(Sema &S, Expr* From,
-                                                 QualType &ToType,
-                                                 bool InOverloadResolution,
-                                                 StandardConversionSequence &SCS,
-                                                 bool CStyle);
-static OverloadingResult
-IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
-                        UserDefinedConversionSequence& User,
-                        OverloadCandidateSet& Conversions,
-                        AllowedExplicit AllowExplicit,
-                        bool AllowObjCConversionOnExplicit);
+static bool IsTransparentUnionStandardConversion(
+    Sema &S, Expr *From, QualType &ToType, bool InOverloadResolution,
+    StandardConversionSequence &SCS, bool CStyle);
+static OverloadingResult IsUserDefinedConversion(
+    Sema &S, Expr *From, QualType ToType, UserDefinedConversionSequence &User,
+    OverloadCandidateSet &Conversions, AllowedExplicit AllowExplicit,
+    bool AllowObjCConversionOnExplicit);
 
 static ImplicitConversionSequence::CompareKind
 CompareStandardConversionSequences(Sema &S, SourceLocation Loc,
-                                   const StandardConversionSequence& SCS1,
-                                   const StandardConversionSequence& SCS2);
+                                   const StandardConversionSequence &SCS1,
+                                   const StandardConversionSequence &SCS2);
 
 static ImplicitConversionSequence::CompareKind
-CompareQualificationConversions(Sema &S,
-                                const StandardConversionSequence& SCS1,
-                                const StandardConversionSequence& SCS2);
+CompareQualificationConversions(Sema &S, const StandardConversionSequence &SCS1,
+                                const StandardConversionSequence &SCS2);
 
 static ImplicitConversionSequence::CompareKind
 CompareOverflowBehaviorConversions(Sema &S,
@@ -125,8 +119,8 @@ CompareOverflowBehaviorConversions(Sema &S,
 
 static ImplicitConversionSequence::CompareKind
 CompareDerivedToBaseConversions(Sema &S, SourceLocation Loc,
-                                const StandardConversionSequence& SCS1,
-                                const StandardConversionSequence& SCS2);
+                                const StandardConversionSequence &SCS1,
+                                const StandardConversionSequence &SCS2);
 
 /// GetConversionRank - Retrieve the implicit conversion rank
 /// corresponding to the given implicit conversion kind.
@@ -287,11 +281,10 @@ bool StandardConversionSequence::isPointerConversionToBool() const {
   // check for their presence as well as checking whether FromType is
   // a pointer.
   if (getToType(1)->isBooleanType() &&
-      (getFromType()->isPointerType() ||
-       getFromType()->isMemberPointerType() ||
+      (getFromType()->isPointerType() || getFromType()->isMemberPointerType() ||
        getFromType()->isObjCObjectPointerType() ||
-       getFromType()->isBlockPointerType() ||
-       First == ICK_Array_To_Pointer || First == ICK_Function_To_Pointer))
+       getFromType()->isBlockPointerType() || First == ICK_Array_To_Pointer ||
+       First == ICK_Function_To_Pointer))
     return true;
 
   return false;
@@ -301,9 +294,8 @@ bool StandardConversionSequence::isPointerConversionToBool() const {
 /// conversion is a conversion of a pointer to a void pointer. This is
 /// used as part of the ranking of standard conversion sequences (C++
 /// 13.3.3.2p4).
-bool
-StandardConversionSequence::
-isPointerConversionToVoidPointer(ASTContext& Context) const {
+bool StandardConversionSequence::isPointerConversionToVoidPointer(
+    ASTContext &Context) const {
   QualType FromType = getFromType();
   QualType ToType = getToType(1);
 
@@ -314,7 +306,7 @@ isPointerConversionToVoidPointer(ASTContext& Context) const {
     FromType = Context.getArrayDecayedType(FromType);
 
   if (Second == ICK_Pointer_Conversion && FromType->isAnyPointerType())
-    if (const PointerType* ToPtrType = ToType->getAs<PointerType>())
+    if (const PointerType *ToPtrType = ToType->getAs<PointerType>())
       return ToPtrType->getPointeeType()->isVoidType();
 
   return false;
@@ -707,42 +699,40 @@ void AmbiguousConversionSequence::construct() {
   new (&conversions()) ConversionSet();
 }
 
-void AmbiguousConversionSequence::destruct() {
-  conversions().~ConversionSet();
-}
+void AmbiguousConversionSequence::destruct() { conversions().~ConversionSet(); }
 
-void
-AmbiguousConversionSequence::copyFrom(const AmbiguousConversionSequence &O) {
+void AmbiguousConversionSequence::copyFrom(
+    const AmbiguousConversionSequence &O) {
   FromTypePtr = O.FromTypePtr;
   ToTypePtr = O.ToTypePtr;
   new (&conversions()) ConversionSet(O.conversions());
 }
 
 namespace {
-  // Structure used by DeductionFailureInfo to store
-  // template argument information.
-  struct DFIArguments {
-    TemplateArgument FirstArg;
-    TemplateArgument SecondArg;
-  };
-  // Structure used by DeductionFailureInfo to store
-  // template parameter and template argument information.
-  struct DFIParamWithArguments : DFIArguments {
-    TemplateParameter Param;
-  };
-  // Structure used by DeductionFailureInfo to store template argument
-  // information and the index of the problematic call argument.
-  struct DFIDeducedMismatchArgs : DFIArguments {
-    TemplateArgumentList *TemplateArgs;
-    unsigned CallArgIndex;
-  };
-  // Structure used by DeductionFailureInfo to store information about
-  // unsatisfied constraints.
-  struct CNSInfo {
-    TemplateArgumentList *TemplateArgs;
-    ConstraintSatisfaction Satisfaction;
-  };
-}
+// Structure used by DeductionFailureInfo to store
+// template argument information.
+struct DFIArguments {
+  TemplateArgument FirstArg;
+  TemplateArgument SecondArg;
+};
+// Structure used by DeductionFailureInfo to store
+// template parameter and template argument information.
+struct DFIParamWithArguments : DFIArguments {
+  TemplateParameter Param;
+};
+// Structure used by DeductionFailureInfo to store template argument
+// information and the index of the problematic call argument.
+struct DFIDeducedMismatchArgs : DFIArguments {
+  TemplateArgumentList *TemplateArgs;
+  unsigned CallArgIndex;
+};
+// Structure used by DeductionFailureInfo to store information about
+// unsatisfied constraints.
+struct CNSInfo {
+  TemplateArgumentList *TemplateArgs;
+  ConstraintSatisfaction Satisfaction;
+};
+} // namespace
 
 /// Convert from Sema's representation of template deduction information
 /// to the form used in overload-candidate information.
@@ -880,7 +870,7 @@ void DeductionFailureInfo::Destroy() {
 
 PartialDiagnosticAt *DeductionFailureInfo::getSFINAEDiagnostic() {
   if (HasDiagnostic)
-    return static_cast<PartialDiagnosticAt*>(static_cast<void*>(Diagnostic));
+    return static_cast<PartialDiagnosticAt *>(static_cast<void *>(Diagnostic));
   return nullptr;
 }
 
@@ -907,7 +897,7 @@ TemplateParameter DeductionFailureInfo::getTemplateParameter() {
   case TemplateDeductionResult::IncompletePack:
   case TemplateDeductionResult::Inconsistent:
   case TemplateDeductionResult::Underqualified:
-    return static_cast<DFIParamWithArguments*>(Data)->Param;
+    return static_cast<DFIParamWithArguments *>(Data)->Param;
 
   // Unhandled
   case TemplateDeductionResult::MiscellaneousDeductionFailure:
@@ -937,13 +927,13 @@ TemplateArgumentList *DeductionFailureInfo::getTemplateArgumentList() {
 
   case TemplateDeductionResult::DeducedMismatch:
   case TemplateDeductionResult::DeducedMismatchNested:
-    return static_cast<DFIDeducedMismatchArgs*>(Data)->TemplateArgs;
+    return static_cast<DFIDeducedMismatchArgs *>(Data)->TemplateArgs;
 
   case TemplateDeductionResult::SubstitutionFailure:
-    return static_cast<TemplateArgumentList*>(Data);
+    return static_cast<TemplateArgumentList *>(Data);
 
   case TemplateDeductionResult::ConstraintsNotSatisfied:
-    return static_cast<CNSInfo*>(Data)->TemplateArgs;
+    return static_cast<CNSInfo *>(Data)->TemplateArgs;
 
   // Unhandled
   case TemplateDeductionResult::MiscellaneousDeductionFailure:
@@ -975,7 +965,7 @@ const TemplateArgument *DeductionFailureInfo::getFirstArg() {
   case TemplateDeductionResult::DeducedMismatch:
   case TemplateDeductionResult::DeducedMismatchNested:
   case TemplateDeductionResult::NonDeducedMismatch:
-    return &static_cast<DFIArguments*>(Data)->FirstArg;
+    return &static_cast<DFIArguments *>(Data)->FirstArg;
 
   // Unhandled
   case TemplateDeductionResult::MiscellaneousDeductionFailure:
@@ -1007,7 +997,7 @@ const TemplateArgument *DeductionFailureInfo::getSecondArg() {
   case TemplateDeductionResult::DeducedMismatch:
   case TemplateDeductionResult::DeducedMismatchNested:
   case TemplateDeductionResult::NonDeducedMismatch:
-    return &static_cast<DFIArguments*>(Data)->SecondArg;
+    return &static_cast<DFIArguments *>(Data)->SecondArg;
 
   // Unhandled
   case TemplateDeductionResult::MiscellaneousDeductionFailure:
@@ -1022,7 +1012,7 @@ UnsignedOrNone DeductionFailureInfo::getCallArgIndex() {
   switch (static_cast<TemplateDeductionResult>(Result)) {
   case TemplateDeductionResult::DeducedMismatch:
   case TemplateDeductionResult::DeducedMismatchNested:
-    return static_cast<DFIDeducedMismatchArgs*>(Data)->CallArgIndex;
+    return static_cast<DFIDeducedMismatchArgs *>(Data)->CallArgIndex;
 
   default:
     return std::nullopt;
@@ -1146,28 +1136,29 @@ void OverloadCandidateSet::clear(CandidateSetKind CSK) {
 }
 
 namespace {
-  class UnbridgedCastsSet {
-    struct Entry {
-      Expr **Addr;
-      Expr *Saved;
-    };
-    SmallVector<Entry, 2> Entries;
+class UnbridgedCastsSet {
+  struct Entry {
+    Expr **Addr;
+    Expr *Saved;
+  };
+  SmallVector<Entry, 2> Entries;
 
-  public:
-    void save(Sema &S, Expr *&E) {
-      assert(E->hasPlaceholderType(BuiltinType::ARCUnbridgedCast));
-      Entry entry = { &E, E };
-      Entries.push_back(entry);
-      E = S.ObjC().stripARCUnbridgedCast(E);
-    }
+public:
+  void save(Sema &S, Expr *&E) {
+    assert(E->hasPlaceholderType(BuiltinType::ARCUnbridgedCast));
+    Entry entry = {&E, E};
+    Entries.push_back(entry);
+    E = S.ObjC().stripARCUnbridgedCast(E);
+  }
 
-    void restore() {
-      for (SmallVectorImpl<Entry>::iterator
-             i = Entries.begin(), e = Entries.end(); i != e; ++i)
-        *i->Addr = i->Saved;
-    }
-  };
-}
+  void restore() {
+    for (SmallVectorImpl<Entry>::iterator i = Entries.begin(),
+                                          e = Entries.end();
+         i != e; ++i)
+      *i->Addr = i->Saved;
+  }
+};
+} // namespace
 
 /// checkPlaceholderForOverload - Do any interesting placeholder-like
 /// preprocessing on the given expression.
@@ -1179,10 +1170,11 @@ namespace {
 static bool
 checkPlaceholderForOverload(Sema &S, Expr *&E,
                             UnbridgedCastsSet *unbridgedCasts = nullptr) {
-  if (const BuiltinType *placeholder =  E->getType()->getAsPlaceholderType()) {
+  if (const BuiltinType *placeholder = E->getType()->getAsPlaceholderType()) {
     // We can't handle overloaded expressions here because overload
     // resolution might reasonably tweak them.
-    if (placeholder->getKind() == BuiltinType::Overload) return false;
+    if (placeholder->getKind() == BuiltinType::Overload)
+      return false;
 
     // If the context potentially accepts unbridged ARC casts, strip
     // the unbridged cast and add it to the collection for later restoration.
@@ -1219,8 +1211,7 @@ static bool checkArgPlaceholdersForOverload(Sema &S, MultiExprArg Args,
 OverloadKind Sema::CheckOverload(Scope *S, FunctionDecl *New,
                                  const LookupResult &Old, NamedDecl *&Match,
                                  bool NewIsUsingDecl) {
-  for (LookupResult::iterator I = Old.begin(), E = Old.end();
-         I != E; ++I) {
+  for (LookupResult::iterator I = Old.begin(), E = Old.end(); I != E; ++I) {
     NamedDecl *OldD = *I;
 
     bool OldIsUsingDecl = false;
@@ -1229,7 +1220,8 @@ OverloadKind Sema::CheckOverload(Scope *S, FunctionDecl *New,
 
       // We can always introduce two using declarations into the same
       // context, even if they have identical signatures.
-      if (NewIsUsingDecl) continue;
+      if (NewIsUsingDecl)
+        continue;
 
       OldD = cast<UsingShadowDecl>(OldD)->getTargetDecl();
     }
@@ -1244,9 +1236,9 @@ OverloadKind Sema::CheckOverload(Scope *S, FunctionDecl *New,
     // Essentially, these rules are the normal rules, except that
     // function templates hide function templates with different
     // return types or template parameter lists.
-    bool UseMemberUsingDeclRules =
-      (OldIsUsingDecl || NewIsUsingDecl) && CurContext->isRecord() &&
-      !New->getFriendObjectKind();
+    bool UseMemberUsingDeclRules = (OldIsUsingDecl || NewIsUsingDecl) &&
+                                   CurContext->isRecord() &&
+                                   !New->getFriendObjectKind();
 
     if (FunctionDecl *OldF = OldD->getAsFunction()) {
       if (!IsOverload(New, OldF, UseMemberUsingDeclRules)) {
@@ -1317,7 +1309,7 @@ OverloadKind Sema::CheckOverload(Scope *S, FunctionDecl *New,
     LookupResult TemplateSpecResult(LookupResult::Temporary, Old);
     TemplateSpecResult.addAllDecls(Old);
     if (CheckFunctionTemplateSpecialization(New, nullptr, TemplateSpecResult,
-                                            /*QualifiedFriend*/true)) {
+                                            /*QualifiedFriend*/ true)) {
       New->setInvalidDecl();
       return OverloadKind::Overload;
     }
@@ -1598,10 +1590,10 @@ static bool IsOverloadOrOverrideImpl(Sema &SemaRef, FunctionDecl *New,
 
   // enable_if attributes are an order-sensitive part of the signature.
   for (specific_attr_iterator<EnableIfAttr>
-         NewI = New->specific_attr_begin<EnableIfAttr>(),
-         NewE = New->specific_attr_end<EnableIfAttr>(),
-         OldI = Old->specific_attr_begin<EnableIfAttr>(),
-         OldE = Old->specific_attr_end<EnableIfAttr>();
+           NewI = New->specific_attr_begin<EnableIfAttr>(),
+           NewE = New->specific_attr_end<EnableIfAttr>(),
+           OldI = Old->specific_attr_begin<EnableIfAttr>(),
+           OldE = Old->specific_attr_end<EnableIfAttr>();
        NewI != NewE || OldI != OldE; ++NewI, ++OldI) {
     if (NewI == NewE || OldI == OldE)
       return true;
@@ -1664,14 +1656,10 @@ bool Sema::IsOverride(FunctionDecl *MD, FunctionDecl *BaseMD,
 ///
 /// Produces an implicit conversion sequence for when a standard conversion
 /// is not an option. See TryImplicitConversion for more information.
-static ImplicitConversionSequence
-TryUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
-                         bool SuppressUserConversions,
-                         AllowedExplicit AllowExplicit,
-                         bool InOverloadResolution,
-                         bool CStyle,
-                         bool AllowObjCWritebackConversion,
-                         bool AllowObjCConversionOnExplicit) {
+static ImplicitConversionSequence TryUserDefinedConversion(
+    Sema &S, Expr *From, QualType ToType, bool SuppressUserConversions,
+    AllowedExplicit AllowExplicit, bool InOverloadResolution, bool CStyle,
+    bool AllowObjCWritebackConversion, bool AllowObjCConversionOnExplicit) {
   ImplicitConversionSequence ICS;
 
   if (SuppressUserConversions) {
@@ -1684,8 +1672,8 @@ TryUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
   // Attempt user-defined conversion.
   OverloadCandidateSet Conversions(From->getExprLoc(),
                                    OverloadCandidateSet::CSK_Normal);
-  switch (IsUserDefinedConversion(S, From, ToType, ICS.UserDefined,
-                                  Conversions, AllowExplicit,
+  switch (IsUserDefinedConversion(S, From, ToType, ICS.UserDefined, Conversions,
+                                  AllowExplicit,
                                   AllowObjCConversionOnExplicit)) {
   case OR_Success:
   case OR_Deleted:
@@ -1697,8 +1685,8 @@ TryUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
     //   given Conversion rank, in spite of the fact that a copy
     //   constructor (i.e., a user-defined conversion function) is
     //   called for those cases.
-    if (CXXConstructorDecl *Constructor
-          = dyn_cast<CXXConstructorDecl>(ICS.UserDefined.ConversionFunction)) {
+    if (CXXConstructorDecl *Constructor =
+            dyn_cast<CXXConstructorDecl>(ICS.UserDefined.ConversionFunction)) {
       QualType FromType;
       SourceLocation FromLoc;
       // C++11 [over.ics.list]p6, per DR2137:
@@ -1721,8 +1709,8 @@ TryUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
       }
       QualType FromCanon =
           S.Context.getCanonicalType(FromType.getUnqualifiedType());
-      QualType ToCanon
-        = S.Context.getCanonicalType(ToType).getUnqualifiedType();
+      QualType ToCanon =
+          S.Context.getCanonicalType(ToType).getUnqualifiedType();
       if ((FromCanon == ToCanon ||
            S.IsDerivedFrom(FromLoc, FromCanon, ToCanon))) {
         // Turn this into a "standard" conversion sequence, so that it
@@ -1787,17 +1775,13 @@ TryUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
 /// \param AllowObjCWritebackConversion Whether we allow the Objective-C
 /// writeback conversion, which allows __autoreleasing id* parameters to
 /// be initialized with __strong id* or __weak id* arguments.
-static ImplicitConversionSequence
-TryImplicitConversion(Sema &S, Expr *From, QualType ToType,
-                      bool SuppressUserConversions,
-                      AllowedExplicit AllowExplicit,
-                      bool InOverloadResolution,
-                      bool CStyle,
-                      bool AllowObjCWritebackConversion,
-                      bool AllowObjCConversionOnExplicit) {
+static ImplicitConversionSequence TryImplicitConversion(
+    Sema &S, Expr *From, QualType ToType, bool SuppressUserConversions,
+    AllowedExplicit AllowExplicit, bool InOverloadResolution, bool CStyle,
+    bool AllowObjCWritebackConversion, bool AllowObjCConversionOnExplicit) {
   ImplicitConversionSequence ICS;
-  if (IsStandardConversion(S, From, ToType, InOverloadResolution,
-                           ICS.Standard, CStyle, AllowObjCWritebackConversion)){
+  if (IsStandardConversion(S, From, ToType, InOverloadResolution, ICS.Standard,
+                           CStyle, AllowObjCWritebackConversion)) {
     ICS.setStandard();
     return ICS;
   }
@@ -1873,13 +1857,10 @@ TryImplicitConversion(Sema &S, Expr *From, QualType ToType,
                                   AllowObjCConversionOnExplicit);
 }
 
-ImplicitConversionSequence
-Sema::TryImplicitConversion(Expr *From, QualType ToType,
-                            bool SuppressUserConversions,
-                            AllowedExplicit AllowExplicit,
-                            bool InOverloadResolution,
-                            bool CStyle,
-                            bool AllowObjCWritebackConversion) {
+ImplicitConversionSequence Sema::TryImplicitConversion(
+    Expr *From, QualType ToType, bool SuppressUserConversions,
+    AllowedExplicit AllowExplicit, bool InOverloadResolution, bool CStyle,
+    bool AllowObjCWritebackConversion) {
   return ::TryImplicitConversion(*this, From, ToType, SuppressUserConversions,
                                  AllowExplicit, InOverloadResolution, CStyle,
                                  AllowObjCWritebackConversion,
@@ -1931,7 +1912,8 @@ bool Sema::IsFunctionConversion(QualType FromType, QualType ToType) const {
   CanQualType CanTo = Context.getCanonicalType(ToType);
   CanQualType CanFrom = Context.getCanonicalType(FromType);
   Type::TypeClass TyClass = CanTo->getTypeClass();
-  if (TyClass != CanFrom->getTypeClass()) return false;
+  if (TyClass != CanFrom->getTypeClass())
+    return false;
   if (TyClass != Type::FunctionProto && TyClass != Type::FunctionNoProto) {
     if (TyClass == Type::Pointer) {
       CanTo = CanTo.castAs<PointerType>()->getPointeeType();
@@ -1953,7 +1935,8 @@ bool Sema::IsFunctionConversion(QualType FromType, QualType ToType) const {
     }
 
     TyClass = CanTo->getTypeClass();
-    if (TyClass != CanFrom->getTypeClass()) return false;
+    if (TyClass != CanFrom->getTypeClass())
+      return false;
     if (TyClass != Type::FunctionProto && TyClass != Type::FunctionNoProto)
       return false;
   }
@@ -1991,9 +1974,9 @@ bool Sema::IsFunctionConversion(QualType FromType, QualType ToType) const {
   if (FromFPT && ToFPT) {
     if (FromFPT->isNothrow() && !ToFPT->isNothrow()) {
       FromFn = cast<FunctionType>(
-          Context.getFunctionTypeWithExceptionSpec(QualType(FromFPT, 0),
-                                                   EST_None)
-                 .getTypePtr());
+          Context
+              .getFunctionTypeWithExceptionSpec(QualType(FromFPT, 0), EST_None)
+              .getTypePtr());
       Changed = true;
     }
 
@@ -2036,7 +2019,8 @@ bool Sema::IsFunctionConversion(QualType FromType, QualType ToType) const {
     return false;
 
   assert(QualType(FromFn, 0).isCanonical());
-  if (QualType(FromFn, 0) != CanTo) return false;
+  if (QualType(FromFn, 0) != CanTo)
+    return false;
 
   return true;
 }
@@ -2298,8 +2282,7 @@ static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType,
 
 static bool tryAtomicConversion(Sema &S, Expr *From, QualType ToType,
                                 bool InOverloadResolution,
-                                StandardConversionSequence &SCS,
-                                bool CStyle);
+                                StandardConversionSequence &SCS, bool CStyle);
 
 static bool tryOverflowBehaviorTypeConversion(Sema &S, Expr *From,
                                               QualType ToType,
@@ -2315,10 +2298,9 @@ static bool tryOverflowBehaviorTypeConversion(Sema &S, Expr *From,
 /// contain the standard conversion sequence required to perform this
 /// conversion and this routine will return true. Otherwise, this
 /// routine will return false and the value of SCS is unspecified.
-static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
+static bool IsStandardConversion(Sema &S, Expr *From, QualType ToType,
                                  bool InOverloadResolution,
-                                 StandardConversionSequence &SCS,
-                                 bool CStyle,
+                                 StandardConversionSequence &SCS, bool CStyle,
                                  bool AllowObjCWritebackConversion) {
   QualType FromType = From->getType();
 
@@ -2340,9 +2322,8 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
 
   if (FromType == S.Context.OverloadTy) {
     DeclAccessPair AccessPair;
-    if (FunctionDecl *Fn
-          = S.ResolveAddressOfOverloadedFunction(From, ToType, false,
-                                                 AccessPair)) {
+    if (FunctionDecl *Fn = S.ResolveAddressOfOverloadedFunction(
+            From, ToType, false, AccessPair)) {
       // We were able to resolve the address of the overloaded function,
       // so we can convert to the type of that function.
       FromType = Fn->getType();
@@ -2369,14 +2350,14 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
           !Method->isExplicitObjectMemberFunction()) {
         assert(isa<UnaryOperator>(From->IgnoreParens()) &&
                "Non-unary operator on non-static member address");
-        assert(cast<UnaryOperator>(From->IgnoreParens())->getOpcode()
-               == UO_AddrOf &&
+        assert(cast<UnaryOperator>(From->IgnoreParens())->getOpcode() ==
+                   UO_AddrOf &&
                "Non-address-of operator on non-static member address");
         FromType = S.Context.getMemberPointerType(
             FromType, /*Qualifier=*/std::nullopt, Method->getParent());
       } else if (isa<UnaryOperator>(From->IgnoreParens())) {
         assert(cast<UnaryOperator>(From->IgnoreParens())->getOpcode() ==
-               UO_AddrOf &&
+                   UO_AddrOf &&
                "Non-address-of operator for overloaded function expression");
         FromType = S.Context.getPointerType(FromType);
       }
@@ -2629,8 +2610,8 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
   //   a conversion. [...]
   QualType CanonFrom = S.Context.getCanonicalType(FromType);
   QualType CanonTo = S.Context.getCanonicalType(ToType);
-  if (CanonFrom.getLocalUnqualifiedType()
-                                     == CanonTo.getLocalUnqualifiedType() &&
+  if (CanonFrom.getLocalUnqualifiedType() ==
+          CanonTo.getLocalUnqualifiedType() &&
       CanonFrom.getLocalQualifiers() != CanonTo.getLocalQualifiers()) {
     FromType = ToType;
     CanonFrom = CanonTo;
@@ -2686,12 +2667,9 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
   return true;
 }
 
-static bool
-IsTransparentUnionStandardConversion(Sema &S, Expr* From,
-                                     QualType &ToType,
-                                     bool InOverloadResolution,
-                                     StandardConversionSequence &SCS,
-                                     bool CStyle) {
+static bool IsTransparentUnionStandardConversion(
+    Sema &S, Expr *From, QualType &ToType, bool InOverloadResolution,
+    StandardConversionSequence &SCS, bool CStyle) {
 
   const RecordType *UT = ToType->getAsUnionType();
   if (!UT)
@@ -2802,11 +2780,9 @@ bool Sema::IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType) {
 
     // The types we'll try to promote to, in the appropriate
     // order. Try each of these types.
-    QualType PromoteTypes[6] = {
-      Context.IntTy, Context.UnsignedIntTy,
-      Context.LongTy, Context.UnsignedLongTy ,
-      Context.LongLongTy, Context.UnsignedLongLongTy
-    };
+    QualType PromoteTypes[6] = {Context.IntTy,      Context.UnsignedIntTy,
+                                Context.LongTy,     Context.UnsignedLongTy,
+                                Context.LongLongTy, Context.UnsignedLongLongTy};
     for (int Idx = 0; Idx < 6; ++Idx) {
       uint64_t ToSize = Context.getTypeSize(PromoteTypes[Idx]);
       if (FromSize < ToSize ||
@@ -2904,7 +2880,7 @@ bool Sema::IsFloatingPointPromotion(QualType FromType, QualType ToType) {
 
       // Half can be promoted to float.
       if (!getLangOpts().NativeHalfType &&
-           FromBuiltin->getKind() == BuiltinType::Half &&
+          FromBuiltin->getKind() == BuiltinType::Half &&
           ToBuiltin->getKind() == BuiltinType::Float)
         return true;
     }
@@ -2923,8 +2899,8 @@ bool Sema::IsComplexPromotion(QualType FromType, QualType ToType) {
 
   return IsFloatingPointPromotion(FromComplex->getElementType(),
                                   ToComplex->getElementType()) ||
-    IsIntegralPromotion(nullptr, FromComplex->getElementType(),
-                        ToComplex->getElementType());
+         IsIntegralPromotion(nullptr, FromComplex->getElementType(),
+                             ToComplex->getElementType());
 }
 
 bool Sema::IsOverflowBehaviorTypePromotion(QualType FromType, QualType ToType) {
@@ -2970,9 +2946,8 @@ bool Sema::IsOverflowBehaviorTypeConversion(QualType FromType,
 /// the right set of qualifiers on its pointee.
 ///
 static QualType
-BuildSimilarlyQualifiedPointerType(const Type *FromPtr,
-                                   QualType ToPointee, QualType ToType,
-                                   ASTContext &Context,
+BuildSimilarlyQualifiedPointerType(const Type *FromPtr, QualType ToPointee,
+                                   QualType ToType, ASTContext &Context,
                                    bool StripObjCLifetime = false) {
   assert((FromPtr->getTypeClass() == Type::Pointer ||
           FromPtr->getTypeClass() == Type::ObjCObjectPointer) &&
@@ -2982,8 +2957,8 @@ BuildSimilarlyQualifiedPointerType(const Type *FromPtr,
   if (ToType->isObjCIdType() || ToType->isObjCQualifiedIdType())
     return ToType.getUnqualifiedType();
 
-  QualType CanonFromPointee
-    = Context.getCanonicalType(FromPtr->getPointeeType());
+  QualType CanonFromPointee =
+      Context.getCanonicalType(FromPtr->getPointeeType());
   QualType CanonToPointee = Context.getCanonicalType(ToPointee);
   Qualifiers Quals = CanonFromPointee.getQualifiers();
 
@@ -3004,8 +2979,8 @@ BuildSimilarlyQualifiedPointerType(const Type *FromPtr,
   }
 
   // Just build a canonical type that has the right qualifiers.
-  QualType QualifiedCanonToPointee
-    = Context.getQualifiedType(CanonToPointee.getLocalUnqualifiedType(), Quals);
+  QualType QualifiedCanonToPointee =
+      Context.getQualifiedType(CanonToPointee.getLocalUnqualifiedType(), Quals);
 
   if (isa<ObjCObjectPointerType>(ToType))
     return Context.getObjCObjectPointerType(QualifiedCanonToPointee);
@@ -3021,14 +2996,14 @@ static bool isNullPointerConstantForConversion(Expr *Expr,
       Expr->getType()->isIntegerType() && !Expr->getType()->isEnumeralType())
     return !InOverloadResolution;
 
-  return Expr->isNullPointerConstant(Context,
-                    InOverloadResolution? Expr::NPC_ValueDependentIsNotNull
-                                        : Expr::NPC_ValueDependentIsNull);
+  return Expr->isNullPointerConstant(
+      Context, InOverloadResolution ? Expr::NPC_ValueDependentIsNotNull
+                                    : Expr::NPC_ValueDependentIsNull);
 }
 
 bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
                                bool InOverloadResolution,
-                               QualType& ConvertedType,
+                               QualType &ConvertedType,
                                bool &IncompatibleObjC) {
   IncompatibleObjC = false;
   if (isObjCPointerConversion(FromType, ToType, ConvertedType,
@@ -3064,7 +3039,7 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
     return true;
   }
 
-  const PointerType* ToTypePtr = ToType->getAs<PointerType>();
+  const PointerType *ToTypePtr = ToType->getAs<PointerType>();
   if (!ToTypePtr)
     return false;
 
@@ -3100,19 +3075,17 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
   // 4.10p2).
   if (FromPointeeType->isIncompleteOrObjectType() &&
       ToPointeeType->isVoidType()) {
-    ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr,
-                                                       ToPointeeType,
-                                                       ToType, Context,
-                                                   /*StripObjCLifetime=*/true);
+    ConvertedType = BuildSimilarlyQualifiedPointerType(
+        FromTypePtr, ToPointeeType, ToType, Context,
+        /*StripObjCLifetime=*/true);
     return true;
   }
 
   // MSVC allows implicit function to void* type conversion.
   if (getLangOpts().MSVCCompat && FromPointeeType->isFunctionType() &&
       ToPointeeType->isVoidType()) {
-    ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr,
-                                                       ToPointeeType,
-                                                       ToType, Context);
+    ConvertedType = BuildSimilarlyQualifiedPointerType(
+        FromTypePtr, ToPointeeType, ToType, Context);
     return true;
   }
 
@@ -3120,9 +3093,8 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
   // conversion for compatible-but-not-identical pointee types.
   if (!getLangOpts().CPlusPlus &&
       Context.typesAreCompatible(FromPointeeType, ToPointeeType)) {
-    ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr,
-                                                       ToPointeeType,
-                                                       ToType, Context);
+    ConvertedType = BuildSimilarlyQualifiedPointerType(
+        FromTypePtr, ToPointeeType, ToType, Context);
     return true;
   }
 
@@ -3143,17 +3115,15 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
       ToPointeeType->isRecordType() &&
       !Context.hasSameUnqualifiedType(FromPointeeType, ToPointeeType) &&
       IsDerivedFrom(From->getBeginLoc(), FromPointeeType, ToPointeeType)) {
-    ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr,
-                                                       ToPointeeType,
-                                                       ToType, Context);
+    ConvertedType = BuildSimilarlyQualifiedPointerType(
+        FromTypePtr, ToPointeeType, ToType, Context);
     return true;
   }
 
   if (FromPointeeType->isVectorType() && ToPointeeType->isVectorType() &&
       Context.areCompatibleVectorTypes(FromPointeeType, ToPointeeType)) {
-    ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr,
-                                                       ToPointeeType,
-                                                       ToType, Context);
+    ConvertedType = BuildSimilarlyQualifiedPointerType(
+        FromTypePtr, ToPointeeType, ToType, Context);
     return true;
   }
 
@@ -3161,7 +3131,8 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
 }
 
 /// Adopt the given qualifiers for the given type.
-static QualType AdoptQualifiers(ASTContext &Context, QualType T, Qualifiers Qs){
+static QualType AdoptQualifiers(ASTContext &Context, QualType T,
+                                Qualifiers Qs) {
   Qualifiers TQs = T.getQualifiers();
 
   // Check whether qualifiers already match.
@@ -3175,7 +3146,7 @@ static QualType AdoptQualifiers(ASTContext &Context, QualType T, Qualifiers Qs){
 }
 
 bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
-                                   QualType& ConvertedType,
+                                   QualType &ConvertedType,
                                    bool &IncompatibleObjC) {
   if (!getLangOpts().ObjC)
     return false;
@@ -3184,10 +3155,10 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
   Qualifiers FromQualifiers = FromType.getQualifiers();
 
   // First, we handle all conversions on ObjC object pointer types.
-  const ObjCObjectPointerType* ToObjCPtr =
-    ToType->getAs<ObjCObjectPointerType>();
+  const ObjCObjectPointerType *ToObjCPtr =
+      ToType->getAs<ObjCObjectPointerType>();
   const ObjCObjectPointerType *FromObjCPtr =
-    FromType->getAs<ObjCObjectPointerType>();
+      FromType->getAs<ObjCObjectPointerType>();
 
   if (ToObjCPtr && FromObjCPtr) {
     // If the pointee types are the same (ignoring qualifications),
@@ -3198,15 +3169,14 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
 
     // Conversion between Objective-C pointers.
     if (Context.canAssignObjCInterfaces(ToObjCPtr, FromObjCPtr)) {
-      const ObjCInterfaceType* LHS = ToObjCPtr->getInterfaceType();
-      const ObjCInterfaceType* RHS = FromObjCPtr->getInterfaceType();
+      const ObjCInterfaceType *LHS = ToObjCPtr->getInterfaceType();
+      const ObjCInterfaceType *RHS = FromObjCPtr->getInterfaceType();
       if (getLangOpts().CPlusPlus && LHS && RHS &&
           !ToObjCPtr->getPointeeType().isAtLeastAsQualifiedAs(
               FromObjCPtr->getPointeeType(), getASTContext()))
         return false;
-      ConvertedType = BuildSimilarlyQualifiedPointerType(FromObjCPtr,
-                                                   ToObjCPtr->getPointeeType(),
-                                                         ToType, Context);
+      ConvertedType = BuildSimilarlyQualifiedPointerType(
+          FromObjCPtr, ToObjCPtr->getPointeeType(), ToType, Context);
       ConvertedType = AdoptQualifiers(Context, ConvertedType, FromQualifiers);
       return true;
     }
@@ -3216,9 +3186,8 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
       // interfaces, which is permitted. However, we're going to
       // complain about it.
       IncompatibleObjC = true;
-      ConvertedType = BuildSimilarlyQualifiedPointerType(FromObjCPtr,
-                                                   ToObjCPtr->getPointeeType(),
-                                                         ToType, Context);
+      ConvertedType = BuildSimilarlyQualifiedPointerType(
+          FromObjCPtr, ToObjCPtr->getPointeeType(), ToType, Context);
       ConvertedType = AdoptQualifiers(Context, ConvertedType, FromQualifiers);
       return true;
     }
@@ -3228,7 +3197,7 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
   if (const PointerType *ToCPtr = ToType->getAs<PointerType>())
     ToPointeeType = ToCPtr->getPointeeType();
   else if (const BlockPointerType *ToBlockPtr =
-            ToType->getAs<BlockPointerType>()) {
+               ToType->getAs<BlockPointerType>()) {
     // Objective C++: We're able to convert from a pointer to any object
     // to a block pointer type.
     if (FromObjCPtr && FromObjCPtr->isObjCBuiltinType()) {
@@ -3236,22 +3205,20 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
       return true;
     }
     ToPointeeType = ToBlockPtr->getPointeeType();
-  }
-  else if (FromType->getAs<BlockPointerType>() &&
-           ToObjCPtr && ToObjCPtr->isObjCBuiltinType()) {
+  } else if (FromType->getAs<BlockPointerType>() && ToObjCPtr &&
+             ToObjCPtr->isObjCBuiltinType()) {
     // Objective C++: We're able to convert from a block pointer type to a
     // pointer to any object.
     ConvertedType = AdoptQualifiers(Context, ToType, FromQualifiers);
     return true;
-  }
-  else
+  } else
     return false;
 
   QualType FromPointeeType;
   if (const PointerType *FromCPtr = FromType->getAs<PointerType>())
     FromPointeeType = FromCPtr->getPointeeType();
   else if (const BlockPointerType *FromBlockPtr =
-           FromType->getAs<BlockPointerType>())
+               FromType->getAs<BlockPointerType>())
     FromPointeeType = FromBlockPtr->getPointeeType();
   else
     return false;
@@ -3283,15 +3250,15 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
   // differences in the argument and result types are in Objective-C
   // pointer conversions. If so, we permit the conversion (but
   // complain about it).
-  const FunctionProtoType *FromFunctionType
-    = FromPointeeType->getAs<FunctionProtoType>();
-  const FunctionProtoType *ToFunctionType
-    = ToPointeeType->getAs<FunctionProtoType>();
+  const FunctionProtoType *FromFunctionType =
+      FromPointeeType->getAs<FunctionProtoType>();
+  const FunctionProtoType *ToFunctionType =
+      ToPointeeType->getAs<FunctionProtoType>();
   if (FromFunctionType && ToFunctionType) {
     // If the function types are exactly the same, this isn't an
     // Objective-C pointer conversion.
-    if (Context.getCanonicalType(FromPointeeType)
-          == Context.getCanonicalType(ToPointeeType))
+    if (Context.getCanonicalType(FromPointeeType) ==
+        Context.getCanonicalType(ToPointeeType))
       return false;
 
     // Perform the quick checks that will tell us whether these
@@ -3320,11 +3287,11 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
          ArgIdx != NumArgs; ++ArgIdx) {
       QualType FromArgType = FromFunctionType->getParamType(ArgIdx);
       QualType ToArgType = ToFunctionType->getParamType(ArgIdx);
-      if (Context.getCanonicalType(FromArgType)
-            == Context.getCanonicalType(ToArgType)) {
+      if (Context.getCanonicalType(FromArgType) ==
+          Context.getCanonicalType(ToArgType)) {
         // Okay, the types match exactly. Nothing to do.
-      } else if (isObjCPointerConversion(FromArgType, ToArgType,
-                                         ConvertedType, IncompatibleObjC)) {
+      } else if (isObjCPointerConversion(FromArgType, ToArgType, ConvertedType,
+                                         IncompatibleObjC)) {
         // Okay, we have an Objective-C pointer conversion.
         HasObjCConversion = true;
       } else {
@@ -3346,17 +3313,16 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
 }
 
 bool Sema::IsBlockPointerConversion(QualType FromType, QualType ToType,
-                                    QualType& ConvertedType) {
+                                    QualType &ConvertedType) {
   QualType ToPointeeType;
-  if (const BlockPointerType *ToBlockPtr =
-        ToType->getAs<BlockPointerType>())
+  if (const BlockPointerType *ToBlockPtr = ToType->getAs<BlockPointerType>())
     ToPointeeType = ToBlockPtr->getPointeeType();
   else
     return false;
 
   QualType FromPointeeType;
   if (const BlockPointerType *FromBlockPtr =
-      FromType->getAs<BlockPointerType>())
+          FromType->getAs<BlockPointerType>())
     FromPointeeType = FromBlockPtr->getPointeeType();
   else
     return false;
@@ -3364,10 +3330,10 @@ bool Sema::IsBlockPointerConversion(QualType FromType, QualType ToType,
   // differences in the argument and result types are in Objective-C
   // pointer conversions. If so, we permit the conversion.
 
-  const FunctionProtoType *FromFunctionType
-    = FromPointeeType->getAs<FunctionProtoType>();
-  const FunctionProtoType *ToFunctionType
-    = ToPointeeType->getAs<FunctionProtoType>();
+  const FunctionProtoType *FromFunctionType =
+      FromPointeeType->getAs<FunctionProtoType>();
+  const FunctionProtoType *ToFunctionType =
+      ToPointeeType->getAs<FunctionProtoType>();
 
   if (!FromFunctionType || !ToFunctionType)
     return false;
@@ -3395,47 +3361,45 @@ bool Sema::IsBlockPointerConversion(QualType FromType, QualType ToType,
     QualType LHS = ToFunctionType->getReturnType();
     if ((!getLangOpts().CPlusPlus || !RHS->isRecordType()) &&
         !RHS.hasQualifiers() && LHS.hasQualifiers())
-       LHS = LHS.getUnqualifiedType();
-
-     if (Context.hasSameType(RHS,LHS)) {
-       // OK exact match.
-     } else if (isObjCPointerConversion(RHS, LHS,
-                                        ConvertedType, IncompatibleObjC)) {
-     if (IncompatibleObjC)
-       return false;
-     // Okay, we have an Objective-C pointer conversion.
-     }
-     else
-       return false;
-   }
-
-   // Check argument types.
-   for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumParams();
-        ArgIdx != NumArgs; ++ArgIdx) {
-     IncompatibleObjC = false;
-     QualType FromArgType = FromFunctionType->getParamType(ArgIdx);
-     QualType ToArgType = ToFunctionType->getParamType(ArgIdx);
-     if (Context.hasSameType(FromArgType, ToArgType)) {
-       // Okay, the types match exactly. Nothing to do.
-     } else if (isObjCPointerConversion(ToArgType, FromArgType,
-                                        ConvertedType, IncompatibleObjC)) {
-       if (IncompatibleObjC)
-         return false;
-       // Okay, we have an Objective-C pointer conversion.
-     } else
-       // Argument types are too different. Abort.
-       return false;
-   }
-
-   SmallVector<FunctionProtoType::ExtParameterInfo, 4> NewParamInfos;
-   bool CanUseToFPT, CanUseFromFPT;
-   if (!Context.mergeExtParameterInfo(ToFunctionType, FromFunctionType,
-                                      CanUseToFPT, CanUseFromFPT,
-                                      NewParamInfos))
-     return false;
-
-   ConvertedType = ToType;
-   return true;
+      LHS = LHS.getUnqualifiedType();
+
+    if (Context.hasSameType(RHS, LHS)) {
+      // OK exact match.
+    } else if (isObjCPointerConversion(RHS, LHS, ConvertedType,
+                                       IncompatibleObjC)) {
+      if (IncompatibleObjC)
+        return false;
+      // Okay, we have an Objective-C pointer conversion.
+    } else
+      return false;
+  }
+
+  // Check argument types.
+  for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumParams();
+       ArgIdx != NumArgs; ++ArgIdx) {
+    IncompatibleObjC = false;
+    QualType FromArgType = FromFunctionType->getParamType(ArgIdx);
+    QualType ToArgType = ToFunctionType->getParamType(ArgIdx);
+    if (Context.hasSameType(FromArgType, ToArgType)) {
+      // Okay, the types match exactly. Nothing to do.
+    } else if (isObjCPointerConversion(ToArgType, FromArgType, ConvertedType,
+                                       IncompatibleObjC)) {
+      if (IncompatibleObjC)
+        return false;
+      // Okay, we have an Objective-C pointer conversion.
+    } else
+      // Argument types are too different. Abort.
+      return false;
+  }
+
+  SmallVector<FunctionProtoType::ExtParameterInfo, 4> NewParamInfos;
+  bool CanUseToFPT, CanUseFromFPT;
+  if (!Context.mergeExtParameterInfo(ToFunctionType, FromFunctionType,
+                                     CanUseToFPT, CanUseFromFPT, NewParamInfos))
+    return false;
+
+  ConvertedType = ToType;
+  return true;
 }
 
 enum {
@@ -3621,10 +3585,8 @@ bool Sema::FunctionNonObjectParamTypesAreEqual(const FunctionDecl *OldFunction,
                                     ArgPos, Reversed);
 }
 
-bool Sema::CheckPointerConversion(Expr *From, QualType ToType,
-                                  CastKind &Kind,
-                                  CXXCastPath& BasePath,
-                                  bool IgnoreBaseAccess,
+bool Sema::CheckPointerConversion(Expr *From, QualType ToType, CastKind &Kind,
+                                  CXXCastPath &BasePath, bool IgnoreBaseAccess,
                                   bool Diagnose) {
   QualType FromType = From->getType();
   bool IsCStyleOrFunctionalCast = IgnoreBaseAccess;
@@ -3637,15 +3599,15 @@ bool Sema::CheckPointerConversion(Expr *From, QualType ToType,
     if (Context.hasSameUnqualifiedType(From->getType(), Context.BoolTy))
       DiagRuntimeBehavior(From->getExprLoc(), From,
                           PDiag(diag::warn_impcast_bool_to_null_pointer)
-                            << ToType << From->getSourceRange());
+                              << ToType << From->getSourceRange());
     else if (!isUnevaluatedContext())
       Diag(From->getExprLoc(), diag::warn_non_literal_null_pointer)
-        << ToType << From->getSourceRange();
+          << ToType << From->getSourceRange();
   }
   if (const PointerType *ToPtrType = ToType->getAs<PointerType>()) {
     if (const PointerType *FromPtrType = FromType->getAs<PointerType>()) {
       QualType FromPointeeType = FromPtrType->getPointeeType(),
-               ToPointeeType   = ToPtrType->getPointeeType();
+               ToPointeeType = ToPtrType->getPointeeType();
 
       if (FromPointeeType->isRecordType() && ToPointeeType->isRecordType() &&
           !Context.hasSameUnqualifiedType(FromPointeeType, ToPointeeType)) {
@@ -3676,9 +3638,9 @@ bool Sema::CheckPointerConversion(Expr *From, QualType ToType,
       }
     }
   } else if (const ObjCObjectPointerType *ToPtrType =
-               ToType->getAs<ObjCObjectPointerType>()) {
+                 ToType->getAs<ObjCObjectPointerType>()) {
     if (const ObjCObjectPointerType *FromPtrType =
-          FromType->getAs<ObjCObjectPointerType>()) {
+            FromType->getAs<ObjCObjectPointerType>()) {
       // Objective-C++ conversions are always okay.
       // FIXME: We should have a different class of conversions for the
       // Objective-C++ implicit conversions.
@@ -3703,16 +3665,15 @@ bool Sema::CheckPointerConversion(Expr *From, QualType ToType,
 }
 
 bool Sema::IsMemberPointerConversion(Expr *From, QualType FromType,
-                                     QualType ToType,
-                                     bool InOverloadResolution,
+                                     QualType ToType, bool InOverloadResolution,
                                      QualType &ConvertedType) {
   const MemberPointerType *ToTypePtr = ToType->getAs<MemberPointerType>();
   if (!ToTypePtr)
     return false;
 
   // A null pointer constant can be converted to a member pointer (C++ 4.11p1)
-  if (From->isNullPointerConstant(Context,
-                    InOverloadResolution? Expr::NPC_ValueDependentIsNotNull
+  if (From->isNullPointerConstant(
+          Context, InOverloadResolution ? Expr::NPC_ValueDependentIsNotNull
                                         : Expr::NPC_ValueDependentIsNull)) {
     ConvertedType = ToType;
     return true;
@@ -3933,9 +3894,9 @@ static bool isQualificationConversionStep(QualType FromType, QualType ToType,
   return true;
 }
 
-bool
-Sema::IsQualificationConversion(QualType FromType, QualType ToType,
-                                bool CStyle, bool &ObjCLifetimeConversion) {
+bool Sema::IsQualificationConversion(QualType FromType, QualType ToType,
+                                     bool CStyle,
+                                     bool &ObjCLifetimeConversion) {
   FromType = Context.getCanonicalType(FromType);
   ToType = Context.getCanonicalType(ToType);
   ObjCLifetimeConversion = false;
@@ -3964,7 +3925,8 @@ Sema::IsQualificationConversion(QualType FromType, QualType ToType,
   // of times. If we unwrapped any pointers, and if FromType and
   // ToType have the same unqualified type (since we checked
   // qualifiers above), then this is a qualification conversion.
-  return UnwrappedAnyPointer && Context.hasSameUnqualifiedType(FromType,ToType);
+  return UnwrappedAnyPointer &&
+         Context.hasSameUnqualifiedType(FromType, ToType);
 }
 
 /// - Determine whether this is a conversion from a scalar type to an
@@ -3974,23 +3936,22 @@ Sema::IsQualificationConversion(QualType FromType, QualType ToType,
 /// sequence to finish the conversion.
 static bool tryAtomicConversion(Sema &S, Expr *From, QualType ToType,
                                 bool InOverloadResolution,
-                                StandardConversionSequence &SCS,
-                                bool CStyle) {
+                                StandardConversionSequence &SCS, bool CStyle) {
   const AtomicType *ToAtomic = ToType->getAs<AtomicType>();
   if (!ToAtomic)
     return false;
 
   StandardConversionSequence InnerSCS;
   if (!IsStandardConversion(S, From, ToAtomic->getValueType(),
-                            InOverloadResolution, InnerSCS,
-                            CStyle, /*AllowObjCWritebackConversion=*/false))
+                            InOverloadResolution, InnerSCS, CStyle,
+                            /*AllowObjCWritebackConversion=*/false))
     return false;
 
   SCS.Second = InnerSCS.Second;
   SCS.setToType(1, InnerSCS.getToType(1));
   SCS.Third = InnerSCS.Third;
-  SCS.QualificationIncludesObjCLifetime
-    = InnerSCS.QualificationIncludesObjCLifetime;
+  SCS.QualificationIncludesObjCLifetime =
+      InnerSCS.QualificationIncludesObjCLifetime;
   SCS.setToType(2, InnerSCS.getToType(2));
   return true;
 }
@@ -4036,12 +3997,10 @@ static bool isFirstArgumentCompatibleWithType(ASTContext &Context,
   return false;
 }
 
-static OverloadingResult
-IsInitializerListConstructorConversion(Sema &S, Expr *From, QualType ToType,
-                                       CXXRecordDecl *To,
-                                       UserDefinedConversionSequence &User,
-                                       OverloadCandidateSet &CandidateSet,
-                                       bool AllowExplicit) {
+static OverloadingResult IsInitializerListConstructorConversion(
+    Sema &S, Expr *From, QualType ToType, CXXRecordDecl *To,
+    UserDefinedConversionSequence &User, OverloadCandidateSet &CandidateSet,
+    bool AllowExplicit) {
   CandidateSet.clear(OverloadCandidateSet::CSK_InitByUserDefinedConversion);
   for (auto *D : S.LookupConstructors(To)) {
     auto Info = getConstructorInfo(D);
@@ -4109,12 +4068,10 @@ IsInitializerListConstructorConversion(Sema &S, Expr *From, QualType ToType,
 /// \param AllowObjCConversionOnExplicit true if the conversion should
 /// allow an extra Objective-C pointer conversion on uses of explicit
 /// constructors. Requires \c AllowExplicit to also be set.
-static OverloadingResult
-IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
-                        UserDefinedConversionSequence &User,
-                        OverloadCandidateSet &CandidateSet,
-                        AllowedExplicit AllowExplicit,
-                        bool AllowObjCConversionOnExplicit) {
+static OverloadingResult IsUserDefinedConversion(
+    Sema &S, Expr *From, QualType ToType, UserDefinedConversionSequence &User,
+    OverloadCandidateSet &CandidateSet, AllowedExplicit AllowExplicit,
+    bool AllowObjCConversionOnExplicit) {
   assert(AllowExplicit != AllowedExplicit::None ||
          !AllowObjCConversionOnExplicit);
   CandidateSet.clear(OverloadCandidateSet::CSK_InitByUserDefinedConversion);
@@ -4255,8 +4212,8 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
   case OR_Success:
   case OR_Deleted:
     // Record the standard conversion we used and the conversion function.
-    if (CXXConstructorDecl *Constructor
-          = dyn_cast<CXXConstructorDecl>(Best->Function)) {
+    if (CXXConstructorDecl *Constructor =
+            dyn_cast<CXXConstructorDecl>(Best->Function)) {
       // C++ [over.ics.user]p1:
       //   If the user-defined conversion is specified by a
       //   constructor (12.3.1), the initial standard conversion
@@ -4283,8 +4240,8 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
       User.After.setAllToTypes(ToType);
       return Result;
     }
-    if (CXXConversionDecl *Conversion
-                 = dyn_cast<CXXConversionDecl>(Best->Function)) {
+    if (CXXConversionDecl *Conversion =
+            dyn_cast<CXXConversionDecl>(Best->Function)) {
 
       assert(Best->HasFinalConversion);
 
@@ -4324,14 +4281,13 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
   llvm_unreachable("Invalid OverloadResult!");
 }
 
-bool
-Sema::DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType) {
+bool Sema::DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType) {
   ImplicitConversionSequence ICS;
   OverloadCandidateSet CandidateSet(From->getExprLoc(),
                                     OverloadCandidateSet::CSK_Normal);
   OverloadingResult OvResult =
-    IsUserDefinedConversion(*this, From, ToType, ICS.UserDefined,
-                            CandidateSet, AllowedExplicit::None, false);
+      IsUserDefinedConversion(*this, From, ToType, ICS.UserDefined,
+                              CandidateSet, AllowedExplicit::None, false);
 
   if (!(OvResult == OR_Ambiguous ||
         (OvResult == OR_No_Viable_Function && !CandidateSet.empty())))
@@ -4352,8 +4308,7 @@ Sema::DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType) {
           << false << From->getType() << From->getSourceRange() << ToType;
   }
 
-  CandidateSet.NoteCandidates(
-                              *this, From, Cands);
+  CandidateSet.NoteCandidates(*this, From, Cands);
   return true;
 }
 
@@ -4446,9 +4401,8 @@ static bool hasDeprecatedStringLiteralToCharPtrConversion(
 /// other or if they are indistinguishable (C++ 13.3.3.2).
 static ImplicitConversionSequence::CompareKind
 CompareImplicitConversionSequences(Sema &S, SourceLocation Loc,
-                                   const ImplicitConversionSequence& ICS1,
-                                   const ImplicitConversionSequence& ICS2)
-{
+                                   const ImplicitConversionSequence &ICS1,
+                                   const ImplicitConversionSequence &ICS2) {
   // (C++ 13.3.3.2p2): When comparing the basic forms of implicit
   // conversion sequences (as defined in 13.3.3.1)
   //   -- a standard conversion sequence (13.3.3.1.1) is a better
@@ -4556,8 +4510,8 @@ CompareImplicitConversionSequences(Sema &S, SourceLocation Loc,
   if (ICS1.isStandard())
     // Standard conversion sequence S1 is a better conversion sequence than
     // standard conversion sequence S2 if [...]
-    Result = CompareStandardConversionSequences(S, Loc,
-                                                ICS1.Standard, ICS2.Standard);
+    Result = CompareStandardConversionSequences(S, Loc, ICS1.Standard,
+                                                ICS2.Standard);
   else if (ICS1.isUserDefined()) {
     // With lazy template loading, it is possible to find non-canonical
     // FunctionDecls, depending on when redecl chains are completed. Make sure
@@ -4576,13 +4530,12 @@ CompareImplicitConversionSequences(Sema &S, SourceLocation Loc,
     // U1 is better than the second standard conversion sequence of
     // U2 (C++ 13.3.3.2p3).
     if (ConvFunc1 == ConvFunc2)
-      Result = CompareStandardConversionSequences(S, Loc,
-                                                  ICS1.UserDefined.After,
-                                                  ICS2.UserDefined.After);
+      Result = CompareStandardConversionSequences(
+          S, Loc, ICS1.UserDefined.After, ICS2.UserDefined.After);
     else
-      Result = compareConversionFunctions(S,
-                                          ICS1.UserDefined.ConversionFunction,
-                                          ICS2.UserDefined.ConversionFunction);
+      Result =
+          compareConversionFunctions(S, ICS1.UserDefined.ConversionFunction,
+                                     ICS2.UserDefined.ConversionFunction);
   }
 
   return Result;
@@ -4592,10 +4545,10 @@ CompareImplicitConversionSequences(Sema &S, SourceLocation Loc,
 // determine if one is a proper subset of the other.
 static ImplicitConversionSequence::CompareKind
 compareStandardConversionSubsets(ASTContext &Context,
-                                 const StandardConversionSequence& SCS1,
-                                 const StandardConversionSequence& SCS2) {
-  ImplicitConversionSequence::CompareKind Result
-    = ImplicitConversionSequence::Indistinguishable;
+                                 const StandardConversionSequence &SCS1,
+                                 const StandardConversionSequence &SCS2) {
+  ImplicitConversionSequence::CompareKind Result =
+      ImplicitConversionSequence::Indistinguishable;
 
   // the identity conversion sequence is considered to be a subsequence of
   // any non-identity conversion sequence
@@ -4615,19 +4568,20 @@ compareStandardConversionSubsets(ASTContext &Context,
     return ImplicitConversionSequence::Indistinguishable;
 
   if (SCS1.Third == SCS2.Third) {
-    return Context.hasSameType(SCS1.getToType(2), SCS2.getToType(2))? Result
-                             : ImplicitConversionSequence::Indistinguishable;
+    return Context.hasSameType(SCS1.getToType(2), SCS2.getToType(2))
+               ? Result
+               : ImplicitConversionSequence::Indistinguishable;
   }
 
   if (SCS1.Third == ICK_Identity)
     return Result == ImplicitConversionSequence::Worse
-             ? ImplicitConversionSequence::Indistinguishable
-             : ImplicitConversionSequence::Better;
+               ? ImplicitConversionSequence::Indistinguishable
+               : ImplicitConversionSequence::Better;
 
   if (SCS2.Third == ICK_Identity)
     return Result == ImplicitConversionSequence::Better
-             ? ImplicitConversionSequence::Indistinguishable
-             : ImplicitConversionSequence::Worse;
+               ? ImplicitConversionSequence::Indistinguishable
+               : ImplicitConversionSequence::Worse;
 
   return ImplicitConversionSequence::Indistinguishable;
 }
@@ -4692,9 +4646,8 @@ getFixedEnumPromtion(Sema &S, const StandardConversionSequence &SCS) {
 /// other or if they are indistinguishable (C++ 13.3.3.2p3).
 static ImplicitConversionSequence::CompareKind
 CompareStandardConversionSequences(Sema &S, SourceLocation Loc,
-                                   const StandardConversionSequence& SCS1,
-                                   const StandardConversionSequence& SCS2)
-{
+                                   const StandardConversionSequence &SCS1,
+                                   const StandardConversionSequence &SCS2) {
   // Standard conversion sequence S1 is a better conversion sequence
   // than standard conversion sequence S2 if (C++ 13.3.3.2p3):
 
@@ -4703,8 +4656,8 @@ CompareStandardConversionSequences(Sema &S, SourceLocation Loc,
   //     excluding any Lvalue Transformation; the identity conversion
   //     sequence is considered to be a subsequence of any
   //     non-identity conversion sequence) or, if not that,
-  if (ImplicitConversionSequence::CompareKind CK
-        = compareStandardConversionSubsets(S.Context, SCS1, SCS2))
+  if (ImplicitConversionSequence::CompareKind CK =
+          compareStandardConversionSubsets(S.Context, SCS1, SCS2))
     return CK;
 
   //  -- the rank of S1 is better than the rank of S2 (by the rules
@@ -4724,9 +4677,8 @@ CompareStandardConversionSequences(Sema &S, SourceLocation Loc,
   //   pointer to member, to bool is better than another conversion
   //   that is such a conversion.
   if (SCS1.isPointerConversionToBool() != SCS2.isPointerConversionToBool())
-    return SCS2.isPointerConversionToBool()
-             ? ImplicitConversionSequence::Better
-             : ImplicitConversionSequence::Worse;
+    return SCS2.isPointerConversionToBool() ? ImplicitConversionSequence::Better
+                                            : ImplicitConversionSequence::Worse;
 
   // C++14 [over.ics.rank]p4b2:
   // This is retroactively applied to C++11 by CWG 1601.
@@ -4748,10 +4700,8 @@ CompareStandardConversionSequences(Sema &S, SourceLocation Loc,
   //   conversion of B* to A* is better than conversion of B* to
   //   void*, and conversion of A* to void* is better than conversion
   //   of B* to void*.
-  bool SCS1ConvertsToVoid
-    = SCS1.isPointerConversionToVoidPointer(S.Context);
-  bool SCS2ConvertsToVoid
-    = SCS2.isPointerConversionToVoidPointer(S.Context);
+  bool SCS1ConvertsToVoid = SCS1.isPointerConversionToVoidPointer(S.Context);
+  bool SCS2ConvertsToVoid = SCS2.isPointerConversionToVoidPointer(S.Context);
   if (SCS1ConvertsToVoid != SCS2ConvertsToVoid) {
     // Exactly one of the conversion sequences is a conversion to
     // a void pointer; it's the worse conversion.
@@ -4760,8 +4710,8 @@ CompareStandardConversionSequences(Sema &S, SourceLocation Loc,
   } else if (!SCS1ConvertsToVoid && !SCS2ConvertsToVoid) {
     // Neither conversion sequence converts to a void pointer; compare
     // their derived-to-base conversions.
-    if (ImplicitConversionSequence::CompareKind DerivedCK
-          = CompareDerivedToBaseConversions(S, Loc, SCS1, SCS2))
+    if (ImplicitConversionSequence::CompareKind DerivedCK =
+            CompareDerivedToBaseConversions(S, Loc, SCS1, SCS2))
       return DerivedCK;
   } else if (SCS1ConvertsToVoid && SCS2ConvertsToVoid &&
              !S.Context.hasSameType(SCS1.getFromType(), SCS2.getFromType())) {
@@ -4788,18 +4738,18 @@ CompareStandardConversionSequences(Sema &S, SourceLocation Loc,
 
     // Objective-C++: If one interface is more specific than the
     // other, it is the better one.
-    const ObjCObjectPointerType* FromObjCPtr1
-      = FromType1->getAs<ObjCObjectPointerType>();
-    const ObjCObjectPointerType* FromObjCPtr2
-      = FromType2->getAs<ObjCObjectPointerType>();
+    const ObjCObjectPointerType *FromObjCPtr1 =
+        FromType1->getAs<ObjCObjectPointerType>();
+    const ObjCObjectPointerType *FromObjCPtr2 =
+        FromType2->getAs<ObjCObjectPointerType>();
     if (FromObjCPtr1 && FromObjCPtr2) {
-      bool AssignLeft = S.Context.canAssignObjCInterfaces(FromObjCPtr1,
-                                                          FromObjCPtr2);
-      bool AssignRight = S.Context.canAssignObjCInterfaces(FromObjCPtr2,
-                                                           FromObjCPtr1);
+      bool AssignLeft =
+          S.Context.canAssignObjCInterfaces(FromObjCPtr1, FromObjCPtr2);
+      bool AssignRight =
+          S.Context.canAssignObjCInterfaces(FromObjCPtr2, FromObjCPtr1);
       if (AssignLeft != AssignRight) {
-        return AssignLeft? ImplicitConversionSequence::Better
-                         : ImplicitConversionSequence::Worse;
+        return AssignLeft ? ImplicitConversionSequence::Better
+                          : ImplicitConversionSequence::Worse;
       }
     }
   }
@@ -4814,8 +4764,8 @@ CompareStandardConversionSequences(Sema &S, SourceLocation Loc,
 
   // Compare based on qualification conversions (C++ 13.3.3.2p3,
   // bullet 3).
-  if (ImplicitConversionSequence::CompareKind QualCK
-        = CompareQualificationConversions(S, SCS1, SCS2))
+  if (ImplicitConversionSequence::CompareKind QualCK =
+          CompareQualificationConversions(S, SCS1, SCS2))
     return QualCK;
 
   if (ImplicitConversionSequence::CompareKind ObtCK =
@@ -4840,10 +4790,10 @@ CompareStandardConversionSequences(Sema &S, SourceLocation Loc,
       // Objective-C++ ARC: If the references refer to objects with different
       // lifetimes, prefer bindings that don't change lifetime.
       if (SCS1.ObjCLifetimeConversionBinding !=
-                                          SCS2.ObjCLifetimeConversionBinding) {
+          SCS2.ObjCLifetimeConversionBinding) {
         return SCS1.ObjCLifetimeConversionBinding
-                                           ? ImplicitConversionSequence::Worse
-                                           : ImplicitConversionSequence::Better;
+                   ? ImplicitConversionSequence::Worse
+                   : ImplicitConversionSequence::Better;
       }
 
       // If the type is an array type, promote the element qualifiers to the
@@ -4957,9 +4907,8 @@ CompareOverflowBehaviorConversions(Sema &S,
 /// sequences to determine whether they can be ranked based on their
 /// qualification conversions (C++ 13.3.3.2p3 bullet 3).
 static ImplicitConversionSequence::CompareKind
-CompareQualificationConversions(Sema &S,
-                                const StandardConversionSequence& SCS1,
-                                const StandardConversionSequence& SCS2) {
+CompareQualificationConversions(Sema &S, const StandardConversionSequence &SCS1,
+                                const StandardConversionSequence &SCS2) {
   // C++ [over.ics.rank]p3:
   //  -- S1 and S2 differ only in their qualification conversion and
   //     yield similar types T1 and T2 (C++ 4.4), respectively, [...]
@@ -5027,8 +4976,8 @@ CompareQualificationConversions(Sema &S,
 /// conversions between Objective-C interface types.
 static ImplicitConversionSequence::CompareKind
 CompareDerivedToBaseConversions(Sema &S, SourceLocation Loc,
-                                const StandardConversionSequence& SCS1,
-                                const StandardConversionSequence& SCS2) {
+                                const StandardConversionSequence &SCS1,
+                                const StandardConversionSequence &SCS2) {
   QualType FromType1 = SCS1.getFromType();
   QualType ToType1 = SCS1.getToType(1);
   QualType FromType2 = SCS2.getFromType();
@@ -5084,28 +5033,26 @@ CompareDerivedToBaseConversions(Sema &S, SourceLocation Loc,
     }
   } else if (SCS1.Second == ICK_Pointer_Conversion &&
              SCS2.Second == ICK_Pointer_Conversion) {
-    const ObjCObjectPointerType *FromPtr1
-      = FromType1->getAs<ObjCObjectPointerType>();
-    const ObjCObjectPointerType *FromPtr2
-      = FromType2->getAs<ObjCObjectPointerType>();
-    const ObjCObjectPointerType *ToPtr1
-      = ToType1->getAs<ObjCObjectPointerType>();
-    const ObjCObjectPointerType *ToPtr2
-      = ToType2->getAs<ObjCObjectPointerType>();
+    const ObjCObjectPointerType *FromPtr1 =
+        FromType1->getAs<ObjCObjectPointerType>();
+    const ObjCObjectPointerType *FromPtr2 =
+        FromType2->getAs<ObjCObjectPointerType>();
+    const ObjCObjectPointerType *ToPtr1 =
+        ToType1->getAs<ObjCObjectPointerType>();
+    const ObjCObjectPointerType *ToPtr2 =
+        ToType2->getAs<ObjCObjectPointerType>();
 
     if (FromPtr1 && FromPtr2 && ToPtr1 && ToPtr2) {
       // Apply the same conversion ranking rules for Objective-C pointer types
       // that we do for C++ pointers to class types. However, we employ the
       // Objective-C pseudo-subtyping relationship used for assignment of
       // Objective-C pointer types.
-      bool FromAssignLeft
-        = S.Context.canAssignObjCInterfaces(FromPtr1, FromPtr2);
-      bool FromAssignRight
-        = S.Context.canAssignObjCInterfaces(FromPtr2, FromPtr1);
-      bool ToAssignLeft
-        = S.Context.canAssignObjCInterfaces(ToPtr1, ToPtr2);
-      bool ToAssignRight
-        = S.Context.canAssignObjCInterfaces(ToPtr2, ToPtr1);
+      bool FromAssignLeft =
+          S.Context.canAssignObjCInterfaces(FromPtr1, FromPtr2);
+      bool FromAssignRight =
+          S.Context.canAssignObjCInterfaces(FromPtr2, FromPtr1);
+      bool ToAssignLeft = S.Context.canAssignObjCInterfaces(ToPtr1, ToPtr2);
+      bool ToAssignRight = S.Context.canAssignObjCInterfaces(ToPtr2, ToPtr1);
 
       // A conversion to an a non-id object pointer type or qualified 'id'
       // type is better than a conversion to 'id'.
@@ -5156,15 +5103,15 @@ CompareDerivedToBaseConversions(Sema &S, SourceLocation Loc,
           } else if (IsSecondSame)
             return ImplicitConversionSequence::Worse;
         }
-        return ToAssignLeft? ImplicitConversionSequence::Worse
-                           : ImplicitConversionSequence::Better;
+        return ToAssignLeft ? ImplicitConversionSequence::Worse
+                            : ImplicitConversionSequence::Better;
       }
 
       //   -- "conversion of B* to A* is better than conversion of C* to A*,"
       if (S.Context.hasSameUnqualifiedType(ToType1, ToType2) &&
           (FromAssignLeft != FromAssignRight))
-        return FromAssignLeft? ImplicitConversionSequence::Better
-        : ImplicitConversionSequence::Worse;
+        return FromAssignLeft ? ImplicitConversionSequence::Better
+                              : ImplicitConversionSequence::Worse;
     }
   }
 
@@ -5236,11 +5183,11 @@ static QualType withoutUnaligned(ASTContext &Ctx, QualType T) {
 }
 
 Sema::ReferenceCompareResult
-Sema::CompareReferenceRelationship(SourceLocation Loc,
-                                   QualType OrigT1, QualType OrigT2,
+Sema::CompareReferenceRelationship(SourceLocation Loc, QualType OrigT1,
+                                   QualType OrigT2,
                                    ReferenceConversions *ConvOut) {
   assert(!OrigT1->isReferenceType() &&
-    "T1 must be the pointee type of the reference type");
+         "T1 must be the pointee type of the reference type");
   assert(!OrigT2->isReferenceType() && "T2 cannot be a reference type");
 
   QualType T1 = Context.getCanonicalType(OrigT1);
@@ -5329,11 +5276,10 @@ Sema::CompareReferenceRelationship(SourceLocation Loc,
 
 /// Look for a user-defined conversion to a value reference-compatible
 ///        with DeclType. Return true if something definite is found.
-static bool
-FindConversionForRefInit(Sema &S, ImplicitConversionSequence &ICS,
-                         QualType DeclType, SourceLocation DeclLoc,
-                         Expr *Init, QualType T2, bool AllowRvalues,
-                         bool AllowExplicit) {
+static bool FindConversionForRefInit(Sema &S, ImplicitConversionSequence &ICS,
+                                     QualType DeclType, SourceLocation DeclLoc,
+                                     Expr *Init, QualType T2, bool AllowRvalues,
+                                     bool AllowExplicit) {
   assert(T2->isRecordType() && "Can only find conversions of record types.");
   auto *T2RecordDecl = T2->castAsCXXRecordDecl();
   OverloadCandidateSet CandidateSet(
@@ -5345,8 +5291,7 @@ FindConversionForRefInit(Sema &S, ImplicitConversionSequence &ICS,
     if (isa<UsingShadowDecl>(D))
       D = cast<UsingShadowDecl>(D)->getTargetDecl();
 
-    FunctionTemplateDecl *ConvTemplate
-      = dyn_cast<FunctionTemplateDecl>(D);
+    FunctionTemplateDecl *ConvTemplate = dyn_cast<FunctionTemplateDecl>(D);
     CXXConversionDecl *Conv;
     if (ConvTemplate)
       Conv = cast<CXXConversionDecl>(ConvTemplate->getTemplatedDecl());
@@ -5357,8 +5302,8 @@ FindConversionForRefInit(Sema &S, ImplicitConversionSequence &ICS,
       // If we are initializing an rvalue reference, don't permit conversion
       // functions that return lvalues.
       if (!ConvTemplate && DeclType->isRValueReferenceType()) {
-        const ReferenceType *RefType
-          = Conv->getConversionType()->getAs<LValueReferenceType>();
+        const ReferenceType *RefType =
+            Conv->getConversionType()->getAs<LValueReferenceType>();
         if (RefType && !RefType->getPointeeType()->isFunctionType())
           continue;
       }
@@ -5378,10 +5323,9 @@ FindConversionForRefInit(Sema &S, ImplicitConversionSequence &ICS,
       // is only acceptable if its referencee is a function type.
 
       const ReferenceType *RefType =
-        Conv->getConversionType()->getAs<ReferenceType>();
-      if (!RefType ||
-          (!RefType->isLValueReferenceType() &&
-           !RefType->getPointeeType()->isFunctionType()))
+          Conv->getConversionType()->getAs<ReferenceType>();
+      if (!RefType || (!RefType->isLValueReferenceType() &&
+                       !RefType->getPointeeType()->isFunctionType()))
         continue;
     }
 
@@ -5449,10 +5393,8 @@ FindConversionForRefInit(Sema &S, ImplicitConversionSequence &ICS,
 /// Compute an implicit conversion sequence for reference
 /// initialization.
 static ImplicitConversionSequence
-TryReferenceInit(Sema &S, Expr *Init, QualType DeclType,
-                 SourceLocation DeclLoc,
-                 bool SuppressUserConversions,
-                 bool AllowExplicit) {
+TryReferenceInit(Sema &S, Expr *Init, QualType DeclType, SourceLocation DeclLoc,
+                 bool SuppressUserConversions, bool AllowExplicit) {
   assert(DeclType->isReferenceType() && "Reference init needs a reference");
 
   // Most paths end in a failed conversion.
@@ -5467,8 +5409,8 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType,
   // type of the resulting function.
   if (S.Context.getCanonicalType(T2) == S.Context.OverloadTy) {
     DeclAccessPair Found;
-    if (FunctionDecl *Fn = S.ResolveAddressOfOverloadedFunction(Init, DeclType,
-                                                                false, Found))
+    if (FunctionDecl *Fn =
+            S.ResolveAddressOfOverloadedFunction(Init, DeclType, false, Found))
       T2 = Fn->getType();
   }
 
@@ -5487,17 +5429,17 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType,
     // consider that when ordering reference-to-function bindings.
     ICS.Standard.Second = (RefConv & Sema::ReferenceConversions::DerivedToBase)
                               ? ICK_Derived_To_Base
-                              : (RefConv & Sema::ReferenceConversions::ObjC)
-                                    ? ICK_Compatible_Conversion
-                                    : ICK_Identity;
+                          : (RefConv & Sema::ReferenceConversions::ObjC)
+                              ? ICK_Compatible_Conversion
+                              : ICK_Identity;
     ICS.Standard.Dimension = ICK_Identity;
     // FIXME: As a speculative fix to a defect introduced by CWG2352, we rank
     // a reference binding that performs a non-top-level qualification
     // conversion as a qualification conversion, not as an identity conversion.
-    ICS.Standard.Third = (RefConv &
-                              Sema::ReferenceConversions::NestedQualification)
-                             ? ICK_Qualification
-                             : ICK_Identity;
+    ICS.Standard.Third =
+        (RefConv & Sema::ReferenceConversions::NestedQualification)
+            ? ICK_Qualification
+            : ICK_Identity;
     ICS.Standard.setFromType(T2);
     ICS.Standard.setToType(0, T2);
     ICS.Standard.setToType(1, T1);
@@ -5552,9 +5494,8 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType,
     if (!SuppressUserConversions && T2->isRecordType() &&
         S.isCompleteType(DeclLoc, T2) &&
         RefRelationship == Sema::Ref_Incompatible) {
-      if (FindConversionForRefInit(S, ICS, DeclType, DeclLoc,
-                                   Init, T2, /*AllowRvalues=*/false,
-                                   AllowExplicit))
+      if (FindConversionForRefInit(S, ICS, DeclType, DeclLoc, Init, T2,
+                                   /*AllowRvalues=*/false, AllowExplicit))
         return ICS;
     }
   }
@@ -5575,7 +5516,7 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType,
   if (RefRelationship == Sema::Ref_Compatible &&
       (InitCategory.isXValue() ||
        (InitCategory.isPRValue() &&
-          (T2->isRecordType() || T2->isArrayType())) ||
+        (T2->isRecordType() || T2->isArrayType())) ||
        (InitCategory.isLValue() && T2->isFunctionType()))) {
     // In C++11, this is always a direct binding. In C++98/03, it's a direct
     // binding unless we're binding to a class prvalue.
@@ -5599,9 +5540,8 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType,
   //          class subobject).
   if (!SuppressUserConversions && RefRelationship == Sema::Ref_Incompatible &&
       T2->isRecordType() && S.isCompleteType(DeclLoc, T2) &&
-      FindConversionForRefInit(S, ICS, DeclType, DeclLoc,
-                               Init, T2, /*AllowRvalues=*/true,
-                               AllowExplicit)) {
+      FindConversionForRefInit(S, ICS, DeclType, DeclLoc, Init, T2,
+                               /*AllowRvalues=*/true, AllowExplicit)) {
     // In the second case, if the reference is an rvalue reference
     // and the second standard conversion sequence of the
     // user-defined conversion sequence includes an lvalue-to-rvalue
@@ -5707,7 +5647,8 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType,
     ICS.UserDefined.After.IsLvalueReference = !isRValRef;
     ICS.UserDefined.After.BindsToFunctionLvalue = false;
     ICS.UserDefined.After.BindsToRvalue = !LValRefType;
-    ICS.UserDefined.After.BindsImplicitObjectArgumentWithoutRefQualifier = false;
+    ICS.UserDefined.After.BindsImplicitObjectArgumentWithoutRefQualifier =
+        false;
     ICS.UserDefined.After.ObjCLifetimeConversionBinding = false;
     ICS.UserDefined.After.FromBracedInitList = false;
   }
@@ -5717,8 +5658,7 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType,
 
 static ImplicitConversionSequence
 TryCopyInitialization(Sema &S, Expr *From, QualType ToType,
-                      bool SuppressUserConversions,
-                      bool InOverloadResolution,
+                      bool SuppressUserConversions, bool InOverloadResolution,
                       bool AllowObjCWritebackConversion,
                       bool AllowExplicit = false);
 
@@ -5726,8 +5666,7 @@ TryCopyInitialization(Sema &S, Expr *From, QualType ToType,
 /// initializer list From.
 static ImplicitConversionSequence
 TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
-                  bool SuppressUserConversions,
-                  bool InOverloadResolution,
+                  bool SuppressUserConversions, bool InOverloadResolution,
                   bool AllowObjCWritebackConversion) {
   // C++11 [over.ics.list]p1:
   //   When an argument is an initializer list, it is not an expression and
@@ -5774,10 +5713,9 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
       QualType InitType = From->getInit(0)->getType();
       if (S.Context.hasSameUnqualifiedType(InitType, ToType) ||
           S.IsDerivedFrom(From->getBeginLoc(), InitType, ToType))
-        return TryCopyInitialization(S, From->getInit(0), ToType,
-                                     SuppressUserConversions,
-                                     InOverloadResolution,
-                                     AllowObjCWritebackConversion);
+        return TryCopyInitialization(
+            S, From->getInit(0), ToType, SuppressUserConversions,
+            InOverloadResolution, AllowObjCWritebackConversion);
     }
 
     if (AT && S.IsStringInit(From->getInit(0), AT)) {
@@ -5902,11 +5840,10 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
   //   implicit conversion sequence is a user-defined conversion sequence.
   if (ToType->isRecordType() && !ToType->isAggregateType()) {
     // This function can deal with initializer lists.
-    return TryUserDefinedConversion(S, From, ToType, SuppressUserConversions,
-                                    AllowedExplicit::None,
-                                    InOverloadResolution, /*CStyle=*/false,
-                                    AllowObjCWritebackConversion,
-                                    /*AllowObjCConversionOnExplicit=*/false);
+    return TryUserDefinedConversion(
+        S, From, ToType, SuppressUserConversions, AllowedExplicit::None,
+        InOverloadResolution, /*CStyle=*/false, AllowObjCWritebackConversion,
+        /*AllowObjCConversionOnExplicit=*/false);
   }
 
   // C++14 [over.ics.list]p5:
@@ -5960,7 +5897,7 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
       if (S.Context.getCanonicalType(T2) == S.Context.OverloadTy) {
         DeclAccessPair Found;
         if (FunctionDecl *Fn = S.ResolveAddressOfOverloadedFunction(
-                                   Init, ToType, false, Found))
+                Init, ToType, false, Found))
           T2 = Fn->getType();
       }
 
@@ -5977,9 +5914,9 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
 
     // Otherwise, we bind the reference to a temporary created from the
     // initializer list.
-    Result = TryListConversion(S, From, T1, SuppressUserConversions,
-                               InOverloadResolution,
-                               AllowObjCWritebackConversion);
+    Result =
+        TryListConversion(S, From, T1, SuppressUserConversions,
+                          InOverloadResolution, AllowObjCWritebackConversion);
     if (Result.isFailure())
       return Result;
     assert(!Result.isEllipsis() &&
@@ -5988,8 +5925,8 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
     // Can we even bind to a temporary?
     if (ToType->isRValueReferenceType() ||
         (T1.isConstQualified() && !T1.isVolatileQualified())) {
-      StandardConversionSequence &SCS = Result.isStandard() ? Result.Standard :
-                                            Result.UserDefined.After;
+      StandardConversionSequence &SCS =
+          Result.isStandard() ? Result.Standard : Result.UserDefined.After;
       SCS.ReferenceBinding = true;
       SCS.IsLvalueReference = ToType->isLValueReferenceType();
       SCS.BindsToRvalue = true;
@@ -5999,8 +5936,7 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
       SCS.FromBracedInitList = false;
 
     } else
-      Result.setBad(BadConversionSequence::lvalue_ref_to_rvalue,
-                    From, ToType);
+      Result.setBad(BadConversionSequence::lvalue_ref_to_rvalue, From, ToType);
     return Result;
   }
 
@@ -6047,36 +5983,30 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
 /// do not permit any user-defined conversion sequences.
 static ImplicitConversionSequence
 TryCopyInitialization(Sema &S, Expr *From, QualType ToType,
-                      bool SuppressUserConversions,
-                      bool InOverloadResolution,
-                      bool AllowObjCWritebackConversion,
-                      bool AllowExplicit) {
+                      bool SuppressUserConversions, bool InOverloadResolution,
+                      bool AllowObjCWritebackConversion, bool AllowExplicit) {
   if (InitListExpr *FromInitList = dyn_cast<InitListExpr>(From))
     return TryListConversion(S, FromInitList, ToType, SuppressUserConversions,
-                             InOverloadResolution,AllowObjCWritebackConversion);
+                             InOverloadResolution,
+                             AllowObjCWritebackConversion);
 
   if (ToType->isReferenceType())
     return TryReferenceInit(S, From, ToType,
                             /*FIXME:*/ From->getBeginLoc(),
                             SuppressUserConversions, AllowExplicit);
 
-  return TryImplicitConversion(S, From, ToType,
-                               SuppressUserConversions,
-                               AllowedExplicit::None,
-                               InOverloadResolution,
-                               /*CStyle=*/false,
-                               AllowObjCWritebackConversion,
+  return TryImplicitConversion(S, From, ToType, SuppressUserConversions,
+                               AllowedExplicit::None, InOverloadResolution,
+                               /*CStyle=*/false, AllowObjCWritebackConversion,
                                /*AllowObjCConversionOnExplicit=*/false);
 }
 
 static bool TryCopyInitialization(const CanQualType FromQTy,
-                                  const CanQualType ToQTy,
-                                  Sema &S,
-                                  SourceLocation Loc,
-                                  ExprValueKind FromVK) {
+                                  const CanQualType ToQTy, Sema &S,
+                                  SourceLocation Loc, ExprValueKind FromVK) {
   OpaqueValueExpr TmpExpr(Loc, FromQTy, FromVK);
   ImplicitConversionSequence ICS =
-    TryCopyInitialization(S, &TmpExpr, ToQTy, true, true, false);
+      TryCopyInitialization(S, &TmpExpr, ToQTy, true, true, false);
 
   return !ICS.isBad();
 }
@@ -6168,8 +6098,8 @@ static ImplicitConversionSequence TryObjectArgumentInitialization(
           FromTypeCanon.getLocalCVRQualifiers() &&
       !ImplicitParamType.isAtLeastAsQualifiedAs(
           withoutUnaligned(S.Context, FromTypeCanon), S.getASTContext())) {
-    ICS.setBad(BadConversionSequence::bad_qualifiers,
-               FromType, ImplicitParamType);
+    ICS.setBad(BadConversionSequence::bad_qualifiers, FromType,
+               ImplicitParamType);
     return ICS;
   }
 
@@ -6178,8 +6108,8 @@ static ImplicitConversionSequence TryObjectArgumentInitialization(
     Qualifiers QualsFromType = FromTypeCanon.getQualifiers();
     if (!QualsImplicitParamType.isAddressSpaceSupersetOf(QualsFromType,
                                                          S.getASTContext())) {
-      ICS.setBad(BadConversionSequence::bad_qualifiers,
-                 FromType, ImplicitParamType);
+      ICS.setBad(BadConversionSequence::bad_qualifiers, FromType,
+                 ImplicitParamType);
       return ICS;
     }
   }
@@ -6193,8 +6123,8 @@ static ImplicitConversionSequence TryObjectArgumentInitialization(
   } else if (S.IsDerivedFrom(Loc, FromType, ClassType)) {
     SecondKind = ICK_Derived_To_Base;
   } else if (!Method->isExplicitObjectMemberFunction()) {
-    ICS.setBad(BadConversionSequence::unrelated_class,
-               FromType, ImplicitParamType);
+    ICS.setBad(BadConversionSequence::unrelated_class, FromType,
+               ImplicitParamType);
     return ICS;
   }
 
@@ -6235,8 +6165,8 @@ static ImplicitConversionSequence TryObjectArgumentInitialization(
   ICS.Standard.BindsToFunctionLvalue = false;
   ICS.Standard.BindsToRvalue = FromClassification.isRValue();
   ICS.Standard.FromBracedInitList = false;
-  ICS.Standard.BindsImplicitObjectArgumentWithoutRefQualifier
-    = (Method->getRefQualifier() == RQ_None);
+  ICS.Standard.BindsImplicitObjectArgumentWithoutRefQualifier =
+      (Method->getRefQualifier() == RQ_None);
   return ICS;
 }
 
@@ -6285,7 +6215,7 @@ ExprResult Sema::PerformImplicitObjectArgumentInitialization(
             << Method->getDeclName() << FromRecordType << (CVR - 1)
             << From->getSourceRange();
         Diag(Method->getLocation(), diag::note_previous_decl)
-          << Method->getDeclName();
+            << Method->getDeclName();
         return ExprError();
       }
       break;
@@ -6294,12 +6224,12 @@ ExprResult Sema::PerformImplicitObjectArgumentInitialization(
     case BadConversionSequence::lvalue_ref_to_rvalue:
     case BadConversionSequence::rvalue_ref_to_lvalue: {
       bool IsRValueQualified =
-        Method->getRefQualifier() == RefQualifierKind::RQ_RValue;
+          Method->getRefQualifier() == RefQualifierKind::RQ_RValue;
       Diag(From->getBeginLoc(), diag::err_member_function_call_bad_ref)
           << Method->getDeclName() << FromClassification.isRValue()
           << IsRValueQualified;
       Diag(Method->getLocation(), diag::note_previous_decl)
-        << Method->getDeclName();
+          << Method->getDeclName();
       return ExprError();
     }
 
@@ -6319,7 +6249,7 @@ ExprResult Sema::PerformImplicitObjectArgumentInitialization(
 
   if (ICS.Standard.Second == ICK_Derived_To_Base) {
     ExprResult FromRes =
-      PerformObjectMemberConversion(From, Qualifier, FoundDecl, Method);
+        PerformObjectMemberConversion(From, Qualifier, FoundDecl, Method);
     if (FromRes.isInvalid())
       return ExprError();
     From = FromRes.get();
@@ -6341,16 +6271,15 @@ ExprResult Sema::PerformImplicitObjectArgumentInitialization(
 
 /// TryContextuallyConvertToBool - Attempt to contextually convert the
 /// expression From to bool (C++0x [conv]p3).
-static ImplicitConversionSequence
-TryContextuallyConvertToBool(Sema &S, Expr *From) {
+static ImplicitConversionSequence TryContextuallyConvertToBool(Sema &S,
+                                                               Expr *From) {
   // C++ [dcl.init]/17.8:
   //   - Otherwise, if the initialization is direct-initialization, the source
   //     type is std::nullptr_t, and the destination type is bool, the initial
   //     value of the object being initialized is false.
   if (From->getType()->isNullPtrType())
-    return ImplicitConversionSequence::getNullptrToBool(From->getType(),
-                                                        S.Context.BoolTy,
-                                                        From->isGLValue());
+    return ImplicitConversionSequence::getNullptrToBool(
+        From->getType(), S.Context.BoolTy, From->isGLValue());
 
   // All other direct-initialization of bool is equivalent to an implicit
   // conversion to bool in which explicit conversions are permitted.
@@ -6748,15 +6677,14 @@ static ImplicitConversionSequence
 TryContextuallyConvertToObjCPointer(Sema &S, Expr *From) {
   // Do an implicit conversion to 'id'.
   QualType Ty = S.Context.getObjCIdType();
-  ImplicitConversionSequence ICS
-    = TryImplicitConversion(S, From, Ty,
-                            // FIXME: Are these flags correct?
-                            /*SuppressUserConversions=*/false,
-                            AllowedExplicit::Conversions,
-                            /*InOverloadResolution=*/false,
-                            /*CStyle=*/false,
-                            /*AllowObjCWritebackConversion=*/false,
-                            /*AllowObjCConversionOnExplicit=*/true);
+  ImplicitConversionSequence ICS = TryImplicitConversion(
+      S, From, Ty,
+      // FIXME: Are these flags correct?
+      /*SuppressUserConversions=*/false, AllowedExplicit::Conversions,
+      /*InOverloadResolution=*/false,
+      /*CStyle=*/false,
+      /*AllowObjCWritebackConversion=*/false,
+      /*AllowObjCConversionOnExplicit=*/true);
 
   // Strip off any final conversions to 'id'.
   switch (ICS.getKind()) {
@@ -6784,7 +6712,7 @@ ExprResult Sema::PerformContextuallyConvertToObjCPointer(Expr *From) {
 
   QualType Ty = Context.getObjCIdType();
   ImplicitConversionSequence ICS =
-    TryContextuallyConvertToObjCPointer(*this, From);
+      TryContextuallyConvertToObjCPointer(*this, From);
   if (!ICS.isBad())
     return PerformImplicitConversion(From, Ty, ICS,
                                      AssignmentAction::Converting);
@@ -7255,8 +7183,8 @@ void Sema::AddOverloadCandidate(
     ADLCallKind IsADLCandidate, ConversionSequenceList EarlyConversions,
     OverloadCandidateParamOrder PO, bool AggregateCandidateDeduction,
     bool StrictPackMatch) {
-  const FunctionProtoType *Proto
-    = dyn_cast<FunctionProtoType>(Function->getType()->getAs<FunctionType>());
+  const FunctionProtoType *Proto =
+      dyn_cast<FunctionProtoType>(Function->getType()->getAs<FunctionType>());
   assert(Proto && "Functions without a prototype cannot be overloaded");
   assert(!Function->getDescribedFunctionTemplate() &&
          "Use AddTemplateOverloadCandidate for function templates");
@@ -7558,13 +7486,13 @@ Sema::SelectBestMethod(Selector Sel, MultiExprArg Args, bool IsInstance,
         break;
       }
 
-      ImplicitConversionSequence ConversionState
-        = TryCopyInitialization(*this, argExpr, param->getType(),
-                                /*SuppressUserConversions*/false,
+      ImplicitConversionSequence ConversionState =
+          TryCopyInitialization(*this, argExpr, param->getType(),
+                                /*SuppressUserConversions*/ false,
                                 /*InOverloadResolution=*/true,
                                 /*AllowObjCWritebackConversion=*/
                                 getLangOpts().ObjCAutoRefCount,
-                                /*AllowExplicit*/false);
+                                /*AllowExplicit*/ false);
       // This function looks for a reasonably-exact match, so we consider
       // incompatible pointer conversions to be a failure here.
       if (ConversionState.isBad() ||
@@ -7673,8 +7601,7 @@ static bool convertArgsForAvailabilityChecks(
 }
 
 EnableIfAttr *Sema::CheckEnableIf(FunctionDecl *Function,
-                                  SourceLocation CallLoc,
-                                  ArrayRef<Expr *> Args,
+                                  SourceLocation CallLoc, ArrayRef<Expr *> Args,
                                   bool MissingImplicitThis) {
   auto EnableIfAttrs = Function->specific_attrs<EnableIfAttr>();
   if (EnableIfAttrs.begin() == EnableIfAttrs.end())
@@ -7785,7 +7712,8 @@ bool Sema::diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function,
         // EvaluateWithSubstitution only cares about the position of each
         // argument in the arg list, not the ParmVarDecl* it maps to.
         if (!DIA->getCond()->EvaluateWithSubstitution(
-                Result, Context, cast<FunctionDecl>(DIA->getParent()), Args, ThisArg))
+                Result, Context, cast<FunctionDecl>(DIA->getParent()), Args,
+                ThisArg))
           return false;
         return Result.isInt() && Result.getInt().getBoolValue();
       });
@@ -7794,8 +7722,7 @@ bool Sema::diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function,
 bool Sema::diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND,
                                                  SourceLocation Loc) {
   return diagnoseDiagnoseIfAttrsWith(
-      *this, ND, /*ArgDependent=*/false, Loc,
-      [&](const DiagnoseIfAttr *DIA) {
+      *this, ND, /*ArgDependent=*/false, Loc, [&](const DiagnoseIfAttr *DIA) {
         bool Result;
         return DIA->getCond()->EvaluateAsBooleanCondition(Result, Context) &&
                Result;
@@ -7858,10 +7785,9 @@ void Sema::AddFunctionCandidates(const UnresolvedSetImpl &Fns,
         FunctionArgs = Args.slice(1);
       }
       if (FunTmpl) {
-        AddTemplateOverloadCandidate(FunTmpl, F.getPair(),
-                                     ExplicitTemplateArgs, FunctionArgs,
-                                     CandidateSet, SuppressUserConversions,
-                                     PartialOverloading);
+        AddTemplateOverloadCandidate(
+            FunTmpl, F.getPair(), ExplicitTemplateArgs, FunctionArgs,
+            CandidateSet, SuppressUserConversions, PartialOverloading);
       } else {
         AddOverloadCandidate(FD, F.getPair(), FunctionArgs, CandidateSet,
                              SuppressUserConversions, PartialOverloading);
@@ -7903,8 +7829,8 @@ void Sema::AddMethodCandidate(
     OverloadCandidateSet &CandidateSet, bool SuppressUserConversions,
     bool PartialOverloading, ConversionSequenceList EarlyConversions,
     OverloadCandidateParamOrder PO, bool StrictPackMatch) {
-  const FunctionProtoType *Proto
-    = dyn_cast<FunctionProtoType>(Method->getType()->getAs<FunctionType>());
+  const FunctionProtoType *Proto =
+      dyn_cast<FunctionProtoType>(Method->getType()->getAs<FunctionType>());
   assert(Proto && "Methods without a prototype cannot be overloaded");
   assert(!isa<CXXConstructorDecl>(Method) &&
          "Use AddOverloadCandidate for constructors");
@@ -8054,12 +7980,11 @@ void Sema::AddMethodCandidate(
       } else {
         ParamType = Proto->getParamType(ArgIdx + ExplicitOffset);
       }
-      Candidate.Conversions[ConvIdx]
-        = TryCopyInitialization(*this, Args[ArgIdx], ParamType,
-                                SuppressUserConversions,
-                                /*InOverloadResolution=*/true,
-                                /*AllowObjCWritebackConversion=*/
-                                  getLangOpts().ObjCAutoRefCount);
+      Candidate.Conversions[ConvIdx] = TryCopyInitialization(
+          *this, Args[ArgIdx], ParamType, SuppressUserConversions,
+          /*InOverloadResolution=*/true,
+          /*AllowObjCWritebackConversion=*/
+          getLangOpts().ObjCAutoRefCount);
       if (Candidate.Conversions[ConvIdx].isBad()) {
         Candidate.Viable = false;
         Candidate.FailureKind = ovl_fail_bad_conversion;
@@ -8131,7 +8056,7 @@ static void AddMethodTemplateCandidateImmediately(
     Candidate.Function = Method;
     Candidate.Viable = false;
     Candidate.RewriteKind =
-      CandidateSet.getRewriteInfo().getRewriteKind(Candidate.Function, PO);
+        CandidateSet.getRewriteInfo().getRewriteKind(Candidate.Function, PO);
     Candidate.IsSurrogate = false;
     Candidate.TookAddressOfOverload =
         CandidateSet.getKind() ==
@@ -8254,7 +8179,7 @@ static void AddTemplateOverloadCandidateImmediately(
     Candidate.Function = FunctionTemplate->getTemplatedDecl();
     Candidate.Viable = false;
     Candidate.RewriteKind =
-      CandidateSet.getRewriteInfo().getRewriteKind(Candidate.Function, PO);
+        CandidateSet.getRewriteInfo().getRewriteKind(Candidate.Function, PO);
     Candidate.IsSurrogate = false;
     Candidate.IsADLCandidate = llvm::to_underlying(IsADLCandidate);
     // Ignore the object argument if there is one, since we don't have an object
@@ -8455,8 +8380,8 @@ bool Sema::CheckNonDependentConversions(
 /// Objective-C pointer to another.
 ///
 /// \returns true if the conversion is allowable, false otherwise.
-static bool isAllowableExplicitConversion(Sema &S,
-                                          QualType ConvType, QualType ToType,
+static bool isAllowableExplicitConversion(Sema &S, QualType ConvType,
+                                          QualType ToType,
                                           bool AllowObjCPointerConversion) {
   QualType ToNonRefType = ToType.getNonReferenceType();
 
@@ -8466,7 +8391,7 @@ static bool isAllowableExplicitConversion(Sema &S,
 
   // Allow qualification conversions.
   bool ObjCLifetimeConversion;
-  if (S.IsQualificationConversion(ConvType, ToNonRefType, /*CStyle*/false,
+  if (S.IsQualificationConversion(ConvType, ToNonRefType, /*CStyle*/ false,
                                   ObjCLifetimeConversion))
     return true;
 
@@ -8583,8 +8508,8 @@ void Sema::AddConversionCandidate(
   // We won't go through a user-defined type conversion function to convert a
   // derived to base as such conversions are given Conversion Rank. They only
   // go through a copy constructor. 13.3.3.1.2-p4 [over.ics.user]
-  QualType FromCanon
-    = Context.getCanonicalType(From->getType().getUnqualifiedType());
+  QualType FromCanon =
+      Context.getCanonicalType(From->getType().getUnqualifiedType());
   QualType ToCanon = Context.getCanonicalType(ToType).getUnqualifiedType();
   if (FromCanon == ToCanon ||
       IsDerivedFrom(CandidateSet.getLocation(), FromCanon, ToCanon)) {
@@ -8665,7 +8590,7 @@ void Sema::AddConversionCandidate(
 
   default:
     llvm_unreachable(
-           "Can only end up with a standard conversion sequence or failure");
+        "Can only end up with a standard conversion sequence or failure");
   }
 
   if (EnableIfAttr *FailedAttr =
@@ -8762,10 +8687,9 @@ void Sema::AddTemplateConversionCandidate(
 void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion,
                                  DeclAccessPair FoundDecl,
                                  CXXRecordDecl *ActingContext,
-                                 const FunctionProtoType *Proto,
-                                 Expr *Object,
+                                 const FunctionProtoType *Proto, Expr *Object,
                                  ArrayRef<Expr *> Args,
-                                 OverloadCandidateSet& CandidateSet) {
+                                 OverloadCandidateSet &CandidateSet) {
   if (!CandidateSet.isNewCandidate(Conversion))
     return;
 
@@ -8811,8 +8735,8 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion,
   Candidate.Conversions[0].UserDefined.HadMultipleCandidates = false;
   Candidate.Conversions[0].UserDefined.ConversionFunction = Conversion;
   Candidate.Conversions[0].UserDefined.FoundConversionFunction = FoundDecl;
-  Candidate.Conversions[0].UserDefined.After
-    = Candidate.Conversions[0].UserDefined.Before;
+  Candidate.Conversions[0].UserDefined.After =
+      Candidate.Conversions[0].UserDefined.Before;
   Candidate.Conversions[0].UserDefined.After.setAsIdentityConversion();
 
   // Find the
@@ -8845,12 +8769,12 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion,
       // (13.3.3.1) that converts that argument to the corresponding
       // parameter of F.
       QualType ParamType = Proto->getParamType(ArgIdx);
-      Candidate.Conversions[ArgIdx + 1]
-        = TryCopyInitialization(*this, Args[ArgIdx], ParamType,
+      Candidate.Conversions[ArgIdx + 1] =
+          TryCopyInitialization(*this, Args[ArgIdx], ParamType,
                                 /*SuppressUserConversions=*/false,
                                 /*InOverloadResolution=*/false,
                                 /*AllowObjCWritebackConversion=*/
-                                  getLangOpts().ObjCAutoRefCount);
+                                getLangOpts().ObjCAutoRefCount);
       if (Candidate.Conversions[ArgIdx + 1].isBad()) {
         Candidate.Viable = false;
         Candidate.FailureKind = ovl_fail_bad_conversion;
@@ -8979,7 +8903,7 @@ void Sema::AddMemberOperatorCandidates(OverloadedOperatorKind Op,
 }
 
 void Sema::AddBuiltinCandidate(QualType *ParamTys, ArrayRef<Expr *> Args,
-                               OverloadCandidateSet& CandidateSet,
+                               OverloadCandidateSet &CandidateSet,
                                bool IsAssignmentOperator,
                                unsigned NumContextualBoolArguments) {
   // Overload resolution is always an unevaluated context.
@@ -9012,15 +8936,15 @@ void Sema::AddBuiltinCandidate(QualType *ParamTys, ArrayRef<Expr *> Args,
     if (ArgIdx < NumContextualBoolArguments) {
       assert(ParamTys[ArgIdx] == Context.BoolTy &&
              "Contextual conversion to bool requires bool type");
-      Candidate.Conversions[ArgIdx]
-        = TryContextuallyConvertToBool(*this, Args[ArgIdx]);
+      Candidate.Conversions[ArgIdx] =
+          TryContextuallyConvertToBool(*this, Args[ArgIdx]);
     } else {
-      Candidate.Conversions[ArgIdx]
-        = TryCopyInitialization(*this, Args[ArgIdx], ParamTys[ArgIdx],
+      Candidate.Conversions[ArgIdx] =
+          TryCopyInitialization(*this, Args[ArgIdx], ParamTys[ArgIdx],
                                 ArgIdx == 0 && IsAssignmentOperator,
                                 /*InOverloadResolution=*/false,
                                 /*AllowObjCWritebackConversion=*/
-                                  getLangOpts().ObjCAutoRefCount);
+                                getLangOpts().ObjCAutoRefCount);
     }
     if (Candidate.Conversions[ArgIdx].isBad()) {
       Candidate.Viable = false;
@@ -9036,7 +8960,7 @@ namespace {
 /// candidate operator functions for built-in operators (C++
 /// [over.built]). The types are separated into pointer types and
 /// enumeration types.
-class BuiltinCandidateTypeSet  {
+class BuiltinCandidateTypeSet {
   /// TypeSet - A set of types.
   typedef llvm::SmallSetVector<QualType, 8> TypeSet;
 
@@ -9094,15 +9018,11 @@ class BuiltinCandidateTypeSet  {
   typedef TypeSet::iterator iterator;
 
   BuiltinCandidateTypeSet(Sema &SemaRef)
-    : HasNonRecordTypes(false),
-      HasArithmeticOrEnumeralTypes(false),
-      HasNullPtrType(false),
-      HasReflectionType(false),
-      SemaRef(SemaRef),
-      Context(SemaRef.Context) { }
-
-  void AddTypesConvertedFrom(QualType Ty,
-                             SourceLocation Loc,
+      : HasNonRecordTypes(false), HasArithmeticOrEnumeralTypes(false),
+        HasNullPtrType(false), HasReflectionType(false), SemaRef(SemaRef),
+        Context(SemaRef.Context) {}
+
+  void AddTypesConvertedFrom(QualType Ty, SourceLocation Loc,
                              bool AllowUserConversions,
                              bool AllowExplicitConversions,
                              const Qualifiers &VisibleTypeConversionsQuals);
@@ -9136,9 +9056,8 @@ class BuiltinCandidateTypeSet  {
 /// false otherwise.
 ///
 /// FIXME: what to do about extended qualifiers?
-bool
-BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(QualType Ty,
-                                             const Qualifiers &VisibleQuals) {
+bool BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(
+    QualType Ty, const Qualifiers &VisibleQuals) {
 
   // Insert this type.
   if (!PointerTypes.insert(Ty))
@@ -9167,10 +9086,12 @@ BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(QualType Ty,
   bool hasRestrict = VisibleQuals.hasRestrict();
 
   // Iterate through all strict supersets of BaseCVR.
-  for (unsigned CVR = BaseCVR+1; CVR <= Qualifiers::CVRMask; ++CVR) {
-    if ((CVR | BaseCVR) != CVR) continue;
+  for (unsigned CVR = BaseCVR + 1; CVR <= Qualifiers::CVRMask; ++CVR) {
+    if ((CVR | BaseCVR) != CVR)
+      continue;
     // Skip over volatile if no volatile found anywhere in the types.
-    if ((CVR & Qualifiers::Volatile) && !hasVolatile) continue;
+    if ((CVR & Qualifiers::Volatile) && !hasVolatile)
+      continue;
 
     // Skip over restrict if no restrict found anywhere in the types, or if
     // the type cannot be restrict-qualified.
@@ -9205,8 +9126,7 @@ BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(QualType Ty,
 /// false otherwise.
 ///
 /// FIXME: what to do about extended qualifiers?
-bool
-BuiltinCandidateTypeSet::AddMemberPointerWithMoreQualifiedTypeVariants(
+bool BuiltinCandidateTypeSet::AddMemberPointerWithMoreQualifiedTypeVariants(
     QualType Ty) {
   // Insert this type.
   if (!MemberPointerTypes.insert(Ty))
@@ -9227,8 +9147,9 @@ BuiltinCandidateTypeSet::AddMemberPointerWithMoreQualifiedTypeVariants(
   // Iterate through all strict supersets of the pointee type's CVR
   // qualifiers.
   unsigned BaseCVR = PointeeTy.getCVRQualifiers();
-  for (unsigned CVR = BaseCVR+1; CVR <= Qualifiers::CVRMask; ++CVR) {
-    if ((CVR | BaseCVR) != CVR) continue;
+  for (unsigned CVR = BaseCVR + 1; CVR <= Qualifiers::CVRMask; ++CVR) {
+    if ((CVR | BaseCVR) != CVR)
+      continue;
 
     QualType QPointeeTy = Context.getCVRQualifiedType(PointeeTy, CVR);
     MemberPointerTypes.insert(Context.getMemberPointerType(
@@ -9246,12 +9167,9 @@ BuiltinCandidateTypeSet::AddMemberPointerWithMoreQualifiedTypeVariants(
 /// functions of a class type, and AllowExplicitConversions if we
 /// should also include the explicit conversion functions of a class
 /// type.
-void
-BuiltinCandidateTypeSet::AddTypesConvertedFrom(QualType Ty,
-                                               SourceLocation Loc,
-                                               bool AllowUserConversions,
-                                               bool AllowExplicitConversions,
-                                               const Qualifiers &VisibleQuals) {
+void BuiltinCandidateTypeSet::AddTypesConvertedFrom(
+    QualType Ty, SourceLocation Loc, bool AllowUserConversions,
+    bool AllowExplicitConversions, const Qualifiers &VisibleQuals) {
   // Only deal with canonical types.
   Ty = Context.getCanonicalType(Ty);
 
@@ -9273,7 +9191,7 @@ BuiltinCandidateTypeSet::AddTypesConvertedFrom(QualType Ty,
 
   // Flag if we encounter an arithmetic type.
   HasArithmeticOrEnumeralTypes =
-    HasArithmeticOrEnumeralTypes || Ty->isArithmeticType();
+      HasArithmeticOrEnumeralTypes || Ty->isArithmeticType();
 
   if (Ty->isObjCIdType() || Ty->isObjCClassType())
     PointerTypes.insert(Ty);
@@ -9339,10 +9257,10 @@ static QualType AdjustAddressSpaceForBuiltinOperandType(Sema &S, QualType T,
 /// Helper function for AddBuiltinOperatorCandidates() that adds
 /// the volatile- and non-volatile-qualified assignment operators for the
 /// given type to the candidate set.
-static void AddBuiltinAssignmentOperatorCandidates(Sema &S,
-                                                   QualType T,
-                                                   ArrayRef<Expr *> Args,
-                                    OverloadCandidateSet &CandidateSet) {
+static void
+AddBuiltinAssignmentOperatorCandidates(Sema &S, QualType T,
+                                       ArrayRef<Expr *> Args,
+                                       OverloadCandidateSet &CandidateSet) {
   QualType ParamTypes[2];
 
   // T& operator=(T&, T)
@@ -9365,51 +9283,51 @@ static void AddBuiltinAssignmentOperatorCandidates(Sema &S,
 
 /// CollectVRQualifiers - This routine returns Volatile/Restrict qualifiers,
 /// if any, found in visible type conversion functions found in ArgExpr's type.
-static  Qualifiers CollectVRQualifiers(ASTContext &Context, Expr* ArgExpr) {
-    Qualifiers VRQuals;
-    CXXRecordDecl *ClassDecl;
-    if (const MemberPointerType *RHSMPType =
-            ArgExpr->getType()->getAs<MemberPointerType>())
-      ClassDecl = RHSMPType->getMostRecentCXXRecordDecl();
-    else
-      ClassDecl = ArgExpr->getType()->getAsCXXRecordDecl();
-    if (!ClassDecl) {
-      // Just to be safe, assume the worst case.
-      VRQuals.addVolatile();
-      VRQuals.addRestrict();
-      return VRQuals;
-    }
-    if (!ClassDecl->hasDefinition())
-      return VRQuals;
+static Qualifiers CollectVRQualifiers(ASTContext &Context, Expr *ArgExpr) {
+  Qualifiers VRQuals;
+  CXXRecordDecl *ClassDecl;
+  if (const MemberPointerType *RHSMPType =
+          ArgExpr->getType()->getAs<MemberPointerType>())
+    ClassDecl = RHSMPType->getMostRecentCXXRecordDecl();
+  else
+    ClassDecl = ArgExpr->getType()->getAsCXXRecordDecl();
+  if (!ClassDecl) {
+    // Just to be safe, assume the worst case.
+    VRQuals.addVolatile();
+    VRQuals.addRestrict();
+    return VRQuals;
+  }
+  if (!ClassDecl->hasDefinition())
+    return VRQuals;
 
-    for (NamedDecl *D : ClassDecl->getVisibleConversionFunctions()) {
-      if (isa<UsingShadowDecl>(D))
-        D = cast<UsingShadowDecl>(D)->getTargetDecl();
-      if (CXXConversionDecl *Conv = dyn_cast<CXXConversionDecl>(D)) {
-        QualType CanTy = Context.getCanonicalType(Conv->getConversionType());
-        if (const ReferenceType *ResTypeRef = CanTy->getAs<ReferenceType>())
-          CanTy = ResTypeRef->getPointeeType();
-        // Need to go down the pointer/mempointer chain and add qualifiers
-        // as see them.
-        bool done = false;
-        while (!done) {
-          if (CanTy.isRestrictQualified())
-            VRQuals.addRestrict();
-          if (const PointerType *ResTypePtr = CanTy->getAs<PointerType>())
-            CanTy = ResTypePtr->getPointeeType();
-          else if (const MemberPointerType *ResTypeMPtr =
-                CanTy->getAs<MemberPointerType>())
-            CanTy = ResTypeMPtr->getPointeeType();
-          else
-            done = true;
-          if (CanTy.isVolatileQualified())
-            VRQuals.addVolatile();
-          if (VRQuals.hasRestrict() && VRQuals.hasVolatile())
-            return VRQuals;
-        }
+  for (NamedDecl *D : ClassDecl->getVisibleConversionFunctions()) {
+    if (isa<UsingShadowDecl>(D))
+      D = cast<UsingShadowDecl>(D)->getTargetDecl();
+    if (CXXConversionDecl *Conv = dyn_cast<CXXConversionDecl>(D)) {
+      QualType CanTy = Context.getCanonicalType(Conv->getConversionType());
+      if (const ReferenceType *ResTypeRef = CanTy->getAs<ReferenceType>())
+        CanTy = ResTypeRef->getPointeeType();
+      // Need to go down the pointer/mempointer chain and add qualifiers
+      // as see them.
+      bool done = false;
+      while (!done) {
+        if (CanTy.isRestrictQualified())
+          VRQuals.addRestrict();
+        if (const PointerType *ResTypePtr = CanTy->getAs<PointerType>())
+          CanTy = ResTypePtr->getPointeeType();
+        else if (const MemberPointerType *ResTypeMPtr =
+                     CanTy->getAs<MemberPointerType>())
+          CanTy = ResTypeMPtr->getPointeeType();
+        else
+          done = true;
+        if (CanTy.isVolatileQualified())
+          VRQuals.addVolatile();
+        if (VRQuals.hasRestrict() && VRQuals.hasVolatile())
+          return VRQuals;
       }
     }
-    return VRQuals;
+  }
+  return VRQuals;
 }
 
 // Note: We're currently only handling qualifiers that are meaningful for the
@@ -9476,12 +9394,9 @@ class BuiltinOperatorOverloadBuilder {
   // Define some indices used to iterate over the arithmetic types in
   // ArithmeticTypes.  The "promoted arithmetic types" are the arithmetic
   // types are that preserved by promotion (C++ [over.built]p2).
-  unsigned FirstIntegralType,
-           LastIntegralType;
-  unsigned FirstPromotedIntegralType,
-           LastPromotedIntegralType;
-  unsigned FirstPromotedArithmeticType,
-           LastPromotedArithmeticType;
+  unsigned FirstIntegralType, LastIntegralType;
+  unsigned FirstPromotedIntegralType, LastPromotedIntegralType;
+  unsigned FirstPromotedArithmeticType, LastPromotedArithmeticType;
   unsigned NumArithmeticTypes;
 
   void InitArithmeticTypes() {
@@ -9556,12 +9471,9 @@ class BuiltinOperatorOverloadBuilder {
   /// Helper method to factor out the common pattern of adding overloads
   /// for '++' and '--' builtin operators.
   void addPlusPlusMinusMinusStyleOverloads(QualType CandidateTy,
-                                           bool HasVolatile,
-                                           bool HasRestrict) {
-    QualType ParamTypes[2] = {
-      S.Context.getLValueReferenceType(CandidateTy),
-      S.Context.IntTy
-    };
+                                           bool HasVolatile, bool HasRestrict) {
+    QualType ParamTypes[2] = {S.Context.getLValueReferenceType(CandidateTy),
+                              S.Context.IntTy};
 
     // Non-volatile version.
     S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet);
@@ -9569,8 +9481,7 @@ class BuiltinOperatorOverloadBuilder {
     // Use a heuristic to reduce number of builtin candidates in the set:
     // add volatile version only if there are conversions to a volatile type.
     if (HasVolatile) {
-      ParamTypes[0] =
-        S.Context.getLValueReferenceType(
+      ParamTypes[0] = S.Context.getLValueReferenceType(
           S.Context.getVolatileType(CandidateTy));
       S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet);
     }
@@ -9579,21 +9490,17 @@ class BuiltinOperatorOverloadBuilder {
     // and our candidate type is a non-restrict-qualified pointer.
     if (HasRestrict && CandidateTy->isAnyPointerType() &&
         !CandidateTy.isRestrictQualified()) {
-      ParamTypes[0]
-        = S.Context.getLValueReferenceType(
-            S.Context.getCVRQualifiedType(CandidateTy, Qualifiers::Restrict));
+      ParamTypes[0] = S.Context.getLValueReferenceType(
+          S.Context.getCVRQualifiedType(CandidateTy, Qualifiers::Restrict));
       S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet);
 
       if (HasVolatile) {
-        ParamTypes[0]
-          = S.Context.getLValueReferenceType(
-              S.Context.getCVRQualifiedType(CandidateTy,
-                                            (Qualifiers::Volatile |
-                                             Qualifiers::Restrict)));
+        ParamTypes[0] =
+            S.Context.getLValueReferenceType(S.Context.getCVRQualifiedType(
+                CandidateTy, (Qualifiers::Volatile | Qualifiers::Restrict)));
         S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet);
       }
     }
-
   }
 
   /// Helper to add an overload candidate for a binary builtin with types \p L
@@ -9605,17 +9512,16 @@ class BuiltinOperatorOverloadBuilder {
 
 public:
   BuiltinOperatorOverloadBuilder(
-    Sema &S, ArrayRef<Expr *> Args,
-    QualifiersAndAtomic VisibleTypeConversionsQuals,
-    bool HasArithmeticOrEnumeralCandidateType,
-    SmallVectorImpl<BuiltinCandidateTypeSet> &CandidateTypes,
-    OverloadCandidateSet &CandidateSet)
-    : S(S), Args(Args),
-      VisibleTypeConversionsQuals(VisibleTypeConversionsQuals),
-      HasArithmeticOrEnumeralCandidateType(
-        HasArithmeticOrEnumeralCandidateType),
-      CandidateTypes(CandidateTypes),
-      CandidateSet(CandidateSet) {
+      Sema &S, ArrayRef<Expr *> Args,
+      QualifiersAndAtomic VisibleTypeConversionsQuals,
+      bool HasArithmeticOrEnumeralCandidateType,
+      SmallVectorImpl<BuiltinCandidateTypeSet> &CandidateTypes,
+      OverloadCandidateSet &CandidateSet)
+      : S(S), Args(Args),
+        VisibleTypeConversionsQuals(VisibleTypeConversionsQuals),
+        HasArithmeticOrEnumeralCandidateType(
+            HasArithmeticOrEnumeralCandidateType),
+        CandidateTypes(CandidateTypes), CandidateSet(CandidateSet) {
 
     InitArithmeticTypes();
   }
@@ -9652,9 +9558,8 @@ class BuiltinOperatorOverloadBuilder {
           continue;
       }
       addPlusPlusMinusMinusStyleOverloads(
-        TypeOfT,
-        VisibleTypeConversionsQuals.hasVolatile(),
-        VisibleTypeConversionsQuals.hasRestrict());
+          TypeOfT, VisibleTypeConversionsQuals.hasVolatile(),
+          VisibleTypeConversionsQuals.hasRestrict());
     }
   }
 
@@ -9699,7 +9604,8 @@ class BuiltinOperatorOverloadBuilder {
       if (!PointeeTy->isObjectType() && !PointeeTy->isFunctionType())
         continue;
 
-      if (const FunctionProtoType *Proto =PointeeTy->getAs<FunctionProtoType>())
+      if (const FunctionProtoType *Proto =
+              PointeeTy->getAs<FunctionProtoType>())
         if (Proto->getMethodQuals() || Proto->getRefQualifier())
           continue;
 
@@ -9781,7 +9687,7 @@ class BuiltinOperatorOverloadBuilder {
       if (CandidateTypes[ArgIdx].hasNullPtrType()) {
         CanQualType NullPtrTy = S.Context.getCanonicalType(S.Context.NullPtrTy);
         if (AddedTypes.insert(NullPtrTy).second) {
-          QualType ParamTypes[2] = { NullPtrTy, NullPtrTy };
+          QualType ParamTypes[2] = {NullPtrTy, NullPtrTy};
           S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet);
         }
       }
@@ -9789,7 +9695,7 @@ class BuiltinOperatorOverloadBuilder {
       if (CandidateTypes[ArgIdx].hasReflectionType()) {
         CanQualType InfoTy = S.Context.getCanonicalType(S.Context.MetaInfoTy);
         if (AddedTypes.insert(InfoTy).second) {
-          QualType ParamTypes[2] = { InfoTy, InfoTy };
+          QualType ParamTypes[2] = {InfoTy, InfoTy};
           S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet);
         }
       }
@@ -9816,18 +9722,18 @@ class BuiltinOperatorOverloadBuilder {
     //   candidate.
     //
     // Note that in practice, this only affects enumeration types because there
-    // aren't any built-in candidates of record type, and a user-defined operator
-    // must have an operand of record or enumeration type. Also, the only other
-    // overloaded operator with enumeration arguments, operator=,
+    // aren't any built-in candidates of record type, and a user-defined
+    // operator must have an operand of record or enumeration type. Also, the
+    // only other overloaded operator with enumeration arguments, operator=,
     // cannot be overloaded for enumeration types, so this is the only place
     // where we must suppress candidates like this.
-    llvm::DenseSet<std::pair<CanQualType, CanQualType> >
-      UserDefinedBinaryOperators;
+    llvm::DenseSet<std::pair<CanQualType, CanQualType>>
+        UserDefinedBinaryOperators;
 
     for (unsigned ArgIdx = 0, N = Args.size(); ArgIdx != N; ++ArgIdx) {
       if (!CandidateTypes[ArgIdx].enumeration_types().empty()) {
         for (OverloadCandidateSet::iterator C = CandidateSet.begin(),
-                                         CEnd = CandidateSet.end();
+                                            CEnd = CandidateSet.end();
              C != CEnd; ++C) {
           if (!C->Viable || !C->Function || C->Function->getNumParams() != 2)
             continue;
@@ -9853,8 +9759,8 @@ class BuiltinOperatorOverloadBuilder {
 
           // Add this operator to the set of known user-defined operators.
           UserDefinedBinaryOperators.insert(
-            std::make_pair(S.Context.getCanonicalType(FirstParamType),
-                           S.Context.getCanonicalType(SecondParamType)));
+              std::make_pair(S.Context.getCanonicalType(FirstParamType),
+                             S.Context.getCanonicalType(SecondParamType)));
         }
       }
     }
@@ -9879,8 +9785,8 @@ class BuiltinOperatorOverloadBuilder {
         // Don't add the same builtin candidate twice, or if a user defined
         // candidate exists.
         if (!AddedTypes.insert(CanonType).second ||
-            UserDefinedBinaryOperators.count(std::make_pair(CanonType,
-                                                            CanonType)))
+            UserDefinedBinaryOperators.count(
+                std::make_pair(CanonType, CanonType)))
           continue;
         QualType ParamTypes[2] = {EnumTy, EnumTy};
         S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet);
@@ -9911,8 +9817,8 @@ class BuiltinOperatorOverloadBuilder {
 
     for (int Arg = 0; Arg < 2; ++Arg) {
       QualType AsymmetricParamTypes[2] = {
-        S.Context.getPointerDiffType(),
-        S.Context.getPointerDiffType(),
+          S.Context.getPointerDiffType(),
+          S.Context.getPointerDiffType(),
       };
       for (QualType PtrTy : CandidateTypes[Arg].pointer_types()) {
         QualType PointeeTy = PtrTy->getPointeeType();
@@ -9974,8 +9880,7 @@ class BuiltinOperatorOverloadBuilder {
          Left < LastPromotedArithmeticType; ++Left) {
       for (unsigned Right = FirstPromotedArithmeticType;
            Right < LastPromotedArithmeticType; ++Right) {
-        QualType LandR[2] = { ArithmeticTypes[Left],
-                              ArithmeticTypes[Right] };
+        QualType LandR[2] = {ArithmeticTypes[Left], ArithmeticTypes[Right]};
         S.AddBuiltinCandidate(LandR, Args, CandidateSet);
       }
     }
@@ -10067,8 +9972,7 @@ class BuiltinOperatorOverloadBuilder {
          Left < LastPromotedIntegralType; ++Left) {
       for (unsigned Right = FirstPromotedIntegralType;
            Right < LastPromotedIntegralType; ++Right) {
-        QualType LandR[2] = { ArithmeticTypes[Left],
-                              ArithmeticTypes[Right] };
+        QualType LandR[2] = {ArithmeticTypes[Left], ArithmeticTypes[Right]};
         S.AddBuiltinCandidate(LandR, Args, CandidateSet);
       }
     }
@@ -10135,7 +10039,7 @@ class BuiltinOperatorOverloadBuilder {
           isEqualOp ? PtrTy : S.Context.getPointerDiffType(),
       };
       S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet,
-                            /*IsAssignmentOperator=*/ isEqualOp);
+                            /*IsAssignmentOperator=*/isEqualOp);
 
       bool NeedVolatile = !PtrTy.isVolatileQualified() &&
                           VisibleTypeConversionsQuals.hasVolatile();
@@ -10314,7 +10218,7 @@ class BuiltinOperatorOverloadBuilder {
                           /*NumContextualBoolArguments=*/1);
   }
   void addAmpAmpOrPipePipeOverload() {
-    QualType ParamTypes[2] = { S.Context.BoolTy, S.Context.BoolTy };
+    QualType ParamTypes[2] = {S.Context.BoolTy, S.Context.BoolTy};
     S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet,
                           /*IsAssignmentOperator=*/false,
                           /*NumContextualBoolArguments=*/2);
@@ -10468,15 +10372,12 @@ void Sema::AddBuiltinOperatorCandidates(OverloadedOperatorKind Op,
   SmallVector<BuiltinCandidateTypeSet, 2> CandidateTypes;
   for (unsigned ArgIdx = 0, N = Args.size(); ArgIdx != N; ++ArgIdx) {
     CandidateTypes.emplace_back(*this);
-    CandidateTypes[ArgIdx].AddTypesConvertedFrom(Args[ArgIdx]->getType(),
-                                                 OpLoc,
-                                                 true,
-                                                 (Op == OO_Exclaim ||
-                                                  Op == OO_AmpAmp ||
-                                                  Op == OO_PipePipe),
-                                                 VisibleTypeConversionsQuals);
-    HasNonRecordCandidateType = HasNonRecordCandidateType ||
-        CandidateTypes[ArgIdx].hasNonRecordTypes();
+    CandidateTypes[ArgIdx].AddTypesConvertedFrom(
+        Args[ArgIdx]->getType(), OpLoc, true,
+        (Op == OO_Exclaim || Op == OO_AmpAmp || Op == OO_PipePipe),
+        VisibleTypeConversionsQuals);
+    HasNonRecordCandidateType =
+        HasNonRecordCandidateType || CandidateTypes[ArgIdx].hasNonRecordTypes();
     HasArithmeticOrEnumeralCandidateType =
         HasArithmeticOrEnumeralCandidateType ||
         CandidateTypes[ArgIdx].hasArithmeticOrEnumeralTypes();
@@ -10492,10 +10393,9 @@ void Sema::AddBuiltinOperatorCandidates(OverloadedOperatorKind Op,
     return;
 
   // Setup an object to manage the common state for building overloads.
-  BuiltinOperatorOverloadBuilder OpBuilder(*this, Args,
-                                           VisibleTypeConversionsQuals,
-                                           HasArithmeticOrEnumeralCandidateType,
-                                           CandidateTypes, CandidateSet);
+  BuiltinOperatorOverloadBuilder OpBuilder(
+      *this, Args, VisibleTypeConversionsQuals,
+      HasArithmeticOrEnumeralCandidateType, CandidateTypes, CandidateSet);
 
   // Dispatch over the operation to add in only those overloads which apply.
   switch (Op) {
@@ -10509,7 +10409,7 @@ void Sema::AddBuiltinOperatorCandidates(OverloadedOperatorKind Op,
   case OO_Array_Delete:
   case OO_Call:
     llvm_unreachable(
-                    "Special operators don't use AddBuiltinOperatorCandidates");
+        "Special operators don't use AddBuiltinOperatorCandidates");
 
   case OO_Comma:
   case OO_Arrow:
@@ -10644,13 +10544,10 @@ void Sema::AddBuiltinOperatorCandidates(OverloadedOperatorKind Op,
   }
 }
 
-void
-Sema::AddArgumentDependentLookupCandidates(DeclarationName Name,
-                                           SourceLocation Loc,
-                                           ArrayRef<Expr *> Args,
-                                 TemplateArgumentListInfo *ExplicitTemplateArgs,
-                                           OverloadCandidateSet& CandidateSet,
-                                           bool PartialOverloading) {
+void Sema::AddArgumentDependentLookupCandidates(
+    DeclarationName Name, SourceLocation Loc, ArrayRef<Expr *> Args,
+    TemplateArgumentListInfo *ExplicitTemplateArgs,
+    OverloadCandidateSet &CandidateSet, bool PartialOverloading) {
   ADLResult Fns;
 
   // FIXME: This approach for uniquing ADL results (and removing
@@ -10667,7 +10564,7 @@ Sema::AddArgumentDependentLookupCandidates(DeclarationName Name,
 
   // Erase all of the candidates we already knew about.
   for (OverloadCandidateSet::iterator Cand = CandidateSet.begin(),
-                                   CandEnd = CandidateSet.end();
+                                      CandEnd = CandidateSet.end();
        Cand != CandEnd; ++Cand)
     if (Cand->Function) {
       FunctionDecl *Fn = Cand->Function;
@@ -11075,9 +10972,8 @@ bool clang::isBetterOverloadCandidate(
   //   conversion sequence than ICSi(F2), and then...
   bool HasWorseConversion = false;
   for (unsigned ArgIdx = StartArg; ArgIdx < NumArgs; ++ArgIdx) {
-    switch (CompareImplicitConversionSequences(S, Loc,
-                                               Cand1.Conversions[ArgIdx],
-                                               Cand2.Conversions[ArgIdx])) {
+    switch (CompareImplicitConversionSequences(
+        S, Loc, Cand1.Conversions[ArgIdx], Cand2.Conversions[ArgIdx])) {
     case ImplicitConversionSequence::Better:
       // Cand1 has a better conversion sequence.
       HasBetterConversion = true;
@@ -11136,8 +11032,7 @@ bool clang::isBetterOverloadCandidate(
     ImplicitConversionSequence::CompareKind Result =
         compareConversionFunctions(S, Cand1.Function, Cand2.Function);
     if (Result == ImplicitConversionSequence::Indistinguishable)
-      Result = CompareStandardConversionSequences(S, Loc,
-                                                  Cand1.FinalConversion,
+      Result = CompareStandardConversionSequences(S, Loc, Cand1.FinalConversion,
                                                   Cand2.FinalConversion);
 
     if (Result != ImplicitConversionSequence::Indistinguishable)
@@ -11165,10 +11060,10 @@ bool clang::isBetterOverloadCandidate(
 
   //    -- F1 is a non-template function and F2 is a function template
   //       specialization, or, if not that,
-  bool Cand1IsSpecialization = Cand1.Function &&
-                               Cand1.Function->getPrimaryTemplate();
-  bool Cand2IsSpecialization = Cand2.Function &&
-                               Cand2.Function->getPrimaryTemplate();
+  bool Cand1IsSpecialization =
+      Cand1.Function && Cand1.Function->getPrimaryTemplate();
+  bool Cand2IsSpecialization =
+      Cand2.Function && Cand2.Function->getPrimaryTemplate();
   if (Cand1IsSpecialization != Cand2IsSpecialization)
     return Cand2IsSpecialization;
 
@@ -11331,8 +11226,8 @@ bool Sema::isEquivalentInternalLinkageDeclaration(const NamedDecl *A,
   // entity in different modules.
   if (!VA->getDeclContext()->getRedeclContext()->Equals(
           VB->getDeclContext()->getRedeclContext()) ||
-      getOwningModule(VA) == getOwningModule(VB) ||
-      VA->isExternallyVisible() || VB->isExternallyVisible())
+      getOwningModule(VA) == getOwningModule(VB) || VA->isExternallyVisible() ||
+      VB->isExternallyVisible())
     return false;
 
   // Check that the declarations appear to be equivalent.
@@ -11761,7 +11656,7 @@ void MaybeEmitInheritedConstructorNote(Sema &S, const Decl *FoundDecl) {
   if (const auto *Shadow = dyn_cast<ConstructorUsingShadowDecl>(FoundDecl))
     S.Diag(FoundDecl->getLocation(),
            diag::note_ovl_candidate_inherited_constructor)
-      << Shadow->getNominatedBaseClass();
+        << Shadow->getNominatedBaseClass();
 }
 
 } // end anonymous namespace
@@ -11970,14 +11865,14 @@ void Sema::NoteAllOverloadCandidates(Expr *OverloadedExpr, QualType DestType,
   OverloadExpr *OvlExpr = Ovl.Expression;
 
   for (UnresolvedSetIterator I = OvlExpr->decls_begin(),
-                            IEnd = OvlExpr->decls_end();
+                             IEnd = OvlExpr->decls_end();
        I != IEnd; ++I) {
     if (FunctionTemplateDecl *FunTmpl =
-                dyn_cast<FunctionTemplateDecl>((*I)->getUnderlyingDecl()) ) {
+            dyn_cast<FunctionTemplateDecl>((*I)->getUnderlyingDecl())) {
       NoteOverloadCandidate(*I, FunTmpl->getTemplatedDecl(), CRK_None, DestType,
                             TakingAddress);
-    } else if (FunctionDecl *Fun
-                      = dyn_cast<FunctionDecl>((*I)->getUnderlyingDecl()) ) {
+    } else if (FunctionDecl *Fun =
+                   dyn_cast<FunctionDecl>((*I)->getUnderlyingDecl())) {
       NoteOverloadCandidate(*I, Fun, CRK_None, DestType, TakingAddress);
     }
   }
@@ -11987,11 +11882,8 @@ void Sema::NoteAllOverloadCandidates(Expr *OverloadedExpr, QualType DestType,
 /// "lead" diagnostic; it will be given two arguments, the source and
 /// target types of the conversion.
 void ImplicitConversionSequence::DiagnoseAmbiguousConversion(
-                                 Sema &S,
-                                 SourceLocation CaretLoc,
-                                 const PartialDiagnostic &PDiag) const {
-  S.Diag(CaretLoc, PDiag)
-    << Ambiguous.getFromType() << Ambiguous.getToType();
+    Sema &S, SourceLocation CaretLoc, const PartialDiagnostic &PDiag) const {
+  S.Diag(CaretLoc, PDiag) << Ambiguous.getFromType() << Ambiguous.getToType();
   unsigned CandsShown = 0;
   AmbiguousConversionSequence::const_iterator I, E;
   for (I = Ambiguous.begin(), E = Ambiguous.end(); I != E; ++I) {
@@ -12005,8 +11897,8 @@ void ImplicitConversionSequence::DiagnoseAmbiguousConversion(
     S.Diag(SourceLocation(), diag::note_ovl_too_many_candidates) << int(E - I);
 }
 
-static void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand,
-                                  unsigned I, bool TakingCandidateAddress) {
+static void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand, unsigned I,
+                                  bool TakingCandidateAddress) {
   const ImplicitConversionSequence &Conv = Cand->Conversions[I];
   assert(Conv.isBad());
   assert(Cand->Function && "for now, candidate must be a function");
@@ -12190,10 +12082,10 @@ static void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand,
                           FromPtrTy->getPointeeType()))
         BaseToDerivedConversion = 1;
     }
-  } else if (const ObjCObjectPointerType *FromPtrTy
-                                    = FromTy->getAs<ObjCObjectPointerType>()) {
-    if (const ObjCObjectPointerType *ToPtrTy
-                                        = ToTy->getAs<ObjCObjectPointerType>())
+  } else if (const ObjCObjectPointerType *FromPtrTy =
+                 FromTy->getAs<ObjCObjectPointerType>()) {
+    if (const ObjCObjectPointerType *ToPtrTy =
+            ToTy->getAs<ObjCObjectPointerType>())
       if (const ObjCInterfaceDecl *FromIface = FromPtrTy->getInterfaceDecl())
         if (const ObjCInterfaceDecl *ToIface = ToPtrTy->getInterfaceDecl())
           if (ToPtrTy->getPointeeType().isAtLeastAsQualifiedAs(
@@ -12219,8 +12111,7 @@ static void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand,
     return;
   }
 
-  if (isa<ObjCObjectPointerType>(CFromTy) &&
-      isa<PointerType>(CToTy)) {
+  if (isa<ObjCObjectPointerType>(CFromTy) && isa<PointerType>(CToTy)) {
     Qualifiers FromQs = CFromTy.getQualifiers();
     Qualifiers ToQs = CToTy.getQualifiers();
     if (FromQs.getObjCLifetime() != ToQs.getObjCLifetime()) {
@@ -12256,7 +12147,7 @@ static void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand,
   if (!S.SourceMgr.isInSystemHeader(Fn->getLocation())) {
     // If we can fix the conversion, suggest the FixIts.
     for (const FixItHint &HI : Cand->Fix.Hints)
-        FDiag << HI;
+      FDiag << HI;
   }
 
   S.Diag(Fn->getLocation(), FDiag);
@@ -12303,9 +12194,9 @@ static void DiagnoseArityMismatch(Sema &S, NamedDecl *Found, Decl *D,
                                   unsigned NumFormalArgs,
                                   bool IsAddressOf = false) {
   assert(isa<FunctionDecl>(D) &&
-      "The templated declaration should at least be a function"
-      " when diagnosing bad template argument deduction due to too many"
-      " or too few arguments");
+         "The templated declaration should at least be a function"
+         " when diagnosing bad template argument deduction due to too many"
+         " or too few arguments");
 
   FunctionDecl *Fn = cast<FunctionDecl>(D);
 
@@ -12383,9 +12274,9 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated,
                                  bool TakingCandidateAddress) {
   TemplateParameter Param = DeductionFailure.getTemplateParameter();
   NamedDecl *ParamD;
-  (ParamD = Param.dyn_cast<TemplateTypeParmDecl*>()) ||
-  (ParamD = Param.dyn_cast<NonTypeTemplateParmDecl*>()) ||
-  (ParamD = Param.dyn_cast<TemplateTemplateParmDecl*>());
+  (ParamD = Param.dyn_cast<TemplateTypeParmDecl *>()) ||
+      (ParamD = Param.dyn_cast<NonTypeTemplateParmDecl *>()) ||
+      (ParamD = Param.dyn_cast<TemplateTemplateParmDecl *>());
   switch (DeductionFailure.getResult()) {
   case TemplateDeductionResult::Success:
     llvm_unreachable(
@@ -12458,8 +12349,8 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated,
       if (!T1.isNull() && !T2.isNull() && !S.Context.hasSameType(T1, T2)) {
         S.Diag(Templated->getLocation(),
                diag::note_ovl_candidate_inconsistent_deduction_types)
-          << ParamD->getDeclName() << *DeductionFailure.getFirstArg() << T1
-          << *DeductionFailure.getSecondArg() << T2;
+            << ParamD->getDeclName() << *DeductionFailure.getFirstArg() << T1
+            << *DeductionFailure.getSecondArg() << T2;
         MaybeEmitInheritedConstructorNote(S, Found);
         return;
       }
@@ -12497,8 +12388,8 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated,
       int index = 0;
       if (TemplateTypeParmDecl *TTP = dyn_cast<TemplateTypeParmDecl>(ParamD))
         index = TTP->getIndex();
-      else if (NonTypeTemplateParmDecl *NTTP
-                                  = dyn_cast<NonTypeTemplateParmDecl>(ParamD))
+      else if (NonTypeTemplateParmDecl *NTTP =
+                   dyn_cast<NonTypeTemplateParmDecl>(ParamD))
         index = NTTP->getIndex();
       else
         index = cast<TemplateTemplateParmDecl>(ParamD)->getIndex();
@@ -12523,7 +12414,7 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated,
         << TemplateArgString;
 
     S.DiagnoseUnsatisfiedConstraint(
-        static_cast<CNSInfo*>(DeductionFailure.Data)->Satisfaction);
+        static_cast<CNSInfo *>(DeductionFailure.Data)->Satisfaction);
     return;
   }
   case TemplateDeductionResult::TooManyArguments:
@@ -12552,20 +12443,20 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated,
     // If this candidate was disabled by enable_if, say so.
     PartialDiagnosticAt *PDiag = DeductionFailure.getSFINAEDiagnostic();
     if (PDiag && PDiag->second.getDiagID() ==
-          diag::err_typename_nested_not_found_enable_if) {
+                     diag::err_typename_nested_not_found_enable_if) {
       // FIXME: Use the source range of the condition, and the fully-qualified
       //        name of the enable_if template. These are both present in PDiag.
       S.Diag(PDiag->first, diag::note_ovl_candidate_disabled_by_enable_if)
-        << "'enable_if'" << TemplateArgString;
+          << "'enable_if'" << TemplateArgString;
       return;
     }
 
     // We found a specific requirement that disabled the enable_if.
     if (PDiag && PDiag->second.getDiagID() ==
-        diag::err_typename_nested_not_found_requirement) {
+                     diag::err_typename_nested_not_found_requirement) {
       S.Diag(Templated->getLocation(),
              diag::note_ovl_candidate_disabled_by_requirement)
-        << PDiag->second.getStringArg(0) << TemplateArgString;
+          << PDiag->second.getStringArg(0) << TemplateArgString;
       return;
     }
 
@@ -12740,7 +12631,7 @@ static void DiagnoseBadTarget(Sema &S, OverloadCandidate *Cand) {
 static void DiagnoseFailedEnableIfAttr(Sema &S, OverloadCandidate *Cand) {
   assert(Cand->Function && "Candidate must be a function");
   FunctionDecl *Callee = Cand->Function;
-  EnableIfAttr *Attr = static_cast<EnableIfAttr*>(Cand->DeductionFailure.Data);
+  EnableIfAttr *Attr = static_cast<EnableIfAttr *>(Cand->DeductionFailure.Data);
 
   S.Diag(Callee->getLocation(),
          diag::note_ovl_candidate_disabled_by_function_cond_attr)
@@ -12776,8 +12667,7 @@ static void DiagnoseFailedExplicitSpec(Sema &S, OverloadCandidate *Cand) {
   if (FunctionDecl *Pattern = First->getTemplateInstantiationPattern())
     First = Pattern->getFirstDecl();
 
-  S.Diag(First->getLocation(),
-         diag::note_ovl_candidate_explicit)
+  S.Diag(First->getLocation(), diag::note_ovl_candidate_explicit)
       << Kind << (ES.getExpr() ? 1 : 0)
       << (ES.getExpr() ? ES.getExpr()->getSourceRange() : SourceRange());
 }
@@ -12838,8 +12728,7 @@ static void NoteImplicitDeductionGuide(Sema &S, FunctionDecl *Fn) {
 /// \param CtorDestAS Addr space of object being constructed (for ctor
 /// candidates only).
 static void NoteFunctionCandidate(Sema &S, OverloadCandidate *Cand,
-                                  unsigned NumArgs,
-                                  bool TakingCandidateAddress,
+                                  unsigned NumArgs, bool TakingCandidateAddress,
                                   LangAS CtorDestAS = LangAS::Default) {
   assert(Cand->Function && "Candidate must be a function");
   FunctionDecl *Fn = Cand->Function;
@@ -12898,12 +12787,11 @@ static void NoteFunctionCandidate(Sema &S, OverloadCandidate *Cand,
     return DiagnoseArityMismatch(S, Cand, NumArgs);
 
   case ovl_fail_bad_deduction:
-    return DiagnoseBadDeduction(S, Cand, NumArgs,
-                                TakingCandidateAddress);
+    return DiagnoseBadDeduction(S, Cand, NumArgs, TakingCandidateAddress);
 
   case ovl_fail_illegal_constructor: {
     S.Diag(Fn->getLocation(), diag::note_ovl_candidate_illegal_constructor)
-      << (Fn->getPrimaryTemplate() ? 1 : 0);
+        << (Fn->getPrimaryTemplate() ? 1 : 0);
     MaybeEmitInheritedConstructorNote(S, Cand->FoundDecl);
     return;
   }
@@ -12950,8 +12838,8 @@ static void NoteFunctionCandidate(Sema &S, OverloadCandidate *Cand,
       return;
     S.Diag(Fn->getLocation(),
            diag::note_ovl_candidate_inherited_constructor_slice)
-      << (Fn->getPrimaryTemplate() ? 1 : 0)
-      << Fn->getParamDecl(0)->getType()->isRValueReferenceType();
+        << (Fn->getPrimaryTemplate() ? 1 : 0)
+        << Fn->getParamDecl(0)->getType()->isRValueReferenceType();
     MaybeEmitInheritedConstructorNote(S, Cand->FoundDecl);
     return;
 
@@ -12996,11 +12884,11 @@ static void NoteSurrogateCandidate(Sema &S, OverloadCandidate *Cand) {
   bool isRValueReference = false;
   bool isPointer = false;
   if (const LValueReferenceType *FnTypeRef =
-        FnType->getAs<LValueReferenceType>()) {
+          FnType->getAs<LValueReferenceType>()) {
     FnType = FnTypeRef->getPointeeType();
     isLValueReference = true;
   } else if (const RValueReferenceType *FnTypeRef =
-               FnType->getAs<RValueReferenceType>()) {
+                 FnType->getAs<RValueReferenceType>()) {
     FnType = FnTypeRef->getPointeeType();
     isRValueReference = true;
   }
@@ -13011,9 +12899,12 @@ static void NoteSurrogateCandidate(Sema &S, OverloadCandidate *Cand) {
   // Desugar down to a function type.
   FnType = QualType(FnType->getAs<FunctionType>(), 0);
   // Reconstruct the pointer/reference as appropriate.
-  if (isPointer) FnType = S.Context.getPointerType(FnType);
-  if (isRValueReference) FnType = S.Context.getRValueReferenceType(FnType);
-  if (isLValueReference) FnType = S.Context.getLValueReferenceType(FnType);
+  if (isPointer)
+    FnType = S.Context.getPointerType(FnType);
+  if (isRValueReference)
+    FnType = S.Context.getRValueReferenceType(FnType);
+  if (isLValueReference)
+    FnType = S.Context.getLValueReferenceType(FnType);
 
   if (!Cand->Viable &&
       Cand->FailureKind == ovl_fail_constraints_not_satisfied) {
@@ -13051,8 +12942,10 @@ static void NoteBuiltinOperatorCandidate(Sema &S, StringRef Opc,
 static void NoteAmbiguousUserConversions(Sema &S, SourceLocation OpLoc,
                                          OverloadCandidate *Cand) {
   for (const ImplicitConversionSequence &ICS : Cand->Conversions) {
-    if (ICS.isBad()) break; // all meaningless after first invalid
-    if (!ICS.isAmbiguous()) continue;
+    if (ICS.isBad())
+      break; // all meaningless after first invalid
+    if (!ICS.isAmbiguous())
+      continue;
 
     ICS.DiagnoseAmbiguousConversion(
         S, OpLoc, S.PDiag(diag::note_ambiguous_type_conversion));
@@ -13135,14 +13028,15 @@ struct CompareOverloadCandidatesForDisplay {
     return static_cast<OverloadFailureKind>(C->FailureKind);
   }
 
-  bool operator()(const OverloadCandidate *L,
-                  const OverloadCandidate *R) {
+  bool operator()(const OverloadCandidate *L, const OverloadCandidate *R) {
     // Fast-path this check.
-    if (L == R) return false;
+    if (L == R)
+      return false;
 
     // Order first by viability.
     if (L->Viable) {
-      if (!R->Viable) return true;
+      if (!R->Viable)
+        return true;
 
       if (int Ord = CompareConversions(*L, *R))
         return Ord < 0;
@@ -13286,7 +13180,7 @@ struct CompareOverloadCandidatesForDisplay {
     return 0;
   }
 };
-}
+} // namespace
 
 /// CompleteNonViableCandidate - Normally, overload resolution only
 /// computes up to the first bad conversion. Produces the FixIt set if
@@ -13330,8 +13224,8 @@ CompleteNonViableCandidate(Sema &S, OverloadCandidate *Cand,
   bool Reversed = Cand->isReversed();
 
   if (Cand->IsSurrogate) {
-    QualType ConvType
-      = Cand->Surrogate->getConversionType().getNonReferenceType();
+    QualType ConvType =
+        Cand->Surrogate->getConversionType().getNonReferenceType();
     if (const PointerType *ConvPtrType = ConvType->getAs<PointerType>())
       ConvType = ConvPtrType->getPointeeType();
     ParamTypes = ConvType->castAs<FunctionProtoType>()->getParamTypes();
@@ -13369,12 +13263,11 @@ CompleteNonViableCandidate(Sema &S, OverloadCandidate *Cand,
         Cand->Conversions[ConvIdx].setAsIdentityConversion(
             Args[ArgIdx]->getType());
       else {
-        Cand->Conversions[ConvIdx] =
-            TryCopyInitialization(S, Args[ArgIdx], ParamTypes[ParamIdx],
-                                  SuppressUserConversions,
-                                  /*InOverloadResolution=*/true,
-                                  /*AllowObjCWritebackConversion=*/
-                                  S.getLangOpts().ObjCAutoRefCount);
+        Cand->Conversions[ConvIdx] = TryCopyInitialization(
+            S, Args[ArgIdx], ParamTypes[ParamIdx], SuppressUserConversions,
+            /*InOverloadResolution=*/true,
+            /*AllowObjCWritebackConversion=*/
+            S.getLangOpts().ObjCAutoRefCount);
         // Store the FixIt in the candidate if it exists.
         if (!Unfixable && Cand->Conversions[ConvIdx].isBad())
           Unfixable = !Cand->TryToFixBadConversion(ConvIdx, S);
@@ -13393,8 +13286,9 @@ SmallVector<OverloadCandidate *, 32> OverloadCandidateSet::CompleteCandidates(
 
   // Sort the candidates by viability and position.  Sorting directly would
   // be prohibitive, so we make a set of pointers and sort those.
-  SmallVector<OverloadCandidate*, 32> Cands;
-  if (OCD == OCD_AllCandidates) Cands.reserve(size());
+  SmallVector<OverloadCandidate *, 32> Cands;
+  if (OCD == OCD_AllCandidates)
+    Cands.reserve(size());
   for (iterator Cand = Candidates.begin(), LastCand = Candidates.end();
        Cand != LastCand; ++Cand) {
     if (!Filter(*Cand))
@@ -13568,7 +13462,7 @@ struct CompareTemplateSpecCandidatesForDisplay {
     return S.SourceMgr.isBeforeInTranslationUnit(LLoc, RLoc);
   }
 };
-}
+} // namespace
 
 /// Diagnose a template argument deduction failure.
 /// We are treating these failures as overload failures due to bad
@@ -13644,16 +13538,15 @@ void TemplateSpecCandidateSet::NoteCandidates(Sema &S, SourceLocation Loc) {
 QualType Sema::ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType) {
   QualType Ret = PossiblyAFunctionType;
   if (const PointerType *ToTypePtr =
-    PossiblyAFunctionType->getAs<PointerType>())
+          PossiblyAFunctionType->getAs<PointerType>())
     Ret = ToTypePtr->getPointeeType();
   else if (const ReferenceType *ToTypeRef =
-    PossiblyAFunctionType->getAs<ReferenceType>())
+               PossiblyAFunctionType->getAs<ReferenceType>())
     Ret = ToTypeRef->getPointeeType();
   else if (const MemberPointerType *MemTypePtr =
-    PossiblyAFunctionType->getAs<MemberPointerType>())
+               PossiblyAFunctionType->getAs<MemberPointerType>())
     Ret = MemTypePtr->getPointeeType();
-  Ret =
-    Context.getCanonicalType(Ret).getUnqualifiedType();
+  Ret = Context.getCanonicalType(Ret).getUnqualifiedType();
   return Ret;
 }
 
@@ -13676,14 +13569,14 @@ namespace {
 // A helper class to help with address of function resolution
 // - allows us to avoid passing around all those ugly parameters
 class AddressOfFunctionResolver {
-  Sema& S;
-  Expr* SourceExpr;
-  const QualType& TargetType;
+  Sema &S;
+  Expr *SourceExpr;
+  const QualType &TargetType;
   QualType TargetFunctionType; // Extracted function type from target type
 
   bool Complain;
-  //DeclAccessPair& ResultFunctionAccessPair;
-  ASTContext& Context;
+  // DeclAccessPair& ResultFunctionAccessPair;
+  ASTContext &Context;
 
   bool TargetTypeIsNonStaticMemberFunction;
   bool FoundNonTemplateFunction;
@@ -13693,7 +13586,7 @@ class AddressOfFunctionResolver {
   OverloadExpr::FindResult OvlExprInfo;
   OverloadExpr *OvlExpr;
   TemplateArgumentListInfo OvlExplicitTemplateArgs;
-  SmallVector<std::pair<DeclAccessPair, FunctionDecl*>, 4> Matches;
+  SmallVector<std::pair<DeclAccessPair, FunctionDecl *>, 4> Matches;
   TemplateSpecCandidateSet FailedCandidates;
 
 public:
@@ -13704,8 +13597,7 @@ class AddressOfFunctionResolver {
         TargetTypeIsNonStaticMemberFunction(
             !!TargetType->getAs<MemberPointerType>()),
         FoundNonTemplateFunction(false),
-        StaticMemberFunctionFromBoundPointer(false),
-        HasComplained(false),
+        StaticMemberFunctionFromBoundPointer(false), HasComplained(false),
         OvlExprInfo(OverloadExpr::find(SourceExpr)),
         OvlExpr(OvlExprInfo.Expression),
         FailedCandidates(OvlExpr->getNameLoc(), /*ForTakingAddress=*/true) {
@@ -13782,15 +13674,16 @@ class AddressOfFunctionResolver {
     // Same algorithm as overload resolution -- one pass to pick the "best",
     // another pass to be sure that nothing is better than the best.
     auto Best = Matches.begin();
-    for (auto I = Matches.begin()+1, E = Matches.end(); I != E; ++I)
+    for (auto I = Matches.begin() + 1, E = Matches.end(); I != E; ++I)
       if (isBetterCandidate(I->second, Best->second))
         Best = I;
 
     const FunctionDecl *BestFn = Best->second;
-    auto IsBestOrInferiorToBest = [this, BestFn](
-        const std::pair<DeclAccessPair, FunctionDecl *> &Pair) {
-      return BestFn == Pair.second || isBetterCandidate(BestFn, Pair.second);
-    };
+    auto IsBestOrInferiorToBest =
+        [this, BestFn](const std::pair<DeclAccessPair, FunctionDecl *> &Pair) {
+          return BestFn == Pair.second ||
+                 isBetterCandidate(BestFn, Pair.second);
+        };
 
     // Note: We explicitly leave Matches unmodified if there isn't a clear best
     // option, so we can potentially give the user a better error
@@ -13815,18 +13708,17 @@ class AddressOfFunctionResolver {
   }
 
   // return true if any matching specializations were found
-  bool AddMatchingTemplateFunction(FunctionTemplateDecl* FunctionTemplate,
-                                   const DeclAccessPair& CurAccessFunPair) {
-    if (CXXMethodDecl *Method
-              = dyn_cast<CXXMethodDecl>(FunctionTemplate->getTemplatedDecl())) {
+  bool AddMatchingTemplateFunction(FunctionTemplateDecl *FunctionTemplate,
+                                   const DeclAccessPair &CurAccessFunPair) {
+    if (CXXMethodDecl *Method =
+            dyn_cast<CXXMethodDecl>(FunctionTemplate->getTemplatedDecl())) {
       // Skip non-static function templates when converting to pointer, and
       // static when converting to member pointer.
       bool CanConvertToFunctionPointer =
           Method->isStatic() || Method->isExplicitObjectMemberFunction();
       if (CanConvertToFunctionPointer == TargetTypeIsNonStaticMemberFunction)
         return false;
-    }
-    else if (TargetTypeIsNonStaticMemberFunction)
+    } else if (TargetTypeIsNonStaticMemberFunction)
       return false;
 
     // C++ [over.over]p2:
@@ -13842,9 +13734,9 @@ class AddressOfFunctionResolver {
             Specialization, Info, /*IsAddressOfFunction*/ true);
         Result != TemplateDeductionResult::Success) {
       // Make a note of the failed deduction for diagnostics.
-      FailedCandidates.addCandidate()
-          .set(CurAccessFunPair, FunctionTemplate->getTemplatedDecl(),
-               MakeDeductionFailureInfo(Context, Result, Info));
+      FailedCandidates.addCandidate().set(
+          CurAccessFunPair, FunctionTemplate->getTemplatedDecl(),
+          MakeDeductionFailureInfo(Context, Result, Info));
       return false;
     }
 
@@ -13852,8 +13744,8 @@ class AddressOfFunctionResolver {
     // compatible pointer-to-function arguments that would be adjusted by ICS.
     // This function template specicalization works.
     assert(S.isSameOrCompatibleFunctionType(
-              Context.getCanonicalType(Specialization->getType()),
-              Context.getCanonicalType(TargetFunctionType)));
+        Context.getCanonicalType(Specialization->getType()),
+        Context.getCanonicalType(TargetFunctionType)));
 
     if (!S.checkAddressOfFunctionIsAvailable(Specialization))
       return false;
@@ -13862,8 +13754,8 @@ class AddressOfFunctionResolver {
     return true;
   }
 
-  bool AddMatchingNonTemplateFunction(NamedDecl* Fn,
-                                      const DeclAccessPair& CurAccessFunPair) {
+  bool AddMatchingNonTemplateFunction(NamedDecl *Fn,
+                                      const DeclAccessPair &CurAccessFunPair) {
     if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Fn)) {
       // Skip non-static functions when converting to pointer, and static
       // when converting to member pointer.
@@ -13871,8 +13763,7 @@ class AddressOfFunctionResolver {
           Method->isStatic() || Method->isExplicitObjectMemberFunction();
       if (CanConvertToFunctionPointer == TargetTypeIsNonStaticMemberFunction)
         return false;
-    }
-    else if (TargetTypeIsNonStaticMemberFunction)
+    } else if (TargetTypeIsNonStaticMemberFunction)
       return false;
 
     if (FunctionDecl *FunDecl = dyn_cast<FunctionDecl>(Fn)) {
@@ -13935,8 +13826,8 @@ class AddressOfFunctionResolver {
       //   Nonstatic member functions match targets of
       //   type "pointer-to-member-function."
       // Note that according to DR 247, the containing class does not matter.
-      if (FunctionTemplateDecl *FunctionTemplate
-                                        = dyn_cast<FunctionTemplateDecl>(Fn)) {
+      if (FunctionTemplateDecl *FunctionTemplate =
+              dyn_cast<FunctionTemplateDecl>(Fn)) {
         if (AddMatchingTemplateFunction(FunctionTemplate, I.getPair()))
           Ret = true;
       }
@@ -13988,7 +13879,7 @@ class AddressOfFunctionResolver {
   void EliminateAllTemplateMatches() {
     //   [...] any function template specializations in the set are
     //   eliminated if the set also contains a non-template function, [...]
-    for (unsigned I = 0, N = Matches.size(); I != N; ) {
+    for (unsigned I = 0, N = Matches.size(); I != N;) {
       if (Matches[I].second->getPrimaryTemplate() == nullptr)
         ++I;
       else {
@@ -14057,14 +13948,14 @@ class AddressOfFunctionResolver {
 
   bool IsInvalidFormOfPointerToMemberFunction() const {
     return TargetTypeIsNonStaticMemberFunction &&
-      !OvlExprInfo.HasFormOfMemberPointer;
+           !OvlExprInfo.HasFormOfMemberPointer;
   }
 
   void ComplainIsInvalidFormOfPointerToMemberFunction() const {
-      // TODO: Should we condition this on whether any functions might
-      // have matched, or is it more appropriate to do that in callers?
-      // TODO: a fixit wouldn't hurt.
-      S.Diag(OvlExpr->getNameLoc(), diag::err_addr_ovl_no_qualifier)
+    // TODO: Should we condition this on whether any functions might
+    // have matched, or is it more appropriate to do that in callers?
+    // TODO: a fixit wouldn't hurt.
+    S.Diag(OvlExpr->getNameLoc(), diag::err_addr_ovl_no_qualifier)
         << TargetType << OvlExpr->getSourceRange();
   }
 
@@ -14095,24 +13986,23 @@ class AddressOfFunctionResolver {
 
   int getNumMatches() const { return Matches.size(); }
 
-  FunctionDecl* getMatchingFunctionDecl() const {
-    if (Matches.size() != 1) return nullptr;
+  FunctionDecl *getMatchingFunctionDecl() const {
+    if (Matches.size() != 1)
+      return nullptr;
     return Matches[0].second;
   }
 
-  const DeclAccessPair* getMatchingFunctionAccessPair() const {
-    if (Matches.size() != 1) return nullptr;
+  const DeclAccessPair *getMatchingFunctionAccessPair() const {
+    if (Matches.size() != 1)
+      return nullptr;
     return &Matches[0].first;
   }
 };
-}
+} // namespace
 
-FunctionDecl *
-Sema::ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr,
-                                         QualType TargetType,
-                                         bool Complain,
-                                         DeclAccessPair &FoundResult,
-                                         bool *pHadMultipleCandidates) {
+FunctionDecl *Sema::ResolveAddressOfOverloadedFunction(
+    Expr *AddressOfExpr, QualType TargetType, bool Complain,
+    DeclAccessPair &FoundResult, bool *pHadMultipleCandidates) {
   assert(AddressOfExpr->getType() == Context.OverloadTy);
 
   AddressOfFunctionResolver Resolver(*this, AddressOfExpr, TargetType,
@@ -14125,8 +14015,7 @@ Sema::ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr,
       Resolver.ComplainIsInvalidFormOfPointerToMemberFunction();
     else
       Resolver.ComplainNoMatchesFound();
-  }
-  else if (NumMatches > 1 && ShouldComplain)
+  } else if (NumMatches > 1 && ShouldComplain)
     Resolver.ComplainMultipleMatchesFound();
   else if (NumMatches == 1) {
     Fn = Resolver.getMatchingFunctionDecl();
@@ -14287,8 +14176,8 @@ FunctionDecl *Sema::ResolveSingleFunctionTemplateSpecialization(
   // Look through all of the overloaded functions, searching for one
   // whose type matches exactly.
   FunctionDecl *Matched = nullptr;
-  for (UnresolvedSetIterator I = ovl->decls_begin(),
-         E = ovl->decls_end(); I != E; ++I) {
+  for (UnresolvedSetIterator I = ovl->decls_begin(), E = ovl->decls_end();
+       I != E; ++I) {
     // C++0x [temp.arg.explicit]p3:
     //   [...] In contexts where deduction is done and fails, or in contexts
     //   where deduction is not done, if a template argument list is
@@ -14333,15 +14222,15 @@ FunctionDecl *Sema::ResolveSingleFunctionTemplateSpecialization(
         continue;
       // Multiple matches; we can't resolve to a single declaration.
       if (Complain) {
-        Diag(ovl->getExprLoc(), diag::err_addr_ovl_ambiguous)
-          << ovl->getName();
+        Diag(ovl->getExprLoc(), diag::err_addr_ovl_ambiguous) << ovl->getName();
         NoteAllOverloadCandidates(ovl);
       }
       return nullptr;
     }
 
     Matched = Specialization;
-    if (FoundResult) *FoundResult = I.getPair();
+    if (FoundResult)
+      *FoundResult = I.getPair();
   }
 
   if (Matched &&
@@ -14362,7 +14251,7 @@ bool Sema::ResolveAndFixSingleFunctionTemplateSpecialization(
   DeclAccessPair found;
   ExprResult SingleFunctionExpression;
   if (FunctionDecl *fn = ResolveSingleFunctionTemplateSpecialization(
-                           ovl.Expression, /*complain*/ false, &found)) {
+          ovl.Expression, /*complain*/ false, &found)) {
     if (DiagnoseUseOfDecl(fn, SrcExpr.get()->getBeginLoc())) {
       SrcExpr = ExprError();
       return true;
@@ -14372,14 +14261,13 @@ bool Sema::ResolveAndFixSingleFunctionTemplateSpecialization(
     // resolving a form that's permitted to be a pointer to member.
     // Otherwise we'll end up making a bound member expression, which
     // is illegal in all the contexts we resolve like this.
-    if (!ovl.HasFormOfMemberPointer &&
-        isa<CXXMethodDecl>(fn) &&
+    if (!ovl.HasFormOfMemberPointer && isa<CXXMethodDecl>(fn) &&
         cast<CXXMethodDecl>(fn)->isInstance()) {
-      if (!complain) return false;
+      if (!complain)
+        return false;
 
-      Diag(ovl.Expression->getExprLoc(),
-           diag::err_bound_member_function)
-        << 0 << ovl.Expression->getSourceRange();
+      Diag(ovl.Expression->getExprLoc(), diag::err_bound_member_function)
+          << 0 << ovl.Expression->getSourceRange();
 
       // TODO: I believe we only end up here if there's a mix of
       // static and non-static candidates (otherwise the expression
@@ -14397,7 +14285,7 @@ bool Sema::ResolveAndFixSingleFunctionTemplateSpecialization(
     // If desired, do function-to-pointer decay.
     if (doFunctionPointerConversion) {
       SingleFunctionExpression =
-        DefaultFunctionArrayLvalueConversion(SingleFunctionExpression.get());
+          DefaultFunctionArrayLvalueConversion(SingleFunctionExpression.get());
       if (SingleFunctionExpression.isInvalid()) {
         SrcExpr = ExprError();
         return true;
@@ -14408,10 +14296,9 @@ bool Sema::ResolveAndFixSingleFunctionTemplateSpecialization(
   if (!SingleFunctionExpression.isUsable()) {
     if (complain) {
       Diag(OpRangeForComplaining.getBegin(), DiagIDForComplaining)
-        << ovl.Expression->getName()
-        << DestTypeForComplaining
-        << OpRangeForComplaining
-        << ovl.Expression->getQualifierLoc().getSourceRange();
+          << ovl.Expression->getName() << DestTypeForComplaining
+          << OpRangeForComplaining
+          << ovl.Expression->getQualifierLoc().getSourceRange();
       NoteAllOverloadCandidates(SrcExpr.get());
 
       SrcExpr = ExprError();
@@ -14426,13 +14313,12 @@ bool Sema::ResolveAndFixSingleFunctionTemplateSpecialization(
 }
 
 /// Add a single candidate to the overload set.
-static void AddOverloadedCallCandidate(Sema &S,
-                                       DeclAccessPair FoundDecl,
-                                 TemplateArgumentListInfo *ExplicitTemplateArgs,
-                                       ArrayRef<Expr *> Args,
-                                       OverloadCandidateSet &CandidateSet,
-                                       bool PartialOverloading,
-                                       bool KnownValid) {
+static void
+AddOverloadedCallCandidate(Sema &S, DeclAccessPair FoundDecl,
+                           TemplateArgumentListInfo *ExplicitTemplateArgs,
+                           ArrayRef<Expr *> Args,
+                           OverloadCandidateSet &CandidateSet,
+                           bool PartialOverloading, bool KnownValid) {
   NamedDecl *Callee = FoundDecl.getDecl();
   if (isa<UsingShadowDecl>(Callee))
     Callee = cast<UsingShadowDecl>(Callee)->getTargetDecl();
@@ -14452,12 +14338,11 @@ static void AddOverloadedCallCandidate(Sema &S,
     return;
   }
 
-  if (FunctionTemplateDecl *FuncTemplate
-      = dyn_cast<FunctionTemplateDecl>(Callee)) {
-    S.AddTemplateOverloadCandidate(FuncTemplate, FoundDecl,
-                                   ExplicitTemplateArgs, Args, CandidateSet,
-                                   /*SuppressUserConversions=*/false,
-                                   PartialOverloading);
+  if (FunctionTemplateDecl *FuncTemplate =
+          dyn_cast<FunctionTemplateDecl>(Callee)) {
+    S.AddTemplateOverloadCandidate(
+        FuncTemplate, FoundDecl, ExplicitTemplateArgs, Args, CandidateSet,
+        /*SuppressUserConversions=*/false, PartialOverloading);
     return;
   }
 
@@ -14489,7 +14374,8 @@ void Sema::AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE,
 
   if (ULE->requiresADL()) {
     for (UnresolvedLookupExpr::decls_iterator I = ULE->decls_begin(),
-           E = ULE->decls_end(); I != E; ++I) {
+                                              E = ULE->decls_end();
+         I != E; ++I) {
       assert(!(*I)->getDeclContext()->isRecord());
       assert(isa<UsingShadowDecl>(*I) ||
              !(*I)->getDeclContext()->isFunctionOrMethod());
@@ -14507,7 +14393,8 @@ void Sema::AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE,
   }
 
   for (UnresolvedLookupExpr::decls_iterator I = ULE->decls_begin(),
-         E = ULE->decls_end(); I != E; ++I)
+                                            E = ULE->decls_end();
+       I != E; ++I)
     AddOverloadedCallCandidate(*this, I.getPair(), ExplicitTemplateArgs, Args,
                                CandidateSet, PartialOverloading,
                                /*KnownValid*/ true);
@@ -14530,8 +14417,10 @@ void Sema::AddOverloadedCallCandidates(
 /// a different namespace.
 static bool canBeDeclaredInNamespace(const DeclarationName &Name) {
   switch (Name.getCXXOverloadedOperator()) {
-  case OO_New: case OO_Array_New:
-  case OO_Delete: case OO_Array_Delete:
+  case OO_New:
+  case OO_Array_New:
+  case OO_Delete:
+  case OO_Array_Delete:
     return false;
 
   default:
@@ -14595,15 +14484,15 @@ static bool DiagnoseTwoPhaseLookup(
       // declaring the function there instead.
       Sema::AssociatedNamespaceSet AssociatedNamespaces;
       Sema::AssociatedClassSet AssociatedClasses;
-      SemaRef.FindAssociatedClassesAndNamespaces(FnLoc, Args,
-                                                 AssociatedNamespaces,
-                                                 AssociatedClasses);
+      SemaRef.FindAssociatedClassesAndNamespaces(
+          FnLoc, Args, AssociatedNamespaces, AssociatedClasses);
       Sema::AssociatedNamespaceSet SuggestedNamespaces;
       if (canBeDeclaredInNamespace(R.getLookupName())) {
         DeclContext *Std = SemaRef.getStdNamespace();
         for (Sema::AssociatedNamespaceSet::iterator
-               it = AssociatedNamespaces.begin(),
-               end = AssociatedNamespaces.end(); it != end; ++it) {
+                 it = AssociatedNamespaces.begin(),
+                 end = AssociatedNamespaces.end();
+             it != end; ++it) {
           // Never suggest declaring a function within namespace 'std'.
           if (Std && Std->Encloses(*it))
             continue;
@@ -14620,22 +14509,22 @@ static bool DiagnoseTwoPhaseLookup(
       }
 
       SemaRef.Diag(R.getNameLoc(), diag::err_not_found_by_two_phase_lookup)
-        << R.getLookupName();
+          << R.getLookupName();
       if (SuggestedNamespaces.empty()) {
         SemaRef.Diag(Best->Function->getLocation(),
                      diag::note_not_found_by_two_phase_lookup)
-          << R.getLookupName() << 0;
+            << R.getLookupName() << 0;
       } else if (SuggestedNamespaces.size() == 1) {
         SemaRef.Diag(Best->Function->getLocation(),
                      diag::note_not_found_by_two_phase_lookup)
-          << R.getLookupName() << 1 << *SuggestedNamespaces.begin();
+            << R.getLookupName() << 1 << *SuggestedNamespaces.begin();
       } else {
         // FIXME: It would be useful to list the associated namespaces here,
         // but the diagnostics infrastructure doesn't provide a way to produce
         // a localized representation of a list of items.
         SemaRef.Diag(Best->Function->getLocation(),
                      diag::note_not_found_by_two_phase_lookup)
-          << R.getLookupName() << 2;
+            << R.getLookupName() << 2;
       }
 
       // Try to recover by calling this function.
@@ -14653,12 +14542,12 @@ static bool DiagnoseTwoPhaseLookup(
 /// was defined.
 ///
 /// Returns true if a viable candidate was found and a diagnostic was issued.
-static bool
-DiagnoseTwoPhaseOperatorLookup(Sema &SemaRef, OverloadedOperatorKind Op,
-                               SourceLocation OpLoc,
-                               ArrayRef<Expr *> Args) {
+static bool DiagnoseTwoPhaseOperatorLookup(Sema &SemaRef,
+                                           OverloadedOperatorKind Op,
+                                           SourceLocation OpLoc,
+                                           ArrayRef<Expr *> Args) {
   DeclarationName OpName =
-    SemaRef.Context.DeclarationNames.getCXXOperatorName(Op);
+      SemaRef.Context.DeclarationNames.getCXXOperatorName(Op);
   LookupResult R(SemaRef, OpName, OpLoc, Sema::LookupOperatorName);
   return DiagnoseTwoPhaseLookup(SemaRef, OpLoc, CXXScopeSpec(), R,
                                 OverloadCandidateSet::CSK_Operator,
@@ -14678,7 +14567,7 @@ class BuildRecoveryCallExprRAII {
 
   ~BuildRecoveryCallExprRAII() { SemaRef.IsBuildingRecoveryCallExpr = false; }
 };
-}
+} // namespace
 
 /// Attempts to recover from a call where no functions were found.
 ///
@@ -14689,10 +14578,8 @@ class BuildRecoveryCallExprRAII {
 ///    expected to diagnose as appropriate.
 static ExprResult
 BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
-                      UnresolvedLookupExpr *ULE,
-                      SourceLocation LParenLoc,
-                      MutableArrayRef<Expr *> Args,
-                      SourceLocation RParenLoc,
+                      UnresolvedLookupExpr *ULE, SourceLocation LParenLoc,
+                      MutableArrayRef<Expr *> Args, SourceLocation RParenLoc,
                       bool EmptyLookup, bool AllowTypoCorrection) {
   // Do not try to recover if it is already building a recovery call.
   // This stops infinite loops for template instantiations like
@@ -14781,10 +14668,8 @@ BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
                                RParenLoc);
 }
 
-bool Sema::buildOverloadedCallSet(Scope *S, Expr *Fn,
-                                  UnresolvedLookupExpr *ULE,
-                                  MultiExprArg Args,
-                                  SourceLocation RParenLoc,
+bool Sema::buildOverloadedCallSet(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE,
+                                  MultiExprArg Args, SourceLocation RParenLoc,
                                   OverloadCandidateSet *CandidateSet,
                                   ExprResult *Result) {
 #ifndef NDEBUG
@@ -14816,8 +14701,8 @@ bool Sema::buildOverloadedCallSet(Scope *S, Expr *Fn,
   // functions, including those from argument-dependent lookup.
   AddOverloadedCallCandidates(ULE, Args, *CandidateSet);
 
-  if (getLangOpts().MSVCCompat &&
-      CurContext->isDependentContext() && !isSFINAEContext() &&
+  if (getLangOpts().MSVCCompat && CurContext->isDependentContext() &&
+      !isSFINAEContext() &&
       (isa<FunctionDecl>(CurContext) || isa<CXXRecordDecl>(CurContext))) {
 
     OverloadCandidateSet::iterator Best;
@@ -14890,16 +14775,12 @@ static QualType chooseRecoveryType(OverloadCandidateSet &CS,
 /// FinishOverloadedCallExpr - given an OverloadCandidateSet, builds and returns
 /// the completed call expression. If overload resolution fails, emits
 /// diagnostics and returns ExprError()
-static ExprResult FinishOverloadedCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
-                                           UnresolvedLookupExpr *ULE,
-                                           SourceLocation LParenLoc,
-                                           MultiExprArg Args,
-                                           SourceLocation RParenLoc,
-                                           Expr *ExecConfig,
-                                           OverloadCandidateSet *CandidateSet,
-                                           OverloadCandidateSet::iterator *Best,
-                                           OverloadingResult OverloadResult,
-                                           bool AllowTypoCorrection) {
+static ExprResult FinishOverloadedCallExpr(
+    Sema &SemaRef, Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE,
+    SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc,
+    Expr *ExecConfig, OverloadCandidateSet *CandidateSet,
+    OverloadCandidateSet::iterator *Best, OverloadingResult OverloadResult,
+    bool AllowTypoCorrection) {
   switch (OverloadResult) {
   case OR_Success: {
     FunctionDecl *FDecl = (*Best)->Function;
@@ -14934,10 +14815,9 @@ static ExprResult FinishOverloadedCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
 
     // Try to recover by looking for viable functions which the user might
     // have meant to call.
-    ExprResult Recovery = BuildRecoveryCallExpr(SemaRef, S, Fn, ULE, LParenLoc,
-                                                Args, RParenLoc,
-                                                CandidateSet->empty(),
-                                                AllowTypoCorrection);
+    ExprResult Recovery =
+        BuildRecoveryCallExpr(SemaRef, S, Fn, ULE, LParenLoc, Args, RParenLoc,
+                              CandidateSet->empty(), AllowTypoCorrection);
     if (Recovery.isInvalid() || Recovery.isUsable())
       return Recovery;
 
@@ -14949,9 +14829,8 @@ static ExprResult FinishOverloadedCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
         continue;
       if (auto *DRE = dyn_cast<DeclRefExpr>(Arg->IgnoreParenImpCasts())) {
         auto *FD = dyn_cast<FunctionDecl>(DRE->getDecl());
-        if (FD &&
-            !SemaRef.checkAddressOfFunctionIsAvailable(FD, /*Complain=*/true,
-                                                       Arg->getExprLoc()))
+        if (FD && !SemaRef.checkAddressOfFunctionIsAvailable(
+                      FD, /*Complain=*/true, Arg->getExprLoc()))
           return ExprError();
       }
     }
@@ -15010,14 +14889,10 @@ static void markUnaddressableCandidatesUnviable(Sema &S,
   }
 }
 
-ExprResult Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn,
-                                         UnresolvedLookupExpr *ULE,
-                                         SourceLocation LParenLoc,
-                                         MultiExprArg Args,
-                                         SourceLocation RParenLoc,
-                                         Expr *ExecConfig,
-                                         bool AllowTypoCorrection,
-                                         bool CalleesAddressIsTaken) {
+ExprResult Sema::BuildOverloadedCallExpr(
+    Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, SourceLocation LParenLoc,
+    MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig,
+    bool AllowTypoCorrection, bool CalleesAddressIsTaken) {
 
   OverloadCandidateSet::CandidateSetKind CSK =
       CalleesAddressIsTaken ? OverloadCandidateSet::CSK_AddressOfOverloadSet
@@ -15182,10 +15057,10 @@ ExprResult Sema::BuildCXXMemberCallExpr(Expr *E, NamedDecl *FoundDecl,
   return CheckForImmediateInvocation(CE, CE->getDirectCallee());
 }
 
-ExprResult
-Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc,
-                              const UnresolvedSetImpl &Fns,
-                              Expr *Input, bool PerformADL) {
+ExprResult Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc,
+                                         UnaryOperatorKind Opc,
+                                         const UnresolvedSetImpl &Fns,
+                                         Expr *Input, bool PerformADL) {
   OverloadedOperatorKind Op = UnaryOperator::getOverloadedOperator(Opc);
   assert(Op != OO_None && "Invalid opcode for overloaded unary operator");
   DeclarationName OpName = Context.DeclarationNames.getCXXOperatorName(Op);
@@ -15195,7 +15070,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc,
   if (checkPlaceholderForOverload(*this, Input))
     return ExprError();
 
-  Expr *Args[2] = { Input, nullptr };
+  Expr *Args[2] = {Input, nullptr};
   unsigned NumArgs = 1;
 
   // For post-increment and post-decrement, add the implicit '0' as
@@ -15203,8 +15078,8 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc,
   // post-decrement.
   if (Opc == UO_PostInc || Opc == UO_PostDec) {
     llvm::APSInt Zero(Context.getTypeSize(Context.IntTy), false);
-    Args[1] = IntegerLiteral::Create(Context, Zero, Context.IntTy,
-                                     SourceLocation());
+    Args[1] =
+        IntegerLiteral::Create(Context, Zero, Context.IntTy, SourceLocation());
     NumArgs = 2;
   }
 
@@ -15245,7 +15120,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc,
   // Add candidates from ADL.
   if (PerformADL) {
     AddArgumentDependentLookupCandidates(OpName, OpLoc, ArgsArray,
-                                         /*ExplicitTemplateArgs*/nullptr,
+                                         /*ExplicitTemplateArgs*/ nullptr,
                                          CandidateSet);
   }
 
@@ -15281,21 +15156,18 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc,
         Base = Input = InputInit.get();
       } else {
         // Convert the arguments.
-        ExprResult InputInit
-          = PerformCopyInitialization(InitializedEntity::InitializeParameter(
-                                                      Context,
-                                                      FnDecl->getParamDecl(0)),
-                                      SourceLocation(),
-                                      Input);
+        ExprResult InputInit =
+            PerformCopyInitialization(InitializedEntity::InitializeParameter(
+                                          Context, FnDecl->getParamDecl(0)),
+                                      SourceLocation(), Input);
         if (InputInit.isInvalid())
           return ExprError();
         Input = InputInit.get();
       }
 
       // Build the actual expression node.
-      ExprResult FnExpr = CreateFunctionRefExpr(*this, FnDecl, Best->FoundDecl,
-                                                Base, HadMultipleCandidates,
-                                                OpLoc);
+      ExprResult FnExpr = CreateFunctionRefExpr(
+          *this, FnDecl, Best->FoundDecl, Base, HadMultipleCandidates, OpLoc);
       if (FnExpr.isInvalid())
         return ExprError();
 
@@ -15346,10 +15218,10 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc,
 
   case OR_Ambiguous:
     CandidateSet.NoteCandidates(
-        PartialDiagnosticAt(OpLoc,
-                            PDiag(diag::err_ovl_ambiguous_oper_unary)
-                                << UnaryOperator::getOpcodeStr(Opc)
-                                << Input->getType() << Input->getSourceRange()),
+        PartialDiagnosticAt(OpLoc, PDiag(diag::err_ovl_ambiguous_oper_unary)
+                                       << UnaryOperator::getOpcodeStr(Opc)
+                                       << Input->getType()
+                                       << Input->getSourceRange()),
         *this, OCD_AmbiguousCandidates, ArgsArray,
         UnaryOperator::getOpcodeStr(Opc), OpLoc);
     return ExprError();
@@ -15454,8 +15326,8 @@ ExprResult Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
                                        Expr *RHS, bool PerformADL,
                                        bool AllowRewrittenCandidates,
                                        FunctionDecl *DefaultedFn) {
-  Expr *Args[2] = { LHS, RHS };
-  LHS=RHS=nullptr; // Please use only Args instead of LHS/RHS couple
+  Expr *Args[2] = {LHS, RHS};
+  LHS = RHS = nullptr; // Please use only Args instead of LHS/RHS couple
 
   if (!getLangOpts().CPlusPlus20)
     AllowRewrittenCandidates = false;
@@ -15541,374 +15413,369 @@ ExprResult Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
   // Perform overload resolution.
   OverloadCandidateSet::iterator Best;
   switch (CandidateSet.BestViableFunction(*this, OpLoc, Best)) {
-    case OR_Success: {
-      // We found a built-in operator or an overloaded operator.
-      FunctionDecl *FnDecl = Best->Function;
+  case OR_Success: {
+    // We found a built-in operator or an overloaded operator.
+    FunctionDecl *FnDecl = Best->Function;
 
-      bool IsReversed = Best->isReversed();
-      if (IsReversed)
-        std::swap(Args[0], Args[1]);
+    bool IsReversed = Best->isReversed();
+    if (IsReversed)
+      std::swap(Args[0], Args[1]);
 
-      if (FnDecl) {
+    if (FnDecl) {
 
-        if (FnDecl->isInvalidDecl())
-          return ExprError();
+      if (FnDecl->isInvalidDecl())
+        return ExprError();
 
-        Expr *Base = nullptr;
-        // We matched an overloaded operator. Build a call to that
-        // operator.
-
-        OverloadedOperatorKind ChosenOp =
-            FnDecl->getDeclName().getCXXOverloadedOperator();
-
-        // C++2a [over.match.oper]p9:
-        //   If a rewritten operator== candidate is selected by overload
-        //   resolution for an operator@, its return type shall be cv bool
-        if (Best->RewriteKind && ChosenOp == OO_EqualEqual &&
-            !FnDecl->getReturnType()->isBooleanType()) {
-          bool IsExtension =
-              FnDecl->getReturnType()->isIntegralOrUnscopedEnumerationType();
-          Diag(OpLoc, IsExtension ? diag::ext_ovl_rewrite_equalequal_not_bool
-                                  : diag::err_ovl_rewrite_equalequal_not_bool)
-              << FnDecl->getReturnType() << BinaryOperator::getOpcodeStr(Opc)
-              << Args[0]->getSourceRange() << Args[1]->getSourceRange();
-          Diag(FnDecl->getLocation(), diag::note_declared_at);
-          if (!IsExtension)
-            return ExprError();
-        }
+      Expr *Base = nullptr;
+      // We matched an overloaded operator. Build a call to that
+      // operator.
 
-        if (AllowRewrittenCandidates && !IsReversed &&
-            CandidateSet.getRewriteInfo().isReversible()) {
-          // We could have reversed this operator, but didn't. Check if some
-          // reversed form was a viable candidate, and if so, if it had a
-          // better conversion for either parameter. If so, this call is
-          // formally ambiguous, and allowing it is an extension.
-          llvm::SmallVector<FunctionDecl*, 4> AmbiguousWith;
-          for (OverloadCandidate &Cand : CandidateSet) {
-            if (Cand.Viable && Cand.Function && Cand.isReversed() &&
-                allowAmbiguity(Context, Cand.Function, FnDecl)) {
-              for (unsigned ArgIdx = 0; ArgIdx < 2; ++ArgIdx) {
-                if (CompareImplicitConversionSequences(
-                        *this, OpLoc, Cand.Conversions[ArgIdx],
-                        Best->Conversions[ArgIdx]) ==
-                    ImplicitConversionSequence::Better) {
-                  AmbiguousWith.push_back(Cand.Function);
-                  break;
-                }
-              }
-            }
-          }
+      OverloadedOperatorKind ChosenOp =
+          FnDecl->getDeclName().getCXXOverloadedOperator();
+
+      // C++2a [over.match.oper]p9:
+      //   If a rewritten operator== candidate is selected by overload
+      //   resolution for an operator@, its return type shall be cv bool
+      if (Best->RewriteKind && ChosenOp == OO_EqualEqual &&
+          !FnDecl->getReturnType()->isBooleanType()) {
+        bool IsExtension =
+            FnDecl->getReturnType()->isIntegralOrUnscopedEnumerationType();
+        Diag(OpLoc, IsExtension ? diag::ext_ovl_rewrite_equalequal_not_bool
+                                : diag::err_ovl_rewrite_equalequal_not_bool)
+            << FnDecl->getReturnType() << BinaryOperator::getOpcodeStr(Opc)
+            << Args[0]->getSourceRange() << Args[1]->getSourceRange();
+        Diag(FnDecl->getLocation(), diag::note_declared_at);
+        if (!IsExtension)
+          return ExprError();
+      }
 
-          if (!AmbiguousWith.empty()) {
-            bool AmbiguousWithSelf =
-                AmbiguousWith.size() == 1 &&
-                declaresSameEntity(AmbiguousWith.front(), FnDecl);
-            Diag(OpLoc, diag::ext_ovl_ambiguous_oper_binary_reversed)
-                << BinaryOperator::getOpcodeStr(Opc)
-                << Args[0]->getType() << Args[1]->getType() << AmbiguousWithSelf
-                << Args[0]->getSourceRange() << Args[1]->getSourceRange();
-            if (AmbiguousWithSelf) {
-              Diag(FnDecl->getLocation(),
-                   diag::note_ovl_ambiguous_oper_binary_reversed_self);
-              // Mark member== const or provide matching != to disallow reversed
-              // args. Eg.
-              // struct S { bool operator==(const S&); };
-              // S()==S();
-              if (auto *MD = dyn_cast<CXXMethodDecl>(FnDecl))
-                if (Op == OverloadedOperatorKind::OO_EqualEqual &&
-                    !MD->isConst() &&
-                    !MD->hasCXXExplicitFunctionObjectParameter() &&
-                    Context.hasSameUnqualifiedType(
-                        MD->getFunctionObjectParameterType(),
-                        MD->getParamDecl(0)->getType().getNonReferenceType()) &&
-                    Context.hasSameUnqualifiedType(
-                        MD->getFunctionObjectParameterType(),
-                        Args[0]->getType()) &&
-                    Context.hasSameUnqualifiedType(
-                        MD->getFunctionObjectParameterType(),
-                        Args[1]->getType()))
-                  Diag(FnDecl->getLocation(),
-                       diag::note_ovl_ambiguous_eqeq_reversed_self_non_const);
-            } else {
-              Diag(FnDecl->getLocation(),
-                   diag::note_ovl_ambiguous_oper_binary_selected_candidate);
-              for (auto *F : AmbiguousWith)
-                Diag(F->getLocation(),
-                     diag::note_ovl_ambiguous_oper_binary_reversed_candidate);
+      if (AllowRewrittenCandidates && !IsReversed &&
+          CandidateSet.getRewriteInfo().isReversible()) {
+        // We could have reversed this operator, but didn't. Check if some
+        // reversed form was a viable candidate, and if so, if it had a
+        // better conversion for either parameter. If so, this call is
+        // formally ambiguous, and allowing it is an extension.
+        llvm::SmallVector<FunctionDecl *, 4> AmbiguousWith;
+        for (OverloadCandidate &Cand : CandidateSet) {
+          if (Cand.Viable && Cand.Function && Cand.isReversed() &&
+              allowAmbiguity(Context, Cand.Function, FnDecl)) {
+            for (unsigned ArgIdx = 0; ArgIdx < 2; ++ArgIdx) {
+              if (CompareImplicitConversionSequences(
+                      *this, OpLoc, Cand.Conversions[ArgIdx],
+                      Best->Conversions[ArgIdx]) ==
+                  ImplicitConversionSequence::Better) {
+                AmbiguousWith.push_back(Cand.Function);
+                break;
+              }
             }
           }
         }
 
-        // Check for nonnull = nullable.
-        // This won't be caught in the arg's initialization: the parameter to
-        // the assignment operator is not marked nonnull.
-        if (Op == OO_Equal)
-          diagnoseNullableToNonnullConversion(Args[0]->getType(),
-                                              Args[1]->getType(), OpLoc);
-
-        // Convert the arguments.
-        if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(FnDecl)) {
-          // Best->Access is only meaningful for class members.
-          CheckMemberOperatorAccess(OpLoc, Args[0], Args[1], Best->FoundDecl);
-
-          ExprResult Arg0, Arg1;
-          unsigned ParamIdx = 0;
-          if (Method->isExplicitObjectMemberFunction()) {
-            Arg0 = InitializeExplicitObjectArgument(*this, Args[0], FnDecl);
-            ParamIdx = 1;
+        if (!AmbiguousWith.empty()) {
+          bool AmbiguousWithSelf =
+              AmbiguousWith.size() == 1 &&
+              declaresSameEntity(AmbiguousWith.front(), FnDecl);
+          Diag(OpLoc, diag::ext_ovl_ambiguous_oper_binary_reversed)
+              << BinaryOperator::getOpcodeStr(Opc) << Args[0]->getType()
+              << Args[1]->getType() << AmbiguousWithSelf
+              << Args[0]->getSourceRange() << Args[1]->getSourceRange();
+          if (AmbiguousWithSelf) {
+            Diag(FnDecl->getLocation(),
+                 diag::note_ovl_ambiguous_oper_binary_reversed_self);
+            // Mark member== const or provide matching != to disallow reversed
+            // args. Eg.
+            // struct S { bool operator==(const S&); };
+            // S()==S();
+            if (auto *MD = dyn_cast<CXXMethodDecl>(FnDecl))
+              if (Op == OverloadedOperatorKind::OO_EqualEqual &&
+                  !MD->isConst() &&
+                  !MD->hasCXXExplicitFunctionObjectParameter() &&
+                  Context.hasSameUnqualifiedType(
+                      MD->getFunctionObjectParameterType(),
+                      MD->getParamDecl(0)->getType().getNonReferenceType()) &&
+                  Context.hasSameUnqualifiedType(
+                      MD->getFunctionObjectParameterType(),
+                      Args[0]->getType()) &&
+                  Context.hasSameUnqualifiedType(
+                      MD->getFunctionObjectParameterType(), Args[1]->getType()))
+                Diag(FnDecl->getLocation(),
+                     diag::note_ovl_ambiguous_eqeq_reversed_self_non_const);
           } else {
-            Arg0 = PerformImplicitObjectArgumentInitialization(
-                Args[0], /*Qualifier=*/std::nullopt, Best->FoundDecl, Method);
+            Diag(FnDecl->getLocation(),
+                 diag::note_ovl_ambiguous_oper_binary_selected_candidate);
+            for (auto *F : AmbiguousWith)
+              Diag(F->getLocation(),
+                   diag::note_ovl_ambiguous_oper_binary_reversed_candidate);
           }
-          Arg1 = PerformCopyInitialization(
-              InitializedEntity::InitializeParameter(
-                  Context, FnDecl->getParamDecl(ParamIdx)),
-              SourceLocation(), Args[1]);
-          if (Arg0.isInvalid() || Arg1.isInvalid())
-            return ExprError();
-
-          Base = Args[0] = Arg0.getAs<Expr>();
-          Args[1] = RHS = Arg1.getAs<Expr>();
-        } else {
-          // Convert the arguments.
-          ExprResult Arg0 = PerformCopyInitialization(
-            InitializedEntity::InitializeParameter(Context,
-                                                   FnDecl->getParamDecl(0)),
-            SourceLocation(), Args[0]);
-          if (Arg0.isInvalid())
-            return ExprError();
-
-          ExprResult Arg1 =
-            PerformCopyInitialization(
-              InitializedEntity::InitializeParameter(Context,
-                                                     FnDecl->getParamDecl(1)),
-              SourceLocation(), Args[1]);
-          if (Arg1.isInvalid())
-            return ExprError();
-          Args[0] = LHS = Arg0.getAs<Expr>();
-          Args[1] = RHS = Arg1.getAs<Expr>();
         }
+      }
 
-        // Build the actual expression node.
-        ExprResult FnExpr = CreateFunctionRefExpr(*this, FnDecl,
-                                                  Best->FoundDecl, Base,
-                                                  HadMultipleCandidates, OpLoc);
-        if (FnExpr.isInvalid())
-          return ExprError();
+      // Check for nonnull = nullable.
+      // This won't be caught in the arg's initialization: the parameter to
+      // the assignment operator is not marked nonnull.
+      if (Op == OO_Equal)
+        diagnoseNullableToNonnullConversion(Args[0]->getType(),
+                                            Args[1]->getType(), OpLoc);
+
+      // Convert the arguments.
+      if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(FnDecl)) {
+        // Best->Access is only meaningful for class members.
+        CheckMemberOperatorAccess(OpLoc, Args[0], Args[1], Best->FoundDecl);
 
-        // Determine the result type.
-        QualType ResultTy = FnDecl->getReturnType();
-        ExprValueKind VK = Expr::getValueKindForType(ResultTy);
-        ResultTy = ResultTy.getNonLValueExprType(Context);
-
-        CallExpr *TheCall;
-        ArrayRef<const Expr *> ArgsArray(Args, 2);
-        const Expr *ImplicitThis = nullptr;
-
-        // We always create a CXXOperatorCallExpr, even for explicit object
-        // members; CodeGen should take care not to emit the this pointer.
-        TheCall = CXXOperatorCallExpr::Create(
-            Context, ChosenOp, FnExpr.get(), Args, ResultTy, VK, OpLoc,
-            CurFPFeatureOverrides(),
-            static_cast<CallExpr::ADLCallKind>(Best->IsADLCandidate));
-
-        if (const auto *Method = dyn_cast<CXXMethodDecl>(FnDecl);
-            Method && Method->isImplicitObjectMemberFunction()) {
-          // Cut off the implicit 'this'.
-          ImplicitThis = ArgsArray[0];
-          ArgsArray = ArgsArray.slice(1);
+        ExprResult Arg0, Arg1;
+        unsigned ParamIdx = 0;
+        if (Method->isExplicitObjectMemberFunction()) {
+          Arg0 = InitializeExplicitObjectArgument(*this, Args[0], FnDecl);
+          ParamIdx = 1;
+        } else {
+          Arg0 = PerformImplicitObjectArgumentInitialization(
+              Args[0], /*Qualifier=*/std::nullopt, Best->FoundDecl, Method);
         }
+        Arg1 = PerformCopyInitialization(
+            InitializedEntity::InitializeParameter(
+                Context, FnDecl->getParamDecl(ParamIdx)),
+            SourceLocation(), Args[1]);
+        if (Arg0.isInvalid() || Arg1.isInvalid())
+          return ExprError();
 
-        if (CheckCallReturnType(FnDecl->getReturnType(), OpLoc, TheCall,
-                                FnDecl))
+        Base = Args[0] = Arg0.getAs<Expr>();
+        Args[1] = RHS = Arg1.getAs<Expr>();
+      } else {
+        // Convert the arguments.
+        ExprResult Arg0 =
+            PerformCopyInitialization(InitializedEntity::InitializeParameter(
+                                          Context, FnDecl->getParamDecl(0)),
+                                      SourceLocation(), Args[0]);
+        if (Arg0.isInvalid())
           return ExprError();
 
-        if (Op == OO_Equal) {
-          // Check for a self move.
-          DiagnoseSelfMove(Args[0], Args[1], OpLoc);
-          // lifetime check.
-          checkAssignmentLifetime(
-              *this, AssignedEntity{Args[0], dyn_cast<CXXMethodDecl>(FnDecl)},
-              Args[1]);
-        }
-        if (ImplicitThis) {
-          QualType ThisType = Context.getPointerType(ImplicitThis->getType());
-          QualType ThisTypeFromDecl = Context.getPointerType(
-              cast<CXXMethodDecl>(FnDecl)->getFunctionObjectParameterType());
+        ExprResult Arg1 =
+            PerformCopyInitialization(InitializedEntity::InitializeParameter(
+                                          Context, FnDecl->getParamDecl(1)),
+                                      SourceLocation(), Args[1]);
+        if (Arg1.isInvalid())
+          return ExprError();
+        Args[0] = LHS = Arg0.getAs<Expr>();
+        Args[1] = RHS = Arg1.getAs<Expr>();
+      }
 
-          CheckArgAlignment(OpLoc, FnDecl, "'this'", ThisType,
-                            ThisTypeFromDecl);
-        }
+      // Build the actual expression node.
+      ExprResult FnExpr = CreateFunctionRefExpr(
+          *this, FnDecl, Best->FoundDecl, Base, HadMultipleCandidates, OpLoc);
+      if (FnExpr.isInvalid())
+        return ExprError();
 
-        checkCall(FnDecl, nullptr, ImplicitThis, ArgsArray,
-                  isa<CXXMethodDecl>(FnDecl), OpLoc, TheCall->getSourceRange(),
-                  VariadicCallType::DoesNotApply);
+      // Determine the result type.
+      QualType ResultTy = FnDecl->getReturnType();
+      ExprValueKind VK = Expr::getValueKindForType(ResultTy);
+      ResultTy = ResultTy.getNonLValueExprType(Context);
 
-        ExprResult R = MaybeBindToTemporary(TheCall);
-        if (R.isInvalid())
-          return ExprError();
+      CallExpr *TheCall;
+      ArrayRef<const Expr *> ArgsArray(Args, 2);
+      const Expr *ImplicitThis = nullptr;
 
-        R = CheckForImmediateInvocation(R, FnDecl);
-        if (R.isInvalid())
-          return ExprError();
+      // We always create a CXXOperatorCallExpr, even for explicit object
+      // members; CodeGen should take care not to emit the this pointer.
+      TheCall = CXXOperatorCallExpr::Create(
+          Context, ChosenOp, FnExpr.get(), Args, ResultTy, VK, OpLoc,
+          CurFPFeatureOverrides(),
+          static_cast<CallExpr::ADLCallKind>(Best->IsADLCandidate));
 
-        // For a rewritten candidate, we've already reversed the arguments
-        // if needed. Perform the rest of the rewrite now.
-        if ((Best->RewriteKind & CRK_DifferentOperator) ||
-            (Op == OO_Spaceship && IsReversed)) {
-          if (Op == OO_ExclaimEqual) {
-            assert(ChosenOp == OO_EqualEqual && "unexpected operator name");
-            R = CreateBuiltinUnaryOp(OpLoc, UO_LNot, R.get());
-          } else {
-            assert(ChosenOp == OO_Spaceship && "unexpected operator name");
-            llvm::APSInt Zero(Context.getTypeSize(Context.IntTy), false);
-            Expr *ZeroLiteral =
-                IntegerLiteral::Create(Context, Zero, Context.IntTy, OpLoc);
-
-            Sema::CodeSynthesisContext Ctx;
-            Ctx.Kind = Sema::CodeSynthesisContext::RewritingOperatorAsSpaceship;
-            Ctx.Entity = FnDecl;
-            pushCodeSynthesisContext(Ctx);
-
-            R = CreateOverloadedBinOp(
-                OpLoc, Opc, Fns, IsReversed ? ZeroLiteral : R.get(),
-                IsReversed ? R.get() : ZeroLiteral, /*PerformADL=*/true,
-                /*AllowRewrittenCandidates=*/false);
-
-            popCodeSynthesisContext();
-          }
-          if (R.isInvalid())
-            return ExprError();
-        } else {
-          assert(ChosenOp == Op && "unexpected operator name");
-        }
+      if (const auto *Method = dyn_cast<CXXMethodDecl>(FnDecl);
+          Method && Method->isImplicitObjectMemberFunction()) {
+        // Cut off the implicit 'this'.
+        ImplicitThis = ArgsArray[0];
+        ArgsArray = ArgsArray.slice(1);
+      }
 
-        // Make a note in the AST if we did any rewriting.
-        if (Best->RewriteKind != CRK_None)
-          R = new (Context) CXXRewrittenBinaryOperator(R.get(), IsReversed);
+      if (CheckCallReturnType(FnDecl->getReturnType(), OpLoc, TheCall, FnDecl))
+        return ExprError();
 
-        return R;
-      } else {
-        // We matched a built-in operator. Convert the arguments, then
-        // break out so that we will build the appropriate built-in
-        // operator node.
-        ExprResult ArgsRes0 = PerformImplicitConversion(
-            Args[0], Best->BuiltinParamTypes[0], Best->Conversions[0],
-            AssignmentAction::Passing,
-            CheckedConversionKind::ForBuiltinOverloadedOp);
-        if (ArgsRes0.isInvalid())
-          return ExprError();
-        Args[0] = ArgsRes0.get();
+      if (Op == OO_Equal) {
+        // Check for a self move.
+        DiagnoseSelfMove(Args[0], Args[1], OpLoc);
+        // lifetime check.
+        checkAssignmentLifetime(
+            *this, AssignedEntity{Args[0], dyn_cast<CXXMethodDecl>(FnDecl)},
+            Args[1]);
+      }
+      if (ImplicitThis) {
+        QualType ThisType = Context.getPointerType(ImplicitThis->getType());
+        QualType ThisTypeFromDecl = Context.getPointerType(
+            cast<CXXMethodDecl>(FnDecl)->getFunctionObjectParameterType());
 
-        ExprResult ArgsRes1 = PerformImplicitConversion(
-            Args[1], Best->BuiltinParamTypes[1], Best->Conversions[1],
-            AssignmentAction::Passing,
-            CheckedConversionKind::ForBuiltinOverloadedOp);
-        if (ArgsRes1.isInvalid())
-          return ExprError();
-        Args[1] = ArgsRes1.get();
-        break;
+        CheckArgAlignment(OpLoc, FnDecl, "'this'", ThisType, ThisTypeFromDecl);
       }
-    }
 
-    case OR_No_Viable_Function: {
-      // C++ [over.match.oper]p9:
-      //   If the operator is the operator , [...] and there are no
-      //   viable functions, then the operator is assumed to be the
-      //   built-in operator and interpreted according to clause 5.
-      if (Opc == BO_Comma)
-        break;
+      checkCall(FnDecl, nullptr, ImplicitThis, ArgsArray,
+                isa<CXXMethodDecl>(FnDecl), OpLoc, TheCall->getSourceRange(),
+                VariadicCallType::DoesNotApply);
 
-      // When defaulting an 'operator<=>', we can try to synthesize a three-way
-      // compare result using '==' and '<'.
-      if (DefaultedFn && Opc == BO_Cmp) {
-        ExprResult E = BuildSynthesizedThreeWayComparison(OpLoc, Fns, Args[0],
-                                                          Args[1], DefaultedFn);
-        if (E.isInvalid() || E.isUsable())
-          return E;
-      }
+      ExprResult R = MaybeBindToTemporary(TheCall);
+      if (R.isInvalid())
+        return ExprError();
 
-      // For class as left operand for assignment or compound assignment
-      // operator do not fall through to handling in built-in, but report that
-      // no overloaded assignment operator found
-      ExprResult Result = ExprError();
-      StringRef OpcStr = BinaryOperator::getOpcodeStr(Opc);
-      auto Cands = CandidateSet.CompleteCandidates(*this, OCD_AllCandidates,
-                                                   Args, OpLoc);
-      DeferDiagsRAII DDR(*this,
-                         CandidateSet.shouldDeferDiags(*this, Args, OpLoc));
-      if (Args[0]->getType()->isRecordType() &&
-          Opc >= BO_Assign && Opc <= BO_OrAssign) {
-        Diag(OpLoc,  diag::err_ovl_no_viable_oper)
-             << BinaryOperator::getOpcodeStr(Opc)
-             << Args[0]->getSourceRange() << Args[1]->getSourceRange();
-        if (Args[0]->getType()->isIncompleteType()) {
-          Diag(OpLoc, diag::note_assign_lhs_incomplete)
-            << Args[0]->getType()
-            << Args[0]->getSourceRange() << Args[1]->getSourceRange();
+      R = CheckForImmediateInvocation(R, FnDecl);
+      if (R.isInvalid())
+        return ExprError();
+
+      // For a rewritten candidate, we've already reversed the arguments
+      // if needed. Perform the rest of the rewrite now.
+      if ((Best->RewriteKind & CRK_DifferentOperator) ||
+          (Op == OO_Spaceship && IsReversed)) {
+        if (Op == OO_ExclaimEqual) {
+          assert(ChosenOp == OO_EqualEqual && "unexpected operator name");
+          R = CreateBuiltinUnaryOp(OpLoc, UO_LNot, R.get());
+        } else {
+          assert(ChosenOp == OO_Spaceship && "unexpected operator name");
+          llvm::APSInt Zero(Context.getTypeSize(Context.IntTy), false);
+          Expr *ZeroLiteral =
+              IntegerLiteral::Create(Context, Zero, Context.IntTy, OpLoc);
+
+          Sema::CodeSynthesisContext Ctx;
+          Ctx.Kind = Sema::CodeSynthesisContext::RewritingOperatorAsSpaceship;
+          Ctx.Entity = FnDecl;
+          pushCodeSynthesisContext(Ctx);
+
+          R = CreateOverloadedBinOp(
+              OpLoc, Opc, Fns, IsReversed ? ZeroLiteral : R.get(),
+              IsReversed ? R.get() : ZeroLiteral, /*PerformADL=*/true,
+              /*AllowRewrittenCandidates=*/false);
+
+          popCodeSynthesisContext();
         }
-      } else {
-        // This is an erroneous use of an operator which can be overloaded by
-        // a non-member function. Check for non-member operators which were
-        // defined too late to be candidates.
-        if (DiagnoseTwoPhaseOperatorLookup(*this, Op, OpLoc, Args))
-          // FIXME: Recover by calling the found function.
+        if (R.isInvalid())
           return ExprError();
+      } else {
+        assert(ChosenOp == Op && "unexpected operator name");
+      }
 
-        // No viable function; try to create a built-in operation, which will
-        // produce an error. Then, show the non-viable candidates.
-        Result = CreateBuiltinBinOp(OpLoc, Opc, Args[0], Args[1]);
+      // Make a note in the AST if we did any rewriting.
+      if (Best->RewriteKind != CRK_None)
+        R = new (Context) CXXRewrittenBinaryOperator(R.get(), IsReversed);
+
+      return R;
+    } else {
+      // We matched a built-in operator. Convert the arguments, then
+      // break out so that we will build the appropriate built-in
+      // operator node.
+      ExprResult ArgsRes0 = PerformImplicitConversion(
+          Args[0], Best->BuiltinParamTypes[0], Best->Conversions[0],
+          AssignmentAction::Passing,
+          CheckedConversionKind::ForBuiltinOverloadedOp);
+      if (ArgsRes0.isInvalid())
+        return ExprError();
+      Args[0] = ArgsRes0.get();
+
+      ExprResult ArgsRes1 = PerformImplicitConversion(
+          Args[1], Best->BuiltinParamTypes[1], Best->Conversions[1],
+          AssignmentAction::Passing,
+          CheckedConversionKind::ForBuiltinOverloadedOp);
+      if (ArgsRes1.isInvalid())
+        return ExprError();
+      Args[1] = ArgsRes1.get();
+      break;
+    }
+  }
+
+  case OR_No_Viable_Function: {
+    // C++ [over.match.oper]p9:
+    //   If the operator is the operator , [...] and there are no
+    //   viable functions, then the operator is assumed to be the
+    //   built-in operator and interpreted according to clause 5.
+    if (Opc == BO_Comma)
+      break;
+
+    // When defaulting an 'operator<=>', we can try to synthesize a three-way
+    // compare result using '==' and '<'.
+    if (DefaultedFn && Opc == BO_Cmp) {
+      ExprResult E = BuildSynthesizedThreeWayComparison(OpLoc, Fns, Args[0],
+                                                        Args[1], DefaultedFn);
+      if (E.isInvalid() || E.isUsable())
+        return E;
+    }
+
+    // For class as left operand for assignment or compound assignment
+    // operator do not fall through to handling in built-in, but report that
+    // no overloaded assignment operator found
+    ExprResult Result = ExprError();
+    StringRef OpcStr = BinaryOperator::getOpcodeStr(Opc);
+    auto Cands =
+        CandidateSet.CompleteCandidates(*this, OCD_AllCandidates, Args, OpLoc);
+    DeferDiagsRAII DDR(*this,
+                       CandidateSet.shouldDeferDiags(*this, Args, OpLoc));
+    if (Args[0]->getType()->isRecordType() && Opc >= BO_Assign &&
+        Opc <= BO_OrAssign) {
+      Diag(OpLoc, diag::err_ovl_no_viable_oper)
+          << BinaryOperator::getOpcodeStr(Opc) << Args[0]->getSourceRange()
+          << Args[1]->getSourceRange();
+      if (Args[0]->getType()->isIncompleteType()) {
+        Diag(OpLoc, diag::note_assign_lhs_incomplete)
+            << Args[0]->getType() << Args[0]->getSourceRange()
+            << Args[1]->getSourceRange();
       }
-      assert(Result.isInvalid() &&
-             "C++ binary operator overloading is missing candidates!");
-      CandidateSet.NoteCandidates(*this, Args, Cands, OpcStr, OpLoc);
-      return Result;
+    } else {
+      // This is an erroneous use of an operator which can be overloaded by
+      // a non-member function. Check for non-member operators which were
+      // defined too late to be candidates.
+      if (DiagnoseTwoPhaseOperatorLookup(*this, Op, OpLoc, Args))
+        // FIXME: Recover by calling the found function.
+        return ExprError();
+
+      // No viable function; try to create a built-in operation, which will
+      // produce an error. Then, show the non-viable candidates.
+      Result = CreateBuiltinBinOp(OpLoc, Opc, Args[0], Args[1]);
     }
+    assert(Result.isInvalid() &&
+           "C++ binary operator overloading is missing candidates!");
+    CandidateSet.NoteCandidates(*this, Args, Cands, OpcStr, OpLoc);
+    return Result;
+  }
 
-    case OR_Ambiguous:
-      CandidateSet.NoteCandidates(
-          PartialDiagnosticAt(OpLoc, PDiag(diag::err_ovl_ambiguous_oper_binary)
-                                         << BinaryOperator::getOpcodeStr(Opc)
-                                         << Args[0]->getType()
-                                         << Args[1]->getType()
-                                         << Args[0]->getSourceRange()
-                                         << Args[1]->getSourceRange()),
-          *this, OCD_AmbiguousCandidates, Args, BinaryOperator::getOpcodeStr(Opc),
-          OpLoc);
-      return ExprError();
+  case OR_Ambiguous:
+    CandidateSet.NoteCandidates(
+        PartialDiagnosticAt(OpLoc, PDiag(diag::err_ovl_ambiguous_oper_binary)
+                                       << BinaryOperator::getOpcodeStr(Opc)
+                                       << Args[0]->getType()
+                                       << Args[1]->getType()
+                                       << Args[0]->getSourceRange()
+                                       << Args[1]->getSourceRange()),
+        *this, OCD_AmbiguousCandidates, Args, BinaryOperator::getOpcodeStr(Opc),
+        OpLoc);
+    return ExprError();
 
-    case OR_Deleted: {
-      if (isImplicitlyDeleted(Best->Function)) {
-        FunctionDecl *DeletedFD = Best->Function;
-        DefaultedFunctionKind DFK = getDefaultedFunctionKind(DeletedFD);
-        if (DFK.isSpecialMember()) {
-          Diag(OpLoc, diag::err_ovl_deleted_special_oper)
-              << Args[0]->getType() << DFK.asSpecialMember();
-        } else {
-          assert(DFK.isComparison());
-          Diag(OpLoc, diag::err_ovl_deleted_comparison)
+  case OR_Deleted: {
+    if (isImplicitlyDeleted(Best->Function)) {
+      FunctionDecl *DeletedFD = Best->Function;
+      DefaultedFunctionKind DFK = getDefaultedFunctionKind(DeletedFD);
+      if (DFK.isSpecialMember()) {
+        Diag(OpLoc, diag::err_ovl_deleted_special_oper)
+            << Args[0]->getType() << DFK.asSpecialMember();
+      } else {
+        assert(DFK.isComparison());
+        Diag(OpLoc, diag::err_ovl_deleted_comparison)
             << Args[0]->getType() << DeletedFD;
-        }
-
-        // The user probably meant to call this special member. Just
-        // explain why it's deleted.
-        NoteDeletedFunction(DeletedFD);
-        return ExprError();
       }
 
-      StringLiteral *Msg = Best->Function->getDeletedMessage();
-      CandidateSet.NoteCandidates(
-          PartialDiagnosticAt(
-              OpLoc,
-              PDiag(diag::err_ovl_deleted_oper)
-                  << getOperatorSpelling(Best->Function->getDeclName()
-                                             .getCXXOverloadedOperator())
-                  << (Msg != nullptr) << (Msg ? Msg->getString() : StringRef())
-                  << Args[0]->getSourceRange() << Args[1]->getSourceRange()),
-          *this, OCD_AllCandidates, Args, BinaryOperator::getOpcodeStr(Opc),
-          OpLoc);
+      // The user probably meant to call this special member. Just
+      // explain why it's deleted.
+      NoteDeletedFunction(DeletedFD);
       return ExprError();
     }
+
+    StringLiteral *Msg = Best->Function->getDeletedMessage();
+    CandidateSet.NoteCandidates(
+        PartialDiagnosticAt(
+            OpLoc,
+            PDiag(diag::err_ovl_deleted_oper)
+                << getOperatorSpelling(
+                       Best->Function->getDeclName().getCXXOverloadedOperator())
+                << (Msg != nullptr) << (Msg ? Msg->getString() : StringRef())
+                << Args[0]->getSourceRange() << Args[1]->getSourceRange()),
+        *this, OCD_AllCandidates, Args, BinaryOperator::getOpcodeStr(Opc),
+        OpLoc);
+    return ExprError();
+  }
   }
 
   // We matched a built-in operator; build it.
@@ -15923,7 +15790,7 @@ ExprResult Sema::BuildSynthesizedThreeWayComparison(
   // If we're not producing a known comparison category type, we can't
   // synthesize a three-way comparison. Let the caller diagnose this.
   if (!Info)
-    return ExprResult((Expr*)nullptr);
+    return ExprResult((Expr *)nullptr);
 
   // If we ever want to perform this synthesis more generally, we will need to
   // apply the temporary materialization conversion to the operands.
@@ -15963,12 +15830,12 @@ ExprResult Sema::BuildSynthesizedThreeWayComparison(
   struct Comparison {
     ExprResult Cmp;
     ComparisonCategoryResult Result;
-  } Comparisons[4] =
-  { {Eq, Info->isStrong() ? ComparisonCategoryResult::Equal
-                          : ComparisonCategoryResult::Equivalent},
-    {Less, ComparisonCategoryResult::Less},
-    {Greater, ComparisonCategoryResult::Greater},
-    {ExprResult(), ComparisonCategoryResult::Unordered},
+  } Comparisons[4] = {
+      {Eq, Info->isStrong() ? ComparisonCategoryResult::Equal
+                            : ComparisonCategoryResult::Equivalent},
+      {Less, ComparisonCategoryResult::Less},
+      {Greater, ComparisonCategoryResult::Greater},
+      {ExprResult(), ComparisonCategoryResult::Unordered},
   };
 
   int I = Info->isPartial() ? 3 : 2;
@@ -15980,7 +15847,7 @@ ExprResult Sema::BuildSynthesizedThreeWayComparison(
     auto *VI = Info->lookupValueInfo(Comparisons[I].Result);
     // FIXME: Missing a constant for a comparison category. Diagnose this?
     if (!VI)
-      return ExprResult((Expr*)nullptr);
+      return ExprResult((Expr *)nullptr);
     ExprResult ThisResult =
         BuildDeclarationNameExpr(CXXScopeSpec(), DeclarationNameInfo(), VI->VD);
     if (ThisResult.isInvalid())
@@ -16104,136 +15971,134 @@ ExprResult Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
   // Perform overload resolution.
   OverloadCandidateSet::iterator Best;
   switch (CandidateSet.BestViableFunction(*this, LLoc, Best)) {
-    case OR_Success: {
-      // We found a built-in operator or an overloaded operator.
-      FunctionDecl *FnDecl = Best->Function;
-
-      if (FnDecl) {
-        // We matched an overloaded operator. Build a call to that
-        // operator.
-
-        CheckMemberOperatorAccess(LLoc, Args[0], ArgExpr, Best->FoundDecl);
-
-        // Convert the arguments.
-        CXXMethodDecl *Method = cast<CXXMethodDecl>(FnDecl);
-        SmallVector<Expr *, 2> MethodArgs;
+  case OR_Success: {
+    // We found a built-in operator or an overloaded operator.
+    FunctionDecl *FnDecl = Best->Function;
 
-        // Initialize the object parameter.
-        if (Method->isExplicitObjectMemberFunction()) {
-          ExprResult Res =
-              InitializeExplicitObjectArgument(*this, Args[0], Method);
-          if (Res.isInvalid())
-            return ExprError();
-          Args[0] = Res.get();
-          ArgExpr = Args;
-        } else {
-          ExprResult Arg0 = PerformImplicitObjectArgumentInitialization(
-              Args[0], /*Qualifier=*/std::nullopt, Best->FoundDecl, Method);
-          if (Arg0.isInvalid())
-            return ExprError();
+    if (FnDecl) {
+      // We matched an overloaded operator. Build a call to that
+      // operator.
 
-          MethodArgs.push_back(Arg0.get());
-        }
+      CheckMemberOperatorAccess(LLoc, Args[0], ArgExpr, Best->FoundDecl);
 
-        bool IsError = PrepareArgumentsForCallToObjectOfClassType(
-            *this, MethodArgs, Method, ArgExpr, LLoc);
-        if (IsError)
+      // Convert the arguments.
+      CXXMethodDecl *Method = cast<CXXMethodDecl>(FnDecl);
+      SmallVector<Expr *, 2> MethodArgs;
+
+      // Initialize the object parameter.
+      if (Method->isExplicitObjectMemberFunction()) {
+        ExprResult Res =
+            InitializeExplicitObjectArgument(*this, Args[0], Method);
+        if (Res.isInvalid())
           return ExprError();
-
-        // Build the actual expression node.
-        DeclarationNameInfo OpLocInfo(OpName, LLoc);
-        OpLocInfo.setCXXOperatorNameRange(SourceRange(LLoc, RLoc));
-        ExprResult FnExpr = CreateFunctionRefExpr(
-            *this, FnDecl, Best->FoundDecl, Base, HadMultipleCandidates,
-            OpLocInfo.getLoc(), OpLocInfo.getInfo());
-        if (FnExpr.isInvalid())
+        Args[0] = Res.get();
+        ArgExpr = Args;
+      } else {
+        ExprResult Arg0 = PerformImplicitObjectArgumentInitialization(
+            Args[0], /*Qualifier=*/std::nullopt, Best->FoundDecl, Method);
+        if (Arg0.isInvalid())
           return ExprError();
 
-        // Determine the result type
-        QualType ResultTy = FnDecl->getReturnType();
-        ExprValueKind VK = Expr::getValueKindForType(ResultTy);
-        ResultTy = ResultTy.getNonLValueExprType(Context);
+        MethodArgs.push_back(Arg0.get());
+      }
 
-        CallExpr *TheCall = CXXOperatorCallExpr::Create(
-            Context, OO_Subscript, FnExpr.get(), MethodArgs, ResultTy, VK, RLoc,
-            CurFPFeatureOverrides());
+      bool IsError = PrepareArgumentsForCallToObjectOfClassType(
+          *this, MethodArgs, Method, ArgExpr, LLoc);
+      if (IsError)
+        return ExprError();
 
-        if (CheckCallReturnType(FnDecl->getReturnType(), LLoc, TheCall, FnDecl))
-          return ExprError();
+      // Build the actual expression node.
+      DeclarationNameInfo OpLocInfo(OpName, LLoc);
+      OpLocInfo.setCXXOperatorNameRange(SourceRange(LLoc, RLoc));
+      ExprResult FnExpr = CreateFunctionRefExpr(
+          *this, FnDecl, Best->FoundDecl, Base, HadMultipleCandidates,
+          OpLocInfo.getLoc(), OpLocInfo.getInfo());
+      if (FnExpr.isInvalid())
+        return ExprError();
 
-        if (CheckFunctionCall(Method, TheCall,
-                              Method->getType()->castAs<FunctionProtoType>()))
-          return ExprError();
+      // Determine the result type
+      QualType ResultTy = FnDecl->getReturnType();
+      ExprValueKind VK = Expr::getValueKindForType(ResultTy);
+      ResultTy = ResultTy.getNonLValueExprType(Context);
 
-        return CheckForImmediateInvocation(MaybeBindToTemporary(TheCall),
-                                           FnDecl);
-      } else {
-        // We matched a built-in operator. Convert the arguments, then
-        // break out so that we will build the appropriate built-in
-        // operator node.
-        ExprResult ArgsRes0 = PerformImplicitConversion(
-            Args[0], Best->BuiltinParamTypes[0], Best->Conversions[0],
-            AssignmentAction::Passing,
-            CheckedConversionKind::ForBuiltinOverloadedOp);
-        if (ArgsRes0.isInvalid())
-          return ExprError();
-        Args[0] = ArgsRes0.get();
+      CallExpr *TheCall = CXXOperatorCallExpr::Create(
+          Context, OO_Subscript, FnExpr.get(), MethodArgs, ResultTy, VK, RLoc,
+          CurFPFeatureOverrides());
 
-        ExprResult ArgsRes1 = PerformImplicitConversion(
-            Args[1], Best->BuiltinParamTypes[1], Best->Conversions[1],
-            AssignmentAction::Passing,
-            CheckedConversionKind::ForBuiltinOverloadedOp);
-        if (ArgsRes1.isInvalid())
-          return ExprError();
-        Args[1] = ArgsRes1.get();
+      if (CheckCallReturnType(FnDecl->getReturnType(), LLoc, TheCall, FnDecl))
+        return ExprError();
 
-        break;
-      }
-    }
+      if (CheckFunctionCall(Method, TheCall,
+                            Method->getType()->castAs<FunctionProtoType>()))
+        return ExprError();
 
-    case OR_No_Viable_Function: {
-      PartialDiagnostic PD =
-          CandidateSet.empty()
-              ? (PDiag(diag::err_ovl_no_oper)
-                 << Args[0]->getType() << /*subscript*/ 0
-                 << Args[0]->getSourceRange() << Range)
-              : (PDiag(diag::err_ovl_no_viable_subscript)
-                 << Args[0]->getType() << Args[0]->getSourceRange() << Range);
-      CandidateSet.NoteCandidates(PartialDiagnosticAt(LLoc, PD), *this,
-                                  OCD_AllCandidates, ArgExpr, "[]", LLoc);
-      return ExprError();
+      return CheckForImmediateInvocation(MaybeBindToTemporary(TheCall), FnDecl);
+    } else {
+      // We matched a built-in operator. Convert the arguments, then
+      // break out so that we will build the appropriate built-in
+      // operator node.
+      ExprResult ArgsRes0 = PerformImplicitConversion(
+          Args[0], Best->BuiltinParamTypes[0], Best->Conversions[0],
+          AssignmentAction::Passing,
+          CheckedConversionKind::ForBuiltinOverloadedOp);
+      if (ArgsRes0.isInvalid())
+        return ExprError();
+      Args[0] = ArgsRes0.get();
+
+      ExprResult ArgsRes1 = PerformImplicitConversion(
+          Args[1], Best->BuiltinParamTypes[1], Best->Conversions[1],
+          AssignmentAction::Passing,
+          CheckedConversionKind::ForBuiltinOverloadedOp);
+      if (ArgsRes1.isInvalid())
+        return ExprError();
+      Args[1] = ArgsRes1.get();
+
+      break;
     }
+  }
 
-    case OR_Ambiguous:
-      if (Args.size() == 2) {
-        CandidateSet.NoteCandidates(
-            PartialDiagnosticAt(
-                LLoc, PDiag(diag::err_ovl_ambiguous_oper_binary)
-                          << "[]" << Args[0]->getType() << Args[1]->getType()
-                          << Args[0]->getSourceRange() << Range),
-            *this, OCD_AmbiguousCandidates, Args, "[]", LLoc);
-      } else {
-        CandidateSet.NoteCandidates(
-            PartialDiagnosticAt(LLoc,
-                                PDiag(diag::err_ovl_ambiguous_subscript_call)
-                                    << Args[0]->getType()
-                                    << Args[0]->getSourceRange() << Range),
-            *this, OCD_AmbiguousCandidates, Args, "[]", LLoc);
-      }
-      return ExprError();
+  case OR_No_Viable_Function: {
+    PartialDiagnostic PD =
+        CandidateSet.empty()
+            ? (PDiag(diag::err_ovl_no_oper)
+               << Args[0]->getType() << /*subscript*/ 0
+               << Args[0]->getSourceRange() << Range)
+            : (PDiag(diag::err_ovl_no_viable_subscript)
+               << Args[0]->getType() << Args[0]->getSourceRange() << Range);
+    CandidateSet.NoteCandidates(PartialDiagnosticAt(LLoc, PD), *this,
+                                OCD_AllCandidates, ArgExpr, "[]", LLoc);
+    return ExprError();
+  }
 
-    case OR_Deleted: {
-      StringLiteral *Msg = Best->Function->getDeletedMessage();
+  case OR_Ambiguous:
+    if (Args.size() == 2) {
+      CandidateSet.NoteCandidates(
+          PartialDiagnosticAt(LLoc, PDiag(diag::err_ovl_ambiguous_oper_binary)
+                                        << "[]" << Args[0]->getType()
+                                        << Args[1]->getType()
+                                        << Args[0]->getSourceRange() << Range),
+          *this, OCD_AmbiguousCandidates, Args, "[]", LLoc);
+    } else {
       CandidateSet.NoteCandidates(
           PartialDiagnosticAt(LLoc,
-                              PDiag(diag::err_ovl_deleted_oper)
-                                  << "[]" << (Msg != nullptr)
-                                  << (Msg ? Msg->getString() : StringRef())
+                              PDiag(diag::err_ovl_ambiguous_subscript_call)
+                                  << Args[0]->getType()
                                   << Args[0]->getSourceRange() << Range),
-          *this, OCD_AllCandidates, Args, "[]", LLoc);
-      return ExprError();
-    }
+          *this, OCD_AmbiguousCandidates, Args, "[]", LLoc);
     }
+    return ExprError();
+
+  case OR_Deleted: {
+    StringLiteral *Msg = Best->Function->getDeletedMessage();
+    CandidateSet.NoteCandidates(
+        PartialDiagnosticAt(LLoc, PDiag(diag::err_ovl_deleted_oper)
+                                      << "[]" << (Msg != nullptr)
+                                      << (Msg ? Msg->getString() : StringRef())
+                                      << Args[0]->getSourceRange() << Range),
+        *this, OCD_AllCandidates, Args, "[]", LLoc);
+    return ExprError();
+  }
+  }
 
   // We matched a built-in operator; build it.
   return CreateBuiltinArraySubscriptExpr(Args[0], LLoc, Args[1], RLoc);
@@ -16258,7 +16123,7 @@ ExprResult Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
     assert(op->getOpcode() == BO_PtrMemD || op->getOpcode() == BO_PtrMemI);
 
     QualType fnType =
-      op->getRHS()->getType()->castAs<MemberPointerType>()->getPointeeType();
+        op->getRHS()->getType()->castAs<MemberPointerType>()->getPointeeType();
 
     const FunctionProtoType *proto = fnType->castAs<FunctionProtoType>();
     QualType resultType = proto->getCallResultType(Context);
@@ -16279,9 +16144,8 @@ ExprResult Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
     if (difference) {
       std::string qualsString = difference.getAsString();
       Diag(LParenLoc, diag::err_pointer_to_member_call_drops_quals)
-        << fnType.getUnqualifiedType()
-        << qualsString
-        << (qualsString.find(' ') == std::string::npos ? 1 : 2);
+          << fnType.getUnqualifiedType() << qualsString
+          << (qualsString.find(' ') == std::string::npos ? 1 : 2);
     }
 
     CXXMemberCallExpr *call = CXXMemberCallExpr::Create(
@@ -16336,9 +16200,9 @@ ExprResult Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
     Qualifier = UnresExpr->getQualifier();
 
     QualType ObjectType = UnresExpr->getBaseType();
-    Expr::Classification ObjectClassification
-      = UnresExpr->isArrow()? Expr::Classification::makeSimpleLValue()
-                            : UnresExpr->getBase()->Classify(Context);
+    Expr::Classification ObjectClassification =
+        UnresExpr->isArrow() ? Expr::Classification::makeSimpleLValue()
+                             : UnresExpr->getBase()->Classify(Context);
 
     // Add overload candidates
     OverloadCandidateSet CandidateSet(UnresExpr->getMemberLoc(),
@@ -16352,7 +16216,8 @@ ExprResult Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
     }
 
     for (UnresolvedMemberExpr::decls_iterator I = UnresExpr->decls_begin(),
-           E = UnresExpr->decls_end(); I != E; ++I) {
+                                              E = UnresExpr->decls_end();
+         I != E; ++I) {
 
       QualType ExplicitObjectType = ObjectType;
 
@@ -16508,8 +16373,7 @@ ExprResult Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
     return BuildRecoveryExpr(ResultType);
 
   // Convert the rest of the arguments
-  if (ConvertArgumentsForCall(TheCall, MemExpr, Method, Proto, Args,
-                              RParenLoc))
+  if (ConvertArgumentsForCall(TheCall, MemExpr, Method, Proto, Args, RParenLoc))
     return BuildRecoveryExpr(ResultType);
 
   DiagnoseSentinelCalls(Method, LParenLoc, Args);
@@ -16563,11 +16427,10 @@ ExprResult Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
                                      TheCall->getDirectCallee());
 }
 
-ExprResult
-Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
-                                   SourceLocation LParenLoc,
-                                   MultiExprArg Args,
-                                   SourceLocation RParenLoc) {
+ExprResult Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
+                                              SourceLocation LParenLoc,
+                                              MultiExprArg Args,
+                                              SourceLocation RParenLoc) {
   if (checkPlaceholderForOverload(*this, Obj))
     return ExprError();
   ExprResult Object = Obj;
@@ -16660,8 +16523,8 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
       if (const PointerType *ConvPtrType = ConvType->getAs<PointerType>())
         ConvType = ConvPtrType->getPointeeType();
 
-      if (const FunctionProtoType *Proto = ConvType->getAs<FunctionProtoType>())
-      {
+      if (const FunctionProtoType *Proto =
+              ConvType->getAs<FunctionProtoType>()) {
         AddSurrogateCandidate(Conv, I.getPair(), ActingContext, Proto,
                               Object.get(), Args, CandidateSet);
       }
@@ -16726,16 +16589,15 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
   if (Best->Function == nullptr) {
     // Since there is no function declaration, this is one of the
     // surrogate candidates. Dig out the conversion function.
-    CXXConversionDecl *Conv
-      = cast<CXXConversionDecl>(
-                         Best->Conversions[0].UserDefined.ConversionFunction);
+    CXXConversionDecl *Conv = cast<CXXConversionDecl>(
+        Best->Conversions[0].UserDefined.ConversionFunction);
 
     CheckMemberOperatorAccess(LParenLoc, Object.get(), nullptr,
                               Best->FoundDecl);
     if (DiagnoseUseOfDecl(Best->FoundDecl, LParenLoc))
       return ExprError();
     assert(Conv == Best->FoundDecl.getDecl() &&
-             "Found Decl & conversion-to-functionptr should be same, right?!");
+           "Found Decl & conversion-to-functionptr should be same, right?!");
     // We selected one of the surrogate functions that converts the
     // object parameter to a function pointer. Perform the conversion
     // on the object argument, then let BuildCallExpr finish the job.
@@ -16769,12 +16631,11 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
   unsigned NumParams = Proto->getNumParams();
 
   DeclarationNameInfo OpLocInfo(
-               Context.DeclarationNames.getCXXOperatorName(OO_Call), LParenLoc);
+      Context.DeclarationNames.getCXXOperatorName(OO_Call), LParenLoc);
   OpLocInfo.setCXXOperatorNameRange(SourceRange(LParenLoc, RParenLoc));
-  ExprResult NewFn = CreateFunctionRefExpr(*this, Method, Best->FoundDecl,
-                                           Obj, HadMultipleCandidates,
-                                           OpLocInfo.getLoc(),
-                                           OpLocInfo.getInfo());
+  ExprResult NewFn = CreateFunctionRefExpr(
+      *this, Method, Best->FoundDecl, Obj, HadMultipleCandidates,
+      OpLocInfo.getLoc(), OpLocInfo.getInfo());
   if (NewFn.isInvalid())
     return true;
 
@@ -16852,7 +16713,7 @@ ExprResult Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base,
   //   the operator is selected as the best match function by the
   //   overload resolution mechanism (13.3).
   DeclarationName OpName =
-    Context.DeclarationNames.getCXXOperatorName(OO_Arrow);
+      Context.DeclarationNames.getCXXOperatorName(OO_Arrow);
   OverloadCandidateSet CandidateSet(Loc, OverloadCandidateSet::CSK_Operator);
 
   if (RequireCompleteType(Loc, Base->getType(),
@@ -16880,7 +16741,8 @@ ExprResult Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base,
     break;
 
   case OR_No_Viable_Function: {
-    auto Cands = CandidateSet.CompleteCandidates(*this, OCD_AllCandidates, Base);
+    auto Cands =
+        CandidateSet.CompleteCandidates(*this, OCD_AllCandidates, Base);
     if (CandidateSet.empty()) {
       QualType BaseType = Base->getType();
       if (NoArrowOperatorFound) {
@@ -16890,14 +16752,14 @@ ExprResult Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base,
         return ExprError();
       }
       Diag(OpLoc, diag::err_typecheck_member_reference_arrow)
-        << BaseType << Base->getSourceRange();
+          << BaseType << Base->getSourceRange();
       if (BaseType->isRecordType() && !BaseType->isPointerType()) {
         Diag(OpLoc, diag::note_typecheck_member_reference_suggestion)
-          << FixItHint::CreateReplacement(OpLoc, ".");
+            << FixItHint::CreateReplacement(OpLoc, ".");
       }
     } else
       Diag(OpLoc, diag::err_ovl_no_viable_oper)
-        << "operator->" << Base->getSourceRange();
+          << "operator->" << Base->getSourceRange();
     CandidateSet.NoteCandidates(*this, Base, Cands);
     return ExprError();
   }
@@ -16964,11 +16826,10 @@ ExprResult Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base,
   return CheckForImmediateInvocation(MaybeBindToTemporary(TheCall), Method);
 }
 
-ExprResult Sema::BuildLiteralOperatorCall(LookupResult &R,
-                                          DeclarationNameInfo &SuffixInfo,
-                                          ArrayRef<Expr*> Args,
-                                          SourceLocation LitEndLoc,
-                                       TemplateArgumentListInfo *TemplateArgs) {
+ExprResult
+Sema::BuildLiteralOperatorCall(LookupResult &R, DeclarationNameInfo &SuffixInfo,
+                               ArrayRef<Expr *> Args, SourceLocation LitEndLoc,
+                               TemplateArgumentListInfo *TemplateArgs) {
   SourceLocation UDSuffixLoc = SuffixInfo.getCXXLiteralOperatorNameLoc();
 
   OverloadCandidateSet CandidateSet(UDSuffixLoc,
@@ -17003,10 +16864,9 @@ ExprResult Sema::BuildLiteralOperatorCall(LookupResult &R,
   }
 
   FunctionDecl *FD = Best->Function;
-  ExprResult Fn = CreateFunctionRefExpr(*this, FD, Best->FoundDecl,
-                                        nullptr, HadMultipleCandidates,
-                                        SuffixInfo.getLoc(),
-                                        SuffixInfo.getInfo());
+  ExprResult Fn = CreateFunctionRefExpr(
+      *this, FD, Best->FoundDecl, nullptr, HadMultipleCandidates,
+      SuffixInfo.getLoc(), SuffixInfo.getInfo());
   if (Fn.isInvalid())
     return true;
 
@@ -17014,9 +16874,10 @@ ExprResult Sema::BuildLiteralOperatorCall(LookupResult &R,
   // that array-to-pointer decay is applied to string literals.
   Expr *ConvArgs[2];
   for (unsigned ArgIdx = 0, N = Args.size(); ArgIdx != N; ++ArgIdx) {
-    ExprResult InputInit = PerformCopyInitialization(
-      InitializedEntity::InitializeParameter(Context, FD->getParamDecl(ArgIdx)),
-      SourceLocation(), Args[ArgIdx]);
+    ExprResult InputInit =
+        PerformCopyInitialization(InitializedEntity::InitializeParameter(
+                                      Context, FD->getParamDecl(ArgIdx)),
+                                  SourceLocation(), Args[ArgIdx]);
     if (InputInit.isInvalid())
       return true;
     ConvArgs[ArgIdx] = InputInit.get();
@@ -17039,24 +16900,20 @@ ExprResult Sema::BuildLiteralOperatorCall(LookupResult &R,
   return CheckForImmediateInvocation(MaybeBindToTemporary(UDL), FD);
 }
 
-Sema::ForRangeStatus
-Sema::BuildForRangeBeginEndCall(SourceLocation Loc,
-                                SourceLocation RangeLoc,
-                                const DeclarationNameInfo &NameInfo,
-                                LookupResult &MemberLookup,
-                                OverloadCandidateSet *CandidateSet,
-                                Expr *Range, ExprResult *CallExpr) {
+Sema::ForRangeStatus Sema::BuildForRangeBeginEndCall(
+    SourceLocation Loc, SourceLocation RangeLoc,
+    const DeclarationNameInfo &NameInfo, LookupResult &MemberLookup,
+    OverloadCandidateSet *CandidateSet, Expr *Range, ExprResult *CallExpr) {
   Scope *S = nullptr;
 
   CandidateSet->clear(OverloadCandidateSet::CSK_Normal);
   if (!MemberLookup.empty()) {
-    ExprResult MemberRef =
-        BuildMemberReferenceExpr(Range, Range->getType(), Loc,
-                                 /*IsPtr=*/false, CXXScopeSpec(),
-                                 /*TemplateKWLoc=*/SourceLocation(),
-                                 /*FirstQualifierInScope=*/nullptr,
-                                 MemberLookup,
-                                 /*TemplateArgs=*/nullptr, S);
+    ExprResult MemberRef = BuildMemberReferenceExpr(
+        Range, Range->getType(), Loc,
+        /*IsPtr=*/false, CXXScopeSpec(),
+        /*TemplateKWLoc=*/SourceLocation(),
+        /*FirstQualifierInScope=*/nullptr, MemberLookup,
+        /*TemplateArgs=*/nullptr, S);
     if (MemberRef.isInvalid()) {
       *CallExpr = ExprError();
       return FRS_DiagnosticIssued;
@@ -17074,8 +16931,8 @@ Sema::BuildForRangeBeginEndCall(SourceLocation Loc,
       return FRS_DiagnosticIssued;
     UnresolvedLookupExpr *Fn = cast<UnresolvedLookupExpr>(FnR.get());
 
-    bool CandidateSetError = buildOverloadedCallSet(S, Fn, Fn, Range, Loc,
-                                                    CandidateSet, CallExpr);
+    bool CandidateSetError =
+        buildOverloadedCallSet(S, Fn, Fn, Range, Loc, CandidateSet, CallExpr);
     if (CandidateSet->empty() || CandidateSetError) {
       *CallExpr = ExprError();
       return FRS_NoViableFunction;
@@ -17088,10 +16945,10 @@ Sema::BuildForRangeBeginEndCall(SourceLocation Loc,
       *CallExpr = ExprError();
       return FRS_NoViableFunction;
     }
-    *CallExpr = FinishOverloadedCallExpr(*this, S, Fn, Fn, Loc, Range,
-                                         Loc, nullptr, CandidateSet, &Best,
-                                         OverloadResult,
-                                         /*AllowTypoCorrection=*/false);
+    *CallExpr =
+        FinishOverloadedCallExpr(*this, S, Fn, Fn, Loc, Range, Loc, nullptr,
+                                 CandidateSet, &Best, OverloadResult,
+                                 /*AllowTypoCorrection=*/false);
     if (CallExpr->isInvalid() || OverloadResult != OR_Success) {
       *CallExpr = ExprError();
       return FRS_DiagnosticIssued;
@@ -17295,8 +17152,8 @@ ExprResult Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,
     return BuildMemberExpr(
         Base, MemExpr->isArrow(), MemExpr->getOperatorLoc(),
         MemExpr->getQualifierLoc(), MemExpr->getTemplateKeywordLoc(), Fn, Found,
-        /*HadMultipleCandidates=*/true, MemExpr->getMemberNameInfo(),
-        type, valueKind, OK_Ordinary, TemplateArgs);
+        /*HadMultipleCandidates=*/true, MemExpr->getMemberNameInfo(), type,
+        valueKind, OK_Ordinary, TemplateArgs);
   }
 
   llvm_unreachable("Invalid reference to overloaded function");

>From 9ed94d69ef1a014534afdbafee328c10148d4aec Mon Sep 17 00:00:00 2001
From: changkhothuychung <nhat7203 at gmail.com>
Date: Tue, 7 Apr 2026 14:19:49 -0400
Subject: [PATCH 03/12] update the builtintype bits

---
 clang/include/clang/AST/TypeBase.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/include/clang/AST/TypeBase.h b/clang/include/clang/AST/TypeBase.h
index 71797b1c372ac..e3477c1cc0ef4 100644
--- a/clang/include/clang/AST/TypeBase.h
+++ b/clang/include/clang/AST/TypeBase.h
@@ -1962,7 +1962,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
     unsigned : NumTypeBits;
 
     /// The kind (BuiltinType::Kind) of builtin type this is.
-    static constexpr unsigned NumOfBuiltinTypeBits = 9;
+    static constexpr unsigned NumOfBuiltinTypeBits = 10;
     unsigned Kind : NumOfBuiltinTypeBits;
   };
 

>From 7b4ab812571cedb2c315433aa355d749116378f9 Mon Sep 17 00:00:00 2001
From: Nhat Nguyen <nhat7203 at gmail.com>
Date: Wed, 8 Apr 2026 12:11:22 -0400
Subject: [PATCH 04/12] Update clang/include/clang/Basic/TargetInfo.h

Co-authored-by: Timm Baeder <tbaeder at redhat.com>
---
 clang/include/clang/Basic/TargetInfo.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index de7e697a40cce..897bedc1f4de7 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -826,8 +826,9 @@ class TargetInfo : public TransferrableTargetInfo,
   unsigned getIbm128Align() const { return Ibm128Align; }
   const llvm::fltSemantics &getIbm128Format() const { return *Ibm128Format; }
 
-  /// getMetaInfoWidth/Align - Returns the size/align of std::meta::info.
+  /// Returns the size of std::meta::info.
   unsigned getMetaInfoWidth() const { return MetaInfoWidth; }
+  /// eturns the align of std::meta::info.
   unsigned getMetaInfoAlign() const { return MetaInfoAlign; }
 
   /// Return the mangled code of long double.

>From 516500740756f46c5ccbee403da9aaa239de8f76 Mon Sep 17 00:00:00 2001
From: changkhothuychung <nhat7203 at gmail.com>
Date: Wed, 8 Apr 2026 16:01:14 -0400
Subject: [PATCH 05/12] apply impl of reflection in bytecode interpreter

---
 clang/lib/AST/ByteCode/Compiler.cpp           | 18 ++++++
 clang/lib/AST/ByteCode/Compiler.h             |  1 +
 clang/lib/AST/ByteCode/Context.cpp            |  3 +
 clang/lib/AST/ByteCode/Descriptor.cpp         |  1 +
 clang/lib/AST/ByteCode/Disasm.cpp             |  2 +
 clang/lib/AST/ByteCode/Interp.h               |  6 ++
 .../lib/AST/ByteCode/InterpBuiltinBitCast.cpp |  2 +-
 clang/lib/AST/ByteCode/InterpStack.h          |  3 +
 clang/lib/AST/ByteCode/InterpState.cpp        |  1 +
 clang/lib/AST/ByteCode/Opcodes.td             |  9 ++-
 clang/lib/AST/ByteCode/PrimType.cpp           |  1 +
 clang/lib/AST/ByteCode/PrimType.h             |  6 ++
 clang/lib/AST/ByteCode/Program.cpp            |  1 +
 clang/lib/AST/ByteCode/Program.h              |  1 +
 clang/lib/AST/ByteCode/Reflect.h              | 61 +++++++++++++++++++
 15 files changed, 114 insertions(+), 2 deletions(-)
 create mode 100644 clang/lib/AST/ByteCode/Reflect.h

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 9d2457a2f35cd..3755e54ebecfb 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -4242,6 +4242,21 @@ bool Compiler<Emitter>::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) {
   return this->emitError(E);
 }
 
+template <class Emitter>
+bool Compiler<Emitter>::VisitCXXReflectExpr(const CXXReflectExpr *E) {
+  if (DiscardResult)
+    return true;
+
+  switch (E->getKind()) {
+    case ReflectionKind::Type: {
+      APValue Result(ReflectionKind::Type, E->getOpaqueValue());
+      return this->emitReflectValue(E->getKind(), E->getOpaqueValue(), E);
+    }
+  }
+
+  return false;
+}
+
 template <class Emitter>
 bool Compiler<Emitter>::VisitExpressionTraitExpr(const ExpressionTraitExpr *E) {
   assert(Ctx.getLangOpts().CPlusPlus);
@@ -4735,6 +4750,8 @@ bool Compiler<Emitter>::visitZeroInitializer(PrimType T, QualType QT,
     auto Sem = Ctx.getASTContext().getFixedPointSemantics(E->getType());
     return this->emitConstFixedPoint(FixedPoint::zero(Sem), E);
   }
+  case PT_Reflect:
+    return this->emitReflectValue(ReflectionKind::Type, nullptr, E);
   }
   llvm_unreachable("unknown primitive type");
 }
@@ -4946,6 +4963,7 @@ bool Compiler<Emitter>::emitConst(T Value, PrimType Ty, const Expr *E) {
   case PT_IntAP:
   case PT_IntAPS:
   case PT_FixedPoint:
+  case PT_Reflect:
     llvm_unreachable("Invalid integral type");
     break;
   }
diff --git a/clang/lib/AST/ByteCode/Compiler.h b/clang/lib/AST/ByteCode/Compiler.h
index 4a70db89dba74..7ac767700ff2f 100644
--- a/clang/lib/AST/ByteCode/Compiler.h
+++ b/clang/lib/AST/ByteCode/Compiler.h
@@ -232,6 +232,7 @@ class Compiler : public ConstStmtVisitor<Compiler<Emitter>, bool>,
   bool VisitCXXTypeidExpr(const CXXTypeidExpr *E);
   bool VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E);
   bool VisitObjCArrayLiteral(const ObjCArrayLiteral *E);
+  bool VisitCXXReflectExpr(const CXXReflectExpr *E);
 
   // Statements.
   bool visitCompoundStmt(const CompoundStmt *S);
diff --git a/clang/lib/AST/ByteCode/Context.cpp b/clang/lib/AST/ByteCode/Context.cpp
index 2b32161fceba0..4f92fabe9c81b 100644
--- a/clang/lib/AST/ByteCode/Context.cpp
+++ b/clang/lib/AST/ByteCode/Context.cpp
@@ -482,6 +482,9 @@ OptPrimType Context::classify(QualType T) const {
   if (T->isFixedPointType())
     return PT_FixedPoint;
 
+  if (T->isMetaInfoType())
+    return PT_Reflect;
+
   // Vector and complex types get here.
   return std::nullopt;
 }
diff --git a/clang/lib/AST/ByteCode/Descriptor.cpp b/clang/lib/AST/ByteCode/Descriptor.cpp
index 9cc79883474a0..65a51f69ea5bf 100644
--- a/clang/lib/AST/ByteCode/Descriptor.cpp
+++ b/clang/lib/AST/ByteCode/Descriptor.cpp
@@ -15,6 +15,7 @@
 #include "Pointer.h"
 #include "PrimType.h"
 #include "Record.h"
+#include "Reflect.h"
 #include "Source.h"
 #include "clang/AST/ExprCXX.h"
 
diff --git a/clang/lib/AST/ByteCode/Disasm.cpp b/clang/lib/AST/ByteCode/Disasm.cpp
index 6caa33261dad6..efbe4f5bd5beb 100644
--- a/clang/lib/AST/ByteCode/Disasm.cpp
+++ b/clang/lib/AST/ByteCode/Disasm.cpp
@@ -309,6 +309,8 @@ static const char *primTypeToString(PrimType T) {
     return "MemberPtr";
   case PT_FixedPoint:
     return "FixedPoint";
+  case PT_Reflect:
+    return "Reflect";
   }
   llvm_unreachable("Unhandled PrimType");
 }
diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index 2e7045b39c3db..647e2abe729df 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -16,6 +16,7 @@
 #include "../ExprConstShared.h"
 #include "BitcastBuffer.h"
 #include "Boolean.h"
+#include "Reflect.h"
 #include "DynamicAllocator.h"
 #include "FixedPoint.h"
 #include "Floating.h"
@@ -3732,6 +3733,11 @@ inline bool CheckDestruction(InterpState &S, CodePtr OpPC) {
   return CheckDestructor(S, OpPC, Ptr);
 }
 
+inline bool ReflectValue(InterpState &S, CodePtr OpPC, ReflectionKind Kind, const void *Operand) {
+  S.Stk.push<Reflect>(Kind, Operand);
+  return true;
+}
+
 //===----------------------------------------------------------------------===//
 // Read opcode arguments
 //===----------------------------------------------------------------------===//
diff --git a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
index 4bd9c66fc9974..717f85a503f9f 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
@@ -474,7 +474,7 @@ using PrimTypeVariant =
                  Integral<8, false>, Integral<8, true>, Integral<16, false>,
                  Integral<16, true>, Integral<32, false>, Integral<32, true>,
                  Integral<64, false>, Integral<64, true>, IntegralAP<true>,
-                 IntegralAP<false>, Boolean, Floating>;
+                 IntegralAP<false>, Boolean, Floating, Reflect>;
 
 // NB: This implementation isn't exactly ideal, but:
 //   1) We can't just do a bitcast here since we need to be able to
diff --git a/clang/lib/AST/ByteCode/InterpStack.h b/clang/lib/AST/ByteCode/InterpStack.h
index c647dfa6d85ea..648638bf7084e 100644
--- a/clang/lib/AST/ByteCode/InterpStack.h
+++ b/clang/lib/AST/ByteCode/InterpStack.h
@@ -16,6 +16,7 @@
 #include "FixedPoint.h"
 #include "IntegralAP.h"
 #include "MemberPointer.h"
+#include "Reflect.h"
 #include "PrimType.h"
 
 namespace clang {
@@ -207,6 +208,8 @@ class InterpStack final {
       return PT_MemberPtr;
     else if constexpr (std::is_same_v<T, FixedPoint>)
       return PT_FixedPoint;
+    else if constexpr (std::is_same_v<T, Reflect>)
+      return PT_Reflect;
 
     llvm_unreachable("unknown type push()'ed into InterpStack");
   }
diff --git a/clang/lib/AST/ByteCode/InterpState.cpp b/clang/lib/AST/ByteCode/InterpState.cpp
index 2d6ed98e6b52c..f8288420da0fa 100644
--- a/clang/lib/AST/ByteCode/InterpState.cpp
+++ b/clang/lib/AST/ByteCode/InterpState.cpp
@@ -11,6 +11,7 @@
 #include "InterpStack.h"
 #include "Program.h"
 #include "State.h"
+#include "Reflect.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclTemplate.h"
 
diff --git a/clang/lib/AST/ByteCode/Opcodes.td b/clang/lib/AST/ByteCode/Opcodes.td
index 5e4d0ab2a84af..3e5699c6a93cc 100644
--- a/clang/lib/AST/ByteCode/Opcodes.td
+++ b/clang/lib/AST/ByteCode/Opcodes.td
@@ -31,6 +31,7 @@ def Float : Type;
 def Ptr : Type;
 def MemberPtr : Type;
 def FixedPoint : Type;
+def Reflect : Type;
 
 //===----------------------------------------------------------------------===//
 // Types transferred to the interpreter.
@@ -71,6 +72,8 @@ def ArgDesc : ArgType { let Name = "const Descriptor *"; }
 def ArgPrimType : ArgType { let Name = "PrimType"; }
 def ArgEnumDecl : ArgType { let Name = "const EnumDecl *"; }
 def ArgTypePtr : ArgType { let Name = "const Type *"; }
+def ArgVoidPtr : ArgType { let Name = "const void *"; }
+def ArgReflectionKind : ArgType { let Name = "ReflectionKind"; }
 
 //===----------------------------------------------------------------------===//
 // Classes of types instructions operate on.
@@ -121,7 +124,7 @@ def NonPtrTypeClass : TypeClass {
 }
 
 def AllTypeClass : TypeClass {
-  let Types = !listconcat(AluTypeClass.Types, PtrTypeClass.Types, FloatTypeClass.Types);
+  let Types = !listconcat(AluTypeClass.Types, PtrTypeClass.Types, FloatTypeClass.Types, [Reflect]);
 }
 
 def ComparableTypeClass : TypeClass {
@@ -344,6 +347,10 @@ def CastMemberPtrDerivedPop : Opcode {
   let Args = [ArgSint32, ArgRecordDecl];
 }
 
+def ReflectValue : Opcode {
+  let Args = [ArgReflectionKind, ArgVoidPtr];
+}
+
 def FinishInitPop : Opcode;
 def FinishInit : Opcode;
 def FinishInitActivate : Opcode;
diff --git a/clang/lib/AST/ByteCode/PrimType.cpp b/clang/lib/AST/ByteCode/PrimType.cpp
index b4c1fd0305540..6abc2c19faf97 100644
--- a/clang/lib/AST/ByteCode/PrimType.cpp
+++ b/clang/lib/AST/ByteCode/PrimType.cpp
@@ -8,6 +8,7 @@
 
 #include "PrimType.h"
 #include "Boolean.h"
+#include "Reflect.h"
 #include "FixedPoint.h"
 #include "Floating.h"
 #include "IntegralAP.h"
diff --git a/clang/lib/AST/ByteCode/PrimType.h b/clang/lib/AST/ByteCode/PrimType.h
index 2fa553b7b4a47..2329aeb9261ea 100644
--- a/clang/lib/AST/ByteCode/PrimType.h
+++ b/clang/lib/AST/ByteCode/PrimType.h
@@ -26,6 +26,7 @@ class Boolean;
 class Floating;
 class MemberPointer;
 class FixedPoint;
+class Reflect;
 template <bool Signed> class IntegralAP;
 template <unsigned Bits, bool Signed> class Integral;
 
@@ -46,6 +47,7 @@ enum PrimType : uint8_t {
   PT_Float = 12,
   PT_Ptr = 13,
   PT_MemberPtr = 14,
+  PT_Reflect = 15,
 };
 
 constexpr bool isIntegerOrBoolType(PrimType T) { return T <= PT_Bool; }
@@ -183,6 +185,9 @@ template <> struct PrimConv<PT_MemberPtr> {
 template <> struct PrimConv<PT_FixedPoint> {
   using T = FixedPoint;
 };
+template <> struct PrimConv<PT_Reflect> {
+  using T = Reflect;
+};
 
 /// Returns the size of a primitive type in bytes.
 size_t primSize(PrimType Type);
@@ -228,6 +233,7 @@ static inline bool aligned(const void *P) {
       TYPE_SWITCH_CASE(PT_Ptr, B)                                              \
       TYPE_SWITCH_CASE(PT_MemberPtr, B)                                        \
       TYPE_SWITCH_CASE(PT_FixedPoint, B)                                       \
+      TYPE_SWITCH_CASE(PT_Reflect, B)                                          \
     }                                                                          \
   } while (0)
 
diff --git a/clang/lib/AST/ByteCode/Program.cpp b/clang/lib/AST/ByteCode/Program.cpp
index 2ad5879b4e82a..8712a66610b46 100644
--- a/clang/lib/AST/ByteCode/Program.cpp
+++ b/clang/lib/AST/ByteCode/Program.cpp
@@ -10,6 +10,7 @@
 #include "Context.h"
 #include "Function.h"
 #include "Integral.h"
+#include "Reflect.h"
 #include "PrimType.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclCXX.h"
diff --git a/clang/lib/AST/ByteCode/Program.h b/clang/lib/AST/ByteCode/Program.h
index 91126a51e8ddc..9433e7c89263f 100644
--- a/clang/lib/AST/ByteCode/Program.h
+++ b/clang/lib/AST/ByteCode/Program.h
@@ -16,6 +16,7 @@
 #include "Function.h"
 #include "Pointer.h"
 #include "PrimType.h"
+#include "Reflect.h"
 #include "Record.h"
 #include "Source.h"
 #include "llvm/ADT/DenseMap.h"
diff --git a/clang/lib/AST/ByteCode/Reflect.h b/clang/lib/AST/ByteCode/Reflect.h
new file mode 100644
index 0000000000000..aa1d61d4d0c7a
--- /dev/null
+++ b/clang/lib/AST/ByteCode/Reflect.h
@@ -0,0 +1,61 @@
+//===--- Boolean.h - Wrapper for boolean types for the VM -------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_AST_INTERP_REFLECT_H
+#define LLVM_CLANG_AST_INTERP_REFLECT_H
+
+#include "clang/AST/Reflection.h"
+#include "clang/AST/APValue.h"
+#include "clang/AST/ComparisonCategories.h"
+#include "llvm/ADT/APSInt.h"
+#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/raw_ostream.h"
+#include <cstddef>
+#include <cstdint>
+
+namespace clang {
+namespace interp {
+
+class Reflect final {
+private:
+  ReflectionKind Kind;
+  const void *Operand;
+
+public:
+  Reflect() : Kind(ReflectionKind::Type), Operand(nullptr) {}
+  Reflect(ReflectionKind Kind, const void *Operand) : Kind(Kind), Operand(Operand) {}
+
+  ComparisonCategoryResult compare(const Reflect &RHS) const {
+    llvm::FoldingSetNodeID LID, RID;
+    APValue(Kind, Operand).Profile(LID);
+    APValue(RHS.Kind, RHS.Operand).Profile(RID);
+
+    if (LID == RID)
+      return ComparisonCategoryResult::Equal;
+    return ComparisonCategoryResult::Unordered;
+  }
+
+  void print(llvm::raw_ostream &OS) const {
+    OS << "Reflect(" << Kind << ", " << Operand << ")";
+  }
+  APValue toAPValue(const ASTContext &Ctx) const {
+    return APValue(Kind, Operand);
+  }
+
+
+};
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Reflect &R) {
+  R.print(OS);
+  return OS;
+}
+
+} // namespace interp
+} // namespace clang
+
+#endif

>From ef7bb368535745110245cb4a4403f11f0509e528 Mon Sep 17 00:00:00 2001
From: changkhothuychung <nhat7203 at gmail.com>
Date: Wed, 8 Apr 2026 16:01:53 -0400
Subject: [PATCH 06/12] some small changes

---
 clang/include/clang/AST/APValue.h    |  6 +++---
 clang/include/clang/AST/Reflection.h | 13 ++++++++++++-
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h
index d48155de208b6..0f4a2f5b5390c 100644
--- a/clang/include/clang/AST/APValue.h
+++ b/clang/include/clang/AST/APValue.h
@@ -318,7 +318,7 @@ class APValue {
     const AddrLabelExpr *RHSExpr;
   };
   struct ReflectionData {
-    const ReflectionKind OperandKind;
+    ReflectionKind OperandKind;
     const void *Operand;
   };
   struct MemberPointerData;
@@ -726,7 +726,7 @@ class APValue {
     return ((const ReflectionData *)(const char *)&Data)->OperandKind;
   }
 
-  const void *getOpaqueReflectionOperand() const {
+  const void *getReflectionOpaqueOperand() const {
     assert(isReflection() && "Invalid accessor");
     return ((const ReflectionData *)(const char *)&Data)->Operand;
   }
@@ -783,7 +783,7 @@ class APValue {
   void DestroyDataAndMakeUninit();
   void MakeReflection(ReflectionKind OperandKind, const void *Operand) {
     assert(isAbsent() && "Bad state change");
-    new ((void *)(char *)Data.buffer) ReflectionData(OperandKind, Operand);
+    new ((void *)(char *)Data.buffer) ReflectionData{OperandKind, Operand};
     Kind = Reflection;
   }
   void MakeInt() {
diff --git a/clang/include/clang/AST/Reflection.h b/clang/include/clang/AST/Reflection.h
index c50c20a0c5afc..37580e8167a91 100644
--- a/clang/include/clang/AST/Reflection.h
+++ b/clang/include/clang/AST/Reflection.h
@@ -12,11 +12,22 @@
 
 #ifndef LLVM_CLANG_AST_REFLECTION_H
 #define LLVM_CLANG_AST_REFLECTION_H
+
+#include "llvm/Support/raw_ostream.h"
+
 namespace clang {
 
 // TODO(Reflection): Add support for Template, Namespace and DeclRefExpr.
 enum class ReflectionKind { Type };
 
-} // namespace clang
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, ReflectionKind Kind) {
+  switch(Kind) {
+  case ReflectionKind::Type:
+    OS << "type";
+  }
 
+  return OS;
+}
+
+} // namespace clang
 #endif

>From c7660cab08d26ad85b3f259e60df4e1445869761 Mon Sep 17 00:00:00 2001
From: changkhothuychung <nhat7203 at gmail.com>
Date: Wed, 8 Apr 2026 16:03:24 -0400
Subject: [PATCH 07/12] update tests

---
 clang/lib/AST/APValue.cpp                                 | 4 ++--
 clang/test/{Parser => Sema}/reflection-meta-info.fail.cpp | 0
 clang/test/{Parser => Sema}/reflection-meta-info.pass.cpp | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)
 rename clang/test/{Parser => Sema}/reflection-meta-info.fail.cpp (100%)
 rename clang/test/{Parser => Sema}/reflection-meta-info.pass.cpp (93%)

diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index 03b45bd3dc461..66dd3f82d3c15 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -375,7 +375,7 @@ APValue::APValue(const APValue &RHS)
     break;
   case Reflection:
     MakeReflection(RHS.getReflectionOperandKind(),
-                   RHS.getOpaqueReflectionOperand());
+                   RHS.getReflectionOpaqueOperand());
     break;
   }
 }
@@ -497,7 +497,7 @@ static void profileReflection(llvm::FoldingSetNodeID &ID, APValue V) {
   switch (V.getReflectionOperandKind()) {
   case ReflectionKind::Type: {
     const TypeSourceInfo *info =
-        static_cast<const TypeSourceInfo *>(V.getOpaqueReflectionOperand());
+        static_cast<const TypeSourceInfo *>(V.getReflectionOpaqueOperand());
     ID.AddPointer((info->getType().getCanonicalType().getAsOpaquePtr()));
     return;
   }
diff --git a/clang/test/Parser/reflection-meta-info.fail.cpp b/clang/test/Sema/reflection-meta-info.fail.cpp
similarity index 100%
rename from clang/test/Parser/reflection-meta-info.fail.cpp
rename to clang/test/Sema/reflection-meta-info.fail.cpp
diff --git a/clang/test/Parser/reflection-meta-info.pass.cpp b/clang/test/Sema/reflection-meta-info.pass.cpp
similarity index 93%
rename from clang/test/Parser/reflection-meta-info.pass.cpp
rename to clang/test/Sema/reflection-meta-info.pass.cpp
index 843227000bcec..d12c2c8c8620c 100644
--- a/clang/test/Parser/reflection-meta-info.pass.cpp
+++ b/clang/test/Sema/reflection-meta-info.pass.cpp
@@ -19,6 +19,7 @@ consteval void test()
     static_assert(__is_same(decltype(^^unsigned int), info));
     static_assert(__is_same(decltype(^^unsigned long), info));
     static_assert(__is_same(decltype(^^unsigned long long), info));
+    static_assert(__is_same(decltype(^^info), info));
 
     static_assert(__is_same(decltype(^^int), decltype(^^int)));
     static_assert(__is_same(decltype(^^int), decltype(^^float)));
@@ -36,4 +37,7 @@ consteval void test()
     static_assert(^^float != ^^int);
     static_assert(!(^^float == ^^int));
     static_assert(r == q);
+
+    int a;
+    static_assert(^^int == ^^decltype(a));
 }

>From edf25a358be7bac8c570bbed59a44e3ec6b9c528 Mon Sep 17 00:00:00 2001
From: changkhothuychung <nhat7203 at gmail.com>
Date: Wed, 8 Apr 2026 16:09:18 -0400
Subject: [PATCH 08/12] clang format

---
 clang/lib/AST/ByteCode/PrimType.cpp |  2 +-
 clang/lib/AST/ByteCode/Program.cpp  | 36 ++++++++++++++---------------
 clang/lib/AST/ByteCode/Program.h    |  2 +-
 clang/lib/AST/ByteCode/Reflect.h    |  7 +++---
 4 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/clang/lib/AST/ByteCode/PrimType.cpp b/clang/lib/AST/ByteCode/PrimType.cpp
index 6abc2c19faf97..3ec3044bd289b 100644
--- a/clang/lib/AST/ByteCode/PrimType.cpp
+++ b/clang/lib/AST/ByteCode/PrimType.cpp
@@ -8,12 +8,12 @@
 
 #include "PrimType.h"
 #include "Boolean.h"
-#include "Reflect.h"
 #include "FixedPoint.h"
 #include "Floating.h"
 #include "IntegralAP.h"
 #include "MemberPointer.h"
 #include "Pointer.h"
+#include "Reflect.h"
 
 using namespace clang;
 using namespace clang::interp;
diff --git a/clang/lib/AST/ByteCode/Program.cpp b/clang/lib/AST/ByteCode/Program.cpp
index 8712a66610b46..1cefa68dce884 100644
--- a/clang/lib/AST/ByteCode/Program.cpp
+++ b/clang/lib/AST/ByteCode/Program.cpp
@@ -10,8 +10,8 @@
 #include "Context.h"
 #include "Function.h"
 #include "Integral.h"
-#include "Reflect.h"
 #include "PrimType.h"
+#include "Reflect.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclTemplate.h"
@@ -426,17 +426,17 @@ Descriptor *Program::createDescriptor(const DeclTy &D, const Type *Ty,
         return allocateDescriptor(D, *T, MDSize, NumElems, IsConst, IsTemporary,
                                   IsMutable);
       }
-        // Arrays of composites. In this case, the array is a list of pointers,
-        // followed by the actual elements.
-        const Descriptor *ElemDesc = createDescriptor(
-            D, ElemTy.getTypePtr(), std::nullopt, IsConst, IsTemporary);
-        if (!ElemDesc)
-          return nullptr;
-        unsigned ElemSize = ElemDesc->getAllocSize() + sizeof(InlineDescriptor);
-        if (std::numeric_limits<unsigned>::max() / ElemSize <= NumElems)
-          return nullptr;
-        return allocateDescriptor(D, Ty, ElemDesc, MDSize, NumElems, IsConst,
-                                  IsTemporary, IsMutable);
+      // Arrays of composites. In this case, the array is a list of pointers,
+      // followed by the actual elements.
+      const Descriptor *ElemDesc = createDescriptor(
+          D, ElemTy.getTypePtr(), std::nullopt, IsConst, IsTemporary);
+      if (!ElemDesc)
+        return nullptr;
+      unsigned ElemSize = ElemDesc->getAllocSize() + sizeof(InlineDescriptor);
+      if (std::numeric_limits<unsigned>::max() / ElemSize <= NumElems)
+        return nullptr;
+      return allocateDescriptor(D, Ty, ElemDesc, MDSize, NumElems, IsConst,
+                                IsTemporary, IsMutable);
     }
 
     // Array of unknown bounds - cannot be accessed and pointer arithmetic
@@ -447,12 +447,12 @@ Descriptor *Program::createDescriptor(const DeclTy &D, const Type *Ty,
         return allocateDescriptor(D, *T, MDSize, IsConst, IsTemporary,
                                   Descriptor::UnknownSize{});
       }
-        const Descriptor *Desc = createDescriptor(
-            D, ElemTy.getTypePtr(), std::nullopt, IsConst, IsTemporary);
-        if (!Desc)
-          return nullptr;
-        return allocateDescriptor(D, Desc, MDSize, IsTemporary,
-                                  Descriptor::UnknownSize{});
+      const Descriptor *Desc = createDescriptor(
+          D, ElemTy.getTypePtr(), std::nullopt, IsConst, IsTemporary);
+      if (!Desc)
+        return nullptr;
+      return allocateDescriptor(D, Desc, MDSize, IsTemporary,
+                                Descriptor::UnknownSize{});
     }
   }
 
diff --git a/clang/lib/AST/ByteCode/Program.h b/clang/lib/AST/ByteCode/Program.h
index 9433e7c89263f..573579c76e01d 100644
--- a/clang/lib/AST/ByteCode/Program.h
+++ b/clang/lib/AST/ByteCode/Program.h
@@ -16,8 +16,8 @@
 #include "Function.h"
 #include "Pointer.h"
 #include "PrimType.h"
-#include "Reflect.h"
 #include "Record.h"
+#include "Reflect.h"
 #include "Source.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Allocator.h"
diff --git a/clang/lib/AST/ByteCode/Reflect.h b/clang/lib/AST/ByteCode/Reflect.h
index aa1d61d4d0c7a..05a3de7225487 100644
--- a/clang/lib/AST/ByteCode/Reflect.h
+++ b/clang/lib/AST/ByteCode/Reflect.h
@@ -9,9 +9,9 @@
 #ifndef LLVM_CLANG_AST_INTERP_REFLECT_H
 #define LLVM_CLANG_AST_INTERP_REFLECT_H
 
-#include "clang/AST/Reflection.h"
 #include "clang/AST/APValue.h"
 #include "clang/AST/ComparisonCategories.h"
+#include "clang/AST/Reflection.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"
@@ -28,7 +28,8 @@ class Reflect final {
 
 public:
   Reflect() : Kind(ReflectionKind::Type), Operand(nullptr) {}
-  Reflect(ReflectionKind Kind, const void *Operand) : Kind(Kind), Operand(Operand) {}
+  Reflect(ReflectionKind Kind, const void *Operand)
+      : Kind(Kind), Operand(Operand) {}
 
   ComparisonCategoryResult compare(const Reflect &RHS) const {
     llvm::FoldingSetNodeID LID, RID;
@@ -46,8 +47,6 @@ class Reflect final {
   APValue toAPValue(const ASTContext &Ctx) const {
     return APValue(Kind, Operand);
   }
-
-
 };
 
 inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Reflect &R) {

>From 819ea4ea75d2641911aa5600ddefb0b97bd11c05 Mon Sep 17 00:00:00 2001
From: changkhothuychung <nhat7203 at gmail.com>
Date: Wed, 8 Apr 2026 16:14:11 -0400
Subject: [PATCH 09/12] clang format

---
 clang/include/clang/AST/Reflection.h   |  5 ++--
 clang/lib/AST/ByteCode/Compiler.cpp    | 40 +++++++++++++-------------
 clang/lib/AST/ByteCode/Interp.h        | 38 ++++++++++++------------
 clang/lib/AST/ByteCode/InterpStack.h   |  2 +-
 clang/lib/AST/ByteCode/InterpState.cpp |  2 +-
 5 files changed, 45 insertions(+), 42 deletions(-)

diff --git a/clang/include/clang/AST/Reflection.h b/clang/include/clang/AST/Reflection.h
index 37580e8167a91..a1bd781d39808 100644
--- a/clang/include/clang/AST/Reflection.h
+++ b/clang/include/clang/AST/Reflection.h
@@ -20,8 +20,9 @@ namespace clang {
 // TODO(Reflection): Add support for Template, Namespace and DeclRefExpr.
 enum class ReflectionKind { Type };
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, ReflectionKind Kind) {
-  switch(Kind) {
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     ReflectionKind Kind) {
+  switch (Kind) {
   case ReflectionKind::Type:
     OS << "type";
   }
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 3755e54ebecfb..c2f48200a102e 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -4248,10 +4248,10 @@ bool Compiler<Emitter>::VisitCXXReflectExpr(const CXXReflectExpr *E) {
     return true;
 
   switch (E->getKind()) {
-    case ReflectionKind::Type: {
-      APValue Result(ReflectionKind::Type, E->getOpaqueValue());
-      return this->emitReflectValue(E->getKind(), E->getOpaqueValue(), E);
-    }
+  case ReflectionKind::Type: {
+    APValue Result(ReflectionKind::Type, E->getOpaqueValue());
+    return this->emitReflectValue(E->getKind(), E->getOpaqueValue(), E);
+  }
   }
 
   return false;
@@ -6173,28 +6173,28 @@ bool Compiler<Emitter>::visitWhileStmt(const WhileStmt *S) {
       return false;
   }
 
-    if (!this->visitBool(Cond))
-      return false;
+  if (!this->visitBool(Cond))
+    return false;
 
-    if (!this->maybeEmitDeferredVarInit(S->getConditionVariable()))
-      return false;
+  if (!this->maybeEmitDeferredVarInit(S->getConditionVariable()))
+    return false;
 
-    if (!this->jumpFalse(EndLabel, S))
-      return false;
+  if (!this->jumpFalse(EndLabel, S))
+    return false;
 
-    if (!this->visitStmt(Body))
-      return false;
+  if (!this->visitStmt(Body))
+    return false;
 
-    if (!CondScope.destroyLocals())
-      return false;
-    // } End of loop body.
+  if (!CondScope.destroyLocals())
+    return false;
+  // } End of loop body.
 
-    if (!this->jump(CondLabel, S))
-      return false;
-    this->fallthrough(EndLabel);
-    this->emitLabel(EndLabel);
+  if (!this->jump(CondLabel, S))
+    return false;
+  this->fallthrough(EndLabel);
+  this->emitLabel(EndLabel);
 
-    return CondScope.destroyLocals() && WholeLoopScope.destroyLocals();
+  return CondScope.destroyLocals() && WholeLoopScope.destroyLocals();
 }
 
 template <class Emitter> bool Compiler<Emitter>::visitDoStmt(const DoStmt *S) {
diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index 647e2abe729df..26a27183ca19c 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -16,7 +16,6 @@
 #include "../ExprConstShared.h"
 #include "BitcastBuffer.h"
 #include "Boolean.h"
-#include "Reflect.h"
 #include "DynamicAllocator.h"
 #include "FixedPoint.h"
 #include "Floating.h"
@@ -29,6 +28,7 @@
 #include "MemberPointer.h"
 #include "PrimType.h"
 #include "Program.h"
+#include "Reflect.h"
 #include "State.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Expr.h"
@@ -2914,9 +2914,9 @@ inline bool DoShift(InterpState &S, CodePtr OpPC, LT &LHS, RT &RHS,
 
     RHS = RHS.isMin() ? RT(APSInt::getMaxValue(RHS.bitWidth(), false)) : -RHS;
 
-    return DoShift<LT, RT,
-                   Dir == ShiftDir::Left ? ShiftDir::Right : ShiftDir::Left>(
-        S, OpPC, LHS, RHS, Result);
+    return DoShift < LT, RT,
+           Dir == ShiftDir::Left ? ShiftDir::Right
+                                 : ShiftDir::Left > (S, OpPC, LHS, RHS, Result);
   }
 
   if (!CheckShift<Dir>(S, OpPC, LHS, RHS, Bits))
@@ -2959,16 +2959,16 @@ inline bool DoShift(InterpState &S, CodePtr OpPC, LT &LHS, RT &RHS,
     return true;
   }
 
-    // Right shift.
-    if (Compare(RHS, RT::from(MaxShiftAmount, RHS.bitWidth())) ==
-        ComparisonCategoryResult::Greater) {
-      R = LT::AsUnsigned::from(-1);
-    } else {
-      // Do the shift on potentially signed LT, then convert to unsigned type.
-      LT A;
-      LT::shiftRight(LHS, LT::from(RHS, Bits), Bits, &A);
-      R = LT::AsUnsigned::from(A);
-    }
+  // Right shift.
+  if (Compare(RHS, RT::from(MaxShiftAmount, RHS.bitWidth())) ==
+      ComparisonCategoryResult::Greater) {
+    R = LT::AsUnsigned::from(-1);
+  } else {
+    // Do the shift on potentially signed LT, then convert to unsigned type.
+    LT A;
+    LT::shiftRight(LHS, LT::from(RHS, Bits), Bits, &A);
+    R = LT::AsUnsigned::from(A);
+  }
 
   S.Stk.push<LT>(LT::from(R));
   return true;
@@ -2993,9 +2993,10 @@ inline bool DoShiftAP(InterpState &S, CodePtr OpPC, const APSInt &LHS,
     S.CCEDiag(Loc, diag::note_constexpr_negative_shift) << RHS; //.toAPSInt();
     if (!S.noteUndefinedBehavior())
       return false;
-    return DoShiftAP<LT, RT,
-                     Dir == ShiftDir::Left ? ShiftDir::Right : ShiftDir::Left>(
-        S, OpPC, LHS, -RHS, Result);
+    return DoShiftAP < LT, RT,
+           Dir == ShiftDir::Left
+               ? ShiftDir::Right
+               : ShiftDir::Left > (S, OpPC, LHS, -RHS, Result);
   }
 
   if (!CheckShift<Dir>(S, OpPC, static_cast<LT>(LHS), static_cast<RT>(RHS),
@@ -3733,7 +3734,8 @@ inline bool CheckDestruction(InterpState &S, CodePtr OpPC) {
   return CheckDestructor(S, OpPC, Ptr);
 }
 
-inline bool ReflectValue(InterpState &S, CodePtr OpPC, ReflectionKind Kind, const void *Operand) {
+inline bool ReflectValue(InterpState &S, CodePtr OpPC, ReflectionKind Kind,
+                         const void *Operand) {
   S.Stk.push<Reflect>(Kind, Operand);
   return true;
 }
diff --git a/clang/lib/AST/ByteCode/InterpStack.h b/clang/lib/AST/ByteCode/InterpStack.h
index 648638bf7084e..9b8468a632d27 100644
--- a/clang/lib/AST/ByteCode/InterpStack.h
+++ b/clang/lib/AST/ByteCode/InterpStack.h
@@ -16,8 +16,8 @@
 #include "FixedPoint.h"
 #include "IntegralAP.h"
 #include "MemberPointer.h"
-#include "Reflect.h"
 #include "PrimType.h"
+#include "Reflect.h"
 
 namespace clang {
 namespace interp {
diff --git a/clang/lib/AST/ByteCode/InterpState.cpp b/clang/lib/AST/ByteCode/InterpState.cpp
index f8288420da0fa..578f32b3ae645 100644
--- a/clang/lib/AST/ByteCode/InterpState.cpp
+++ b/clang/lib/AST/ByteCode/InterpState.cpp
@@ -10,8 +10,8 @@
 #include "InterpFrame.h"
 #include "InterpStack.h"
 #include "Program.h"
-#include "State.h"
 #include "Reflect.h"
+#include "State.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclTemplate.h"
 

>From 3cb9ab2c1a5624c8bc620306487c163d25c7fcf5 Mon Sep 17 00:00:00 2001
From: changkhothuychung <nhat7203 at gmail.com>
Date: Wed, 8 Apr 2026 17:01:47 -0400
Subject: [PATCH 10/12] revert errornerous change

---
 clang/lib/AST/ByteCode/Interp.h | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index 26a27183ca19c..73b0b6248a7ad 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -2914,9 +2914,9 @@ inline bool DoShift(InterpState &S, CodePtr OpPC, LT &LHS, RT &RHS,
 
     RHS = RHS.isMin() ? RT(APSInt::getMaxValue(RHS.bitWidth(), false)) : -RHS;
 
-    return DoShift < LT, RT,
-           Dir == ShiftDir::Left ? ShiftDir::Right
-                                 : ShiftDir::Left > (S, OpPC, LHS, RHS, Result);
+    return DoShift<LT, RT,
+                   Dir == ShiftDir::Left ? ShiftDir::Right : ShiftDir::Left>(
+        S, OpPC, LHS, RHS, Result);
   }
 
   if (!CheckShift<Dir>(S, OpPC, LHS, RHS, Bits))
@@ -2993,10 +2993,9 @@ inline bool DoShiftAP(InterpState &S, CodePtr OpPC, const APSInt &LHS,
     S.CCEDiag(Loc, diag::note_constexpr_negative_shift) << RHS; //.toAPSInt();
     if (!S.noteUndefinedBehavior())
       return false;
-    return DoShiftAP < LT, RT,
-           Dir == ShiftDir::Left
-               ? ShiftDir::Right
-               : ShiftDir::Left > (S, OpPC, LHS, -RHS, Result);
+    return DoShiftAP<LT, RT,
+                     Dir == ShiftDir::Left ? ShiftDir::Right : ShiftDir::Left>(
+        S, OpPC, LHS, -RHS, Result);
   }
 
   if (!CheckShift<Dir>(S, OpPC, static_cast<LT>(LHS), static_cast<RT>(RHS),

>From bc7a99488164e29783e16d566dc898831a3242f7 Mon Sep 17 00:00:00 2001
From: changkhothuychung <nhat7203 at gmail.com>
Date: Wed, 8 Apr 2026 17:06:48 -0400
Subject: [PATCH 11/12] revert clang format

---
 clang/include/clang/AST/APValue.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h
index 0f4a2f5b5390c..50013529d7ebd 100644
--- a/clang/include/clang/AST/APValue.h
+++ b/clang/include/clang/AST/APValue.h
@@ -28,18 +28,18 @@ namespace serialization {
 template <typename T> class BasicReaderBase;
 } // end namespace serialization
 
-class AddrLabelExpr;
-class ASTContext;
-class CharUnits;
-class CXXRecordDecl;
-class Decl;
-class DiagnosticBuilder;
-class Expr;
-class FieldDecl;
-struct PrintingPolicy;
-class Type;
-class ValueDecl;
-class QualType;
+  class AddrLabelExpr;
+  class ASTContext;
+  class CharUnits;
+  class CXXRecordDecl;
+  class Decl;
+  class DiagnosticBuilder;
+  class Expr;
+  class FieldDecl;
+  struct PrintingPolicy;
+  class Type;
+  class ValueDecl;
+  class QualType;
 
 /// Symbolic representation of typeid(T) for some type T.
 class TypeInfoLValue {

>From 22bcd2c8b2a2454260f31384555e8c58592cf6e5 Mon Sep 17 00:00:00 2001
From: changkhothuychung <nhat7203 at gmail.com>
Date: Wed, 8 Apr 2026 17:13:18 -0400
Subject: [PATCH 12/12] revert wrong clang format

---
 clang/include/clang/AST/APValue.h | 97 +++++++++++++++----------------
 1 file changed, 47 insertions(+), 50 deletions(-)

diff --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h
index 50013529d7ebd..2492dd4847b3e 100644
--- a/clang/include/clang/AST/APValue.h
+++ b/clang/include/clang/AST/APValue.h
@@ -55,7 +55,7 @@ class TypeInfoLValue {
   const void *getOpaqueValue() const { return T; }
   static TypeInfoLValue getFromOpaqueValue(const void *Value) {
     TypeInfoLValue V;
-    V.T = reinterpret_cast<const Type *>(Value);
+    V.T = reinterpret_cast<const Type*>(Value);
     return V;
   }
 
@@ -89,10 +89,10 @@ class DynamicAllocLValue {
 
   static constexpr int NumLowBitsAvailable = 3;
 };
-} // namespace clang
+}
 
 namespace llvm {
-template <> struct PointerLikeTypeTraits<clang::TypeInfoLValue> {
+template<> struct PointerLikeTypeTraits<clang::TypeInfoLValue> {
   static const void *getAsVoidPointer(clang::TypeInfoLValue V) {
     return V.getOpaqueValue();
   }
@@ -104,7 +104,7 @@ template <> struct PointerLikeTypeTraits<clang::TypeInfoLValue> {
   static constexpr int NumLowBitsAvailable = 3;
 };
 
-template <> struct PointerLikeTypeTraits<clang::DynamicAllocLValue> {
+template<> struct PointerLikeTypeTraits<clang::DynamicAllocLValue> {
   static const void *getAsVoidPointer(clang::DynamicAllocLValue V) {
     return V.getOpaqueValue();
   }
@@ -114,7 +114,7 @@ template <> struct PointerLikeTypeTraits<clang::DynamicAllocLValue> {
   static constexpr int NumLowBitsAvailable =
       clang::DynamicAllocLValue::NumLowBitsAvailable;
 };
-} // namespace llvm
+}
 
 namespace clang {
 /// APValue - This class implements a discriminated union of [uninitialized]
@@ -124,7 +124,6 @@ class APValue {
   typedef llvm::APFixedPoint APFixedPoint;
   typedef llvm::APSInt APSInt;
   typedef llvm::APFloat APFloat;
-
 public:
   enum ValueKind {
     /// There is no such object (it's outside its lifetime).
@@ -314,20 +313,19 @@ class APValue {
     ~UnionData();
   };
   struct AddrLabelDiffData {
-    const AddrLabelExpr *LHSExpr;
-    const AddrLabelExpr *RHSExpr;
+    const AddrLabelExpr* LHSExpr;
+    const AddrLabelExpr* RHSExpr;
   };
   struct ReflectionData {
-    ReflectionKind OperandKind;
+    const ReflectionKind OperandKind;
     const void *Operand;
   };
   struct MemberPointerData;
 
   // We ensure elsewhere that Data is big enough for LV and MemberPointerData.
-  typedef llvm::AlignedCharArrayUnion<
-      void *, APSInt, APFloat, ComplexAPSInt, ComplexAPFloat, Vec, Mat, Arr,
-      StructData, UnionData, AddrLabelDiffData, ReflectionData>
-      DataType;
+  typedef llvm::AlignedCharArrayUnion<void *, APSInt, APFloat, ComplexAPSInt,
+                                      ComplexAPFloat, Vec, Mat, Arr, StructData,
+                                      UnionData, AddrLabelDiffData, ReflectionData> DataType;
   static const size_t DataSize = sizeof(DataType);
 
   DataType Data;
@@ -343,13 +341,11 @@ class APValue {
   APValue() : Kind(None), AllowConstexprUnknown(false) {}
   /// Creates an integer APValue holding the given value.
   explicit APValue(APSInt I) : Kind(None), AllowConstexprUnknown(false) {
-    MakeInt();
-    setInt(std::move(I));
+    MakeInt(); setInt(std::move(I));
   }
   /// Creates a float APValue holding the given value.
   explicit APValue(APFloat F) : Kind(None), AllowConstexprUnknown(false) {
-    MakeFloat();
-    setFloat(std::move(F));
+    MakeFloat(); setFloat(std::move(F));
   }
   /// Creates a fixed-point APValue holding the given value.
   explicit APValue(APFixedPoint FX) : Kind(None), AllowConstexprUnknown(false) {
@@ -359,8 +355,7 @@ class APValue {
   /// are read from \p E.
   explicit APValue(const APValue *E, unsigned N)
       : Kind(None), AllowConstexprUnknown(false) {
-    MakeVector();
-    setVector(E, N);
+    MakeVector(); setVector(E, N);
   }
   /// Creates a matrix APValue with given dimensions. The elements
   /// are read from \p E and assumed to be in row-major order.
@@ -372,13 +367,11 @@ class APValue {
   /// Creates an integer complex APValue with the given real and imaginary
   /// values.
   APValue(APSInt R, APSInt I) : Kind(None), AllowConstexprUnknown(false) {
-    MakeComplexInt();
-    setComplexInt(std::move(R), std::move(I));
+    MakeComplexInt(); setComplexInt(std::move(R), std::move(I));
   }
   /// Creates a float complex APValue with the given real and imaginary values.
   APValue(APFloat R, APFloat I) : Kind(None), AllowConstexprUnknown(false) {
-    MakeComplexFloat();
-    setComplexFloat(std::move(R), std::move(I));
+    MakeComplexFloat(); setComplexFloat(std::move(R), std::move(I));
   }
   APValue(const APValue &RHS);
   APValue(APValue &&RHS);
@@ -430,7 +423,8 @@ class APValue {
   /// Creates a new Reflection APValue.
   /// \param OperandKind The kind of reflection.
   /// \param Operand The entity being reflected.
-  APValue(ReflectionKind OperandKind, const void *Operand) : Kind(None) {
+  APValue(ReflectionKind OperandKind, const void *Operand)
+      : Kind(None) {
     MakeReflection(OperandKind, Operand);
   }
 
@@ -465,8 +459,7 @@ class APValue {
   /// \param RHSExpr The right-hand side of the difference.
   APValue(const AddrLabelExpr *LHSExpr, const AddrLabelExpr *RHSExpr)
       : Kind(None), AllowConstexprUnknown(false) {
-    MakeAddrLabelDiff();
-    setAddrLabelDiff(LHSExpr, RHSExpr);
+    MakeAddrLabelDiff(); setAddrLabelDiff(LHSExpr, RHSExpr);
   }
   static APValue IndeterminateValue() {
     APValue Result;
@@ -531,7 +524,9 @@ class APValue {
     assert(isInt() && "Invalid accessor");
     return *(APSInt *)(char *)&Data;
   }
-  const APSInt &getInt() const { return const_cast<APValue *>(this)->getInt(); }
+  const APSInt &getInt() const {
+    return const_cast<APValue*>(this)->getInt();
+  }
 
   /// Try to convert this value to an integral constant. This works if it's an
   /// integer, null pointer, or offset from a null pointer. Returns true on
@@ -544,7 +539,7 @@ class APValue {
     return *(APFloat *)(char *)&Data;
   }
   const APFloat &getFloat() const {
-    return const_cast<APValue *>(this)->getFloat();
+    return const_cast<APValue*>(this)->getFloat();
   }
 
   APFixedPoint &getFixedPoint() {
@@ -560,7 +555,7 @@ class APValue {
     return ((ComplexAPSInt *)(char *)&Data)->Real;
   }
   const APSInt &getComplexIntReal() const {
-    return const_cast<APValue *>(this)->getComplexIntReal();
+    return const_cast<APValue*>(this)->getComplexIntReal();
   }
 
   APSInt &getComplexIntImag() {
@@ -568,7 +563,7 @@ class APValue {
     return ((ComplexAPSInt *)(char *)&Data)->Imag;
   }
   const APSInt &getComplexIntImag() const {
-    return const_cast<APValue *>(this)->getComplexIntImag();
+    return const_cast<APValue*>(this)->getComplexIntImag();
   }
 
   APFloat &getComplexFloatReal() {
@@ -576,7 +571,7 @@ class APValue {
     return ((ComplexAPFloat *)(char *)&Data)->Real;
   }
   const APFloat &getComplexFloatReal() const {
-    return const_cast<APValue *>(this)->getComplexFloatReal();
+    return const_cast<APValue*>(this)->getComplexFloatReal();
   }
 
   APFloat &getComplexFloatImag() {
@@ -584,13 +579,13 @@ class APValue {
     return ((ComplexAPFloat *)(char *)&Data)->Imag;
   }
   const APFloat &getComplexFloatImag() const {
-    return const_cast<APValue *>(this)->getComplexFloatImag();
+    return const_cast<APValue*>(this)->getComplexFloatImag();
   }
 
   const LValueBase getLValueBase() const;
   CharUnits &getLValueOffset();
   const CharUnits &getLValueOffset() const {
-    return const_cast<APValue *>(this)->getLValueOffset();
+    return const_cast<APValue*>(this)->getLValueOffset();
   }
   bool isLValueOnePastTheEnd() const;
   bool hasLValuePath() const;
@@ -605,7 +600,7 @@ class APValue {
     return ((Vec *)(char *)&Data)->Elts[I];
   }
   const APValue &getVectorElt(unsigned I) const {
-    return const_cast<APValue *>(this)->getVectorElt(I);
+    return const_cast<APValue*>(this)->getVectorElt(I);
   }
   unsigned getVectorLength() const {
     assert(isVector() && "Invalid accessor");
@@ -649,7 +644,7 @@ class APValue {
     return ((Arr *)(char *)&Data)->Elts[I];
   }
   const APValue &getArrayInitializedElt(unsigned I) const {
-    return const_cast<APValue *>(this)->getArrayInitializedElt(I);
+    return const_cast<APValue*>(this)->getArrayInitializedElt(I);
   }
   bool hasArrayFiller() const {
     return getArrayInitializedElts() != getArraySize();
@@ -660,7 +655,7 @@ class APValue {
     return ((Arr *)(char *)&Data)->Elts[getArrayInitializedElts()];
   }
   const APValue &getArrayFiller() const {
-    return const_cast<APValue *>(this)->getArrayFiller();
+    return const_cast<APValue*>(this)->getArrayFiller();
   }
   unsigned getArrayInitializedElts() const {
     assert(isArray() && "Invalid accessor");
@@ -690,10 +685,10 @@ class APValue {
     return ((StructData *)(char *)&Data)->Elts[getStructNumBases() + i];
   }
   const APValue &getStructBase(unsigned i) const {
-    return const_cast<APValue *>(this)->getStructBase(i);
+    return const_cast<APValue*>(this)->getStructBase(i);
   }
   const APValue &getStructField(unsigned i) const {
-    return const_cast<APValue *>(this)->getStructField(i);
+    return const_cast<APValue*>(this)->getStructField(i);
   }
 
   const FieldDecl *getUnionField() const {
@@ -705,18 +700,18 @@ class APValue {
     return *((UnionData *)(char *)&Data)->Value;
   }
   const APValue &getUnionValue() const {
-    return const_cast<APValue *>(this)->getUnionValue();
+    return const_cast<APValue*>(this)->getUnionValue();
   }
 
   const ValueDecl *getMemberPointerDecl() const;
   bool isMemberPointerToDerivedMember() const;
-  ArrayRef<const CXXRecordDecl *> getMemberPointerPath() const;
+  ArrayRef<const CXXRecordDecl*> getMemberPointerPath() const;
 
-  const AddrLabelExpr *getAddrLabelDiffLHS() const {
+  const AddrLabelExpr* getAddrLabelDiffLHS() const {
     assert(isAddrLabelDiff() && "Invalid accessor");
     return ((const AddrLabelDiffData *)(const char *)&Data)->LHSExpr;
   }
-  const AddrLabelExpr *getAddrLabelDiffRHS() const {
+  const AddrLabelExpr* getAddrLabelDiffRHS() const {
     assert(isAddrLabelDiff() && "Invalid accessor");
     return ((const AddrLabelDiffData *)(const char *)&Data)->RHSExpr;
   }
@@ -726,7 +721,7 @@ class APValue {
     return ((const ReflectionData *)(const char *)&Data)->OperandKind;
   }
 
-  const void *getReflectionOpaqueOperand() const {
+  const void* getOpaqueReflectionOperand() const {
     assert(isReflection() && "Invalid accessor");
     return ((const ReflectionData *)(const char *)&Data)->Operand;
   }
@@ -773,17 +768,19 @@ class APValue {
                  ArrayRef<LValuePathEntry> Path, bool OnePastTheEnd,
                  bool IsNullPtr);
   void setUnion(const FieldDecl *Field, const APValue &Value);
-  void setAddrLabelDiff(const AddrLabelExpr *LHSExpr,
-                        const AddrLabelExpr *RHSExpr) {
+  void setAddrLabelDiff(const AddrLabelExpr* LHSExpr,
+                        const AddrLabelExpr* RHSExpr) {
     ((AddrLabelDiffData *)(char *)&Data)->LHSExpr = LHSExpr;
     ((AddrLabelDiffData *)(char *)&Data)->RHSExpr = RHSExpr;
   }
 
 private:
   void DestroyDataAndMakeUninit();
-  void MakeReflection(ReflectionKind OperandKind, const void *Operand) {
+  void MakeReflection(ReflectionKind OperandKind,
+                      const void *Operand) {
     assert(isAbsent() && "Bad state change");
-    new ((void *)(char *)Data.buffer) ReflectionData{OperandKind, Operand};
+    new ((void *)(char *)Data.buffer) ReflectionData(
+            OperandKind, Operand);
     Kind = Reflection;
   }
   void MakeInt() {
@@ -834,7 +831,7 @@ class APValue {
     Kind = Union;
   }
   void MakeMemberPointer(const ValueDecl *Member, bool IsDerivedMember,
-                         ArrayRef<const CXXRecordDecl *> Path);
+                         ArrayRef<const CXXRecordDecl*> Path);
   void MakeAddrLabelDiff() {
     assert(isAbsent() && "Bad state change");
     new ((void *)(char *)&Data) AddrLabelDiffData();
@@ -872,13 +869,13 @@ class APValue {
 } // end namespace clang.
 
 namespace llvm {
-template <> struct DenseMapInfo<clang::APValue::LValueBase> {
+template<> struct DenseMapInfo<clang::APValue::LValueBase> {
   static clang::APValue::LValueBase getEmptyKey();
   static clang::APValue::LValueBase getTombstoneKey();
   static unsigned getHashValue(const clang::APValue::LValueBase &Base);
   static bool isEqual(const clang::APValue::LValueBase &LHS,
                       const clang::APValue::LValueBase &RHS);
 };
-} // namespace llvm
+}
 
 #endif



More information about the cfe-commits mailing list