aboutsummaryrefslogtreecommitdiff
path: root/Driver/RewriteTest.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-12-02 01:09:57 +0000
committerChris Lattner <sabre@nondot.org>2007-12-02 01:09:57 +0000
commit182745ae7892bca0842d9c023370ade5f8d1c6e8 (patch)
tree97b1bd149c792843070cfec3b3ec46381e18a8a3 /Driver/RewriteTest.cpp
parent6f0768bc565028d2536fc41ee0d466c13985a921 (diff)
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
Diffstat (limited to 'Driver/RewriteTest.cpp')
-rw-r--r--Driver/RewriteTest.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp
index 808fe98798..2073f7e391 100644
--- a/Driver/RewriteTest.cpp
+++ b/Driver/RewriteTest.cpp
@@ -867,6 +867,11 @@ Stmt *RewriteTest::RewriteAtEncode(ObjCEncodeExpr *Exp) {
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;
}