The --debug-only option now takes a comma separated list of debug types.
authorChristof Douma <Christof.Douma@arm.com>
Tue, 12 Jan 2016 10:23:13 +0000 (10:23 +0000)
committerChristof Douma <Christof.Douma@arm.com>
Tue, 12 Jan 2016 10:23:13 +0000 (10:23 +0000)
This means that the DEBUG_TYPE cannot take a comma anymore. All existing passes
conform to this rule.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257466 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 44f76fef8f1f5cb8719dc62d90151c01e40aa413..665e30aeb676206eaec5f0c700865a330fd44f2e 100644 (file)
@@ -408,6 +408,9 @@ Then you can run your pass like this:
   '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 @@ system in place to ensure that names do not conflict. If two different modules
 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.
index 47751fce3fcdca4c74853d288e038adb6300c492..323d53279b45319ae44ae18572e86001f1f8e62c 100644 (file)
@@ -95,7 +95,10 @@ struct DebugOnlyOpt {
     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);
   }
 };
 
@@ -104,10 +107,9 @@ struct DebugOnlyOpt {
 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);
-
 // Signal handlers - dump debug output on termination.
 static void debug_user_sig_handler(void *Cookie) {
   // This is a bit sneaky.  Since this is under #ifndef NDEBUG, we