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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44498 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp
index 808fe98..2073f7e 100644
--- a/Driver/RewriteTest.cpp
+++ b/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;
   }