diff options
author | Corentin Jabot <corentinjabot@gmail.com> | 2022-01-27 13:55:08 +0100 |
---|---|---|
committer | Corentin Jabot <corentinjabot@gmail.com> | 2023-10-02 14:33:02 +0200 |
commit | af4751738db89a142a8880c782d12d4201b222a8 (patch) | |
tree | b58f2c515b189904f4b598a06f0af0e642343b2c /clang/lib/CodeGen/CGClass.cpp | |
parent | bc7d88faf1a595ab59952a2054418cdd0d9eeee8 (diff) | |
download | llvm-af4751738db89a142a8880c782d12d4201b222a8.zip llvm-af4751738db89a142a8880c782d12d4201b222a8.tar.gz llvm-af4751738db89a142a8880c782d12d4201b222a8.tar.bz2 |
[C++] Implement "Deducing this" (P0847R7)
This patch implements P0847R7 (partially),
CWG2561 and CWG2653.
Reviewed By: aaron.ballman, #clang-language-wg
Differential Revision: https://reviews.llvm.org/D140828
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index e7ed3ec..57a424c 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -138,7 +138,7 @@ Address CodeGenFunction::LoadCXXThisAddress() { CXXThisAlignment = CGM.getClassPointerAlignment(MD->getParent()); } - llvm::Type *Ty = ConvertType(MD->getThisObjectType()); + llvm::Type *Ty = ConvertType(MD->getFunctionObjectParameterType()); return Address(LoadCXXThis(), Ty, CXXThisAlignment, KnownNonNull); } @@ -510,7 +510,7 @@ namespace { const CXXDestructorDecl *D = BaseClass->getDestructor(); // We are already inside a destructor, so presumably the object being // destroyed should have the expected type. - QualType ThisTy = D->getThisObjectType(); + QualType ThisTy = D->getFunctionObjectParameterType(); Address Addr = CGF.GetAddressOfDirectBaseInCompleteClass(CGF.LoadCXXThisAddress(), DerivedClass, BaseClass, @@ -1456,7 +1456,7 @@ void CodeGenFunction::EmitDestructorBody(FunctionArgList &Args) { RunCleanupsScope DtorEpilogue(*this); EnterDtorCleanups(Dtor, Dtor_Deleting); if (HaveInsertPoint()) { - QualType ThisTy = Dtor->getThisObjectType(); + QualType ThisTy = Dtor->getFunctionObjectParameterType(); EmitCXXDestructorCall(Dtor, Dtor_Complete, /*ForVirtualBase=*/false, /*Delegating=*/false, LoadCXXThisAddress(), ThisTy); } @@ -1490,7 +1490,7 @@ void CodeGenFunction::EmitDestructorBody(FunctionArgList &Args) { EnterDtorCleanups(Dtor, Dtor_Complete); if (!isTryBody) { - QualType ThisTy = Dtor->getThisObjectType(); + QualType ThisTy = Dtor->getFunctionObjectParameterType(); EmitCXXDestructorCall(Dtor, Dtor_Base, /*ForVirtualBase=*/false, /*Delegating=*/false, LoadCXXThisAddress(), ThisTy); break; @@ -2114,7 +2114,7 @@ void CodeGenFunction::EmitCXXConstructorCall(const CXXConstructorDecl *D, CallArgList Args; Address This = ThisAVS.getAddress(); LangAS SlotAS = ThisAVS.getQualifiers().getAddressSpace(); - LangAS ThisAS = D->getThisObjectType().getAddressSpace(); + LangAS ThisAS = D->getFunctionObjectParameterType().getAddressSpace(); llvm::Value *ThisPtr = This.getPointer(); if (SlotAS != ThisAS) { @@ -2453,7 +2453,7 @@ namespace { void Emit(CodeGenFunction &CGF, Flags flags) override { // We are calling the destructor from within the constructor. // Therefore, "this" should have the expected type. - QualType ThisTy = Dtor->getThisObjectType(); + QualType ThisTy = Dtor->getFunctionObjectParameterType(); CGF.EmitCXXDestructorCall(Dtor, Type, /*ForVirtualBase=*/false, /*Delegating=*/true, Addr, ThisTy); } |