diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2022-07-04 19:20:19 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-08 19:02:26 +0000 |
| commit | 81ad626541db97eb356e2c1d4a20eb2a26a766ab (patch) | |
| tree | 311b6a8987c32b1e1dcbab65c54cfac3fdb56175 /contrib/llvm-project/clang/lib/CodeGen/CGVTables.cpp | |
| parent | 5fff09660e06a66bed6482da9c70df328e16bbb6 (diff) | |
| parent | 145449b1e420787bb99721a429341fa6be3adfb6 (diff) | |
Diffstat (limited to 'contrib/llvm-project/clang/lib/CodeGen/CGVTables.cpp')
| -rw-r--r-- | contrib/llvm-project/clang/lib/CodeGen/CGVTables.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGVTables.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGVTables.cpp index c839376880c4..cdd40d2a6a2e 100644 --- a/contrib/llvm-project/clang/lib/CodeGen/CGVTables.cpp +++ b/contrib/llvm-project/clang/lib/CodeGen/CGVTables.cpp @@ -90,9 +90,11 @@ static RValue PerformReturnAdjustment(CodeGenFunction &CGF, auto ClassDecl = ResultType->getPointeeType()->getAsCXXRecordDecl(); auto ClassAlign = CGF.CGM.getClassPointerAlignment(ClassDecl); - ReturnValue = CGF.CGM.getCXXABI().performReturnAdjustment(CGF, - Address(ReturnValue, ClassAlign), - Thunk.Return); + ReturnValue = CGF.CGM.getCXXABI().performReturnAdjustment( + CGF, + Address(ReturnValue, CGF.ConvertTypeForMem(ResultType->getPointeeType()), + ClassAlign), + Thunk.Return); if (NullCheckValue) { CGF.Builder.CreateBr(AdjustEnd); @@ -198,7 +200,9 @@ CodeGenFunction::GenerateVarArgsThunk(llvm::Function *Fn, // Find the first store of "this", which will be to the alloca associated // with "this". - Address ThisPtr(&*AI, CGM.getClassPointerAlignment(MD->getParent())); + Address ThisPtr = + Address(&*AI, ConvertTypeForMem(MD->getThisType()->getPointeeType()), + CGM.getClassPointerAlignment(MD->getParent())); llvm::BasicBlock *EntryBB = &Fn->front(); llvm::BasicBlock::iterator ThisStore = llvm::find_if(*EntryBB, [&](llvm::Instruction &I) { @@ -396,9 +400,7 @@ void CodeGenFunction::EmitMustTailThunk(GlobalDecl GD, // to translate AST arguments into LLVM IR arguments. For thunks, we know // that the caller prototype more or less matches the callee prototype with // the exception of 'this'. - SmallVector<llvm::Value *, 8> Args; - for (llvm::Argument &A : CurFn->args()) - Args.push_back(&A); + SmallVector<llvm::Value *, 8> Args(llvm::make_pointer_range(CurFn->args())); // Set the adjusted 'this' pointer. const ABIArgInfo &ThisAI = CurFnInfo->arg_begin()->info; @@ -1173,7 +1175,10 @@ void CodeGenModule::EmitDeferredVTables() { DeferredVTables.clear(); } -bool CodeGenModule::HasLTOVisibilityPublicStd(const CXXRecordDecl *RD) { +bool CodeGenModule::AlwaysHasLTOVisibilityPublic(const CXXRecordDecl *RD) { + if (RD->hasAttr<LTOVisibilityPublicAttr>() || RD->hasAttr<UuidAttr>()) + return true; + if (!getCodeGenOpts().LTOVisibilityPublicStd) return false; @@ -1198,9 +1203,6 @@ bool CodeGenModule::HasHiddenLTOVisibility(const CXXRecordDecl *RD) { if (!isExternallyVisible(LV.getLinkage())) return true; - if (RD->hasAttr<LTOVisibilityPublicAttr>() || RD->hasAttr<UuidAttr>()) - return false; - if (getTriple().isOSBinFormatCOFF()) { if (RD->hasAttr<DLLExportAttr>() || RD->hasAttr<DLLImportAttr>()) return false; @@ -1209,7 +1211,7 @@ bool CodeGenModule::HasHiddenLTOVisibility(const CXXRecordDecl *RD) { return false; } - return !HasLTOVisibilityPublicStd(RD); + return !AlwaysHasLTOVisibilityPublic(RD); } llvm::GlobalObject::VCallVisibility CodeGenModule::GetVCallVisibilityLevel( |
