File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -894,6 +894,7 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
894894 llvm::SmallVector<SILValue, 8 > values;
895895 llvm::copy (inst->getResults (), std::back_inserter (values));
896896 printUserList (values, inst);
897+ printBranchTargets (inst);
897898 }
898899
899900 void printUserList (ArrayRef<SILValue> values, SILNodePointer node) {
@@ -937,6 +938,21 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
937938 [&] { *this << " , " ; });
938939 }
939940
941+ void printBranchTargets (const SILInstruction *inst) {
942+ if (auto condBr = dyn_cast<CondBranchInst>(inst)) {
943+ if (condBr->getTrueBB ()->getDebugName ().hasValue ()) {
944+ *this << " , true->" << condBr->getTrueBB ()->getDebugName ().getValue ();
945+ }
946+ if (condBr->getFalseBB ()->getDebugName ().hasValue ()) {
947+ *this << " , false->" << condBr->getFalseBB ()->getDebugName ().getValue ();
948+ }
949+ } else if (auto br = dyn_cast<BranchInst>(inst)) {
950+ if (br->getDestBB ()->getDebugName ().hasValue ()) {
951+ *this << " , dest->" << br->getDestBB ()->getDebugName ().getValue ();
952+ }
953+ }
954+ }
955+
940956 void printConformances (ArrayRef<ProtocolConformanceRef> conformances) {
941957 // FIXME: conformances should always be printed and parsed!
942958 if (!Ctx.printVerbose ()) {
You can’t perform that action at this time.
0 commit comments