r341212 - [DEBUGINFO] Add support for emission of the debug directives only.

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 31 06:56:15 PDT 2018


Author: abataev
Date: Fri Aug 31 06:56:14 2018
New Revision: 341212

URL: http://llvm.org/viewvc/llvm-project?rev=341212&view=rev
Log:
[DEBUGINFO] Add support for emission of the debug directives only.

Summary:
Added option -gline-directives-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.

Reviewers: echristo

Subscribers: aprantl, fedor.sergeev, JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D51177

Modified:
    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

Modified: cfe/trunk/include/clang/Basic/DebugInfoOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DebugInfoOptions.h?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DebugInfoOptions.h (original)
+++ cfe/trunk/include/clang/Basic/DebugInfoOptions.h Fri Aug 31 06:56:14 2018
@@ -21,6 +21,7 @@ enum DebugInfoKind {
                        /// 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

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Aug 31 06:56:14 2018
@@ -1777,6 +1777,8 @@ def g_Flag : Flag<["-"], "g">, Group<g_G
   HelpText<"Generate source-level debug information">;
 def gline_tables_only : Flag<["-"], "gline-tables-only">, Group<gN_Group>,
   Flags<[CoreOption]>, HelpText<"Emit debug line number tables only">;
+def gline_directives_only : Flag<["-"], "gline-directives-only">, Group<gN_Group>,
+  Flags<[CoreOption]>, HelpText<"Emit debug line info directives only">;
 def gmlt : Flag<["-"], "gmlt">, Alias<gline_tables_only>;
 def g0 : Flag<["-"], "g0">, Group<gN_Group>;
 def g1 : Flag<["-"], "g1">, Group<gN_Group>, Alias<gline_tables_only>;

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Aug 31 06:56:14 2018
@@ -557,6 +557,9 @@ void CGDebugInfo::CreateCompileUnit() {
   case codegenoptions::DebugLineTablesOnly:
     EmissionKind = llvm::DICompileUnit::LineTablesOnly;
     break;
+  case codegenoptions::DebugDirectivesOnly:
+    EmissionKind = llvm::DICompileUnit::DebugDirectivesOnly;
+    break;
   case codegenoptions::LimitedDebugInfo:
   case codegenoptions::FullDebugInfo:
     EmissionKind = llvm::DICompileUnit::FullDebug;

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Fri Aug 31 06:56:14 2018
@@ -493,6 +493,8 @@ static codegenoptions::DebugInfoKind Deb
   if (A.getOption().matches(options::OPT_gline_tables_only) ||
       A.getOption().matches(options::OPT_ggdb1))
     return codegenoptions::DebugLineTablesOnly;
+  if (A.getOption().matches(options::OPT_gline_directives_only))
+    return codegenoptions::DebugDirectivesOnly;
   return codegenoptions::LimitedDebugInfo;
 }
 
@@ -889,6 +891,9 @@ static void RenderDebugEnablingArgs(cons
                                     unsigned DwarfVersion,
                                     llvm::DebuggerKind DebuggerTuning) {
   switch (DebugInfoKind) {
+  case codegenoptions::DebugDirectivesOnly:
+    CmdArgs.push_back("-debug-info-kind=line-directives-only");
+    break;
   case codegenoptions::DebugLineTablesOnly:
     CmdArgs.push_back("-debug-info-kind=line-tables-only");
     break;
@@ -2928,6 +2933,7 @@ static void RenderDebugOptions(const Too
         if (SplitDWARFArg) {
           if (A->getIndex() > SplitDWARFArg->getIndex()) {
             if (DebugInfoKind == codegenoptions::NoDebugInfo ||
+                DebugInfoKind == codegenoptions::DebugDirectivesOnly ||
                 (DebugInfoKind == codegenoptions::DebugLineTablesOnly &&
                  SplitDWARFInlining))
               SplitDWARFArg = nullptr;
@@ -2979,6 +2985,10 @@ static void RenderDebugOptions(const Too
       DebugInfoKind != codegenoptions::NoDebugInfo)
     DWARFVersion = TC.GetDefaultDwarfVersion();
 
+  // -gline-directives-only supported only for the DWARF debug info.
+  if (DWARFVersion == 0 && DebugInfoKind == codegenoptions::DebugDirectivesOnly)
+    DebugInfoKind = codegenoptions::NoDebugInfo;
+
   // We ignore flag -gstrict-dwarf for now.
   // And we handle flag -grecord-gcc-switches later with DWARFDebugFlags.
   Args.ClaimAllArgs(options::OPT_g_flags_Group);
@@ -2996,10 +3006,11 @@ static void RenderDebugOptions(const Too
     CmdArgs.push_back("-dwarf-column-info");
 
   // FIXME: Move backend command line options to the module.
-  // If -gline-tables-only is the last option it wins.
+  // If -gline-tables-only or -gline-directives-only is the last option it wins.
   if (const Arg *A = Args.getLastArg(options::OPT_gmodules))
     if (checkDebugInfoOption(A, Args, D, TC)) {
-      if (DebugInfoKind != codegenoptions::DebugLineTablesOnly) {
+      if (DebugInfoKind != codegenoptions::DebugLineTablesOnly &&
+          DebugInfoKind != codegenoptions::DebugDirectivesOnly) {
         DebugInfoKind = codegenoptions::LimitedDebugInfo;
         CmdArgs.push_back("-dwarf-ext-refs");
         CmdArgs.push_back("-fmodule-format=obj");

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Aug 31 06:56:14 2018
@@ -568,6 +568,7 @@ static bool ParseCodeGenArgs(CodeGenOpti
     unsigned Val =
         llvm::StringSwitch<unsigned>(A->getValue())
             .Case("line-tables-only", codegenoptions::DebugLineTablesOnly)
+            .Case("line-directives-only", codegenoptions::DebugDirectivesOnly)
             .Case("limited", codegenoptions::LimitedDebugInfo)
             .Case("standalone", codegenoptions::FullDebugInfo)
             .Default(~0U);

Modified: cfe/trunk/test/CodeGen/debug-info-gline-tables-only.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-gline-tables-only.c?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-gline-tables-only.c (original)
+++ cfe/trunk/test/CodeGen/debug-info-gline-tables-only.c Fri Aug 31 06:56:14 2018
@@ -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

Modified: cfe/trunk/test/CodeGen/debug-info-gline-tables-only2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-gline-tables-only2.c?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-gline-tables-only2.c (original)
+++ cfe/trunk/test/CodeGen/debug-info-gline-tables-only2.c Fri Aug 31 06:56:14 2018
@@ -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" emits metadata for
+// 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" emits metadata for
 // compile unit, subprogram and file.
 
 int main() {

Modified: cfe/trunk/test/CodeGen/debug-info-line.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-line.c?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-line.c (original)
+++ cfe/trunk/test/CodeGen/debug-info-line.c Fri Aug 31 06:56:14 2018
@@ -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:!.*]]

Modified: cfe/trunk/test/CodeGen/debug-info-macro.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-macro.c?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-macro.c (original)
+++ cfe/trunk/test/CodeGen/debug-info-macro.c Fri Aug 31 06:56:14 2018
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -emit-llvm -debug-info-kind=line-tables-only -debug-info-macro %s -o - "-DC1(x)=( x  + 5 )" -DA -include %S/Inputs/debug-info-macro.h -UC1 | FileCheck -check-prefixes=CHECK,NO_PCH %s 
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=line-directives-only -debug-info-macro %s -o - "-DC1(x)=( x  + 5 )" -DA -include %S/Inputs/debug-info-macro.h -UC1 | FileCheck -check-prefixes=CHECK,NO_PCH %s 
 // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited          -debug-info-macro %s -o - "-DC1(x)=( x  + 5 )" -DA -include %S/Inputs/debug-info-macro.h -UC1 | FileCheck -check-prefixes=CHECK,NO_PCH %s 
 // RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone       -debug-info-macro %s -o - "-DC1(x)=( x  + 5 )" -DA -include %S/Inputs/debug-info-macro.h -UC1 | FileCheck -check-prefixes=CHECK,NO_PCH %s 
 // RUN: %clang_cc1 -emit-llvm                                   -debug-info-macro %s -o - "-DC1(x)=( x  + 5 )" -DA -include %S/Inputs/debug-info-macro.h -UC1 | FileCheck -check-prefixes=NO_MACRO %s 

Modified: cfe/trunk/test/CodeGen/debug-info-scope.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-scope.c?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-scope.c (original)
+++ cfe/trunk/test/CodeGen/debug-info-scope.c Fri Aug 31 06:56:14 2018
@@ -1,5 +1,6 @@
 // RUN: %clang_cc1 -dwarf-version=4 -debug-info-kind=limited -disable-llvm-passes -emit-llvm < %s | FileCheck %s
 // RUN: %clang_cc1 -dwarf-version=4 -debug-info-kind=line-tables-only -disable-llvm-passes -emit-llvm < %s | FileCheck --check-prefix=GMLT %s
+// RUN: %clang_cc1 -dwarf-version=4 -debug-info-kind=line-directives-only -disable-llvm-passes -emit-llvm < %s | FileCheck --check-prefix=GMLT %s
 // Two variables with same name in separate scope.
 // Radar 8330217.
 int main() {

Modified: cfe/trunk/test/CodeGen/lifetime-debuginfo-1.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/lifetime-debuginfo-1.c?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/lifetime-debuginfo-1.c (original)
+++ cfe/trunk/test/CodeGen/lifetime-debuginfo-1.c Fri Aug 31 06:56:14 2018
@@ -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
 

Modified: cfe/trunk/test/CodeGen/lifetime-debuginfo-2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/lifetime-debuginfo-2.c?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/lifetime-debuginfo-2.c (original)
+++ cfe/trunk/test/CodeGen/lifetime-debuginfo-2.c Fri Aug 31 06:56:14 2018
@@ -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

Modified: cfe/trunk/test/CodeGenCXX/crash.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/crash.cpp?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/crash.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/crash.cpp Fri Aug 31 06:56:14 2018
@@ -1,5 +1,6 @@
 // RUN: %clang_cc1 %s -std=c++11 -emit-llvm-only
 // RUN: %clang_cc1 -emit-obj -o %t -debug-info-kind=line-tables-only -std=c++11 %s
+// RUN: %clang_cc1 -emit-obj -o %t -debug-info-kind=line-directives-only -std=c++11 %s
 // CHECK that we don't crash.
 
 // PR11676's example is ill-formed:

Modified: cfe/trunk/test/CodeGenCXX/debug-info-blocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-blocks.cpp?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-blocks.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-blocks.cpp Fri Aug 31 06:56:14 2018
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 %s -debug-info-kind=line-tables-only -fblocks -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -debug-info-kind=line-directives-only -fblocks -S -emit-llvm -o - | FileCheck %s
 
 struct A {
   A();
@@ -11,8 +12,8 @@ void test() {
 }
 
 // CHECK: !DISubprogram(name: "__Block_byref_object_copy_",
-// CHECK-SAME:          line: 10,
+// CHECK-SAME:          line: 11,
 // CHECK-SAME:          isLocal: true, isDefinition: true
 // CHECK: !DISubprogram(name: "__Block_byref_object_dispose_",
-// CHECK-SAME:          line: 10,
+// CHECK-SAME:          line: 11,
 // CHECK-SAME:          isLocal: true, isDefinition: true

Modified: cfe/trunk/test/CodeGenCXX/debug-info-gline-tables-only.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-gline-tables-only.cpp?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-gline-tables-only.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-gline-tables-only.cpp Fri Aug 31 06:56:14 2018
@@ -1,5 +1,6 @@
 // RUN: %clang_cc1 %s -fno-rtti -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 -fno-rtti -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_namespace

Modified: cfe/trunk/test/CodeGenCXX/debug-info-line.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line.cpp?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-line.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-line.cpp Fri Aug 31 06:56:14 2018
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -mllvm -no-discriminators -emit-llvm %s -o - -triple %itanium_abi_triple | FileCheck %s
 // RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -mllvm -no-discriminators -emit-llvm %s -o - -triple i686-linux-gnu | FileCheck %s
+// RUN: %clang_cc1 -w -debug-info-kind=line-directives-only -std=c++11 -fexceptions -fcxx-exceptions -S -mllvm -no-discriminators -emit-llvm %s -o - -triple %itanium_abi_triple | FileCheck %s
+// RUN: %clang_cc1 -w -debug-info-kind=line-directives-only -std=c++11 -fexceptions -fcxx-exceptions -S -mllvm -no-discriminators -emit-llvm %s -o - -triple i686-linux-gnu | FileCheck %s
 
 int &src();
 int *sink();

Modified: cfe/trunk/test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp Fri Aug 31 06:56:14 2018
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple i686--windows -emit-llvm -debug-info-kind=line-tables-only -x c++ %s -fms-extensions -o - | FileCheck %s
+// RUN: %clang_cc1 -triple i686--windows -emit-llvm -debug-info-kind=line-directives-only -x c++ %s -fms-extensions -o - | FileCheck %s
 
 struct __declspec(dllexport) S { virtual ~S(); };
 struct __declspec(dllexport) T { virtual ~T(); };

Modified: cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp Fri Aug 31 06:56:14 2018
@@ -1,5 +1,6 @@
 // RUN: %clang_cc1 -std=c++11 -debug-info-kind=limited -S -emit-llvm %s -o - | FileCheck %s
 // RUN: %clang_cc1 -std=c++11 -debug-info-kind=line-tables-only -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-GMLT %s
+// RUN: %clang_cc1 -std=c++11 -debug-info-kind=line-directives-only -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-GMLI %s
 // RUN: %clang_cc1 -std=c++11 -debug-info-kind=standalone -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-NOLIMIT %s
 
 namespace A {
@@ -125,6 +126,10 @@ void C::c() {}
 // CHECK-GMLT-SAME:                            emissionKind: LineTablesOnly,
 // CHECK-GMLT-NOT:                             imports:
 
+// CHECK-GMLI: [[CU:![0-9]+]] = distinct !DICompileUnit(
+// CHECK-GMLI-SAME:                            emissionKind: DebugDirectivesOnly,
+// CHECK-GMLI-NOT:                             imports:
+
 // CHECK-NOLIMIT: !DICompositeType(tag: DW_TAG_structure_type, name: "bar",{{.*}} line: 6,
 // CHECK-NOLIMIT-NOT:              DIFlagFwdDecl
 // CHECK-NOLIMIT-SAME:             ){{$}}

Modified: cfe/trunk/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp Fri Aug 31 06:56:14 2018
@@ -1,8 +1,9 @@
 // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=limited %s -o - | FileCheck %s
 
-// Run again with -gline-tables-only and verify we don't crash.  We won't output
+// Run again with -gline-tables-only or -gline-directives-only and verify we don't crash.  We won't output
 // type info at all.
 // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=line-tables-only %s -o - | FileCheck %s -check-prefix LINES-ONLY
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=line-directives-only %s -o - | FileCheck %s -check-prefix LINES-ONLY
 
 // LINES-ONLY-NOT: !DICompositeType(tag: DW_TAG_structure_type
 

Modified: cfe/trunk/test/CodeGenCXX/debug-info-windows-dtor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-windows-dtor.cpp?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-windows-dtor.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-windows-dtor.cpp Fri Aug 31 06:56:14 2018
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple i386-unknown-windows-msvc -std=c++11 -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple i386-unknown-windows-msvc -std=c++11 -emit-llvm -debug-info-kind=line-directives-only %s -o - | FileCheck %s
 
 struct A {
   virtual ~A() {}

Modified: cfe/trunk/test/CodeGenCXX/linetable-virtual-variadic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/linetable-virtual-variadic.cpp?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/linetable-virtual-variadic.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/linetable-virtual-variadic.cpp Fri Aug 31 06:56:14 2018
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -debug-info-kind=line-directives-only %s -o - | FileCheck %s
 // Crasher for PR22929.
 class Base {
   virtual void VariadicFunction(...);

Modified: cfe/trunk/test/CodeGenObjCXX/debug-info-line.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/debug-info-line.mm?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/debug-info-line.mm (original)
+++ cfe/trunk/test/CodeGenObjCXX/debug-info-line.mm Fri Aug 31 06:56:14 2018
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-windows-gnu -fcxx-exceptions -fexceptions -debug-info-kind=line-tables-only -fblocks -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-windows-gnu -fcxx-exceptions -fexceptions -debug-info-kind=line-directives-only -fblocks -emit-llvm %s -o - | FileCheck %s
 
 void fn();
 

Modified: cfe/trunk/test/CodeGenObjCXX/pr14474-gline-tables-only.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/pr14474-gline-tables-only.mm?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/pr14474-gline-tables-only.mm (original)
+++ cfe/trunk/test/CodeGenObjCXX/pr14474-gline-tables-only.mm Fri Aug 31 06:56:14 2018
@@ -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;

Modified: cfe/trunk/test/Driver/debug-options.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/debug-options.c?rev=341212&r1=341211&r2=341212&view=diff
==============================================================================
--- cfe/trunk/test/Driver/debug-options.c (original)
+++ cfe/trunk/test/Driver/debug-options.c Fri Aug 31 06:56:14 2018
@@ -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
 //




More information about the cfe-commits mailing list