summaryrefslogtreecommitdiffstats
path: root/clang/Driver/RewriteTest.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-03-11 18:14:26 +0000
committerSteve Naroff <snaroff@apple.com>2008-03-11 18:14:26 +0000
commit0b844f053f36d70e57a8831b8e9368ceee7744df (patch)
tree875f7146da4ae9f66a317447af824d2f233b0dde /clang/Driver/RewriteTest.cpp
parente5605568aed396b9ec4fb0eb223cd2e609b40845 (diff)
downloadbcm5719-llvm-0b844f053f36d70e57a8831b8e9368ceee7744df.tar.gz
bcm5719-llvm-0b844f053f36d70e57a8831b8e9368ceee7744df.zip
Make "super" rewrite for class methods C++ friendly (follow-up from last commit).
llvm-svn: 48235
Diffstat (limited to 'clang/Driver/RewriteTest.cpp')
-rw-r--r--clang/Driver/RewriteTest.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/clang/Driver/RewriteTest.cpp b/clang/Driver/RewriteTest.cpp
index 2b6c08c49a7..e00f92dbd3d 100644
--- a/clang/Driver/RewriteTest.cpp
+++ b/clang/Driver/RewriteTest.cpp
@@ -1878,13 +1878,22 @@ Stmt *RewriteTest::SynthMessageExpr(ObjCMessageExpr *Exp) {
Cls, SourceLocation())); // set 'super class', using objc_getClass().
// struct objc_super
QualType superType = getSuperStructType();
+ Expr *SuperRep;
- // (struct objc_super) { <exprs from above> }
- InitListExpr *ILE = new InitListExpr(SourceLocation(),
- &InitExprs[0], InitExprs.size(),
- SourceLocation());
- CompoundLiteralExpr *SuperRep = new CompoundLiteralExpr(SourceLocation(),
- superType, ILE, false);
+ if (LangOpts.Microsoft) {
+ SynthSuperContructorFunctionDecl();
+ // Simulate a contructor call...
+ DeclRefExpr *DRE = new DeclRefExpr(SuperContructorFunctionDecl,
+ superType, SourceLocation());
+ SuperRep = new CallExpr(DRE, &InitExprs[0], InitExprs.size(),
+ superType, SourceLocation());
+ } else {
+ // (struct objc_super) { <exprs from above> }
+ InitListExpr *ILE = new InitListExpr(SourceLocation(),
+ &InitExprs[0], InitExprs.size(),
+ SourceLocation());
+ SuperRep = new CompoundLiteralExpr(SourceLocation(), superType, ILE, false);
+ }
// struct objc_super *
Expr *Unop = new UnaryOperator(SuperRep, UnaryOperator::AddrOf,
Context->getPointerType(SuperRep->getType()),
@@ -2753,7 +2762,7 @@ void RewriteTest::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
// 'info' field is initialized to CLS_META(2) for metaclass
Result += ", 0,2, sizeof(struct _objc_class), 0";
if (IDecl->getNumClassMethods() > 0) {
- Result += "\n\t, &_OBJC_CLASS_METHODS_";
+ Result += "\n\t, (struct _objc_method_list *)&_OBJC_CLASS_METHODS_";
Result += IDecl->getName();
Result += "\n";
}
OpenPOWER on IntegriCloud