[PATCH] D51177: [DEBUGINFO] Add support for emission of the debug directives only.
This revision was automatically updated to reflect the committed changes. Closed by commit rL341212: [DEBUGINFO] Add support for emission of the debug directives only. (authored by ABataev, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D51177 Files: cfe/trunk/include/clang/Basic/DebugInfoOptions.h cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/test/CodeGen/debug-info-gline-tables-only.c cfe/trunk/test/CodeGen/debug-info-gline-tables-only2.c cfe/trunk/test/CodeGen/debug-info-line.c cfe/trunk/test/CodeGen/debug-info-macro.c cfe/trunk/test/CodeGen/debug-info-scope.c cfe/trunk/test/CodeGen/lifetime-debuginfo-1.c cfe/trunk/test/CodeGen/lifetime-debuginfo-2.c cfe/trunk/test/CodeGenCXX/crash.cpp cfe/trunk/test/CodeGenCXX/debug-info-blocks.cpp cfe/trunk/test/CodeGenCXX/debug-info-gline-tables-only.cpp cfe/trunk/test/CodeGenCXX/debug-info-line.cpp cfe/trunk/test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp cfe/trunk/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp cfe/trunk/test/CodeGenCXX/debug-info-windows-dtor.cpp cfe/trunk/test/CodeGenCXX/linetable-virtual-variadic.cpp cfe/trunk/test/CodeGenObjCXX/debug-info-line.mm cfe/trunk/test/CodeGenObjCXX/pr14474-gline-tables-only.mm cfe/trunk/test/Driver/debug-options.c Index: cfe/trunk/include/clang/Basic/DebugInfoOptions.h === --- cfe/trunk/include/clang/Basic/DebugInfoOptions.h +++ cfe/trunk/include/clang/Basic/DebugInfoOptions.h @@ -21,6 +21,7 @@ /// locations for instructions without actually /// emitting debug info for them (e.g., when -Rpass /// is used). + DebugDirectivesOnly, /// Emit only debug directives with the line numbers data DebugLineTablesOnly, /// Emit only debug info necessary for generating /// line number tables (-gline-tables-only). LimitedDebugInfo,/// Limit generated debug info to reduce size Index: cfe/trunk/include/clang/Driver/Options.td === --- cfe/trunk/include/clang/Driver/Options.td +++ cfe/trunk/include/clang/Driver/Options.td @@ -1777,6 +1777,8 @@ HelpText<"Generate source-level debug information">; def gline_tables_only : Flag<["-"], "gline-tables-only">, Group, Flags<[CoreOption]>, HelpText<"Emit debug line number tables only">; +def gline_directives_only : Flag<["-"], "gline-directives-only">, Group, + Flags<[CoreOption]>, HelpText<"Emit debug line info directives only">; def gmlt : Flag<["-"], "gmlt">, Alias; def g0 : Flag<["-"], "g0">, Group; def g1 : Flag<["-"], "g1">, Group, Alias; Index: cfe/trunk/test/CodeGen/debug-info-line.c === --- cfe/trunk/test/CodeGen/debug-info-line.c +++ cfe/trunk/test/CodeGen/debug-info-line.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -w -debug-info-kind=line-directives-only -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s int f1(int a, int b) { // CHECK: icmp {{.*}}, !dbg [[DBG_F1:!.*]] Index: cfe/trunk/test/CodeGen/debug-info-gline-tables-only.c === --- cfe/trunk/test/CodeGen/debug-info-gline-tables-only.c +++ cfe/trunk/test/CodeGen/debug-info-gline-tables-only.c @@ -1,5 +1,6 @@ // RUN: %clang_cc1 %s -debug-info-kind=line-tables-only -S -emit-llvm -o - | FileCheck %s -// Checks that clang with "-gline-tables-only" doesn't emit debug info +// RUN: %clang_cc1 %s -debug-info-kind=line-directives-only -S -emit-llvm -o - | FileCheck %s +// Checks that clang with "-gline-tables-only" or "-gline-directives-only" doesn't emit debug info // for variables and types. // CHECK-NOT: DW_TAG_variable Index: cfe/trunk/test/CodeGen/lifetime-debuginfo-2.c === --- cfe/trunk/test/CodeGen/lifetime-debuginfo-2.c +++ cfe/trunk/test/CodeGen/lifetime-debuginfo-2.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s +// RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=line-directives-only %s -o - | FileCheck %s // Inserting lifetime markers should not affect debuginfo: lifetime.end is not // a destructor, but instrumentation for the compiler. Ensure the debug info for Index: cfe/trunk/test/CodeGen/lifetime-debuginfo-1.c === --- cfe/trunk/test/CodeGen/lifetime-debuginfo-1.c ++
[PATCH] D51177: [DEBUGINFO] Add support for emission of the debug directives only.
dblaikie accepted this revision. dblaikie added a comment. This revision is now accepted and ready to land. Not sure that every test for line-tables-only needs to also test line-directives-only, but not a huge deal either way. (only the cases where there's actually a different codepath to test/new code to validate would I bother testing - rather than duplicating all the tests) Looks good. Repository: rC Clang https://reviews.llvm.org/D51177 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51177: [DEBUGINFO] Add support for emission of the debug directives only.
ABataev updated this revision to Diff 163353. ABataev added a comment. Address comment from David. Repository: rC Clang https://reviews.llvm.org/D51177 Files: include/clang/Basic/DebugInfoOptions.h include/clang/Driver/Options.td lib/CodeGen/CGDebugInfo.cpp lib/Driver/ToolChains/Clang.cpp lib/Frontend/CompilerInvocation.cpp test/CodeGen/debug-info-gline-tables-only.c test/CodeGen/debug-info-gline-tables-only2.c test/CodeGen/debug-info-line.c test/CodeGen/debug-info-macro.c test/CodeGen/debug-info-scope.c test/CodeGen/lifetime-debuginfo-1.c test/CodeGen/lifetime-debuginfo-2.c test/CodeGenCXX/crash.cpp test/CodeGenCXX/debug-info-blocks.cpp test/CodeGenCXX/debug-info-gline-tables-only.cpp test/CodeGenCXX/debug-info-line.cpp test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp test/CodeGenCXX/debug-info-namespace.cpp test/CodeGenCXX/debug-info-template-explicit-specialization.cpp test/CodeGenCXX/debug-info-windows-dtor.cpp test/CodeGenCXX/linetable-virtual-variadic.cpp test/CodeGenObjCXX/debug-info-line.mm test/CodeGenObjCXX/pr14474-gline-tables-only.mm test/Driver/debug-options.c Index: test/Driver/debug-options.c === --- test/Driver/debug-options.c +++ test/Driver/debug-options.c @@ -119,6 +119,25 @@ // RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \ // RUN: | FileCheck -check-prefix=GLTO_NO %s // +// RUN: %clang -### -c -gline-directives-only %s -target x86_64-apple-darwin 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_ONLY %s +// RUN: %clang -### -c -gline-directives-only %s -target i686-pc-openbsd 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_ONLY_DWARF2 %s +// RUN: %clang -### -c -gline-directives-only %s -target x86_64-pc-freebsd10.0 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_ONLY_DWARF2 %s +// RUN: %clang -### -c -gline-directives-only -g %s -target x86_64-linux-gnu 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY %s +// RUN: %clang -### -c -gline-directives-only -g %s -target x86_64-apple-darwin16 2>&1 \ +// RUN: | FileCheck -check-prefix=G_STANDALONE -check-prefix=G_DWARF4 %s +// RUN: %clang -### -c -gline-directives-only -g %s -target i686-pc-openbsd 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s +// RUN: %clang -### -c -gline-directives-only -g %s -target x86_64-pc-freebsd10.0 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s +// RUN: %clang -### -c -gline-directives-only -g %s -target i386-pc-solaris 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s +// RUN: %clang -### -c -gline-directives-only -g0 %s 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_NO %s +// // RUN: %clang -### -c -grecord-gcc-switches %s 2>&1 \ // | FileCheck -check-prefix=GRECORD %s // RUN: %clang -### -c -gno-record-gcc-switches %s 2>&1 \ @@ -178,6 +197,9 @@ // RUN: %clang -### -gmodules -gline-tables-only %s 2>&1 \ // RUN:| FileCheck -check-prefix=GLTO_ONLY %s // +// RUN: %clang -### -gmodules -gline-directives-only %s 2>&1 \ +// RUN:| FileCheck -check-prefix=GLIO_ONLY %s +// // G: "-cc1" // G: "-debug-info-kind=limited" // @@ -204,6 +226,15 @@ // GLTO_ONLY_DWARF2: "-debug-info-kind=line-tables-only" // GLTO_ONLY_DWARF2: "-dwarf-version=2" // +// GLIO_ONLY: "-cc1" +// GLIO_ONLY-NOT: "-dwarf-ext-refs" +// GLIO_ONLY: "-debug-info-kind=line-directives-only" +// GLIO_ONLY-NOT: "-dwarf-ext-refs" +// +// GLIO_ONLY_DWARF2: "-cc1" +// GLIO_ONLY_DWARF2: "-debug-info-kind=line-directives-only" +// GLIO_ONLY_DWARF2: "-dwarf-version=2" +// // G_ONLY: "-cc1" // G_ONLY: "-debug-info-kind=limited" // @@ -225,6 +256,10 @@ // GLTO_NO: "-cc1" // GLTO_NO-NOT: -debug-info-kind= // +// This tests asserts that "-gline-directives-only" "-g0" disables debug info. +// GLIO_NO: "-cc1" +// GLIO_NO-NOT: -debug-info-kind= +// // GRECORD: "-dwarf-debug-flags" // GRECORD: -### -c -grecord-gcc-switches // Index: test/CodeGenObjCXX/pr14474-gline-tables-only.mm === --- test/CodeGenObjCXX/pr14474-gline-tables-only.mm +++ test/CodeGenObjCXX/pr14474-gline-tables-only.mm @@ -1,6 +1,8 @@ // PR 14474 // RUN: %clang_cc1 -triple i386-apple-macosx10.6.0 -emit-llvm \ // RUN: -debug-info-kind=line-tables-only -x objective-c++ -o /dev/null %s +// RUN: %clang_cc1 -triple i386-apple-macosx10.6.0 -emit-llvm \ +// RUN: -debug-info-kind=line-directives-only -x objective-c++ -o /dev/null %s typedef signed char BOOL; @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; Index: test/CodeGenObjCXX/debug-info-line.mm === --- test/CodeGenObjCXX/debug-info-line.mm +++ test/CodeGenObjCXX/debug-info-line.mm @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-unknown-windows-gnu -fcxx-exceptions -fexceptions -debu
[PATCH] D51177: [DEBUGINFO] Add support for emission of the debug directives only.
dblaikie added inline comments. Comment at: test/Driver/debug-options.c:259 // +// This tests asserts that "-glineinfo-only" "-g0" disables debug info. +// GLIO_NO: "-cc1" 'lineinfo' seems like two words - the inconsistency with 'line-tables' seems like it'd be confusing. But also I'm not sure line-table versus line-info is very differentiating. Maybe line-directives-only? Repository: rC Clang https://reviews.llvm.org/D51177 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51177: [DEBUGINFO] Add support for emission of the debug directives only.
ABataev added a comment. In https://reviews.llvm.org/D51177#1213079, @echristo wrote: > Should we just have them mean the same thing and change it based on target? I reused the same debug info level support in clang, but in LLVM they have different processing and I'm not sure that they are absolutely compatible. Repository: rC Clang https://reviews.llvm.org/D51177 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51177: [DEBUGINFO] Add support for emission of the debug directives only.
echristo added a comment. Should we just have them mean the same thing and change it based on target? Repository: rC Clang https://reviews.llvm.org/D51177 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51177: [DEBUGINFO] Add support for emission of the debug directives only.
ABataev created this revision. ABataev added a reviewer: echristo. Herald added subscribers: JDevlieghere, fedor.sergeev, aprantl. Added option -glineinfo-only to support emission of the debug directives only. It behaves very similar to -gline-tables-only, except that it sets llvm debug info emission kind to llvm::DICompileUnit::DebugDirectivesOnly. Repository: rC Clang https://reviews.llvm.org/D51177 Files: include/clang/Basic/DebugInfoOptions.h include/clang/Driver/Options.td lib/CodeGen/CGDebugInfo.cpp lib/Driver/ToolChains/Clang.cpp lib/Frontend/CompilerInvocation.cpp test/CodeGen/debug-info-gline-tables-only.c test/CodeGen/debug-info-gline-tables-only2.c test/CodeGen/debug-info-line.c test/CodeGen/debug-info-macro.c test/CodeGen/debug-info-scope.c test/CodeGen/lifetime-debuginfo-1.c test/CodeGen/lifetime-debuginfo-2.c test/CodeGenCXX/crash.cpp test/CodeGenCXX/debug-info-blocks.cpp test/CodeGenCXX/debug-info-gline-tables-only.cpp test/CodeGenCXX/debug-info-line.cpp test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp test/CodeGenCXX/debug-info-namespace.cpp test/CodeGenCXX/debug-info-template-explicit-specialization.cpp test/CodeGenCXX/debug-info-windows-dtor.cpp test/CodeGenCXX/linetable-virtual-variadic.cpp test/CodeGenObjCXX/debug-info-line.mm test/CodeGenObjCXX/pr14474-gline-tables-only.mm test/Driver/debug-options.c Index: test/Driver/debug-options.c === --- test/Driver/debug-options.c +++ test/Driver/debug-options.c @@ -119,6 +119,25 @@ // RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \ // RUN: | FileCheck -check-prefix=GLTO_NO %s // +// RUN: %clang -### -c -glineinfo-only %s -target x86_64-apple-darwin 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_ONLY %s +// RUN: %clang -### -c -glineinfo-only %s -target i686-pc-openbsd 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_ONLY_DWARF2 %s +// RUN: %clang -### -c -glineinfo-only %s -target x86_64-pc-freebsd10.0 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_ONLY_DWARF2 %s +// RUN: %clang -### -c -glineinfo-only -g %s -target x86_64-linux-gnu 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY %s +// RUN: %clang -### -c -glineinfo-only -g %s -target x86_64-apple-darwin16 2>&1 \ +// RUN: | FileCheck -check-prefix=G_STANDALONE -check-prefix=G_DWARF4 %s +// RUN: %clang -### -c -glineinfo-only -g %s -target i686-pc-openbsd 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s +// RUN: %clang -### -c -glineinfo-only -g %s -target x86_64-pc-freebsd10.0 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s +// RUN: %clang -### -c -glineinfo-only -g %s -target i386-pc-solaris 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s +// RUN: %clang -### -c -glineinfo-only -g0 %s 2>&1 \ +// RUN: | FileCheck -check-prefix=GLIO_NO %s +// // RUN: %clang -### -c -grecord-gcc-switches %s 2>&1 \ // | FileCheck -check-prefix=GRECORD %s // RUN: %clang -### -c -gno-record-gcc-switches %s 2>&1 \ @@ -178,6 +197,9 @@ // RUN: %clang -### -gmodules -gline-tables-only %s 2>&1 \ // RUN:| FileCheck -check-prefix=GLTO_ONLY %s // +// RUN: %clang -### -gmodules -glineinfo-only %s 2>&1 \ +// RUN:| FileCheck -check-prefix=GLIO_ONLY %s +// // G: "-cc1" // G: "-debug-info-kind=limited" // @@ -204,6 +226,15 @@ // GLTO_ONLY_DWARF2: "-debug-info-kind=line-tables-only" // GLTO_ONLY_DWARF2: "-dwarf-version=2" // +// GLIO_ONLY: "-cc1" +// GLIO_ONLY-NOT: "-dwarf-ext-refs" +// GLIO_ONLY: "-debug-info-kind=lineinfo-directives-only" +// GLIO_ONLY-NOT: "-dwarf-ext-refs" +// +// GLIO_ONLY_DWARF2: "-cc1" +// GLIO_ONLY_DWARF2: "-debug-info-kind=lineinfo-directives-only" +// GLIO_ONLY_DWARF2: "-dwarf-version=2" +// // G_ONLY: "-cc1" // G_ONLY: "-debug-info-kind=limited" // @@ -225,6 +256,10 @@ // GLTO_NO: "-cc1" // GLTO_NO-NOT: -debug-info-kind= // +// This tests asserts that "-glineinfo-only" "-g0" disables debug info. +// GLIO_NO: "-cc1" +// GLIO_NO-NOT: -debug-info-kind= +// // GRECORD: "-dwarf-debug-flags" // GRECORD: -### -c -grecord-gcc-switches // Index: test/CodeGenObjCXX/pr14474-gline-tables-only.mm === --- test/CodeGenObjCXX/pr14474-gline-tables-only.mm +++ test/CodeGenObjCXX/pr14474-gline-tables-only.mm @@ -1,6 +1,8 @@ // PR 14474 // RUN: %clang_cc1 -triple i386-apple-macosx10.6.0 -emit-llvm \ // RUN: -debug-info-kind=line-tables-only -x objective-c++ -o /dev/null %s +// RUN: %clang_cc1 -triple i386-apple-macosx10.6.0 -emit-llvm \ +// RUN: -debug-info-kind=lineinfo-directives-only -x objective-c++ -o /dev/null %s typedef signed char BOOL; @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; Index: test/CodeGenObjCXX/debug-info-line.mm === --