[cfe-commits] r44468 - in /cfe/trunk: Driver/ASTConsumers.h Driver/RewriteTest.cpp Driver/clang.cpp clang.xcodeproj/project.pbxproj
Chris Lattner
sabre at nondot.org
Fri Nov 30 14:25:38 PST 2007
Author: lattner
Date: Fri Nov 30 16:25:36 2007
New Revision: 44468
URL: http://llvm.org/viewvc/llvm-project?rev=44468&view=rev
Log:
pass diagnostics into the rewrite test client.
Modified:
cfe/trunk/Driver/ASTConsumers.h
cfe/trunk/Driver/RewriteTest.cpp
cfe/trunk/Driver/clang.cpp
cfe/trunk/clang.xcodeproj/project.pbxproj
Modified: cfe/trunk/Driver/ASTConsumers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/ASTConsumers.h?rev=44468&r1=44467&r2=44468&view=diff
==============================================================================
--- cfe/trunk/Driver/ASTConsumers.h (original)
+++ cfe/trunk/Driver/ASTConsumers.h Fri Nov 30 16:25:36 2007
@@ -30,7 +30,7 @@
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
Modified: cfe/trunk/Driver/RewriteTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteTest.cpp?rev=44468&r1=44467&r2=44468&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Fri Nov 30 16:25:36 2007
@@ -27,6 +27,7 @@
namespace {
class RewriteTest : public ASTConsumer {
Rewriter Rewrite;
+ Diagnostic &Diags;
ASTContext *Context;
SourceManager *SM;
unsigned MainFileID;
@@ -92,6 +93,7 @@
// 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 @@
};
}
-ASTConsumer *clang::CreateCodeRewriterTest() { return new RewriteTest(); }
+ASTConsumer *clang::CreateCodeRewriterTest(Diagnostic &Diags) {
+ return new RewriteTest(Diags);
+}
//===----------------------------------------------------------------------===//
// Top Level Driver Code
@@ -860,7 +864,11 @@
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;
}
Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=44468&r1=44467&r2=44468&view=diff
==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Fri Nov 30 16:25:36 2007
@@ -836,7 +836,7 @@
break;
case RewriteTest:
- Consumer = CreateCodeRewriterTest();
+ Consumer = CreateCodeRewriterTest(PP.getDiagnostics());
break;
}
Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=44468&r1=44467&r2=44468&view=diff
==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Fri Nov 30 16:25:36 2007
@@ -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 = "";
More information about the cfe-commits
mailing list