[cfe-commits] r43948 - in /cfe/trunk: Sema/SemaDecl.cpp Sema/SemaType.cpp test/Sema/method-encoding-2.m
Fariborz Jahanian
fjahanian at apple.com
Fri Nov 9 09:18:31 PST 2007
Author: fjahanian
Date: Fri Nov 9 11:18:29 2007
New Revision: 43948
URL: http://llvm.org/viewvc/llvm-project?rev=43948&view=rev
Log:
Insert invisble arguments to method definition header.
Modified:
cfe/trunk/Sema/SemaDecl.cpp
cfe/trunk/Sema/SemaType.cpp
cfe/trunk/test/Sema/method-encoding-2.m
Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=43948&r1=43947&r2=43948&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Fri Nov 9 11:18:29 2007
@@ -1045,9 +1045,26 @@
// Create Decl objects for each parameter, adding them to the FunctionDecl.
llvm::SmallVector<ParmVarDecl*, 16> Params;
+ ParmVarDecl *PDecl;
+ // Insert the invisible arguments!
+ if (MDecl->isInstance())
+ // FIXME: type is wrong.
+ PDecl = new ParmVarDecl(SourceLocation(/*FIXME*/),
+ &Context.Idents.get("self"),
+ Context.getObjcIdType(), VarDecl::None, 0);
+ else
+ PDecl = new ParmVarDecl(SourceLocation(/*FIXME*/),
+ &Context.Idents.get("self"),
+ Context.getObjcIdType(), VarDecl::None, 0);
+ Params.push_back(ObjcParseParamDeclarator(PDecl, FnBodyScope));
+ PDecl = new ParmVarDecl(SourceLocation(/*FIXME*/),
+ &Context.Idents.get("_cmd"),
+ Context.getObjcSelType(), VarDecl::None, 0);
+ Params.push_back(ObjcParseParamDeclarator(PDecl, FnBodyScope));
+
for (int i = 0; i < MDecl->getNumParams(); i++) {
- ParmVarDecl *PDecl = MDecl->getParamDecl(i);
+ PDecl = MDecl->getParamDecl(i);
Params.push_back(ObjcParseParamDeclarator(PDecl, FnBodyScope));
}
Modified: cfe/trunk/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaType.cpp?rev=43948&r1=43947&r2=43948&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaType.cpp (original)
+++ cfe/trunk/Sema/SemaType.cpp Fri Nov 9 11:18:29 2007
@@ -325,13 +325,21 @@
return T;
}
-/// GetTypeForDeclarator - Convert the type for the specified declarator to Type
+/// ObjcGetTypeForDeclarator - Convert the type for the specified declarator to Type
/// instances.
QualType Sema::ObjcGetTypeForDeclarator(DeclTy *D, Scope *S) {
ObjcMethodDecl *MDecl = dyn_cast<ObjcMethodDecl>(static_cast<Decl *>(D));
QualType T = MDecl->getResultType();
llvm::SmallVector<QualType, 16> ArgTys;
+ // Add the first two invisible argument types for self and _cmd.
+ if (MDecl->isInstance())
+ // FIXME: interface-name *
+ ArgTys.push_back(Context.getObjcIdType());
+ else
+ ArgTys.push_back(Context.getObjcIdType());
+ ArgTys.push_back(Context.getObjcSelType());
+
for (int i = 0; i < MDecl->getNumParams(); i++) {
ParmVarDecl *PDecl = MDecl->getParamDecl(i);
QualType ArgTy = PDecl->getType();
Modified: cfe/trunk/test/Sema/method-encoding-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/method-encoding-2.m?rev=43948&r1=43947&r2=43948&view=diff
==============================================================================
--- cfe/trunk/test/Sema/method-encoding-2.m (original)
+++ cfe/trunk/test/Sema/method-encoding-2.m Fri Nov 9 11:18:29 2007
@@ -1,4 +1,5 @@
-// RUN: clang -rewrite-test %s
+// RUN: clang %s
+// TODO: We don't support rewrite of method definitions
@interface Intf
- (in out bycopy id) address:(byref inout void *)location with:(out oneway unsigned **)arg2;
More information about the cfe-commits
mailing list