forked from OSchip/llvm-project
pass diagnostics into the rewrite test client.
llvm-svn: 44468
This commit is contained in:
parent
b10dc27b20
commit
e9c810c87c
|
@ -30,7 +30,7 @@ ASTConsumer *CreateLiveVarAnalyzer();
|
|||
ASTConsumer *CreateDeadStoreChecker(Diagnostic &Diags);
|
||||
ASTConsumer *CreateUnitValsChecker(Diagnostic &Diags);
|
||||
ASTConsumer *CreateLLVMEmitter(Diagnostic &Diags, const LangOptions &Features);
|
||||
ASTConsumer *CreateCodeRewriterTest();
|
||||
ASTConsumer *CreateCodeRewriterTest(Diagnostic &Diags);
|
||||
ASTConsumer *CreateSerializationTest();
|
||||
|
||||
} // end clang namespace
|
||||
|
|
|
@ -27,6 +27,7 @@ using llvm::utostr;
|
|||
namespace {
|
||||
class RewriteTest : public ASTConsumer {
|
||||
Rewriter Rewrite;
|
||||
Diagnostic &Diags;
|
||||
ASTContext *Context;
|
||||
SourceManager *SM;
|
||||
unsigned MainFileID;
|
||||
|
@ -92,6 +93,7 @@ namespace {
|
|||
// Top Level Driver code.
|
||||
virtual void HandleTopLevelDecl(Decl *D);
|
||||
void HandleDeclInMainFile(Decl *D);
|
||||
RewriteTest(Diagnostic &D) : Diags(D) {}
|
||||
~RewriteTest();
|
||||
|
||||
// Syntactic Rewriting.
|
||||
|
@ -160,7 +162,9 @@ namespace {
|
|||
};
|
||||
}
|
||||
|
||||
ASTConsumer *clang::CreateCodeRewriterTest() { return new RewriteTest(); }
|
||||
ASTConsumer *clang::CreateCodeRewriterTest(Diagnostic &Diags) {
|
||||
return new RewriteTest(Diags);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Top Level Driver Code
|
||||
|
@ -860,7 +864,11 @@ Stmt *RewriteTest::RewriteAtEncode(ObjCEncodeExpr *Exp) {
|
|||
Expr *Replacement = new StringLiteral(StrEncoding.c_str(),
|
||||
StrEncoding.length(), false, StrType,
|
||||
SourceLocation(), SourceLocation());
|
||||
Rewrite.ReplaceStmt(Exp, Replacement);
|
||||
if (Rewrite.ReplaceStmt(Exp, Replacement)) {
|
||||
// replacement failed.
|
||||
return Exp;
|
||||
}
|
||||
|
||||
delete Exp;
|
||||
return Replacement;
|
||||
}
|
||||
|
|
|
@ -836,7 +836,7 @@ static void ProcessInputFile(Preprocessor &PP, unsigned MainFileID,
|
|||
break;
|
||||
|
||||
case RewriteTest:
|
||||
Consumer = CreateCodeRewriterTest();
|
||||
Consumer = CreateCodeRewriterTest(PP.getDiagnostics());
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -766,7 +766,6 @@
|
|||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
|
||||
compatibilityVersion = "Xcode 2.4";
|
||||
hasScannedForEncodings = 1;
|
||||
mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
|
||||
projectDirPath = "";
|
||||
|
|
Loading…
Reference in New Issue