[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:
Vedant Kumar
2019-06-05 10:38:10 -07:00
committed by GitHub
parent 27b56b17f9
commit 569c8afc54
14 changed files with 171 additions and 207 deletions

View File

@@ -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);