diff options
Diffstat (limited to 'llvm/docs')
-rw-r--r-- | llvm/docs/Bugpoint.rst | 16 | ||||
-rw-r--r-- | llvm/docs/CommandGuide/opt.rst | 2 | ||||
-rw-r--r-- | llvm/docs/CommandLine.rst | 6 | ||||
-rw-r--r-- | llvm/docs/ProgrammersManual.rst | 18 |
4 files changed, 21 insertions, 21 deletions
diff --git a/llvm/docs/Bugpoint.rst b/llvm/docs/Bugpoint.rst index 27732e0fffb..f3bb54cffb5 100644 --- a/llvm/docs/Bugpoint.rst +++ b/llvm/docs/Bugpoint.rst @@ -198,14 +198,14 @@ desired ranges. For example: static int calledCount = 0; calledCount++; - DEBUG(if (calledCount < 212) return false); - DEBUG(if (calledCount > 217) return false); - DEBUG(if (calledCount == 213) return false); - DEBUG(if (calledCount == 214) return false); - DEBUG(if (calledCount == 215) return false); - DEBUG(if (calledCount == 216) return false); - DEBUG(dbgs() << "visitXOR calledCount: " << calledCount << "\n"); - DEBUG(dbgs() << "I: "; I->dump()); + LLVM_DEBUG(if (calledCount < 212) return false); + LLVM_DEBUG(if (calledCount > 217) return false); + LLVM_DEBUG(if (calledCount == 213) return false); + LLVM_DEBUG(if (calledCount == 214) return false); + LLVM_DEBUG(if (calledCount == 215) return false); + LLVM_DEBUG(if (calledCount == 216) return false); + LLVM_DEBUG(dbgs() << "visitXOR calledCount: " << calledCount << "\n"); + LLVM_DEBUG(dbgs() << "I: "; I->dump()); could be added to ``visitXOR`` to limit ``visitXor`` to being applied only to calls 212 and 217. This is from an actual test case and raises an important diff --git a/llvm/docs/CommandGuide/opt.rst b/llvm/docs/CommandGuide/opt.rst index 7b9255d2642..2b2fffa063a 100644 --- a/llvm/docs/CommandGuide/opt.rst +++ b/llvm/docs/CommandGuide/opt.rst @@ -96,7 +96,7 @@ OPTIONS .. option:: -debug If this is a debug build, this option will enable debug printouts from passes - which use the ``DEBUG()`` macro. See the `LLVM Programmer's Manual + which use the ``LLVM_DEBUG()`` macro. See the `LLVM Programmer's Manual <../ProgrammersManual.html>`_, section ``#DEBUG`` for more information. .. option:: -load=<plugin> diff --git a/llvm/docs/CommandLine.rst b/llvm/docs/CommandLine.rst index 9496157d434..9a6a196b431 100644 --- a/llvm/docs/CommandLine.rst +++ b/llvm/docs/CommandLine.rst @@ -886,12 +886,12 @@ To do this, set up your .h file with your option, like this for example: // debug build, then the code specified as the option to the macro will be // executed. Otherwise it will not be. #ifdef NDEBUG - #define DEBUG(X) + #define LLVM_DEBUG(X) #else - #define DEBUG(X) do { if (DebugFlag) { X; } } while (0) + #define LLVM_DEBUG(X) do { if (DebugFlag) { X; } } while (0) #endif -This allows clients to blissfully use the ``DEBUG()`` macro, or the +This allows clients to blissfully use the ``LLVM_DEBUG()`` macro, or the ``DebugFlag`` explicitly if they want to. Now we just need to be able to set the ``DebugFlag`` boolean when the option is set. To do this, we pass an additional argument to our command line argument processor, and we specify where diff --git a/llvm/docs/ProgrammersManual.rst b/llvm/docs/ProgrammersManual.rst index 5e510fb7e7b..aef0d207f07 100644 --- a/llvm/docs/ProgrammersManual.rst +++ b/llvm/docs/ProgrammersManual.rst @@ -1020,7 +1020,7 @@ be passed by value. .. _DEBUG: -The ``DEBUG()`` macro and ``-debug`` option +The ``LLVM_DEBUG()`` macro and ``-debug`` option ------------------------------------------- Often when working on your pass you will put a bunch of debugging printouts and @@ -1033,14 +1033,14 @@ them out, allowing you to enable them if you need them in the future. The ``llvm/Support/Debug.h`` (`doxygen <http://llvm.org/doxygen/Debug_8h_source.html>`__) file provides a macro named -``DEBUG()`` that is a much nicer solution to this problem. Basically, you can -put arbitrary code into the argument of the ``DEBUG`` macro, and it is only +``LLVM_DEBUG()`` that is a much nicer solution to this problem. Basically, you can +put arbitrary code into the argument of the ``LLVM_DEBUG`` macro, and it is only executed if '``opt``' (or any other tool) is run with the '``-debug``' command line argument: .. code-block:: c++ - DEBUG(dbgs() << "I am here!\n"); + LLVM_DEBUG(dbgs() << "I am here!\n"); Then you can run your pass like this: @@ -1051,13 +1051,13 @@ Then you can run your pass like this: $ opt < a.bc > /dev/null -mypass -debug I am here! -Using the ``DEBUG()`` macro instead of a home-brewed solution allows you to not +Using the ``LLVM_DEBUG()`` macro instead of a home-brewed solution allows you to not have to create "yet another" command line option for the debug output for your -pass. Note that ``DEBUG()`` macros are disabled for non-asserts builds, so they +pass. Note that ``LLVM_DEBUG()`` macros are disabled for non-asserts builds, so they do not cause a performance impact at all (for the same reason, they should also not contain side-effects!). -One additional nice thing about the ``DEBUG()`` macro is that you can enable or +One additional nice thing about the ``LLVM_DEBUG()`` macro is that you can enable or disable it directly in gdb. Just use "``set DebugFlag=0``" or "``set DebugFlag=1``" from the gdb if the program is running. If the program hasn't been started yet, you can always just run it with ``-debug``. @@ -1076,10 +1076,10 @@ follows: .. code-block:: c++ #define DEBUG_TYPE "foo" - DEBUG(dbgs() << "'foo' debug type\n"); + LLVM_DEBUG(dbgs() << "'foo' debug type\n"); #undef DEBUG_TYPE #define DEBUG_TYPE "bar" - DEBUG(dbgs() << "'bar' debug type\n"); + LLVM_DEBUG(dbgs() << "'bar' debug type\n"); #undef DEBUG_TYPE Then you can run your pass like this: |