diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-04-23 01:02:12 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-04-23 01:02:12 +0000 |
commit | 653f1b1bf293a9bd96fd4dd6372e779cc7af1597 (patch) | |
tree | 8f4f4bbb5f2d6fa627550d8d8c94d5ec5e059b39 /lib/CodeGen/CGObjCMac.cpp | |
parent | 70e5a14c6076d63833c62d1d6d628c26309897c1 (diff) |
Eliminate the three SmallVectors in ObjCImplDecl (for instance
methods, class methods, and property implementations) and instead
place all of these entities into the DeclContext.
This eliminates more linear walks when looking for class or instance
methods and should make PCH (de-)serialization of ObjCDecls trivial
(and lazy).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69849 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r-- | lib/CodeGen/CGObjCMac.cpp | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index d8ffbbe0de..cf15d2e62c 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -1764,13 +1764,15 @@ void CGObjCMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) { OCD->getNameAsString()); std::vector<llvm::Constant*> InstanceMethods, ClassMethods; - for (ObjCCategoryImplDecl::instmeth_iterator i = OCD->instmeth_begin(), - e = OCD->instmeth_end(); i != e; ++i) { + for (ObjCCategoryImplDecl::instmeth_iterator + i = OCD->instmeth_begin(CGM.getContext()), + e = OCD->instmeth_end(CGM.getContext()); i != e; ++i) { // Instance methods should always be defined. InstanceMethods.push_back(GetMethodConstant(*i)); } - for (ObjCCategoryImplDecl::classmeth_iterator i = OCD->classmeth_begin(), - e = OCD->classmeth_end(); i != e; ++i) { + for (ObjCCategoryImplDecl::classmeth_iterator + i = OCD->classmeth_begin(CGM.getContext()), + e = OCD->classmeth_end(CGM.getContext()); i != e; ++i) { // Class methods should always be defined. ClassMethods.push_back(GetMethodConstant(*i)); } @@ -1865,19 +1867,22 @@ void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) { Flags |= eClassFlags_Hidden; std::vector<llvm::Constant*> InstanceMethods, ClassMethods; - for (ObjCImplementationDecl::instmeth_iterator i = ID->instmeth_begin(), - e = ID->instmeth_end(); i != e; ++i) { + for (ObjCImplementationDecl::instmeth_iterator + i = ID->instmeth_begin(CGM.getContext()), + e = ID->instmeth_end(CGM.getContext()); i != e; ++i) { // Instance methods should always be defined. InstanceMethods.push_back(GetMethodConstant(*i)); } - for (ObjCImplementationDecl::classmeth_iterator i = ID->classmeth_begin(), - e = ID->classmeth_end(); i != e; ++i) { + for (ObjCImplementationDecl::classmeth_iterator + i = ID->classmeth_begin(CGM.getContext()), + e = ID->classmeth_end(CGM.getContext()); i != e; ++i) { // Class methods should always be defined. ClassMethods.push_back(GetMethodConstant(*i)); } - for (ObjCImplementationDecl::propimpl_iterator i = ID->propimpl_begin(), - e = ID->propimpl_end(); i != e; ++i) { + for (ObjCImplementationDecl::propimpl_iterator + i = ID->propimpl_begin(CGM.getContext()), + e = ID->propimpl_end(CGM.getContext()); i != e; ++i) { ObjCPropertyImplDecl *PID = *i; if (PID->getPropertyImplementation() == ObjCPropertyImplDecl::Synthesize) { @@ -4169,20 +4174,23 @@ llvm::GlobalVariable * CGObjCNonFragileABIMac::BuildClassRoTInitializer( std::string MethodListName("\01l_OBJC_$_"); if (flags & CLS_META) { MethodListName += "CLASS_METHODS_" + ID->getNameAsString(); - for (ObjCImplementationDecl::classmeth_iterator i = ID->classmeth_begin(), - e = ID->classmeth_end(); i != e; ++i) { + for (ObjCImplementationDecl::classmeth_iterator + i = ID->classmeth_begin(CGM.getContext()), + e = ID->classmeth_end(CGM.getContext()); i != e; ++i) { // Class methods should always be defined. Methods.push_back(GetMethodConstant(*i)); } } else { MethodListName += "INSTANCE_METHODS_" + ID->getNameAsString(); - for (ObjCImplementationDecl::instmeth_iterator i = ID->instmeth_begin(), - e = ID->instmeth_end(); i != e; ++i) { + for (ObjCImplementationDecl::instmeth_iterator + i = ID->instmeth_begin(CGM.getContext()), + e = ID->instmeth_end(CGM.getContext()); i != e; ++i) { // Instance methods should always be defined. Methods.push_back(GetMethodConstant(*i)); } - for (ObjCImplementationDecl::propimpl_iterator i = ID->propimpl_begin(), - e = ID->propimpl_end(); i != e; ++i) { + for (ObjCImplementationDecl::propimpl_iterator + i = ID->propimpl_begin(CGM.getContext()), + e = ID->propimpl_end(CGM.getContext()); i != e; ++i) { ObjCPropertyImplDecl *PID = *i; if (PID->getPropertyImplementation() == ObjCPropertyImplDecl::Synthesize){ @@ -4466,8 +4474,9 @@ void CGObjCNonFragileABIMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) MethodListName += "INSTANCE_METHODS_" + Interface->getNameAsString() + "_$_" + OCD->getNameAsString(); - for (ObjCCategoryImplDecl::instmeth_iterator i = OCD->instmeth_begin(), - e = OCD->instmeth_end(); i != e; ++i) { + for (ObjCCategoryImplDecl::instmeth_iterator + i = OCD->instmeth_begin(CGM.getContext()), + e = OCD->instmeth_end(CGM.getContext()); i != e; ++i) { // Instance methods should always be defined. Methods.push_back(GetMethodConstant(*i)); } @@ -4480,8 +4489,9 @@ void CGObjCNonFragileABIMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) MethodListName += "CLASS_METHODS_" + Interface->getNameAsString() + "_$_" + OCD->getNameAsString(); Methods.clear(); - for (ObjCCategoryImplDecl::classmeth_iterator i = OCD->classmeth_begin(), - e = OCD->classmeth_end(); i != e; ++i) { + for (ObjCCategoryImplDecl::classmeth_iterator + i = OCD->classmeth_begin(CGM.getContext()), + e = OCD->classmeth_end(CGM.getContext()); i != e; ++i) { // Class methods should always be defined. Methods.push_back(GetMethodConstant(*i)); } |