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()
This commit is contained in:
Shubham Sandeep Rastogi
2025-02-19 19:41:22 -08:00
parent 6aea6ce2f5
commit 092068340e
2 changed files with 33 additions and 0 deletions

View File

@@ -73,6 +73,11 @@ llvm::cl::opt<bool>
SILPrintDebugInfo("sil-print-debuginfo", llvm::cl::init(false),
llvm::cl::desc("Include debug info in SIL output"));
llvm::cl::opt<bool>
SILPrintDebugInfoVerbose("sil-print-debuginfo-verbose",
llvm::cl::init(false),
llvm::cl::desc("Print verbose debug info output"));
llvm::cl::opt<bool>
SILPrintSourceInfo("sil-print-sourceinfo", llvm::cl::init(false),
llvm::cl::desc("Include source annotation in SIL output"));
@@ -1132,6 +1137,22 @@ public:
*this << "* ";
*this << QuotedString(DL.filename) << ':' << DL.line << ':'
<< (unsigned)DL.column;
if (SILPrintDebugInfoVerbose) {
if (Loc.isImplicit())
*this << " isImplicit: " << "true";
else
*this << " isImplicit: " << "false";
if (Loc.isAutoGenerated())
*this << ", isAutoGenerated: " << "true";
else
*this << ", isAutoGenerated: " << "false";
if (Loc.isHiddenFromDebugInfo())
*this << ", isHiddenFromDebugInfo: " << "true";
else
*this << ", isHiddenFromDebugInfo: " << "false";
}
}
}

View File

@@ -0,0 +1,12 @@
// RUN: %target-swift-frontend %s -Xllvm -sil-print-debuginfo -Xllvm -sil-print-debuginfo-verbose -emit-sil -Onone -g -o - | %FileCheck %s
// CHECK: %0 = alloc_stack [var_decl] $Int64, var, name "x", type $Int64, loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false
// CHECK-NEXT: %1 = integer_literal $Builtin.Int64, 1, loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false
// CHECK-NEXT: %2 = struct $Int64 (%1), loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false
// CHECK-NEXT: store %2 to %0, loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false
// CHECK-NEXT: dealloc_stack %0, loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false
// CHECK-NEXT: %5 = tuple (), loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false
// CHECK-NEXT: return %5, loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false
func main() {
var x : Int64 = 1
}