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