Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: tools/clang/BindMigrate/DiagnosticEmitter.cpp

Issue 7886056: Clang plugin that rewrites PostTask(_, NewRunnableMethod(...)) to PostTask(_, base::Bind(...)); (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: break into files and make saner Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #include "DiagnosticEmitter.h"
2
3 #include "clang/Basic/Diagnostic.h"
4 #include "clang/Frontend/CompilerInstance.h"
5
6 namespace clang {
7
8 DiagnosticEmitter::DiagnosticEmitter(CompilerInstance* instance,
9 const std::string& name)
10 : instance_(instance),
11 diagnostic_(&instance_->getDiagnostics()) {
12 }
13
14 void DiagnosticEmitter::EmitWarning(SourceLocation loc,
15 const char* raw_error) {
16 FullSourceLoc full(loc, instance_->getSourceManager());
17 std::string err(name_);
18 err += raw_error;
19 Diagnostic::Level level =
20 diagnostic_->getWarningsAsErrors() ?
21 Diagnostic::Error :
22 Diagnostic::Warning;
23 unsigned id = diagnostic_->getCustomDiagID(level, err);
24 diagnostic_->Report(full, id).Emit();
25 }
26
27 void DiagnosticEmitter::EmitError(SourceLocation loc, const char* raw_error) {
28 FullSourceLoc full(loc, instance_->getSourceManager());
29 std::string err(name_);
30 err += raw_error;
31 unsigned id = diagnostic_->getCustomDiagID(Diagnostic::Error, err);
32 diagnostic_->Report(full, id).Emit();
33 }
34
35 } // namespace clang
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698