[cfe-commits] r43274 - in /cfe/trunk: Driver/RewriteTest.cpp clang.xcodeproj/project.pbxproj
Chris Lattner
clattner at apple.com
Tue Oct 23 17:37:08 PDT 2007
On Oct 23, 2007, at 4:50 PM, Steve Naroff wrote:
> Author: snaroff
> Date: Tue Oct 23 18:50:29 2007
> New Revision: 43274
>
> URL: http://llvm.org/viewvc/llvm-project?rev=43274&view=rev
> Log:
>
> Add some plumbing to rewrite message expressions (still under
> construction).
Ok.
> @@ -28,12 +29,17 @@
> SourceLocation LastIncLoc;
> llvm::SmallVector<ObjcImplementationDecl *, 8>
> ClassImplementation;
> llvm::SmallVector<ObjcCategoryImplDecl *, 8>
> CategoryImplementation;
> +
> + FunctionDecl *MsgSendFunctionDecl;
> + FunctionDecl *GetClassFunctionDecl;
> +
> static const int OBJC_ABI_VERSION =7 ;
> public:
> void Initialize(ASTContext &context, unsigned mainFileID) {
> Context = &context;
> SM = &Context->SourceMgr;
> MainFileID = mainFileID;
> + MsgSendFunctionDecl = 0;
This should probably also init GetClassFunctionDecl to 0.
> @@ -65,6 +72,13 @@
> // If this is for a builtin, ignore it.
> if (Loc.isInvalid()) return;
>
> + // Look for built-in declarations that we need to refer during
> the rewrite.
> + if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
> + if (FD->getIdentifier() == &Context->Idents.get("objc_msgSend"))
> + MsgSendFunctionDecl = FD;
> + else if (FD->getIdentifier() == &Context->Idents.get
> ("objc_getClass"))
> + GetClassFunctionDecl = FD;
two suggestions:
1) just do strcmp on FI->getName()
2) cache the Contents->Idents.get() result.
#1 is simpler and cleaner (eliminates the ivars), the perf win of #2
isn't worth it at this point.
> @@ -113,15 +127,19 @@
>
>
> void RewriteTest::RewriteFunctionBody(Stmt *S) {
> // Otherwise, just rewrite all children.
Please update the comment.
-Chris
More information about the cfe-commits
mailing list