From 23f4127411d926fc6a1fe9af7c2bf97e653f16eb Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Tue, 11 Mar 2008 18:14:26 +0000 Subject: [PATCH] Make "super" rewrite for class methods C++ friendly (follow-up from last commit). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48235 91177308-0d34-0410-b5e6-96231b3b80d8 --- Driver/RewriteTest.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp index 2b6c08c49a..e00f92dbd3 100644 --- a/Driver/RewriteTest.cpp +++ b/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) { } - 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) { } + 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"; } -- 2.40.0