[swift-dev] DebugScope Verification Error

Raj Barik rkbarik at gmail.com
Mon Jan 15 11:24:24 CST 2018


I am running into a debug scope SIL Verifier error when creating a new
function (NF) from an existing one (F). Can someone point me where I am
going wrong?

NF = M.createFunction(...., F->getDebugScope());
SILBasicBlock *NFBody = NF->createBasicBlock();
SILBuilder NFBuilder(NFBody);
SILOpenedArchetypesTracker OpenedArchetypesTrackerNF(NF);
for (auto &param : params) { /* Assume all are generic types */
  auto GenericsSILType = ....
  auto NewArg = NFBody->createFunctionArgument(GenericSILType);
  auto Conformances = Mod->lookupConformance(...);
  auto *InitRef = NFBuilder.createInitExistentialRef( Loc,
NewArg->getType().getSwiftRValueType()->getCanonicalType(), NewArg,

The InitRef instruction created above runs into SIL verifier error:

SIL verification failed: debug scope of instruction belongs to a different
function: !DS || DS->getParentFunction() == I->getFunction()
Verifying instruction:
   %0 = argument of bb0 : $τ_0_0                 // user: %1
->   %1 = init_existential_ref %0 : $τ_0_0 : $τ_0_0, $SomeProtocol // user:

The SIL looks correct to me though.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20180115/2abef64a/attachment.html>

More information about the swift-dev mailing list