[PATCH] D15645: Allow multiple debug types in --debug-only

Christof Douma via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 18 08:43:45 PST 2015


christof created this revision.
christof added a subscriber: llvm-commits.
christof set the repository for this revision to rL LLVM.

The --debug-only option now takes a comma separated list of debug types. This means that the DEBUG_TYPE should cannot take a comma anymore. All existing passes conform to this rule.


Repository:
  rL LLVM

http://reviews.llvm.org/D15645

Files:
  docs/ProgrammersManual.rst
  lib/Support/Debug.cpp

Index: lib/Support/Debug.cpp
===================================================================
--- lib/Support/Debug.cpp
+++ lib/Support/Debug.cpp
@@ -95,16 +95,19 @@
     if (Val.empty())
       return;
     DebugFlag = true;
-    CurrentDebugType->push_back(Val);
+    SmallVector<StringRef,8> dbgTypes;
+    StringRef(Val).split(dbgTypes, ',', -1, false);
+    for (auto dbgType : dbgTypes)
+      CurrentDebugType->push_back(dbgType);
   }
 };
 
 }
 
 static DebugOnlyOpt DebugOnlyOptLoc;
 
 static cl::opt<DebugOnlyOpt, true, cl::parser<std::string> >
-DebugOnly("debug-only", cl::desc("Enable a specific type of debug output"),
+DebugOnly("debug-only", cl::desc("Enable a specific type of debug output (comma separated list of types)"),
           cl::Hidden, cl::ZeroOrMore, cl::value_desc("debug string"),
           cl::location(DebugOnlyOptLoc), cl::ValueRequired);
 
Index: docs/ProgrammersManual.rst
===================================================================
--- docs/ProgrammersManual.rst
+++ docs/ProgrammersManual.rst
@@ -408,6 +408,9 @@
   'foo' debug type
   $ opt < a.bc > /dev/null -mypass -debug-only=bar
   'bar' debug type
+  $ opt < a.bc > /dev/null -mypass -debug-only=foo,bar
+  'foo' debug type
+  'bar' debug type
 
 Of course, in practice, you should only set ``DEBUG_TYPE`` at the top of a file,
 to specify the debug type for the entire module. Be careful that you only do
@@ -417,7 +420,8 @@
 use the same string, they will all be turned on when the name is specified.
 This allows, for example, all debug information for instruction scheduling to be
 enabled with ``-debug-only=InstrSched``, even if the source lives in multiple
-files.
+files. The name must not include a comma (,) as that is used to seperate the
+arguments of the ``-debug-only`` option.
 
 For performance reasons, -debug-only is not available in optimized build
 (``--enable-optimized``) of LLVM.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15645.43234.patch
Type: text/x-patch
Size: 1911 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151218/1029b5aa/attachment.bin>


More information about the llvm-commits mailing list