Index: include/clang/AST/DeclCXX.h =================================================================== --- include/clang/AST/DeclCXX.h +++ include/clang/AST/DeclCXX.h @@ -2180,7 +2180,7 @@ /// that for the call operator of a lambda closure type, this returns the /// desugared 'this' type (a pointer to the closure type), not the captured /// 'this' type. - QualType getThisType(ASTContext &C) const; + QualType getThisType() const; static QualType getThisType(const FunctionProtoType *FPT, const CXXRecordDecl *Decl); Index: lib/AST/DeclCXX.cpp =================================================================== --- lib/AST/DeclCXX.cpp +++ lib/AST/DeclCXX.cpp @@ -2181,7 +2181,7 @@ return C.getPointerType(ClassTy); } -QualType CXXMethodDecl::getThisType(ASTContext &C) const { +QualType CXXMethodDecl::getThisType() const { // C++ 9.3.2p1: The type of this in a member function of a class X is X*. // If the member function is declared const, the type of this is const X*, // if the member function is declared volatile, the type of this is Index: lib/AST/ExprConstant.cpp =================================================================== --- lib/AST/ExprConstant.cpp +++ lib/AST/ExprConstant.cpp @@ -4462,7 +4462,7 @@ if (!handleLValueToRValueConversion(Info, Args[0], Args[0]->getType(), RHS, RHSValue)) return false; - if (!handleAssignment(Info, Args[0], *This, MD->getThisType(Info.Ctx), + if (!handleAssignment(Info, Args[0], *This, MD->getThisType(), RHSValue)) return false; This->moveInto(Result); Index: lib/Analysis/Consumed.cpp =================================================================== --- lib/Analysis/Consumed.cpp +++ lib/Analysis/Consumed.cpp @@ -463,7 +463,6 @@ using InfoEntry = MapType::iterator; using ConstInfoEntry = MapType::const_iterator; - AnalysisDeclContext ∾ ConsumedAnalyzer &Analyzer; ConsumedStateMap *StateMap; MapType PropagationMap; @@ -515,9 +514,8 @@ void VisitUnaryOperator(const UnaryOperator *UOp); void VisitVarDecl(const VarDecl *Var); - ConsumedStmtVisitor(AnalysisDeclContext &AC, ConsumedAnalyzer &Analyzer, - ConsumedStateMap *StateMap) - : AC(AC), Analyzer(Analyzer), StateMap(StateMap) {} + ConsumedStmtVisitor(ConsumedAnalyzer &Analyzer, ConsumedStateMap *StateMap) + : Analyzer(Analyzer), StateMap(StateMap) {} PropagationInfo getInfo(const Expr *StmtNode) const { ConstInfoEntry Entry = findInfo(StmtNode); @@ -774,8 +772,7 @@ void ConsumedStmtVisitor::VisitCXXConstructExpr(const CXXConstructExpr *Call) { CXXConstructorDecl *Constructor = Call->getConstructor(); - ASTContext &CurrContext = AC.getASTContext(); - QualType ThisType = Constructor->getThisType(CurrContext)->getPointeeType(); + QualType ThisType = Constructor->getThisType()->getPointeeType(); if (!isConsumableType(ThisType)) return; @@ -793,7 +790,7 @@ } else if (Constructor->isCopyConstructor()) { // Copy state from arg. If setStateOnRead then set arg to CS_Unknown. ConsumedState NS = - isSetOnReadPtrType(Constructor->getThisType(CurrContext)) ? + isSetOnReadPtrType(Constructor->getThisType()) ? CS_Unknown : CS_None; copyInfo(Call->getArg(0), Call, NS); } else { @@ -1203,8 +1200,7 @@ const FunctionDecl *D) { QualType ReturnType; if (const auto *Constructor = dyn_cast(D)) { - ASTContext &CurrContext = AC.getASTContext(); - ReturnType = Constructor->getThisType(CurrContext)->getPointeeType(); + ReturnType = Constructor->getThisType()->getPointeeType(); } else ReturnType = D->getCallResultType(); @@ -1323,7 +1319,7 @@ BlockInfo = ConsumedBlockInfo(CFGraph->getNumBlockIDs(), SortedGraph); CurrStates = llvm::make_unique(); - ConsumedStmtVisitor Visitor(AC, *this, CurrStates.get()); + ConsumedStmtVisitor Visitor(*this, CurrStates.get()); // Add all trackable parameters to the state map. for (const auto *PI : D->parameters()) Index: lib/CodeGen/CGBlocks.cpp =================================================================== --- lib/CodeGen/CGBlocks.cpp +++ lib/CodeGen/CGBlocks.cpp @@ -551,7 +551,7 @@ if (block->capturesCXXThis()) { assert(CGF && CGF->CurFuncDecl && isa(CGF->CurFuncDecl) && "Can't capture 'this' outside a method"); - QualType thisType = cast(CGF->CurFuncDecl)->getThisType(C); + QualType thisType = cast(CGF->CurFuncDecl)->getThisType(); // Theoretically, this could be in a different address space, so // don't assume standard pointer size/align. Index: lib/CodeGen/CGCXXABI.cpp =================================================================== --- lib/CodeGen/CGCXXABI.cpp +++ lib/CodeGen/CGCXXABI.cpp @@ -132,7 +132,7 @@ // generation. Maybe we can come up with a better way? auto *ThisDecl = ImplicitParamDecl::Create( CGM.getContext(), nullptr, MD->getLocation(), - &CGM.getContext().Idents.get("this"), MD->getThisType(CGM.getContext()), + &CGM.getContext().Idents.get("this"), MD->getThisType(), ImplicitParamDecl::CXXThis); params.push_back(ThisDecl); CGF.CXXABIThisDecl = ThisDecl; Index: lib/CodeGen/CGClass.cpp =================================================================== --- lib/CodeGen/CGClass.cpp +++ lib/CodeGen/CGClass.cpp @@ -2014,7 +2014,7 @@ CallArgList Args; LangAS SlotAS = E->getType().getAddressSpace(); - QualType ThisType = D->getThisType(getContext()); + QualType ThisType = D->getThisType(); LangAS ThisAS = ThisType.getTypePtr()->getPointeeType().getAddressSpace(); llvm::Value *ThisPtr = This.getPointer(); if (SlotAS != ThisAS) { @@ -2025,7 +2025,7 @@ ThisAS, SlotAS, NewType); } // Push the this ptr. - Args.add(RValue::get(ThisPtr), D->getThisType(getContext())); + Args.add(RValue::get(ThisPtr), D->getThisType()); // If this is a trivial constructor, emit a memcpy now before we lose // the alignment information on the argument. @@ -2159,7 +2159,7 @@ const CXXConstructorDecl *D, bool ForVirtualBase, Address This, bool InheritedFromVBase, const CXXInheritedCtorInitExpr *E) { CallArgList Args; - CallArg ThisArg(RValue::get(This.getPointer()), D->getThisType(getContext())); + CallArg ThisArg(RValue::get(This.getPointer()), D->getThisType()); // Forward the parameters. if (InheritedFromVBase && @@ -2284,7 +2284,7 @@ CallArgList Args; // Push the this ptr. - Args.add(RValue::get(This.getPointer()), D->getThisType(getContext())); + Args.add(RValue::get(This.getPointer()), D->getThisType()); // Push the src ptr. QualType QT = *(FPT->param_type_begin()); Index: lib/CodeGen/CGDebugInfo.cpp =================================================================== --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -1428,8 +1428,7 @@ if (Method->isStatic()) return cast_or_null( getOrCreateType(QualType(Func, 0), Unit)); - return getOrCreateInstanceMethodType(Method->getThisType(CGM.getContext()), - Func, Unit); + return getOrCreateInstanceMethodType(Method->getThisType(), Func, Unit); } llvm::DISubroutineType *CGDebugInfo::getOrCreateInstanceMethodType( @@ -4064,7 +4063,7 @@ QualType type; if (auto *Method = cast_or_null(blockDecl->getNonClosureContext())) - type = Method->getThisType(C); + type = Method->getThisType(); else if (auto *RDecl = dyn_cast(blockDecl->getParent())) type = QualType(RDecl->getTypeForDecl(), 0); else Index: lib/CodeGen/CGVTables.cpp =================================================================== --- lib/CodeGen/CGVTables.cpp +++ lib/CodeGen/CGVTables.cpp @@ -231,7 +231,7 @@ // Build FunctionArgs. const CXXMethodDecl *MD = cast(GD.getDecl()); - QualType ThisType = MD->getThisType(getContext()); + QualType ThisType = MD->getThisType(); const FunctionProtoType *FPT = MD->getType()->getAs(); QualType ResultType; if (IsUnprototyped) @@ -310,7 +310,7 @@ // Start building CallArgs. CallArgList CallArgs; - QualType ThisType = MD->getThisType(getContext()); + QualType ThisType = MD->getThisType(); CallArgs.add(RValue::get(AdjustedThisPtr), ThisType); if (isa(MD)) Index: lib/CodeGen/CodeGenFunction.cpp =================================================================== --- lib/CodeGen/CodeGenFunction.cpp +++ lib/CodeGen/CodeGenFunction.cpp @@ -1156,7 +1156,7 @@ if (CXXABIThisValue) { SanitizerSet SkippedChecks; SkippedChecks.set(SanitizerKind::ObjectSize, true); - QualType ThisTy = MD->getThisType(getContext()); + QualType ThisTy = MD->getThisType(); // If this is the call operator of a lambda with no capture-default, it // may have a static invoker function, which may call this operator with @@ -1256,7 +1256,7 @@ const CXXMethodDecl *MD = dyn_cast(FD); if (MD && MD->isInstance()) { if (CGM.getCXXABI().HasThisReturn(GD)) - ResTy = MD->getThisType(getContext()); + ResTy = MD->getThisType(); else if (CGM.getCXXABI().hasMostDerivedReturn(GD)) ResTy = CGM.getContext().VoidPtrTy; CGM.getCXXABI().buildThisParam(*this, Args); Index: lib/CodeGen/MicrosoftCXXABI.cpp =================================================================== --- lib/CodeGen/MicrosoftCXXABI.cpp +++ lib/CodeGen/MicrosoftCXXABI.cpp @@ -3929,7 +3929,7 @@ CallArgList Args; // Push the this ptr. - Args.add(RValue::get(This), CD->getThisType(getContext())); + Args.add(RValue::get(This), CD->getThisType()); // Push the src ptr. if (SrcVal) Index: lib/Sema/SemaCoroutine.cpp =================================================================== --- lib/Sema/SemaCoroutine.cpp +++ lib/Sema/SemaCoroutine.cpp @@ -84,8 +84,7 @@ // ref-qualifier or with the & ref-qualifier // -- "rvalue reference to cv X" for functions declared with the && // ref-qualifier - QualType T = - MD->getThisType(S.Context)->getAs()->getPointeeType(); + QualType T = MD->getThisType()->getAs()->getPointeeType(); T = FnType->getRefQualifier() == RQ_RValue ? S.Context.getRValueReferenceType(T) : S.Context.getLValueReferenceType(T, /*SpelledAsLValue*/ true); @@ -506,7 +505,7 @@ auto *FD = cast(CurContext); bool IsThisDependentType = [&] { if (auto *MD = dyn_cast_or_null(FD)) - return MD->isInstance() && MD->getThisType(Context)->isDependentType(); + return MD->isInstance() && MD->getThisType()->isDependentType(); else return false; }(); Index: lib/Sema/SemaDeclAttr.cpp =================================================================== --- lib/Sema/SemaDeclAttr.cpp +++ lib/Sema/SemaDeclAttr.cpp @@ -1151,8 +1151,7 @@ static bool checkForConsumableClass(Sema &S, const CXXMethodDecl *MD, const ParsedAttr &AL) { - ASTContext &CurrContext = S.getASTContext(); - QualType ThisType = MD->getThisType(CurrContext)->getPointeeType(); + QualType ThisType = MD->getThisType()->getPointeeType(); if (const CXXRecordDecl *RD = ThisType->getAsCXXRecordDecl()) { if (!RD->hasAttr()) { @@ -1265,7 +1264,7 @@ // //} else if (const CXXConstructorDecl *Constructor = // dyn_cast(D)) { - // ReturnType = Constructor->getThisType(S.getASTContext())->getPointeeType(); + // ReturnType = Constructor->getThisType()->getPointeeType(); // //} else { // Index: lib/Sema/SemaExpr.cpp =================================================================== --- lib/Sema/SemaExpr.cpp +++ lib/Sema/SemaExpr.cpp @@ -2585,7 +2585,7 @@ if (Method->isStatic()) return From; - DestType = Method->getThisType(Context); + DestType = Method->getThisType(); DestRecordType = DestType->getPointeeType(); if (FromType->getAs()) { Index: lib/Sema/SemaExprCXX.cpp =================================================================== --- lib/Sema/SemaExprCXX.cpp +++ lib/Sema/SemaExprCXX.cpp @@ -1064,7 +1064,7 @@ if (CXXMethodDecl *method = dyn_cast(DC)) { if (method && method->isInstance()) - ThisTy = method->getThisType(Context); + ThisTy = method->getThisType(); } if (ThisTy.isNull() && isLambdaCallOperator(CurContext) && @@ -3588,7 +3588,7 @@ if (getSourceManager().isInSystemHeader(PointeeRD->getLocation())) return; - QualType ClassType = dtor->getThisType(Context)->getPointeeType(); + QualType ClassType = dtor->getThisType()->getPointeeType(); if (PointeeRD->isAbstract()) { // If the class is abstract, we warn by default, because we're // sure the code has undefined behavior. Index: lib/Sema/SemaOverload.cpp =================================================================== --- lib/Sema/SemaOverload.cpp +++ lib/Sema/SemaOverload.cpp @@ -3277,7 +3277,7 @@ case OR_Success: { // Record the standard conversion we used and the conversion function. CXXConstructorDecl *Constructor = cast(Best->Function); - QualType ThisType = Constructor->getThisType(S.Context); + QualType ThisType = Constructor->getThisType(); // Initializer lists don't have conversions as such. User.Before.setAsIdentityConversion(); User.HadMultipleCandidates = HadMultipleCandidates; @@ -3458,7 +3458,7 @@ // sequence converts the source type to the type required by // the argument of the constructor. // - QualType ThisType = Constructor->getThisType(S.Context); + QualType ThisType = Constructor->getThisType(); if (isa(From)) { // Initializer lists don't have conversions as such. User.Before.setAsIdentityConversion(); @@ -5212,12 +5212,12 @@ CXXMethodDecl *Method) { QualType FromRecordType, DestType; QualType ImplicitParamRecordType = - Method->getThisType(Context)->getAs()->getPointeeType(); + Method->getThisType()->getAs()->getPointeeType(); Expr::Classification FromClassification; if (const PointerType *PT = From->getType()->getAs()) { FromRecordType = PT->getPointeeType(); - DestType = Method->getThisType(Context); + DestType = Method->getThisType(); FromClassification = Expr::Classification::makeSimpleLValue(); } else { FromRecordType = From->getType(); Index: lib/Sema/SemaTemplate.cpp =================================================================== --- lib/Sema/SemaTemplate.cpp +++ lib/Sema/SemaTemplate.cpp @@ -627,7 +627,7 @@ if (!MightBeCxx11UnevalField && !isAddressOfOperand && !IsEnum && isa(DC) && cast(DC)->isInstance()) { - QualType ThisType = cast(DC)->getThisType(Context); + QualType ThisType = cast(DC)->getThisType(); // Since the 'this' expression is synthesized, we don't need to // perform the double-lookup check. Index: lib/StaticAnalyzer/Core/LoopWidening.cpp =================================================================== --- lib/StaticAnalyzer/Core/LoopWidening.cpp +++ lib/StaticAnalyzer/Core/LoopWidening.cpp @@ -85,9 +85,8 @@ // have 'this' pointers. const CXXMethodDecl *CXXMD = dyn_cast(STC->getDecl()); if (CXXMD && !CXXMD->isStatic()) { - const CXXThisRegion *ThisR = MRMgr.getCXXThisRegion( - CXXMD->getThisType(STC->getAnalysisDeclContext()->getASTContext()), - STC); + const CXXThisRegion *ThisR = + MRMgr.getCXXThisRegion(CXXMD->getThisType(), STC); ITraits.setTrait(ThisR, RegionAndSymbolInvalidationTraits::TK_PreserveContents); } Index: lib/StaticAnalyzer/Core/MemRegion.cpp =================================================================== --- lib/StaticAnalyzer/Core/MemRegion.cpp +++ lib/StaticAnalyzer/Core/MemRegion.cpp @@ -1105,9 +1105,8 @@ // FIXME: when operator() of lambda is analyzed as a top level function and // 'this' refers to a this to the enclosing scope, there is no right region to // return. - while (!LC->inTopFrame() && - (!D || D->isStatic() || - PT != D->getThisType(getContext())->getAs())) { + while (!LC->inTopFrame() && (!D || D->isStatic() || + PT != D->getThisType()->getAs())) { LC = LC->getParent(); D = dyn_cast(LC->getDecl()); } Index: lib/StaticAnalyzer/Core/SValBuilder.cpp =================================================================== --- lib/StaticAnalyzer/Core/SValBuilder.cpp +++ lib/StaticAnalyzer/Core/SValBuilder.cpp @@ -271,8 +271,8 @@ /// Return a memory region for the 'this' object reference. loc::MemRegionVal SValBuilder::getCXXThis(const CXXMethodDecl *D, const StackFrameContext *SFC) { - return loc::MemRegionVal(getRegionManager(). - getCXXThisRegion(D->getThisType(getContext()), SFC)); + return loc::MemRegionVal( + getRegionManager().getCXXThisRegion(D->getThisType(), SFC)); } /// Return a memory region for the 'this' object reference.