Skip to content

Commit 0920683

Browse files
Add option -sil-print-debuginfo-verbose
The option -sil-print-debuginfo-verbose will print the values of the fields, implicit, and autoGenerated for a SILLocation, as well as whether the SILLocation is considered hidden from debug information by calling SILLocation::isHiddenFromDebugInfo()
1 parent 6aea6ce commit 0920683

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

lib/SIL/IR/SILPrinter.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ llvm::cl::opt<bool>
7373
SILPrintDebugInfo("sil-print-debuginfo", llvm::cl::init(false),
7474
llvm::cl::desc("Include debug info in SIL output"));
7575

76+
llvm::cl::opt<bool>
77+
SILPrintDebugInfoVerbose("sil-print-debuginfo-verbose",
78+
llvm::cl::init(false),
79+
llvm::cl::desc("Print verbose debug info output"));
80+
7681
llvm::cl::opt<bool>
7782
SILPrintSourceInfo("sil-print-sourceinfo", llvm::cl::init(false),
7883
llvm::cl::desc("Include source annotation in SIL output"));
@@ -1132,6 +1137,22 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
11321137
*this << "* ";
11331138
*this << QuotedString(DL.filename) << ':' << DL.line << ':'
11341139
<< (unsigned)DL.column;
1140+
if (SILPrintDebugInfoVerbose) {
1141+
if (Loc.isImplicit())
1142+
*this << " isImplicit: " << "true";
1143+
else
1144+
*this << " isImplicit: " << "false";
1145+
1146+
if (Loc.isAutoGenerated())
1147+
*this << ", isAutoGenerated: " << "true";
1148+
else
1149+
*this << ", isAutoGenerated: " << "false";
1150+
1151+
if (Loc.isHiddenFromDebugInfo())
1152+
*this << ", isHiddenFromDebugInfo: " << "true";
1153+
else
1154+
*this << ", isHiddenFromDebugInfo: " << "false";
1155+
}
11351156
}
11361157
}
11371158

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %target-swift-frontend %s -Xllvm -sil-print-debuginfo -Xllvm -sil-print-debuginfo-verbose -emit-sil -Onone -g -o - | %FileCheck %s
2+
// CHECK: %0 = alloc_stack [var_decl] $Int64, var, name "x", type $Int64, loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false
3+
// CHECK-NEXT: %1 = integer_literal $Builtin.Int64, 1, loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false
4+
// CHECK-NEXT: %2 = struct $Int64 (%1), loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false
5+
// CHECK-NEXT: store %2 to %0, loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false
6+
// CHECK-NEXT: dealloc_stack %0, loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false
7+
// CHECK-NEXT: %5 = tuple (), loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false
8+
// CHECK-NEXT: return %5, loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false
9+
10+
func main() {
11+
var x : Int64 = 1
12+
}

0 commit comments

Comments
 (0)