mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Profiler] Separate profiler instances for property inits and constructors (#25247)
Assign separate SILProfiler instances to stored property initializers and constructors. Starting with rdar://39460313, coverage reporting for these constructs was bundled up into a single SILProfiler uniqued by the NominalTypeDecl. There are two problems with doing this. First, the shared SILProfiler is given a fake name that can't be demangled. That breaks Xcode's reports. Second, the relationship between SILProfiler and SILFunction is supposed to be 1:1. Having a shared SILProfiler muddies things a bit and requires extra bookkeeping. rdar://47467864
This commit is contained in:
@@ -612,7 +612,8 @@ void SILGenFunction::emitArtificialTopLevel(ClassDecl *mainClass) {
|
||||
}
|
||||
}
|
||||
|
||||
void SILGenFunction::emitGeneratorFunction(SILDeclRef function, Expr *value) {
|
||||
void SILGenFunction::emitGeneratorFunction(SILDeclRef function, Expr *value,
|
||||
bool EmitProfilerIncrement) {
|
||||
MagicFunctionName = SILGenModule::getMagicFunctionName(function);
|
||||
|
||||
RegularLocation Loc(value);
|
||||
@@ -635,6 +636,8 @@ void SILGenFunction::emitGeneratorFunction(SILDeclRef function, Expr *value) {
|
||||
auto interfaceType = value->getType()->mapTypeOutOfContext();
|
||||
emitProlog(/*paramList=*/nullptr, /*selfParam=*/nullptr, interfaceType,
|
||||
dc, false);
|
||||
if (EmitProfilerIncrement)
|
||||
emitProfilerIncrement(value);
|
||||
prepareEpilog(value->getType(), false, CleanupLocation::get(Loc));
|
||||
emitReturnExpr(Loc, value);
|
||||
emitEpilog(Loc);
|
||||
|
||||
Reference in New Issue
Block a user