diff options
author | Manuel Klimek <klimek@google.com> | 2013-01-16 12:31:12 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2013-01-16 12:31:12 +0000 |
commit | ab3dc000cadeb5c75e9c8019509b5235debd8b18 (patch) | |
tree | 5c24e5368a022caa368e4b5e2872bce1fb05aa7c /clang/lib | |
parent | ae6e53c15db2264799e91298b8f4d703b2fd0842 (diff) | |
download | bcm5719-llvm-ab3dc000cadeb5c75e9c8019509b5235debd8b18.tar.gz bcm5719-llvm-ab3dc000cadeb5c75e9c8019509b5235debd8b18.zip |
Use standard llvm Debug.h support for debugging output.
Leave a quick "// Uncomment this." hint to enable the debug output in
tests. FIXME: figure out whether we want to enable debug command line
handling for all tests.
llvm-svn: 172608
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index d6c66dc9ac4..e8b334bb3d8 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -16,14 +16,15 @@ /// //===----------------------------------------------------------------------===// -#include "UnwrappedLineParser.h" +#define DEBUG_TYPE "format-parser" + #include "clang/Basic/Diagnostic.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" +#include "UnwrappedLineParser.h" -// Uncomment to get debug output from the UnwrappedLineParser. -// Use in combination with --gtest_filter=*TestName* to limit the output to a -// single test. -// #define UNWRAPPED_LINE_PARSER_DEBUG_OUTPUT +// Uncomment to get debug output from tests: +// #define DEBUG_WITH_TYPE(T, X) do { X; } while(0) namespace clang { namespace format { @@ -109,9 +110,7 @@ UnwrappedLineParser::UnwrappedLineParser( } bool UnwrappedLineParser::parse() { -#ifdef UNWRAPPED_LINE_PARSER_DEBUG_OUTPUT - llvm::errs() << "----\n"; -#endif + DEBUG(llvm::dbgs() << "----\n"); readToken(); return parseFile(); } @@ -658,16 +657,16 @@ void UnwrappedLineParser::addUnwrappedLine() { FormatTok.Tok.is(tok::comment)) { nextToken(); } -#ifdef UNWRAPPED_LINE_PARSER_DEBUG_OUTPUT - llvm::errs() << "Line: "; - for (std::list<FormatToken>::iterator I = Line->Tokens.begin(), - E = Line->Tokens.end(); - I != E; ++I) { - llvm::errs() << I->Tok.getName() << " "; + DEBUG({ + llvm::dbgs() << "Line: "; + for (std::list<FormatToken>::iterator I = Line->Tokens.begin(), + E = Line->Tokens.end(); + I != E; ++I) { + llvm::dbgs() << I->Tok.getName() << " "; - } - llvm::errs() << "\n"; -#endif + } + llvm::dbgs() << "\n"; + }); Callback.consumeUnwrappedLine(*Line); Line->Tokens.clear(); } |