summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineParser.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-01-10 15:05:09 +0000
committerAlexander Kornienko <alexfh@google.com>2013-01-10 15:05:09 +0000
commit5b7157ac8d7cffe6f3026657ece7b615a7099d43 (patch)
treed3f4bd8362c3330108e3b1002cced3ab720df104 /clang/lib/Format/UnwrappedLineParser.cpp
parent73a2fdf232711cc013c6fab2be560eaa4acb4034 (diff)
downloadbcm5719-llvm-5b7157ac8d7cffe6f3026657ece7b615a7099d43.tar.gz
bcm5719-llvm-5b7157ac8d7cffe6f3026657ece7b615a7099d43.zip
Basic support for diagnostics.
Summary: Uses DiagnosticsEngine to output diagnostics. Reviewers: djasper, klimek Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D278 llvm-svn: 172071
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.cpp')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index e9c6211313b..a6c5c165ffd 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -17,6 +17,7 @@
//===----------------------------------------------------------------------===//
#include "UnwrappedLineParser.h"
+#include "clang/Basic/Diagnostic.h"
#include "llvm/Support/raw_ostream.h"
// Uncomment to get debug output from the UnwrappedLineParser.
@@ -110,12 +111,12 @@ private:
bool PreBlockRootTokenInitialized;
};
-UnwrappedLineParser::UnwrappedLineParser(const FormatStyle &Style,
- FormatTokenSource &Tokens,
- UnwrappedLineConsumer &Callback)
+UnwrappedLineParser::UnwrappedLineParser(
+ clang::DiagnosticsEngine &Diag, const FormatStyle &Style,
+ FormatTokenSource &Tokens, UnwrappedLineConsumer &Callback)
: Line(new UnwrappedLine), RootTokenInitialized(false),
- LastInCurrentLine(NULL), MustBreakBeforeNextToken(false), Style(Style),
- Tokens(&Tokens), Callback(Callback) {
+ LastInCurrentLine(NULL), MustBreakBeforeNextToken(false), Diag(Diag),
+ Style(Style), Tokens(&Tokens), Callback(Callback) {
}
bool UnwrappedLineParser::parse() {
@@ -149,7 +150,9 @@ bool UnwrappedLineParser::parseLevel(bool HasOpeningBrace) {
if (HasOpeningBrace) {
return false;
} else {
- // Stray '}' is an error.
+ Diag.Report(FormatTok.Tok.getLocation(),
+ Diag.getCustomDiagID(clang::DiagnosticsEngine::Error,
+ "Stray '}' found"));
Error = true;
nextToken();
addUnwrappedLine();
OpenPOWER on IntegriCloud