bit ShowInSystemHeader = 1;
}
+class SuppressInSystemHeader {
+ bit ShowInSystemHeader = 0;
+}
+
// FIXME: ExtWarn and Extension should also be SFINAEFailure by default.
class Error<string str> : Diagnostic<str, CLASS_ERROR, SEV_Error>, SFINAEFailure {
bit ShowInSystemHeader = 1;
// TransformActions
// TODO: Use a custom category name to distinguish rewriter errors.
-def err_mt_message : Error<"[rewriter] %0">;
+def err_mt_message : Error<"[rewriter] %0">, SuppressInSystemHeader;
def warn_mt_message : Warning<"[rewriter] %0">;
def note_mt_message : Note<"[rewriter] %0">;
class TransformActions {
DiagnosticsEngine &Diags;
CapturedDiagList &CapturedDiags;
- bool ReportedErrors;
void *Impl; // TransformActionsImpl.
public:
void reportNote(StringRef note, SourceLocation loc,
SourceRange range = SourceRange());
- bool hasReportedErrors() const { return ReportedErrors; }
+ bool hasReportedErrors() const {
+ return Diags.hasUnrecoverableErrorOccurred();
+ }
class RewriteReceiver {
public:
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);
}
SourceRange range) {
assert(!static_cast<TransformActionsImpl *>(Impl)->isInTransaction() &&
"Errors should be emitted out of a transaction");
-
- SourceManager &SM = static_cast<TransformActionsImpl *>(Impl)
- ->getASTContext()
- .getSourceManager();
- DiagnosticsEngine::Level L = Diags.getDiagnosticLevel(diagId, loc);
- // TODO: Move this check to the caller to ensure consistent note attachments.
- if (L == DiagnosticsEngine::Ignored ||
- SM.isInSystemHeader(SM.getExpansionLoc(loc)))
- return DiagnosticBuilder::getEmpty();
- if (L >= DiagnosticsEngine::Error)
- ReportedErrors = true;
return Diags.Report(loc, diagId) << range;
}