diff options
author | Chris Lattner <sabre@nondot.org> | 2007-12-12 07:56:42 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-12-12 07:56:42 +0000 |
commit | 30d23e82892162c08a4e673c02a418cc39c9dbd9 (patch) | |
tree | 1fab88306634b08061aa3915881b1496fb00d379 /clang/Driver/RewriteTest.cpp | |
parent | 0f42730722715555e082b854996b01b9b5655720 (diff) | |
download | bcm5719-llvm-30d23e82892162c08a4e673c02a418cc39c9dbd9.tar.gz bcm5719-llvm-30d23e82892162c08a4e673c02a418cc39c9dbd9.zip |
more cleanups changing things like getInstanceVariables to iterators.
llvm-svn: 44930
Diffstat (limited to 'clang/Driver/RewriteTest.cpp')
-rw-r--r-- | clang/Driver/RewriteTest.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/clang/Driver/RewriteTest.cpp b/clang/Driver/RewriteTest.cpp index c8c8f9dd3e2..6edfcb17d75 100644 --- a/clang/Driver/RewriteTest.cpp +++ b/clang/Driver/RewriteTest.cpp @@ -2090,10 +2090,6 @@ void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl, std::string &Result) { ObjcInterfaceDecl *CDecl = IDecl->getClassInterface(); - // Build _objc_ivar_list metadata for classes ivars if needed - int NumIvars = IDecl->getImplDeclNumIvars() > 0 - ? IDecl->getImplDeclNumIvars() - : (CDecl ? CDecl->getNumInstanceVariables() : 0); // Explictly declared @interface's are already synthesized. if (CDecl->ImplicitInterfaceDecl()) { // FIXME: Implementation of a class with no @interface (legacy) doese not @@ -2101,6 +2097,10 @@ void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl, SynthesizeObjcInternalStruct(CDecl, Result); } + // Build _objc_ivar_list metadata for classes ivars if needed + int NumIvars = IDecl->getImplDeclNumIvars() > 0 + ? IDecl->getImplDeclNumIvars() + : (CDecl ? CDecl->getNumInstanceVariables() : 0); if (NumIvars > 0) { static bool objc_ivar = false; if (!objc_ivar) { @@ -2133,28 +2133,33 @@ void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl, "{\n\t"; Result += utostr(NumIvars); Result += "\n"; - - ObjcIvarDecl **Ivars = IDecl->getImplDeclIVars() - ? IDecl->getImplDeclIVars() - : CDecl->getInstanceVariables(); + + ObjcInterfaceDecl::ivar_iterator IVI, IVE; + if (IDecl->getImplDeclNumIvars() > 0) { + IVI = IDecl->ivar_begin(); + IVE = IDecl->ivar_end(); + } else { + IVI = CDecl->ivar_begin(); + IVE = CDecl->ivar_end(); + } Result += "\t,{{\""; - Result += Ivars[0]->getName(); + Result += (*IVI)->getName(); Result += "\", \""; std::string StrEncoding; - Context->getObjcEncodingForType(Ivars[0]->getType(), StrEncoding); + Context->getObjcEncodingForType((*IVI)->getType(), StrEncoding); Result += StrEncoding; Result += "\", "; - SynthesizeIvarOffsetComputation(IDecl, Ivars[0], Result); + SynthesizeIvarOffsetComputation(IDecl, *IVI, Result); Result += "}\n"; - for (int i = 1; i < NumIvars; i++) { + for (++IVI; IVI != IVE; ++IVI) { Result += "\t ,{\""; - Result += Ivars[i]->getName(); + Result += (*IVI)->getName(); Result += "\", \""; std::string StrEncoding; - Context->getObjcEncodingForType(Ivars[i]->getType(), StrEncoding); + Context->getObjcEncodingForType((*IVI)->getType(), StrEncoding); Result += StrEncoding; Result += "\", "; - SynthesizeIvarOffsetComputation(IDecl, Ivars[i], Result); + SynthesizeIvarOffsetComputation(IDecl, (*IVI), Result); Result += "}\n"; } |