Use NoDebug compile units to mark debug metadata used only for sample-based

profiling and optimization remarks and indicate that no debug info shall
be emitted for these compile units.

http://reviews.llvm.org/D18808
<rdar://problem/25427165>

llvm-svn: 265862
This commit is contained in:
Adrian Prantl 2016-04-08 22:43:06 +00:00
parent 5992a72b4d
commit 826824ea3d
3 changed files with 22 additions and 9 deletions

View File

@ -396,16 +396,27 @@ void CGDebugInfo::CreateCompileUnit() {
if (LO.ObjC1)
RuntimeVers = LO.ObjCRuntime.isNonFragile() ? 2 : 1;
llvm::DICompileUnit::DebugEmissionKind EmissionKind;
switch (DebugKind) {
case codegenoptions::NoDebugInfo:
case codegenoptions::LocTrackingOnly:
EmissionKind = llvm::DICompileUnit::NoDebug;
break;
case codegenoptions::DebugLineTablesOnly:
EmissionKind = llvm::DICompileUnit::LineTablesOnly;
break;
case codegenoptions::LimitedDebugInfo:
case codegenoptions::FullDebugInfo:
EmissionKind = llvm::DICompileUnit::FullDebug;
break;
}
// Create new compile unit.
// FIXME - Eliminate TheCU.
TheCU = DBuilder.createCompileUnit(
LangTag, remapDIPath(MainFileName), remapDIPath(getCurrentDirname()),
Producer, LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers,
CGM.getCodeGenOpts().SplitDwarfFile,
DebugKind <= codegenoptions::DebugLineTablesOnly
? llvm::DICompileUnit::LineTablesOnly
: llvm::DICompileUnit::FullDebug,
0 /* DWOid */, DebugKind != codegenoptions::LocTrackingOnly);
CGM.getCodeGenOpts().SplitDwarfFile, EmissionKind, 0 /* DWOid */);
}
llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {

View File

@ -27,9 +27,10 @@
// CHECK: , !dbg !
// CHECK-NOT: DW_TAG_base_type
// But llvm.dbg.cu should be missing (to prevent writing debug info to
// The CU should be marked NoDebug (to prevent writing debug info to
// the final output).
// CHECK-NOT: !llvm.dbg.cu = !{
// CHECK: !llvm.dbg.cu = !{![[CU:.*]]}
// CHECK: ![[CU]] = distinct !DICompileUnit({{.*}}emissionKind: NoDebug
int foo(int x, int y) __attribute__((always_inline));
int foo(int x, int y) { return x + y; }

View File

@ -10,9 +10,10 @@
// CHECK: , !dbg !
// CHECK-NOT: DW_TAG_base_type
// But llvm.dbg.cu should be missing (to prevent writing debug info to
// The CU should be marked NoDebug (to prevent writing debug info to
// the final output).
// CHECK-NOT: !llvm.dbg.cu = !{
// CHECK: !llvm.dbg.cu = !{![[CU:.*]]}
// CHECK: ![[CU]] = distinct !DICompileUnit({{.*}}emissionKind: NoDebug
int bar(int j) {
return (j + j - 2) * (j - 2) * j;