HelpText<"The compilation directory to embed in the debug info.">;
def dwarf_debug_flags : Separate<"-dwarf-debug-flags">,
HelpText<"The string to embed in the Dwarf debug flags record.">;
+def dwarf_column_info : Flag<"-dwarf-column-info">,
+ HelpText<"Turn on column location information.">;
def fforbid_guard_variables : Flag<"-fforbid-guard-variables">,
HelpText<"Emit an error if a C++ static local initializer would need a guard variable">;
def no_implicit_float : Flag<"-no-implicit-float">,
Group<g_flags_Group>;
def gstrict_dwarf : Flag<"-gstrict-dwarf">, Group<g_flags_Group>;
def gno_strict_dwarf : Flag<"-gno-strict-dwarf">, Group<g_flags_Group>;
+def gcolumn_info : Flag<"-gcolumn-info">, Group<g_flags_Group>;
def headerpad__max__install__names : Joined<"-headerpad_max_install_names">;
def help : Flag<"-help">, Flags<[CC1Option]>,
HelpText<"Display available options">;
/// The kind of generated debug info.
DebugInfoKind DebugInfo;
+ /// Whether or not to use column information in debug info.
+ bool DebugColumnInfo;
+
/// The string to embed in the debug information for the compile unit, if
/// non-empty.
std::string DwarfDebugFlags;
unsigned CGDebugInfo::getColumnNumber(SourceLocation Loc) {
if (Loc.isInvalid() && CurLoc.isInvalid())
return 0;
+ if (!CGM.getCodeGenOpts().DebugColumnInfo)
+ return 0;
SourceManager &SM = CGM.getContext().getSourceManager();
PresumedLoc PLoc = SM.getPresumedLoc(Loc.isValid() ? Loc : CurLoc);
return PLoc.isValid()? PLoc.getColumn() : 0;
// We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
Args.ClaimAllArgs(options::OPT_g_flags_Group);
+ if (Args.hasArg(options::OPT_gcolumn_info))
+ CmdArgs.push_back("-dwarf-column-info");
Args.AddAllArgs(CmdArgs, options::OPT_ffunction_sections);
Args.AddAllArgs(CmdArgs, options::OPT_fdata_sections);
Res.push_back("-fno-limit-debug-info");
break;
}
+ if (Opts.DebugColumnInfo)
+ Res.push_back("-gcolumn-info");
if (Opts.DisableLLVMOpts)
Res.push_back("-disable-llvm-optzns");
if (Opts.DisableRedZone)
else
Opts.DebugInfo = CodeGenOptions::FullDebugInfo;
}
+ Opts.DebugColumnInfo = Args.hasArg(OPT_dwarf_column_info);
Opts.DisableLLVMOpts = Args.hasArg(OPT_disable_llvm_optzns);
Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
Array[i][j] = 0;
test_indvars(Array[0], Array);
-//CHECK: .loc 2 31 8
+//CHECK: .loc 2 31
for (i=0; i < 100; i+=2)
for (j=0; j < 200; j++)
sum += Array[i][j];
}
-// CHECK: ret void, !dbg !17
-// CHECK: !17 = metadata !{i32 6,
+// CHECK: ret void, !dbg [[LINE:.*]]
+// CHECK: [[LINE]] = metadata !{i32 6,
--- /dev/null
+// RUN: %clang %s -g -gcolumn-info -S -emit-llvm -o - | FileCheck %s
+// Checks that clang emits column information when -gcolumn-info is passed.
+
+int foo(int a, int b) { int c = a + b;
+
+
+ return c;
+}
+
+// Without column information we wouldn't change locations for b.
+// CHECK: metadata !{i32 4, i32 20,
// Check to make sure that we emit the block for the break so that we can count the line.
// CHECK: sw.bb: ; preds = %entry
-// CHECK: br label %sw.epilog, !dbg !19
+// CHECK: br label %sw.epilog, !dbg !
extern int atoi(const char *);
// CHECK-NOT: dbg
// CHECK: store i32 %[[C1]], i32* @_ZL1j, align 4
//
-// CHECK: ![[LINE]] = metadata !{i32 13, i32 16
+// CHECK: ![[LINE]] = metadata !{i32 13, i32
}
}
// Check there is a line number entry for line 19 where b1 is destructed.
-// CHECK: i32 19, i32 3, metadata
+// CHECK: i32 19, i32 0, metadata