瀏覽代碼

Stop messing with the 'g' group of options in CompilerInvocation.

With this change, most 'g' options are rejected by CompilerInvocation.
They remain only as Driver options. The new way to request debug info
from cc1 is with "-debug-info-kind={line-tables-only|limited|standalone}"
and "-dwarf-version={2|3|4}". In the absence of a command-line option
to specify Dwarf version, the Toolchain decides it, rather than placing
Toolchain-specific logic in CompilerInvocation.

Also fix a bug in the Windows compatibility argument parsing
in which the "rightmost argument wins" principle failed.

Differential Revision: http://reviews.llvm.org/D13221

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249655 91177308-0d34-0410-b5e6-96231b3b80d8
Douglas Katzman 10 年之前
父節點
當前提交
adbb8c2aef
共有 100 個文件被更改,包括 263 次插入184 次删除
  1. 2 0
      include/clang/Driver/CC1Options.td
  2. 7 7
      include/clang/Driver/Options.td
  3. 10 0
      include/clang/Driver/ToolChain.h
  4. 13 0
      lib/Driver/ToolChains.h
  5. 113 42
      lib/Driver/Tools.cpp
  6. 4 1
      lib/Driver/Tools.h
  7. 9 29
      lib/Frontend/CompilerInvocation.cpp
  8. 1 1
      test/CodeGen/2006-01-13-Includes.c
  9. 1 1
      test/CodeGen/2007-05-11-str-const.c
  10. 1 1
      test/CodeGen/2009-01-21-InvalidIterator.c
  11. 1 1
      test/CodeGen/2009-03-13-dbg.c
  12. 1 1
      test/CodeGen/2009-04-23-dbg.c
  13. 1 1
      test/CodeGen/2009-07-31-DbgDeclare.c
  14. 1 1
      test/CodeGen/2010-01-14-FnType-DebugInfo.c
  15. 1 1
      test/CodeGen/2010-01-18-Inlined-Debug.c
  16. 1 1
      test/CodeGen/2010-02-10-PointerName.c
  17. 1 1
      test/CodeGen/2010-02-15-DbgStaticVar.c
  18. 1 1
      test/CodeGen/2010-02-16-DbgScopes.c
  19. 1 1
      test/CodeGen/2010-03-5-LexicalScope.c
  20. 1 1
      test/CodeGen/2010-07-08-DeclDebugLineNo.c
  21. 1 1
      test/CodeGen/2010-08-10-DbgConstant.c
  22. 1 1
      test/CodeGen/attr-nodebug.c
  23. 1 1
      test/CodeGen/attr-noinline.c
  24. 3 3
      test/CodeGen/cleanup-destslot-simple.c
  25. 1 1
      test/CodeGen/debug-info-257-args.c
  26. 1 1
      test/CodeGen/debug-info-args.c
  27. 1 1
      test/CodeGen/debug-info-block-decl.c
  28. 1 1
      test/CodeGen/debug-info-block-out-return.c
  29. 1 1
      test/CodeGen/debug-info-block.c
  30. 2 2
      test/CodeGen/debug-info-compilation-dir.c
  31. 1 1
      test/CodeGen/debug-info-crash.c
  32. 1 1
      test/CodeGen/debug-info-enum.c
  33. 1 1
      test/CodeGen/debug-info-gline-tables-only.c
  34. 1 1
      test/CodeGen/debug-info-gline-tables-only2.c
  35. 1 1
      test/CodeGen/debug-info-line.c
  36. 1 1
      test/CodeGen/debug-info-line2.c
  37. 1 1
      test/CodeGen/debug-info-line3.c
  38. 1 1
      test/CodeGen/debug-info-member.c
  39. 1 1
      test/CodeGen/debug-info-packed-struct.c
  40. 1 1
      test/CodeGen/debug-info-same-line.c
  41. 1 1
      test/CodeGen/debug-info-scope-file.c
  42. 2 2
      test/CodeGen/debug-info-scope.c
  43. 1 1
      test/CodeGen/debug-info-static.c
  44. 1 1
      test/CodeGen/debug-info-typedef.c
  45. 1 1
      test/CodeGen/debug-info-vector.c
  46. 1 1
      test/CodeGen/debug-info-vla.c
  47. 1 1
      test/CodeGen/debug-info.c
  48. 1 1
      test/CodeGen/debug-line-1.c
  49. 1 1
      test/CodeGen/enum2.c
  50. 1 1
      test/CodeGen/global-blocks-lines.c
  51. 1 1
      test/CodeGen/lifetime-debuginfo-1.c
  52. 1 1
      test/CodeGen/lifetime-debuginfo-2.c
  53. 1 1
      test/CodeGen/lineno-dbginfo.c
  54. 1 1
      test/CodeGen/linetable-endscope.c
  55. 1 1
      test/CodeGen/sse-builtins-dbg.c
  56. 1 1
      test/CodeGen/vector.c
  57. 1 1
      test/CodeGenCXX/2006-11-20-GlobalSymbols.cpp
  58. 1 1
      test/CodeGenCXX/2007-01-02-UnboundedArray.cpp
  59. 1 1
      test/CodeGenCXX/2009-03-17-dbg.cpp
  60. 1 1
      test/CodeGenCXX/2009-06-16-DebugInfoCrash.cpp
  61. 1 1
      test/CodeGenCXX/2010-03-09-AnonAggregate.cpp
  62. 1 1
      test/CodeGenCXX/2010-05-10-Var-DbgInfo.cpp
  63. 1 1
      test/CodeGenCXX/2010-05-12-PtrToMember-Dbg.cpp
  64. 1 1
      test/CodeGenCXX/2010-06-21-LocalVarDbg.cpp
  65. 1 1
      test/CodeGenCXX/2010-06-22-BitfieldInit.cpp
  66. 1 1
      test/CodeGenCXX/2010-06-22-ZeroBitfield.cpp
  67. 1 1
      test/CodeGenCXX/2010-07-23-DeclLoc.cpp
  68. 1 1
      test/CodeGenCXX/PR20038.cpp
  69. 1 1
      test/CodeGenCXX/cp-blocks-linetables.cpp
  70. 1 1
      test/CodeGenCXX/crash.cpp
  71. 1 1
      test/CodeGenCXX/debug-info-access.cpp
  72. 1 1
      test/CodeGenCXX/debug-info-anon-union-vars.cpp
  73. 1 1
      test/CodeGenCXX/debug-info-artificial-arg.cpp
  74. 1 1
      test/CodeGenCXX/debug-info-blocks.cpp
  75. 1 1
      test/CodeGenCXX/debug-info-char16.cpp
  76. 4 4
      test/CodeGenCXX/debug-info-class-nolimit.cpp
  77. 1 1
      test/CodeGenCXX/debug-info-context.cpp
  78. 1 1
      test/CodeGenCXX/debug-info-cxx0x.cpp
  79. 1 1
      test/CodeGenCXX/debug-info-cxx1y.cpp
  80. 1 1
      test/CodeGenCXX/debug-info-decl-nested.cpp
  81. 2 2
      test/CodeGenCXX/debug-info-determinism.cpp
  82. 1 1
      test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
  83. 1 1
      test/CodeGenCXX/debug-info-enum-class.cpp
  84. 1 1
      test/CodeGenCXX/debug-info-enum.cpp
  85. 1 1
      test/CodeGenCXX/debug-info-flex-member.cpp
  86. 1 1
      test/CodeGenCXX/debug-info-function-context.cpp
  87. 1 1
      test/CodeGenCXX/debug-info-fwd-ref.cpp
  88. 1 1
      test/CodeGenCXX/debug-info-gline-tables-only.cpp
  89. 2 2
      test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
  90. 1 1
      test/CodeGenCXX/debug-info-global.cpp
  91. 1 1
      test/CodeGenCXX/debug-info-globalinit.cpp
  92. 1 1
      test/CodeGenCXX/debug-info-indirect-field-decl.cpp
  93. 1 1
      test/CodeGenCXX/debug-info-large-constant.cpp
  94. 1 1
      test/CodeGenCXX/debug-info-line-if.cpp
  95. 2 2
      test/CodeGenCXX/debug-info-line.cpp
  96. 1 1
      test/CodeGenCXX/debug-info-method-nodebug.cpp
  97. 1 1
      test/CodeGenCXX/debug-info-method.cpp
  98. 1 1
      test/CodeGenCXX/debug-info-method2.cpp
  99. 3 3
      test/CodeGenCXX/debug-info-namespace.cpp
  100. 1 1
      test/CodeGenCXX/debug-info-nullptr.cpp

+ 2 - 0
include/clang/Driver/CC1Options.td

@@ -132,6 +132,8 @@ def migrator_no_finalize_removal : Flag<["-"], "no-finalize-removal">,
 
 let Flags = [CC1Option, CC1AsOption, NoDriverOption] in {
 
+def debug_info_kind_EQ : Joined<["-"], "debug-info-kind=">;
+def dwarf_version_EQ : Joined<["-"], "dwarf-version=">;
 def fdebug_compilation_dir : Separate<["-"], "fdebug-compilation-dir">,
   HelpText<"The compilation directory to embed in the debug info.">;
 def dwarf_debug_flags : Separate<["-"], "dwarf-debug-flags">,

+ 7 - 7
include/clang/Driver/Options.td

@@ -989,9 +989,9 @@ def fstack_protector_strong : Flag<["-"], "fstack-protector-strong">, Group<f_Gr
   HelpText<"Use a strong heuristic to apply stack protectors to functions">;
 def fstack_protector : Flag<["-"], "fstack-protector">, Group<f_Group>,
   HelpText<"Enable stack protectors for functions potentially vulnerable to stack smashing">;
-def fstandalone_debug : Flag<["-"], "fstandalone-debug">, Group<f_Group>, Flags<[CC1Option]>,
+def fstandalone_debug : Flag<["-"], "fstandalone-debug">, Group<f_Group>,
   HelpText<"Emit full debug info for all types used by the program">;
-def fno_standalone_debug : Flag<["-"], "fno-standalone-debug">, Group<f_Group>, Flags<[CC1Option]>,
+def fno_standalone_debug : Flag<["-"], "fno-standalone-debug">, Group<f_Group>,
   HelpText<"Limit debug information produced to reduce size of debug binary">;
 def flimit_debug_info : Flag<["-"], "flimit-debug-info">, Alias<fno_standalone_debug>;
 def fno_limit_debug_info : Flag<["-"], "fno-limit-debug-info">, Alias<fstandalone_debug>;
@@ -1108,9 +1108,9 @@ def fdebug_types_section: Flag <["-"], "fdebug-types-section">, Group<f_Group>,
 def fno_debug_types_section: Flag<["-"], "fno-debug-types-section">, Group<f_Group>,
   Flags<[CC1Option]>;
 def g_Flag : Flag<["-"], "g">, Group<g_Group>,
-  HelpText<"Generate source-level debug information">, Flags<[CC1Option,CC1AsOption]>;
+  HelpText<"Generate source-level debug information">;
 def gline_tables_only : Flag<["-"], "gline-tables-only">, Group<g_Group>,
-  HelpText<"Emit debug line number tables only">, Flags<[CC1Option]>;
+  HelpText<"Emit debug line number tables only">;
 def gmlt : Flag<["-"], "gmlt">, Alias<gline_tables_only>;
 def g0 : Flag<["-"], "g0">, Group<g_Group>;
 def g1 : Flag<["-"], "g1">, Group<g_Group>, Alias<gline_tables_only>;
@@ -1124,11 +1124,11 @@ def ggdb1 : Flag<["-"], "ggdb1">, Alias<gline_tables_only>;
 def ggdb2 : Flag<["-"], "ggdb2">, Alias<g2>;
 def ggdb3 : Flag<["-"], "ggdb3">, Alias<g3>;
 def gdwarf_2 : Flag<["-"], "gdwarf-2">, Group<g_Group>,
-  HelpText<"Generate source-level debug information with dwarf version 2">, Flags<[CC1Option,CC1AsOption]>;
+  HelpText<"Generate source-level debug information with dwarf version 2">;
 def gdwarf_3 : Flag<["-"], "gdwarf-3">, Group<g_Group>,
-  HelpText<"Generate source-level debug information with dwarf version 3">, Flags<[CC1Option,CC1AsOption]>;
+  HelpText<"Generate source-level debug information with dwarf version 3">;
 def gdwarf_4 : Flag<["-"], "gdwarf-4">, Group<g_Group>,
-  HelpText<"Generate source-level debug information with dwarf version 4">, Flags<[CC1Option,CC1AsOption]>;
+  HelpText<"Generate source-level debug information with dwarf version 4">;
 def gcodeview : Flag<["-"], "gcodeview">,
   HelpText<"Generate CodeView debug information">,
   Flags<[CC1Option, CC1AsOption, CoreOption]>;

+ 10 - 0
include/clang/Driver/ToolChain.h

@@ -287,6 +287,16 @@ public:
   /// compile unit information.
   virtual bool UseDwarfDebugFlags() const { return false; }
 
+  // Return the DWARF version to emit, in the absence of arguments
+  // to the contrary.
+  virtual unsigned GetDefaultDwarfVersion() const { return 4; }
+
+  // True if the driver should assume "-fstandalone-debug"
+  // in the absence of an option specifying otherwise,
+  // provided that debugging was requested in the first place.
+  // i.e. a value of 'true' does not imply that debugging is wanted.
+  virtual bool GetDefaultStandaloneDebug() const { return false; }
+
   /// UseSjLjExceptions - Does this tool chain use SjLj exceptions.
   virtual bool UseSjLjExceptions() const { return false; }
 

+ 13 - 0
lib/Driver/ToolChains.h

@@ -508,6 +508,12 @@ public:
 
   void AddLinkARCArgs(const llvm::opt::ArgList &Args,
                       llvm::opt::ArgStringList &CmdArgs) const override;
+
+  unsigned GetDefaultDwarfVersion() const override { return 2; }
+  // Until dtrace (via CTF) and LLDB can deal with distributed debug info,
+  // Darwin defaults to standalone/full debug info.
+  bool GetDefaultStandaloneDebug() const override { return true; }
+
   /// }
 
 private:
@@ -564,6 +570,8 @@ public:
       const llvm::opt::ArgList &DriverArgs,
       llvm::opt::ArgStringList &CC1Args) const override;
 
+  unsigned GetDefaultDwarfVersion() const override { return 2; }
+
 protected:
   Tool *buildAssembler() const override;
   Tool *buildLinker() const override;
@@ -615,6 +623,7 @@ public:
   unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
     return 2;
   }
+  unsigned GetDefaultDwarfVersion() const override { return 2; }
 
 protected:
   Tool *buildAssembler() const override;
@@ -661,6 +670,10 @@ public:
   bool UseSjLjExceptions() const override;
   bool isPIEDefault() const override;
   SanitizerMask getSupportedSanitizers() const override;
+  unsigned GetDefaultDwarfVersion() const override { return 2; }
+  // Until dtrace (via CTF) and LLDB can deal with distributed debug info,
+  // FreeBSD defaults to standalone/full debug info.
+  bool GetDefaultStandaloneDebug() const override { return true; }
 
 protected:
   Tool *buildAssembler() const override;

+ 113 - 42
lib/Driver/Tools.cpp

@@ -2324,6 +2324,38 @@ static bool UseRelaxAll(Compilation &C, const ArgList &Args) {
                       RelaxDefault);
 }
 
+// Extract the integer N from a string spelled "-dwarf-N", returning 0
+// on mismatch. The StringRef input (rather than an Arg) allows
+// for use by the "-Xassembler" option parser.
+static unsigned DwarfVersionNum(StringRef ArgValue) {
+  return llvm::StringSwitch<unsigned>(ArgValue)
+      .Case("-gdwarf-2", 2)
+      .Case("-gdwarf-3", 3)
+      .Case("-gdwarf-4", 4)
+      .Default(0);
+}
+
+static void RenderDebugEnablingArgs(const ArgList &Args, ArgStringList &CmdArgs,
+                                    CodeGenOptions::DebugInfoKind DebugInfoKind,
+                                    unsigned DwarfVersion) {
+  switch (DebugInfoKind) {
+  case CodeGenOptions::DebugLineTablesOnly:
+    CmdArgs.push_back("-debug-info-kind=line-tables-only");
+    break;
+  case CodeGenOptions::LimitedDebugInfo:
+    CmdArgs.push_back("-debug-info-kind=limited");
+    break;
+  case CodeGenOptions::FullDebugInfo:
+    CmdArgs.push_back("-debug-info-kind=standalone");
+    break;
+  default:
+    break;
+  }
+  if (DwarfVersion > 0)
+    CmdArgs.push_back(
+        Args.MakeArgString("-dwarf-version=" + std::to_string(DwarfVersion)));
+}
+
 static void CollectArgsForIntegratedAssembler(Compilation &C,
                                               const ArgList &Args,
                                               ArgStringList &CmdArgs,
@@ -2373,7 +2405,14 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
         if (Value == "-I")
           TakeNextArg = true;
       } else if (Value.startswith("-gdwarf-")) {
-        CmdArgs.push_back(Value.data());
+        // "-gdwarf-N" options are not cc1as options.
+        unsigned DwarfVersion = DwarfVersionNum(Value);
+        if (DwarfVersion == 0) { // Send it onward, and let cc1as complain.
+          CmdArgs.push_back(Value.data());
+        } else {
+          RenderDebugEnablingArgs(
+              Args, CmdArgs, CodeGenOptions::LimitedDebugInfo, DwarfVersion);
+        }
       } else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") ||
                  Value.startswith("-mhwdiv") || Value.startswith("-march")) {
         // Do nothing, we'll validate it later.
@@ -3710,9 +3749,23 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
     break;
   }
 
+  // The 'g' groups options involve a somewhat intricate sequence of decisions
+  // about what to pass from the driver to the frontend, but by the time they
+  // reach cc1 they've been factored into two well-defined orthogonal choices:
+  //  * what level of debug info to generate
+  //  * what dwarf version to write
+  // This avoids having to monkey around further in cc1 other than to disable
+  // codeview if not running in a Windows environment. Perhaps even that
+  // decision should be made in the driver as well though.
+  enum CodeGenOptions::DebugInfoKind DebugInfoKind =
+      CodeGenOptions::NoDebugInfo;
+  // These two are potentially updated by AddClangCLArgs.
+  unsigned DwarfVersion = 0;
+  bool EmitCodeView = false;
+
   // Add clang-cl arguments.
   if (getToolChain().getDriver().IsCLMode())
-    AddClangCLArgs(Args, CmdArgs);
+    AddClangCLArgs(Args, CmdArgs, &DebugInfoKind, &EmitCodeView);
 
   // Pass the linker version in use.
   if (Arg *A = Args.getLastArg(options::OPT_mlinker_version_EQ)) {
@@ -3753,41 +3806,41 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
                                                  : "-");
   }
 
-  // Use the last option from "-g" group. "-gline-tables-only" and "-gdwarf-x"
-  // are preserved, all other debug options are substituted with "-g".
   Args.ClaimAllArgs(options::OPT_g_Group);
   Arg *SplitDwarfArg = Args.getLastArg(options::OPT_gsplit_dwarf);
   if (Arg *A = Args.getLastArg(options::OPT_g_Group)) {
+    // If you say "-gline-tables-only -gsplit-dwarf", split-dwarf wins,
+    // which mandates turning on "-g". But -split-dwarf is not a g_group option,
+    // hence it takes a nontrivial test to decide about line-tables-only.
     if (A->getOption().matches(options::OPT_gline_tables_only) &&
         (!SplitDwarfArg || A->getIndex() > SplitDwarfArg->getIndex())) {
-      // FIXME: we should support specifying dwarf version with
-      // -gline-tables-only.
-      CmdArgs.push_back("-gline-tables-only");
-      // Default is dwarf-2 for Darwin, OpenBSD, FreeBSD and Solaris.
-      const llvm::Triple &Triple = getToolChain().getTriple();
-      if (Triple.isOSDarwin() || Triple.getOS() == llvm::Triple::OpenBSD ||
-          Triple.getOS() == llvm::Triple::FreeBSD ||
-          Triple.getOS() == llvm::Triple::Solaris)
-        CmdArgs.push_back("-gdwarf-2");
+      DebugInfoKind = CodeGenOptions::DebugLineTablesOnly;
       SplitDwarfArg = nullptr;
-    } else if (A->getOption().matches(options::OPT_gdwarf_2) ||
-               A->getOption().matches(options::OPT_gdwarf_3) ||
-               A->getOption().matches(options::OPT_gdwarf_4)) {
-      A->render(Args, CmdArgs);
     } else if (!A->getOption().matches(options::OPT_g0)) {
-      // Default is dwarf-2 for Darwin, OpenBSD, FreeBSD and Solaris.
-      const llvm::Triple &Triple = getToolChain().getTriple();
-      if (Triple.isOSDarwin() || Triple.getOS() == llvm::Triple::OpenBSD ||
-          Triple.getOS() == llvm::Triple::FreeBSD ||
-          Triple.getOS() == llvm::Triple::Solaris)
-        CmdArgs.push_back("-gdwarf-2");
-      else
-        CmdArgs.push_back("-g");
+      // Some 'g' group option other than one expressly disabling debug info
+      // must have been the final (winning) one. They're all equivalent.
+      DebugInfoKind = CodeGenOptions::LimitedDebugInfo;
     }
   }
 
+  // If a -gdwarf argument appeared, use it, unless DebugInfoKind is None
+  // (because that would mean that "-g0" was the rightmost 'g' group option).
+  // FIXME: specifying "-gdwarf-<N>" "-g1" in that order works,
+  // but "-g1" "-gdwarf-<N>" does not. A deceptively simple (but wrong) "fix"
+  // exists of removing the gdwarf options from the g_group.
+  if (Arg *A = Args.getLastArg(options::OPT_gdwarf_2, options::OPT_gdwarf_3,
+                               options::OPT_gdwarf_4))
+    DwarfVersion = DwarfVersionNum(A->getSpelling());
+
   // Forward -gcodeview.
-  Args.AddLastArg(CmdArgs, options::OPT_gcodeview);
+  // 'EmitCodeView might have been set by CL-compatibility argument parsing.
+  if (Args.hasArg(options::OPT_gcodeview) || EmitCodeView) {
+    // DwarfVersion remains at 0 if no explicit choice was made.
+    CmdArgs.push_back("-gcodeview");
+  } else if (DwarfVersion == 0 &&
+             DebugInfoKind != CodeGenOptions::NoDebugInfo) {
+    DwarfVersion = getToolChain().GetDefaultDwarfVersion();
+  }
 
   // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
   Args.ClaimAllArgs(options::OPT_g_flags_Group);
@@ -3797,7 +3850,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
 
   // FIXME: Move backend command line options to the module.
   if (Args.hasArg(options::OPT_gmodules)) {
-    CmdArgs.push_back("-g");
+    DebugInfoKind = CodeGenOptions::LimitedDebugInfo;
     CmdArgs.push_back("-dwarf-ext-refs");
     CmdArgs.push_back("-fmodule-format=obj");
   }
@@ -3806,11 +3859,23 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   // splitting and extraction.
   // FIXME: Currently only works on Linux.
   if (getToolChain().getTriple().isOSLinux() && SplitDwarfArg) {
-    CmdArgs.push_back("-g");
+    DebugInfoKind = CodeGenOptions::LimitedDebugInfo;
     CmdArgs.push_back("-backend-option");
     CmdArgs.push_back("-split-dwarf=Enable");
   }
 
+  // After we've dealt with all combinations of things that could
+  // make DebugInfoKind be other than None or DebugLineTablesOnly,
+  // figure out if we need to "upgrade" it to standalone debug info.
+  // We parse these two '-f' options whether or not they will be used,
+  // to claim them even if you wrote "-fstandalone-debug -gline-tables-only"
+  bool NeedFullDebug = Args.hasFlag(options::OPT_fstandalone_debug,
+                                    options::OPT_fno_standalone_debug,
+                                    getToolChain().GetDefaultStandaloneDebug());
+  if (DebugInfoKind == CodeGenOptions::LimitedDebugInfo && NeedFullDebug)
+    DebugInfoKind = CodeGenOptions::FullDebugInfo;
+  RenderDebugEnablingArgs(Args, CmdArgs, DebugInfoKind, DwarfVersion);
+
   // -ggnu-pubnames turns on gnu style pubnames in the backend.
   if (Args.hasArg(options::OPT_ggnu_pubnames)) {
     CmdArgs.push_back("-backend-option");
@@ -4173,8 +4238,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   // Forward -f (flag) options which we can pass directly.
   Args.AddLastArg(CmdArgs, options::OPT_femit_all_decls);
   Args.AddLastArg(CmdArgs, options::OPT_fheinous_gnu_extensions);
-  Args.AddLastArg(CmdArgs, options::OPT_fstandalone_debug);
-  Args.AddLastArg(CmdArgs, options::OPT_fno_standalone_debug);
   Args.AddLastArg(CmdArgs, options::OPT_fno_operator_names);
   // Emulated TLS is enabled by default on Android, and can be enabled manually
   // with -femulated-tls.
@@ -5336,7 +5399,9 @@ static EHFlags parseClangCLEHFlags(const Driver &D, const ArgList &Args) {
   return EH;
 }
 
-void Clang::AddClangCLArgs(const ArgList &Args, ArgStringList &CmdArgs) const {
+void Clang::AddClangCLArgs(const ArgList &Args, ArgStringList &CmdArgs,
+                           enum CodeGenOptions::DebugInfoKind *DebugInfoKind,
+                           bool *EmitCodeView) const {
   unsigned RTOptionID = options::OPT__SLASH_MT;
 
   if (Args.hasArg(options::OPT__SLASH_LDd))
@@ -5400,13 +5465,13 @@ void Clang::AddClangCLArgs(const ArgList &Args, ArgStringList &CmdArgs) const {
     CmdArgs.push_back("-fno-rtti-data");
 
   // Emit CodeView if -Z7 is present.
-  bool EmitCodeView = Args.hasArg(options::OPT__SLASH_Z7);
+  *EmitCodeView = Args.hasArg(options::OPT__SLASH_Z7);
   bool EmitDwarf = Args.hasArg(options::OPT_gdwarf);
   // If we are emitting CV but not DWARF, don't build information that LLVM
   // can't yet process.
-  if (EmitCodeView && !EmitDwarf)
-    CmdArgs.push_back("-gline-tables-only");
-  if (EmitCodeView)
+  if (*EmitCodeView && !EmitDwarf)
+    *DebugInfoKind = CodeGenOptions::DebugLineTablesOnly;
+  if (*EmitCodeView)
     CmdArgs.push_back("-gcodeview");
 
   const Driver &D = getToolChain().getDriver();
@@ -5557,14 +5622,20 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
   // with an actual assembly file.
   if (SourceAction->getType() == types::TY_Asm ||
       SourceAction->getType() == types::TY_PP_Asm) {
+    bool WantDebug = false;
+    unsigned DwarfVersion = 0;
     Args.ClaimAllArgs(options::OPT_g_Group);
-    if (Arg *A = Args.getLastArg(options::OPT_g_Group))
-      if (!A->getOption().matches(options::OPT_g0))
-        CmdArgs.push_back("-g");
-
-    if (Arg *A = Args.getLastArg(options::OPT_gdwarf_2, options::OPT_gdwarf_3,
-                                 options::OPT_gdwarf_4))
-      A->render(Args, CmdArgs);
+    if (Arg *A = Args.getLastArg(options::OPT_g_Group)) {
+      WantDebug = !A->getOption().matches(options::OPT_g0);
+      if (WantDebug) {
+        if ((DwarfVersion = DwarfVersionNum(A->getSpelling())) == 0)
+          DwarfVersion = getToolChain().GetDefaultDwarfVersion();
+      }
+    }
+    RenderDebugEnablingArgs(Args, CmdArgs,
+                            (WantDebug ? CodeGenOptions::LimitedDebugInfo
+                                       : CodeGenOptions::NoDebugInfo),
+                            DwarfVersion);
 
     // Add the -fdebug-compilation-dir flag if needed.
     addDebugCompDirArg(Args, CmdArgs);

+ 4 - 1
lib/Driver/Tools.h

@@ -14,6 +14,7 @@
 #include "clang/Driver/Tool.h"
 #include "clang/Driver/Types.h"
 #include "clang/Driver/Util.h"
+#include "clang/Frontend/CodeGenOptions.h"
 #include "llvm/ADT/Triple.h"
 #include "llvm/Option/Option.h"
 #include "llvm/Support/Compiler.h"
@@ -88,7 +89,9 @@ private:
                                  RewriteKind rewrite) const;
 
   void AddClangCLArgs(const llvm::opt::ArgList &Args,
-                      llvm::opt::ArgStringList &CmdArgs) const;
+                      llvm::opt::ArgStringList &CmdArgs,
+                      enum CodeGenOptions::DebugInfoKind *DebugInfoKind,
+                      bool *EmitCodeView) const;
 
   visualstudio::Compiler *getCLFallback() const;
 

+ 9 - 29
lib/Frontend/CompilerInvocation.cpp

@@ -393,37 +393,17 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
       Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
   }
 
-  if (Args.hasArg(OPT_gline_tables_only)) {
-    Opts.setDebugInfo(CodeGenOptions::DebugLineTablesOnly);
-  } else if (Args.hasArg(OPT_g_Flag) || Args.hasArg(OPT_gdwarf_2) ||
-             Args.hasArg(OPT_gdwarf_3) || Args.hasArg(OPT_gdwarf_4)) {
-    bool Default = false;
-    // Until dtrace (via CTF) and LLDB can deal with distributed debug info,
-    // Darwin and FreeBSD default to standalone/full debug info.
-    if (llvm::Triple(TargetOpts.Triple).isOSDarwin() ||
-        llvm::Triple(TargetOpts.Triple).isOSFreeBSD())
-      Default = true;
-
-    if (Args.hasFlag(OPT_fstandalone_debug, OPT_fno_standalone_debug, Default))
-      Opts.setDebugInfo(CodeGenOptions::FullDebugInfo);
-    else
-      Opts.setDebugInfo(CodeGenOptions::LimitedDebugInfo);
-  }
+  if (Arg *A = Args.getLastArg(OPT_debug_info_kind_EQ)) {
+    Opts.setDebugInfo(
+        llvm::StringSwitch<CodeGenOptions::DebugInfoKind>(A->getValue())
+            .Case("line-tables-only", CodeGenOptions::DebugLineTablesOnly)
+            .Case("limited", CodeGenOptions::LimitedDebugInfo)
+            .Case("standalone", CodeGenOptions::FullDebugInfo));
+  }
+  Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 0, Diags);
   Opts.DebugColumnInfo = Args.hasArg(OPT_dwarf_column_info);
-  if (Args.hasArg(OPT_gcodeview)) {
-    Opts.EmitCodeView = true;
-    Opts.DwarfVersion = 0;
-  } else if (Opts.getDebugInfo() != CodeGenOptions::NoDebugInfo) {
-    // Default Dwarf version is 4 if we are generating debug information.
-    Opts.DwarfVersion = 4;
-  }
+  Opts.EmitCodeView = Args.hasArg(OPT_gcodeview);
   Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file);
-  if (Args.hasArg(OPT_gdwarf_2))
-    Opts.DwarfVersion = 2;
-  else if (Args.hasArg(OPT_gdwarf_3))
-    Opts.DwarfVersion = 3;
-  else if (Args.hasArg(OPT_gdwarf_4))
-    Opts.DwarfVersion = 4;
   Opts.DebugTypeExtRefs = Args.hasArg(OPT_dwarf_ext_refs);
 
   if (const Arg *A =

+ 1 - 1
test/CodeGen/2006-01-13-Includes.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -g -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -debug-info-kind=limited -emit-llvm -o - | FileCheck %s
 // PR676
 
 int printf(const char * restrict format, ...);

+ 1 - 1
test/CodeGen/2007-05-11-str-const.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g %s  -o /dev/null
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s  -o /dev/null
 
 static unsigned char out[]={0,1};
 static const unsigned char str1[]="1";

+ 1 - 1
test/CodeGen/2009-01-21-InvalidIterator.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -g -o /dev/null
+// RUN: %clang_cc1 %s -emit-llvm -debug-info-kind=limited -o /dev/null
 
 typedef long unsigned int size_t;
 typedef unsigned short int uint16_t;

+ 1 - 1
test/CodeGen/2009-03-13-dbg.c

@@ -1,2 +1,2 @@
-// RUN: %clang_cc1 %s -emit-llvm -g -o /dev/null
+// RUN: %clang_cc1 %s -emit-llvm -debug-info-kind=limited -o /dev/null
 void foo() {}

+ 1 - 1
test/CodeGen/2009-04-23-dbg.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -S -g -o %t %s
+// RUN: %clang_cc1 -S -debug-info-kind=limited -o %t %s
 # 1 "a.c"
 # 1 "a.c" 1
 # 1 "<built-in>" 1

+ 1 - 1
test/CodeGen/2009-07-31-DbgDeclare.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -S -g -o %t.s %s
+// RUN: %clang_cc1 -S -debug-info-kind=limited -o %t.s %s
 void foo() {
      int i = 0;
      i = 42;

+ 1 - 1
test/CodeGen/2010-01-14-FnType-DebugInfo.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -g -o /dev/null
+// RUN: %clang_cc1 %s -emit-llvm -debug-info-kind=limited -o /dev/null
 typedef void (*sigcatch_t)( struct sigcontext *);
 sigcatch_t sigcatch[50] = {(sigcatch_t) 0};
 

+ 1 - 1
test/CodeGen/2010-01-18-Inlined-Debug.c

@@ -1,5 +1,5 @@
 // PR: 6058
-// RUN: %clang_cc1 -g -emit-llvm %s -o /dev/null
+// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm %s -o /dev/null
 
 static inline int foo(double) __attribute__ ((always_inline));
 static inline int foo(double __x) { return __x; }

+ 1 - 1
test/CodeGen/2010-02-10-PointerName.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -g -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -debug-info-kind=limited -o - | FileCheck %s
 // CHECK: DW_TAG_pointer_type
 // CHECK-NOT: {"char"}
 

+ 1 - 1
test/CodeGen/2010-02-15-DbgStaticVar.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -g -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s
 // Test to check intentionally empty linkage name for a static variable.
 // Radar 7651244.
 static int foo(int a)

+ 1 - 1
test/CodeGen/2010-02-16-DbgScopes.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g < %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited < %s | FileCheck %s
 // Test to check number of lexical scope identified in debug info.
 // CHECK: !DILexicalBlock(
 // CHECK: !DILexicalBlock(

+ 1 - 1
test/CodeGen/2010-03-5-LexicalScope.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
 // CHECK: !DILexicalBlock(
 // CHECK: !DILexicalBlock(
 int foo(int i) {

+ 1 - 1
test/CodeGen/2010-07-08-DeclDebugLineNo.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
 // Insure that dbg.declare lines for locals refer to correct line number records.
 // Radar 8152866.
 void foo() {

+ 1 - 1
test/CodeGen/2010-08-10-DbgConstant.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -S -emit-llvm -g  %s -o - | FileCheck %s
+// RUN: %clang_cc1 -S -emit-llvm -debug-info-kind=limited  %s -o - | FileCheck %s
 // CHECK: !DIGlobalVariable(
 
 static const unsigned int ro = 201;

+ 1 - 1
test/CodeGen/attr-nodebug.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -g -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s
 
 void t1() __attribute__((nodebug));
 

+ 1 - 1
test/CodeGen/attr-noinline.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -g -emit-llvm -o %t %s
+// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o %t %s
 // RUN: grep 'noinline' %t
 
 void t1() __attribute__((noinline));

+ 3 - 3
test/CodeGen/cleanup-destslot-simple.c

@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -gline-tables-only %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=LIFETIME
+// RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=LIFETIME
 
 // We shouldn't have markers at -O0 or with msan.
-// RUN: %clang_cc1 -O0 -triple x86_64-none-linux-gnu -emit-llvm -gline-tables-only %s -o - | FileCheck %s --check-prefix=CHECK
-// RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -gline-tables-only %s -o - -fsanitize=memory | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -O0 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=line-tables-only %s -o - -fsanitize=memory | FileCheck %s --check-prefix=CHECK
 
 // There is no exception to handle here, lifetime.end is not a destructor,
 // so there is no need have cleanup dest slot related code

+ 1 - 1
test/CodeGen/debug-info-257-args.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x c++ -g -emit-llvm -triple x86_64-linux-gnu -o - %s | FileCheck %s
+// RUN: %clang_cc1 -x c++ -debug-info-kind=limited -emit-llvm -triple x86_64-linux-gnu -o - %s | FileCheck %s
 // PR23332
 
 // CHECK: DILocalVariable(arg: 255

+ 1 - 1
test/CodeGen/debug-info-args.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -g %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s
 
 int somefunc(char *x, int y, double z) {
   

+ 1 - 1
test/CodeGen/debug-info-block-decl.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -g -fblocks -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -debug-info-kind=limited -fblocks -emit-llvm -o - %s | FileCheck %s
 // Assignment and block entry should point to the same line.
 // rdar://problem/14039866
 

+ 1 - 1
test/CodeGen/debug-info-block-out-return.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -g -fblocks -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -debug-info-kind=limited -fblocks -emit-llvm -o - %s | FileCheck %s
 
 // Check that arg numbering is not affected by LLVM IR argument numbering -
 // since the latter is affected by return-by-out-parameter ABI requirements

+ 1 - 1
test/CodeGen/debug-info-block.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fblocks -g -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s
 // Verify that the desired debugging type is generated for a structure
 // member that is a pointer to a block.
 

+ 2 - 2
test/CodeGen/debug-info-compilation-dir.c

@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -fdebug-compilation-dir /nonsense -emit-llvm -g %s -o - | FileCheck -check-prefix=CHECK-NONSENSE %s
+// RUN: %clang_cc1 -fdebug-compilation-dir /nonsense -emit-llvm -debug-info-kind=limited %s -o - | FileCheck -check-prefix=CHECK-NONSENSE %s
 // CHECK-NONSENSE: nonsense
 
-// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck -check-prefix=CHECK-DIR %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck -check-prefix=CHECK-DIR %s
 // CHECK-DIR: CodeGen
 

+ 1 - 1
test/CodeGen/debug-info-crash.c

@@ -1,5 +1,5 @@
 // REQUIRES: x86-registered-target
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -fblocks -g -S %s -o -
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -fblocks -debug-info-kind=limited -S %s -o -
 
 // rdar://7590323
 typedef struct dispatch_queue_s *dispatch_queue_t;

+ 1 - 1
test/CodeGen/debug-info-enum.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
 
 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "e"
 // CHECK-SAME:             elements: [[TEST3_ENUMS:![0-9]*]]

+ 1 - 1
test/CodeGen/debug-info-gline-tables-only.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -gline-tables-only -S -emit-llvm -o - | FileCheck %s
+// 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
 // for variables and types.
 

+ 1 - 1
test/CodeGen/debug-info-gline-tables-only2.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -gline-tables-only -S -emit-llvm -o - | FileCheck %s
+// 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
 // compile unit, subprogram and file.
 

+ 1 - 1
test/CodeGen/debug-info-line.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -w -gline-tables-only -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s
 
 int f1(int a, int b) {
   // CHECK: icmp {{.*}}, !dbg [[DBG_F1:!.*]]

+ 1 - 1
test/CodeGen/debug-info-line2.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-darwin-apple -g -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-darwin-apple -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s
 // Radar 9199234
 
 int bar();

+ 1 - 1
test/CodeGen/debug-info-line3.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -g -S -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=limited -S -emit-llvm %s -o - | FileCheck %s
 
 void func(char c, char* d)
 {

+ 1 - 1
test/CodeGen/debug-info-member.c

@@ -1,3 +1,3 @@
-// RUN: %clang_cc1 -emit-llvm -g < %s | grep DW_TAG_member 
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited < %s | grep DW_TAG_member
 
 struct A { int x; } a;

+ 1 - 1
test/CodeGen/debug-info-packed-struct.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x c -g -emit-llvm -triple x86_64-apple-darwin -o - %s | FileCheck %s
+// RUN: %clang_cc1 -x c -debug-info-kind=limited -emit-llvm -triple x86_64-apple-darwin -o - %s | FileCheck %s
 
 // CHECK: %struct.layout0 = type { i8, %struct.size8, i8 }
 // CHECK: %struct.layout1 = type <{ i8, %struct.size8_anon, i8, [2 x i8] }>

+ 1 - 1
test/CodeGen/debug-info-same-line.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -g -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -debug-info-kind=limited -o - | FileCheck %s
 // Here two temporary nodes are identical (but should not get uniqued) while
 // building the full debug type.
 typedef struct { long x; } foo; typedef struct {  foo *x; } bar;

+ 1 - 1
test/CodeGen/debug-info-scope-file.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -g -emit-llvm < %s | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm < %s | FileCheck %s
 
 // Check that, just because we emitted a function from a different file doesn't
 // mean we insert a file-change inside the next function.

+ 2 - 2
test/CodeGen/debug-info-scope.c

@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -g -emit-llvm < %s | FileCheck %s
-// RUN: %clang_cc1 -gline-tables-only -emit-llvm < %s | FileCheck --check-prefix=GMLT %s
+// RUN: %clang_cc1 -dwarf-version=4 -debug-info-kind=limited -emit-llvm < %s | FileCheck %s
+// RUN: %clang_cc1 -dwarf-version=4 -debug-info-kind=line-tables-only -emit-llvm < %s | FileCheck --check-prefix=GMLT %s
 // Two variables with same name in separate scope.
 // Radar 8330217.
 int main() {

+ 1 - 1
test/CodeGen/debug-info-static.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1  -g -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1  -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s
 
 // CHECK: !DIGlobalVariable({{.*}}variable: i32* @f.xyzzy
 void f(void)

+ 1 - 1
test/CodeGen/debug-info-typedef.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g -I%p %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -I%p %s -o - | FileCheck %s
 // Test that the location of the typedef points to the header file.
 #line 1 "a.c"
 #line 2 "b.h"

+ 1 - 1
test/CodeGen/debug-info-vector.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
 typedef int v4si __attribute__((__vector_size__(16)));
 
 v4si a;

+ 1 - 1
test/CodeGen/debug-info-vla.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin %s -o - | FileCheck %s
 
 void testVLAwithSize(int s)
 {

+ 1 - 1
test/CodeGen/debug-info.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -g %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s
 
 // PR3023
 void convert(void) {

+ 1 - 1
test/CodeGen/debug-line-1.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -o - -emit-llvm -g %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s
 // REQUIRES: asserts
 // PR9796
 

+ 1 - 1
test/CodeGen/enum2.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown %s -g -emit-llvm -o /dev/null
+// RUN: %clang_cc1 -triple i386-unknown-unknown %s -debug-info-kind=limited -emit-llvm -o /dev/null
 int v;
 enum e { MAX };
 

+ 1 - 1
test/CodeGen/global-blocks-lines.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fblocks -g -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s
 // Make sure we do not generate line info for debugging-related frame setup.
 // CHECK: define {{.*}}block_invoke
 // CHECK-NOT: store {{.*}}%struct.__block_descriptor*{{.*}}dbg

+ 1 - 1
test/CodeGen/lifetime-debuginfo-1.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -gline-tables-only %s -o - | FileCheck %s
+// RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s
 
 // Inserting lifetime markers should not affect debuginfo
 

+ 1 - 1
test/CodeGen/lifetime-debuginfo-2.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -gline-tables-only %s -o - | FileCheck %s
+// RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=line-tables-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

+ 1 - 1
test/CodeGen/lineno-dbginfo.c

@@ -1,5 +1,5 @@
 // RUN: echo "#include <stddef.h>" > %t.h
-// RUN: %clang_cc1 -S -g -include %t.h %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -S -debug-info-kind=limited -include %t.h %s -emit-llvm -o - | FileCheck %s
 
 // CHECK: !DIGlobalVariable(name: "outer",
 // CHECK-NOT:               linkageName:

+ 1 - 1
test/CodeGen/linetable-endscope.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
 
 // Check the line numbers for the ret instruction. We expect it to be
 // at the closing of the lexical scope in this case. See the comments in

+ 1 - 1
test/CodeGen/sse-builtins-dbg.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -ffreestanding -triple x86_64-apple-macosx10.8.0 -target-feature +sse4.1 -g -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding -triple x86_64-apple-macosx10.8.0 -target-feature +sse4.1 -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s
 
 // Test that intrinsic calls inlined from _mm_* wrappers have debug metadata.
 

+ 1 - 1
test/CodeGen/vector.c

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -O1 -target-cpu pentium4 -target-feature +sse4.1 -g -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -O1 -target-cpu pentium4 -target-feature +sse4.1 -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s
 typedef short __v4hi __attribute__ ((__vector_size__ (8)));
 
 void test1() {

+ 1 - 1
test/CodeGenCXX/2006-11-20-GlobalSymbols.cpp

@@ -1,7 +1,7 @@
 // PR1013
 // Check to make sure debug symbols use the correct name for globals and
 // functions.  Will not assemble if it fails to.
-// RUN: %clang_cc1 -emit-llvm -g -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -o - %s | FileCheck %s
 
 // CHECK: f\01oo"
 int foo __asm__("f\001oo");

+ 1 - 1
test/CodeGenCXX/2007-01-02-UnboundedArray.cpp

@@ -1,6 +1,6 @@
 // Make sure unbounded arrays compile with debug information.
 //
-// RUN: %clang_cc1 -emit-llvm -g %s -o -
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o -
 
 // PR1068
 

+ 1 - 1
test/CodeGenCXX/2009-03-17-dbg.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o /dev/null -g
+// RUN: %clang_cc1 -emit-llvm %s -o /dev/null -debug-info-kind=limited
 
 template <typename T1,typename T2>
 inline void f(const T1&,const T2&) { }

+ 1 - 1
test/CodeGenCXX/2009-06-16-DebugInfoCrash.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o /dev/null -g
+// RUN: %clang_cc1 -emit-llvm %s -o /dev/null -debug-info-kind=limited
 // This crashes if we try to emit debug info for TEMPLATE_DECL members.
 template <class T> class K2PtrVectorBase {};
 template <class T> class K2Vector {};

+ 1 - 1
test/CodeGenCXX/2010-03-09-AnonAggregate.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -g -S -o %t %s
+// RUN: %clang_cc1 -debug-info-kind=limited -S -o %t %s
 // PR: 6554
 // More then one anonymous aggregates on one line creates chaos when MDNode uniquness is 
 // combined with RAUW operation.

+ 1 - 1
test/CodeGenCXX/2010-05-10-Var-DbgInfo.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g %s -o /dev/null
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o /dev/null
 // PR 7104
 
 struct A {

+ 1 - 1
test/CodeGenCXX/2010-05-12-PtrToMember-Dbg.cpp

@@ -1,4 +1,4 @@
-//RUN: %clang_cc1 -emit-llvm -g -o - %s | FileCheck %s
+//RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -o - %s | FileCheck %s
 //CHECK: DILocalVariable(
 class Foo
 {

+ 1 - 1
test/CodeGenCXX/2010-06-21-LocalVarDbg.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -g -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s
 // Do not use function name to create named metadata used to hold
 // local variable info. For example. llvm.dbg.lv.~A is an invalid name.
 

+ 1 - 1
test/CodeGenCXX/2010-06-22-BitfieldInit.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g %s -o -
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o -
 struct TEST2
 {
   int subid:32;

+ 1 - 1
test/CodeGenCXX/2010-06-22-ZeroBitfield.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g %s -o -
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o -
 struct s8_0 { unsigned : 0; };
 struct s8_1 { double x; };
 struct s8 { s8_0 a; s8_1 b; };

+ 1 - 1
test/CodeGenCXX/2010-07-23-DeclLoc.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
 // Require the template function declaration refer to the correct filename.
 // First, locate the function decl in metadata, and pluck out the file handle:
 // CHECK: !DISubprogram(name: "extract_dwarf_data_from_header

+ 1 - 1
test/CodeGenCXX/PR20038.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple %itanium_abi_triple -g -mllvm -no-discriminators -emit-llvm  %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -debug-info-kind=limited -mllvm -no-discriminators -emit-llvm  %s -o - | FileCheck %s
 
 struct C {
   ~C();

+ 1 - 1
test/CodeGenCXX/cp-blocks-linetables.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fblocks -g -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s
 // Ensure that we generate a line table entry for the block cleanup.
 // CHECK: define {{.*}} @__main_block_invoke
 // CHECK: _NSConcreteStackBlock

+ 1 - 1
test/CodeGenCXX/crash.cpp

@@ -1,6 +1,6 @@
 // XFAIL: hexagon
 // RUN: %clang_cc1 %s -std=c++11 -emit-llvm-only
-// RUN: %clang_cc1 -emit-obj -o %t -gline-tables-only -std=c++11 %s
+// RUN: %clang_cc1 -emit-obj -o %t -debug-info-kind=line-tables-only -std=c++11 %s
 // CHECK that we don't crash.
 
 // PR11676's example is ill-formed:

+ 1 - 1
test/CodeGenCXX/debug-info-access.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g -triple %itanium_abi_triple %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple %itanium_abi_triple %s -o - | FileCheck %s
 // Test the various accessibility flags in the debug info.
 struct A {
   // CHECK-DAG: !DISubprogram(name: "pub_default",{{.*}} line: [[@LINE+1]],{{.*}} flags: DIFlagPrototyped,

+ 1 - 1
test/CodeGenCXX/debug-info-anon-union-vars.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -gdwarf-4 -triple x86_64-linux-gnu %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-linux-gnu %s -o - | FileCheck %s
 
 // Make sure that we emit a global variable for each of the members of the
 // anonymous union.

+ 1 - 1
test/CodeGenCXX/debug-info-artificial-arg.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin %s -o - | FileCheck %s
 
 template<class X> class B {
 public:

+ 1 - 1
test/CodeGenCXX/debug-info-blocks.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -gline-tables-only -fblocks -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -debug-info-kind=line-tables-only -fblocks -S -emit-llvm -o - | FileCheck %s
 
 struct A {
   A();

+ 1 - 1
test/CodeGenCXX/debug-info-char16.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -g %s -o -| FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -debug-info-kind=limited %s -o -| FileCheck %s
 
 // 16 is DW_ATE_UTF (0x10) encoding attribute.
 char16_t char_a = u'h';

+ 4 - 4
test/CodeGenCXX/debug-info-class-nolimit.cpp

@@ -1,6 +1,7 @@
-// RUN: %clang_cc1 -triple x86_64-unk-unk -fstandalone-debug -o - -emit-llvm -g %s | FileCheck %s
-// On Darwin, this should be the default:
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -o - -emit-llvm -g %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unk-unk -debug-info-kind=standalone -o - -emit-llvm %s | FileCheck %s
+// On Darwin, "full" debug info is the default, so really these tests are
+// identical, as cc1 no longer chooses the effective value of DebugInfoKind.
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -debug-info-kind=standalone -o - -emit-llvm %s | FileCheck %s
 
 namespace rdar14101097_1 { // see also PR16214
 // Check that we emit debug info for the definition of a struct if the
@@ -33,4 +34,3 @@ void bar() {
 struct foo {
 };
 }
-

+ 1 - 1
test/CodeGenCXX/debug-info-context.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin %s -o - | FileCheck %s
 // PR11345
 
 class locale {

+ 1 - 1
test/CodeGenCXX/debug-info-cxx0x.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm-only -std=c++11 -g %s
+// RUN: %clang_cc1 -emit-llvm-only -std=c++11 -debug-info-kind=limited %s
 
 namespace PR9414 {
   int f() {

+ 1 - 1
test/CodeGenCXX/debug-info-cxx1y.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only -std=c++14 -emit-llvm -g %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only -std=c++14 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
 
 // CHECK: [[EMPTY:![0-9]*]] = !{}
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo",

+ 1 - 1
test/CodeGenCXX/debug-info-decl-nested.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -g -emit-llvm -g -triple x86_64-apple-darwin %s -o %t
+// RUN: %clang_cc1 -std=c++11 -debug-info-kind=standalone -emit-llvm -triple x86_64-apple-darwin %s -o %t
 // RUN: cat %t | FileCheck %s -check-prefix=CHECK0
 // RUN: cat %t | FileCheck %s -check-prefix=CHECK1
 // RUN: cat %t | FileCheck %s -check-prefix=CHECK2

+ 2 - 2
test/CodeGenCXX/debug-info-determinism.cpp

@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -S -emit-llvm -g -o %t1.ll %s
-// RUN: %clang_cc1 -S -emit-llvm -g -o %t2.ll %s
+// RUN: %clang_cc1 -S -emit-llvm -debug-info-kind=limited -o %t1.ll %s
+// RUN: %clang_cc1 -S -emit-llvm -debug-info-kind=limited -o %t2.ll %s
 // RUN: diff %t1.ll %t2.ll
 
 template <int N> struct C {

+ 1 - 1
test/CodeGenCXX/debug-info-dup-fwd-decl.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin -fstandalone-debug %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple x86_64-apple-darwin %s -o - | FileCheck %s
 
 class Test
 {

+ 1 - 1
test/CodeGenCXX/debug-info-enum-class.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin -std=c++11 %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin -std=c++11 %s -o - | FileCheck %s
 
 enum class A { A1=1 };                 // underlying type is int by default
 enum class B: unsigned long { B1=1 };  // underlying type is unsigned long

+ 1 - 1
test/CodeGenCXX/debug-info-enum.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -g %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
 
 // CHECK: !DICompileUnit(
 // CHECK-SAME:           enums: [[ENUMS:![0-9]*]]

+ 1 - 1
test/CodeGenCXX/debug-info-flex-member.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin %s -o - | FileCheck %s
 
 // CHECK: !DISubrange(count: -1)
 

+ 1 - 1
test/CodeGenCXX/debug-info-function-context.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-pc-linux-gnu %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-pc-linux-gnu %s -o - | FileCheck %s
 
 struct C {
   void member_function();

+ 1 - 1
test/CodeGenCXX/debug-info-fwd-ref.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin %s -o - | FileCheck %s
 
 struct baz {
     int h;

+ 1 - 1
test/CodeGenCXX/debug-info-gline-tables-only.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fno-rtti -gline-tables-only -S -emit-llvm -o - | FileCheck %s
+// 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
 // for variables and types.
 

+ 2 - 2
test/CodeGenCXX/debug-info-global-ctor-dtor.cpp

@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 %s -g -triple %itanium_abi_triple -fno-use-cxa-atexit -S -emit-llvm -o - \
+// RUN: %clang_cc1 %s -debug-info-kind=limited -triple %itanium_abi_triple -fno-use-cxa-atexit -S -emit-llvm -o - \
 // RUN:     | FileCheck %s --check-prefix=CHECK-NOKEXT
-// RUN: %clang_cc1 %s -g -triple %itanium_abi_triple -fno-use-cxa-atexit -fapple-kext -S -emit-llvm -o - \
+// RUN: %clang_cc1 %s -debug-info-kind=limited -triple %itanium_abi_triple -fno-use-cxa-atexit -fapple-kext -S -emit-llvm -o - \
 // RUN:     | FileCheck %s --check-prefix=CHECK-KEXT
 
 class A {

+ 1 - 1
test/CodeGenCXX/debug-info-global.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -emit-llvm -g %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
 
 // Multiple references to the same constant should result in only one entry in
 // the globals list.

+ 1 - 1
test/CodeGenCXX/debug-info-globalinit.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -std=c++11 -g | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -std=c++11 -debug-info-kind=limited | FileCheck %s
 
 void crash() {
   volatile char *ptr = 0;

+ 1 - 1
test/CodeGenCXX/debug-info-indirect-field-decl.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin %s -o - | FileCheck %s
 //
 // Test that indirect field decls are handled gracefully.
 // rdar://problem/16348575

+ 1 - 1
test/CodeGenCXX/debug-info-large-constant.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -g -triple=x86_64-apple-darwin %s -o /dev/null
+// RUN: %clang_cc1 -debug-info-kind=limited -triple=x86_64-apple-darwin %s -o /dev/null
 // PR 8913
 
 typedef __uint128_t word128;

+ 1 - 1
test/CodeGenCXX/debug-info-line-if.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -g -std=c++11 -S -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=limited -std=c++11 -S -emit-llvm %s -o - | FileCheck %s
 // PR19864
 extern int v[2];
 int a = 0, b = 0;

+ 2 - 2
test/CodeGenCXX/debug-info-line.cpp

@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -w -gline-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s
-// RUN: %clang_cc1 -w -gline-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - -triple i686-linux-gnu | FileCheck %s
+// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - -triple i686-linux-gnu | FileCheck %s
 
 // XFAIL: win32
 

+ 1 - 1
test/CodeGenCXX/debug-info-method-nodebug.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
 
 class C {
   void present();

+ 1 - 1
test/CodeGenCXX/debug-info-method.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -g %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -debug-info-kind=limited %s -o - | FileCheck %s
 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A",{{.*}} identifier: "_ZTS1A")
 // CHECK: !DISubprogram(name: "foo", linkageName: "_ZN1A3fooEiS_3$_0"
 // CHECK-SAME:          DIFlagProtected

+ 1 - 1
test/CodeGenCXX/debug-info-method2.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fno-standalone-debug -x c++ -g -S -emit-llvm < %s | FileCheck %s
+// RUN: %clang_cc1 -x c++ -debug-info-kind=limited -S -emit-llvm < %s | FileCheck %s
 // rdar://10336845
 // Preserve type qualifiers in -flimit-debug-info mode.
 

+ 3 - 3
test/CodeGenCXX/debug-info-namespace.cpp

@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -g -fno-standalone-debug -S -emit-llvm %s -o - | FileCheck %s
-// RUN: %clang_cc1 -g -gline-tables-only    -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-GMLT %s
-// RUN: %clang_cc1 -g -fstandalone-debug    -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-NOLIMIT %s
+// RUN: %clang_cc1 -debug-info-kind=limited -S -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=line-tables-only -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-GMLT %s
+// RUN: %clang_cc1 -debug-info-kind=standalone -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-NOLIMIT %s
 
 namespace A {
 #line 1 "foo.cpp"

+ 1 - 1
test/CodeGenCXX/debug-info-nullptr.cpp

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -std=c++11 -g %s -o -| FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -std=c++11 -debug-info-kind=limited %s -o -| FileCheck %s
 
 void foo() {
   decltype(nullptr) t = 0;

部分文件因文件數量過多而無法顯示