add support for custom client-specific diagnostics. As a testcase, make the
rewriter emit this error if it fails to rewrite an @encode:
t.m:17:9: error: rewriter could not replace sub-expression due to macros
c = ENC(char *)[2] + 4;
^~~~~~~~~~~
... where ENC is: #define ENC @encode
llvm-svn: 44498
diff --git a/clang/Driver/RewriteTest.cpp b/clang/Driver/RewriteTest.cpp
index 808fe98..2073f7e 100644
--- a/clang/Driver/RewriteTest.cpp
+++ b/clang/Driver/RewriteTest.cpp
@@ -867,6 +867,11 @@
SourceLocation(), SourceLocation());
if (Rewrite.ReplaceStmt(Exp, Replacement)) {
// replacement failed.
+ unsigned DiagID = Diags.getCustomDiagID(Diagnostic::Error,
+ "rewriter could not replace sub-expression due to macros");
+ SourceRange Range = Exp->getSourceRange();
+ Diags.Report(Exp->getAtLoc(), DiagID, 0, 0, &Range, 1);
+ delete Replacement;
return Exp;
}