Skip to content

Commit 75450c7

Browse files
committed
[embedded] When missing a source location in a PerformanceDiagnostic, at least print the function name
1 parent 36dd2c9 commit 75450c7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/SILOptimizer/Mandatory/PerformanceDiagnostics.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ bool PerformanceDiagnostics::visitFunction(SILFunction *function,
181181

182182
for (SILInstruction &inst : block) {
183183
if (visitInst(&inst, perfConstr, parentLoc)) {
184+
if (inst.getLoc().getSourceLoc().isInvalid()) {
185+
llvm::errs() << "in function " << inst.getFunction()->getName() << "\n";
186+
}
184187
LLVM_DEBUG(llvm::dbgs() << inst << *inst.getFunction());
185188
return true;
186189
}
@@ -582,6 +585,9 @@ void PerformanceDiagnostics::checkNonAnnotatedFunction(SILFunction *function) {
582585
if (function->getModule().getOptions().EmbeddedSwift) {
583586
auto loc = LocWithParent(inst.getLoc().getSourceLoc(), nullptr);
584587
if (visitInst(&inst, PerformanceConstraints::None, &loc)) {
588+
if (inst.getLoc().getSourceLoc().isInvalid()) {
589+
llvm::errs() << "in function " << inst.getFunction()->getName() << "\n";
590+
}
585591
LLVM_DEBUG(llvm::dbgs() << inst << *inst.getFunction());
586592
}
587593
}

0 commit comments

Comments
 (0)