[semantic-sil] Print out function name when incompatible ownership is detected.

This makes FileCheck matching easier.
This commit is contained in:
Michael Gottesman
2017-01-18 14:46:54 -08:00
parent f6d5714412
commit a0b498ca1b

View File

@@ -101,15 +101,6 @@ public:
return getType().isTrivial(Mod);
}
void error(SILInstruction *User) {
llvm::errs() << "Have operand with incompatible ownership?!\n"
<< "Value: " << *getValue() << "User: " << *User
<< "Conv: " << getOwnershipKind() << "\n";
if (PrintMessageInsteadOfAssert)
return;
llvm_unreachable("triggering standard assertion failure routine");
}
OwnershipUseCheckerResult visitForwardingInst(SILInstruction *I);
/// Check if \p User as compatible ownership with the SILValue that we are
@@ -120,7 +111,13 @@ public:
bool check(SILInstruction *User) {
auto Result = visit(User);
if (!Result.HasCompatibleOwnership) {
error(User);
llvm::errs() << "Function: '" << User->getFunction()->getName() << "'\n"
<< "Have operand with incompatible ownership?!\n"
<< "Value: " << *getValue() << "User: " << *User
<< "Conv: " << getOwnershipKind() << "\n";
if (PrintMessageInsteadOfAssert)
return false;
llvm_unreachable("triggering standard assertion failure routine");
}
assert((!Result.ShouldCheckForDataflowViolations ||