diff options
| author | Manuel Klimek <klimek@google.com> | 2013-01-10 10:05:08 +0000 |
|---|---|---|
| committer | Manuel Klimek <klimek@google.com> | 2013-01-10 10:05:08 +0000 |
| commit | fba4bb114b4229f0b87516fe3be2659611c3eb69 (patch) | |
| tree | 9338b27b7f61d60de0e62746b099671164b4ab73 /clang/lib | |
| parent | 83a54d23d3601eeba4b4d6dfb616744965976863 (diff) | |
| download | bcm5719-llvm-fba4bb114b4229f0b87516fe3be2659611c3eb69.tar.gz bcm5719-llvm-fba4bb114b4229f0b87516fe3be2659611c3eb69.zip | |
Introduce a define to switch on debug output.
After re-writing the same loop multiple times, we deicided it's time to
add this as an optional debugging help.
llvm-svn: 172050
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 9b2a1e90e1f..c09ee311d3b 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -19,6 +19,11 @@ #include "UnwrappedLineParser.h" #include "llvm/Support/raw_ostream.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 + namespace clang { namespace format { @@ -80,6 +85,9 @@ UnwrappedLineParser::UnwrappedLineParser(const FormatStyle &Style, } bool UnwrappedLineParser::parse() { +#ifdef UNWRAPPED_LINE_PARSER_DEBUG_OUTPUT + llvm::errs() << "----\n"; +#endif readToken(); return parseFile(); } @@ -576,6 +584,15 @@ void UnwrappedLineParser::addUnwrappedLine() { FormatTok.Tok.is(tok::comment)) { nextToken(); } +#ifdef UNWRAPPED_LINE_PARSER_DEBUG_OUTPUT + FormatToken* NextToken = &Line->RootToken; + llvm::errs() << "Line: "; + while (NextToken) { + llvm::errs() << NextToken->Tok.getName() << " "; + NextToken = NextToken->Children.empty() ? NULL : &NextToken->Children[0]; + } + llvm::errs() << "\n"; +#endif Callback.consumeUnwrappedLine(*Line); RootTokenInitialized = false; LastInCurrentLine = NULL; |

