diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-01 17:14:12 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-01 17:14:12 +0000 |
commit | b9689bb46f5b28f035f24f70e1b165f6b4514425 (patch) | |
tree | 81151cb2754ba96d64c22eebf89d9446250087a0 /clang/lib/AST/ASTContext.cpp | |
parent | fec0992acaf273f1c98c883c822e1db3cda3c9cf (diff) | |
download | bcm5719-llvm-b9689bb46f5b28f035f24f70e1b165f6b4514425.tar.gz bcm5719-llvm-b9689bb46f5b28f035f24f70e1b165f6b4514425.zip |
[libclang] For a class extension, give it a unique USR but for any property or ivar
it contains give it a USR based on its semantic context, which is the interface.
This follows what we already did for objc methods. rdar://10371669
llvm-svn: 143464
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index b695a5b7095..896a80a90f9 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1261,6 +1261,17 @@ void ASTContext::setObjCImplementation(ObjCCategoryDecl *CatD, ObjCImpls[CatD] = ImplD; } +ObjCInterfaceDecl *ASTContext::getObjContainingInterface(NamedDecl *ND) const { + if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(ND->getDeclContext())) + return ID; + if (ObjCCategoryDecl *CD = dyn_cast<ObjCCategoryDecl>(ND->getDeclContext())) + return CD->getClassInterface(); + if (ObjCImplDecl *IMD = dyn_cast<ObjCImplDecl>(ND->getDeclContext())) + return IMD->getClassInterface(); + + return 0; +} + /// \brief Get the copy initialization expression of VarDecl,or NULL if /// none exists. Expr *ASTContext::getBlockVarCopyInits(const VarDecl*VD) { |