diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/ARCMigrate/TransformActions.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/ARCMigrate/TransformActions.cpp | 64 |
1 files changed, 14 insertions, 50 deletions
diff --git a/contrib/llvm/tools/clang/lib/ARCMigrate/TransformActions.cpp b/contrib/llvm/tools/clang/lib/ARCMigrate/TransformActions.cpp index 2fd0619..6d178be 100644 --- a/contrib/llvm/tools/clang/lib/ARCMigrate/TransformActions.cpp +++ b/contrib/llvm/tools/clang/lib/ARCMigrate/TransformActions.cpp @@ -601,7 +601,7 @@ TransformActions::RewriteReceiver::~RewriteReceiver() { } TransformActions::TransformActions(DiagnosticsEngine &diag, CapturedDiagList &capturedDiags, ASTContext &ctx, Preprocessor &PP) - : Diags(diag), CapturedDiags(capturedDiags), ReportedErrors(false) { + : Diags(diag), CapturedDiags(capturedDiags) { Impl = new TransformActionsImpl(capturedDiags, ctx, PP); } @@ -673,60 +673,24 @@ void TransformActions::applyRewrites(RewriteReceiver &receiver) { static_cast<TransformActionsImpl*>(Impl)->applyRewrites(receiver); } -void TransformActions::reportError(StringRef error, SourceLocation loc, - SourceRange range) { - assert(!static_cast<TransformActionsImpl*>(Impl)->isInTransaction() && +DiagnosticBuilder TransformActions::report(SourceLocation loc, unsigned diagId, + SourceRange range) { + assert(!static_cast<TransformActionsImpl *>(Impl)->isInTransaction() && "Errors should be emitted out of a transaction"); - - SourceManager &SM = static_cast<TransformActionsImpl*>(Impl)-> - getASTContext().getSourceManager(); - if (SM.isInSystemHeader(SM.getExpansionLoc(loc))) - return; - - // FIXME: Use a custom category name to distinguish rewriter errors. - std::string rewriteErr = "[rewriter] "; - rewriteErr += error; - unsigned diagID - = Diags.getDiagnosticIDs()->getCustomDiagID(DiagnosticIDs::Error, - rewriteErr); - Diags.Report(loc, diagID) << range; - ReportedErrors = true; + return Diags.Report(loc, diagId) << range; } -void TransformActions::reportWarning(StringRef warning, SourceLocation loc, +void TransformActions::reportError(StringRef message, SourceLocation loc, SourceRange range) { - assert(!static_cast<TransformActionsImpl*>(Impl)->isInTransaction() && - "Warning should be emitted out of a transaction"); - - SourceManager &SM = static_cast<TransformActionsImpl*>(Impl)-> - getASTContext().getSourceManager(); - if (SM.isInSystemHeader(SM.getExpansionLoc(loc))) - return; - - // FIXME: Use a custom category name to distinguish rewriter errors. - std::string rewriterWarn = "[rewriter] "; - rewriterWarn += warning; - unsigned diagID - = Diags.getDiagnosticIDs()->getCustomDiagID(DiagnosticIDs::Warning, - rewriterWarn); - Diags.Report(loc, diagID) << range; + report(loc, diag::err_mt_message, range) << message; } -void TransformActions::reportNote(StringRef note, SourceLocation loc, - SourceRange range) { - assert(!static_cast<TransformActionsImpl*>(Impl)->isInTransaction() && - "Errors should be emitted out of a transaction"); - - SourceManager &SM = static_cast<TransformActionsImpl*>(Impl)-> - getASTContext().getSourceManager(); - if (SM.isInSystemHeader(SM.getExpansionLoc(loc))) - return; +void TransformActions::reportWarning(StringRef message, SourceLocation loc, + SourceRange range) { + report(loc, diag::warn_mt_message, range) << message; +} - // FIXME: Use a custom category name to distinguish rewriter errors. - std::string rewriteNote = "[rewriter] "; - rewriteNote += note; - unsigned diagID - = Diags.getDiagnosticIDs()->getCustomDiagID(DiagnosticIDs::Note, - rewriteNote); - Diags.Report(loc, diagID) << range; +void TransformActions::reportNote(StringRef message, SourceLocation loc, + SourceRange range) { + report(loc, diag::note_mt_message, range) << message; } |