[cfe-dev] Objective-C tidy up
Chris Lattner
clattner at apple.com
Mon Jun 2 23:33:30 PDT 2008
On Jun 1, 2008, at 10:07 AM, David Chisnall wrote:
> Hi,
>
> Here's the next installment of my ObjC changes. This is fairly
> minor, although the diff is quite large. The biggest change is that
> I've moved common code used to generate Objective-C methods and C
> functions out into a separate method in CodeGenFunction and I've
> moved GenerateObjCMethod from CodeGenFunction.cpp into CGObjC.cpp
> where it should probably have been from the start.
>
> This diff also includes small changes to Sema to make self and _cmd
> implicit parameters. At some point, I imagine these will be pulled
> out into a superclass for method decls that can be used for both
> Objective-C and C++ methods.
Why should self and _cmd be ParmVarDecls? Shouldn't they be
PredefinedExprs?
+++ include/clang/AST/DeclObjC.h (working copy)
@@ -91,7 +91,8 @@
// The following are only used for method definitions, null
otherwise.
// FIXME: space savings opportunity, consider a sub-class.
Stmt *Body;
- ParmVarDecl *SelfDecl;
+ // Decls for implicit parameters
+ llvm::SmallVector<ParmVarDecl *, 2> ImplicitParamInfo;
If there are always exactly two of these, just use:
ParmVarDecl *ImplicitParamInfo[2];
Otherwise, looks reasonable to me if it causes no testsuite regressions.
-Chris
More information about the cfe-dev
mailing list