[cfe-commits] r43716 - /cfe/trunk/Driver/RewriteTest.cpp
Fariborz Jahanian
fjahanian at apple.com
Mon Nov 5 09:47:34 PST 2007
Author: fjahanian
Date: Mon Nov 5 11:47:33 2007
New Revision: 43716
URL: http://llvm.org/viewvc/llvm-project?rev=43716&view=rev
Log:
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.
Modified:
cfe/trunk/Driver/RewriteTest.cpp
Modified: cfe/trunk/Driver/RewriteTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteTest.cpp?rev=43716&r1=43715&r2=43716&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Mon Nov 5 11:47:33 2007
@@ -91,6 +91,9 @@
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 @@
// 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 @@
// 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::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 @@
Result += ",0";
else {
// class has size. Must synthesize its size.
- Result += ",sizeof(struct _interface_";
+ Result += ",sizeof(struct ";
Result += CDecl->getName();
Result += ")";
}
More information about the cfe-commits
mailing list