aboutsummaryrefslogtreecommitdiff
path: root/Driver/RewriteTest.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2007-11-05 17:47:33 +0000
committerFariborz Jahanian <fjahanian@apple.com>2007-11-05 17:47:33 +0000
commit909f02a69786e94d34d34fc8d4ea3e160bcff775 (patch)
tree25b006d09ece34f20cd1973157c137dfe90b6791 /Driver/RewriteTest.cpp
parentaa499b6ab30975d0cea225f71b33e7ee60b88a1f (diff)
Misc. fixes. 1) Resurrect meta-data generation turned off by a previous patch.
2) Fixed a regression in meta-data generation caused by removal of '_interface' prefix from synthesize class name. 3) Added stubs for @try/@catch/@finally statements. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43716 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/RewriteTest.cpp')
-rw-r--r--Driver/RewriteTest.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp
index e253ae8242..e79d830e01 100644
--- a/Driver/RewriteTest.cpp
+++ b/Driver/RewriteTest.cpp
@@ -91,6 +91,9 @@ namespace {
Stmt *RewriteAtSelector(ObjCSelectorExpr *Exp);
Stmt *RewriteMessageExpr(ObjCMessageExpr *Exp);
Stmt *RewriteObjCStringLiteral(ObjCStringLiteral *Exp);
+ Stmt *RewriteObjcTryStmt(ObjcAtTryStmt *S);
+ Stmt *RewriteObjcCatchStmt(ObjcAtCatchStmt *S);
+ Stmt *RewriteObjcFinallyStmt(ObjcAtFinallyStmt *S);
CallExpr *SynthesizeCallToFunctionDecl(FunctionDecl *FD,
Expr **args, unsigned nargs);
void SynthMsgSendFunctionDecl();
@@ -185,6 +188,12 @@ RewriteTest::~RewriteTest() {
// Get the top-level buffer that this corresponds to.
RewriteTabs();
+ // Rewrite Objective-c meta data*
+ std::string ResultStr;
+ WriteObjcMetaData(ResultStr);
+ // For now just print the string out.
+ printf("%s", ResultStr.c_str());
+
// Get the buffer corresponding to MainFileID. If we haven't changed it, then
// we are done.
if (const RewriteBuffer *RewriteBuf =
@@ -404,10 +413,33 @@ Stmt *RewriteTest::RewriteFunctionBody(Stmt *S) {
// Rewrite.ReplaceText(startLoc, 0, messString.c_str(), messString.size());
return RewriteMessageExpr(MessExpr);
}
+
+ if (ObjcAtTryStmt *StmtTry = dyn_cast<ObjcAtTryStmt>(S))
+ return RewriteObjcTryStmt(StmtTry);
+
+ if (ObjcAtCatchStmt *StmtCatch = dyn_cast<ObjcAtCatchStmt>(S))
+ return RewriteObjcCatchStmt(StmtCatch);
+
+ if (ObjcAtFinallyStmt *StmtFinally = dyn_cast<ObjcAtFinallyStmt>(S))
+ return RewriteObjcFinallyStmt(StmtFinally);
+
// Return this stmt unmodified.
return S;
}
+Stmt *RewriteTest::RewriteObjcTryStmt(ObjcAtTryStmt *S) {
+ return 0;
+}
+
+Stmt *RewriteTest::RewriteObjcCatchStmt(ObjcAtCatchStmt *S) {
+ return 0;
+}
+
+Stmt *RewriteTest::RewriteObjcFinallyStmt(ObjcAtFinallyStmt *S) {
+ return 0;
+}
+
+
Stmt *RewriteTest::RewriteAtEncode(ObjCEncodeExpr *Exp) {
// Create a new string expression.
QualType StrType = Context->getPointerType(Context->CharTy);
@@ -1115,7 +1147,7 @@ void RewriteTest::RewriteObjcCategoryImplDecl(ObjcCategoryImplDecl *IDecl,
void RewriteTest::SynthesizeIvarOffsetComputation(ObjcImplementationDecl *IDecl,
ObjcIvarDecl *ivar,
std::string &Result) {
- Result += "offsetof(struct _interface_";
+ Result += "offsetof(struct ";
Result += IDecl->getName();
Result += ", ";
Result += ivar->getName();
@@ -1322,7 +1354,7 @@ void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl,
Result += ",0";
else {
// class has size. Must synthesize its size.
- Result += ",sizeof(struct _interface_";
+ Result += ",sizeof(struct ";
Result += CDecl->getName();
Result += ")";
}