diff options
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 12 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 9 |
2 files changed, 14 insertions, 7 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index dcb53e8c426..afc3aa19598 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -171,6 +171,18 @@ void ObjCInterfaceDecl::addMethods(ObjCMethodDecl **insMethods, } /// addMethods - Insert instance and methods declarations into +/// ObjCInterfaceDecl's InsMethods and ClsMethods fields. +/// +void ObjCInterfaceDecl::addProperties(ObjCPropertyDecl **Properties, + unsigned NumProperties) { + if (NumProperties == 0) return; + + NumPropertyDecl = NumProperties; + PropertyDecl = new ObjCPropertyDecl*[NumProperties]; + memcpy(PropertyDecl, Properties, NumProperties*sizeof(ObjCPropertyDecl*)); +} + +/// addMethods - Insert instance and methods declarations into /// ObjCProtocolDecl's ProtoInsMethods and ProtoClsMethods fields. /// void ObjCProtocolDecl::addMethods(ObjCMethodDecl **insMethods, diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 121004db990..335122ebfa5 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -705,13 +705,8 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclTy *classDecl, // TODO: property declaration in category and protocols. if (pNum != 0) - if (ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(ClassDecl)) { - // FIXME: Move the memory allocation into setPropertyDecls! - ObjCPropertyDecl **properties = new ObjCPropertyDecl*[pNum]; - memcpy(properties, allProperties, pNum*sizeof(ObjCPropertyDecl*)); - IDecl->setPropertyDecls(properties); - IDecl->setNumPropertyDecl(pNum); - } + if (ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(ClassDecl)) + IDecl->addProperties((ObjCPropertyDecl**)allProperties, pNum); for (unsigned i = 0; i < allNum; i++ ) { ObjCMethodDecl *Method = |

