CGM.setGlobalVisibility(Fn, MD);
}
+static void setThunkProperties(CodeGenModule &CGM, const ThunkInfo &Thunk,
+ llvm::Function *ThunkFn, bool ForVTable,
+ GlobalDecl GD) {
+ CGM.setFunctionLinkage(GD, ThunkFn);
+ CGM.getCXXABI().setThunkLinkage(ThunkFn, ForVTable, GD,
+ !Thunk.Return.isEmpty());
+
+ // Set the right visibility.
+ const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
+ setThunkVisibility(CGM, MD, Thunk, ThunkFn);
+
+ if (CGM.supportsCOMDAT() && ThunkFn->isWeakForLinker())
+ ThunkFn->setComdat(CGM.getModule().getOrInsertComdat(ThunkFn->getName()));
+}
+
#ifndef NDEBUG
static bool similar(const ABIArgInfo &infoL, CanQualType typeL,
const ABIArgInfo &infoR, CanQualType typeR) {
return;
}
- // Change the linkage.
- CGM.setFunctionLinkage(GD, ThunkFn);
+ setThunkProperties(CGM, Thunk, ThunkFn, ForVTable, GD);
return;
}
CodeGenFunction(CGM).generateThunk(ThunkFn, FnInfo, GD, Thunk);
}
- CGM.setFunctionLinkage(GD, ThunkFn);
- CGM.getCXXABI().setThunkLinkage(ThunkFn, ForVTable, GD,
- !Thunk.Return.isEmpty());
-
- // Set the right visibility.
- const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
- setThunkVisibility(CGM, MD, Thunk, ThunkFn);
-
- if (CGM.supportsCOMDAT() && ThunkFn->isWeakForLinker())
- ThunkFn->setComdat(CGM.getModule().getOrInsertComdat(ThunkFn->getName()));
+ setThunkProperties(CGM, Thunk, ThunkFn, ForVTable, GD);
}
void CodeGenVTables::maybeEmitThunkForVTable(GlobalDecl GD,