[llvm-branch-commits] [cfe-branch] r125037 - in /cfe/branches/Apple/sill: test/Index/usrs.m tools/libclang/CIndexUSRs.cpp
Daniel Dunbar
daniel at zuster.org
Mon Feb 7 11:59:55 PST 2011
Author: ddunbar
Date: Mon Feb 7 13:59:55 2011
New Revision: 125037
URL: http://llvm.org/viewvc/llvm-project?rev=125037&view=rev
Log:
Merge r124859:
--
Author: Ted Kremenek <kremenek at apple.com>
Date: Fri Feb 4 07:13:40 2011 +0000
USRs for Objective-C methods use the USR of the @interface as their base, not the USR of the class category or extension.
Modified:
cfe/branches/Apple/sill/test/Index/usrs.m
cfe/branches/Apple/sill/tools/libclang/CIndexUSRs.cpp
Modified: cfe/branches/Apple/sill/test/Index/usrs.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/sill/test/Index/usrs.m?rev=125037&r1=125036&r2=125037&view=diff
==============================================================================
--- cfe/branches/Apple/sill/test/Index/usrs.m (original)
+++ cfe/branches/Apple/sill/test/Index/usrs.m Mon Feb 7 13:59:55 2011
@@ -119,13 +119,13 @@
// CHECK: usrs.m c:objc(ext)CWithExt at usrs.m@654 Extent=[57:1 - 59:5]
// CHECK: usrs.m c:objc(cs)CWithExt(im)meth3 Extent=[58:1 - 58:14]
// CHECK: usrs.m c:objc(cy)CWithExt at Bar Extent=[60:1 - 62:5]
-// CHECK: usrs.m c:objc(cy)CWithExt at Bar(im)meth4 Extent=[61:1 - 61:14]
+// CHECK: usrs.m c:objc(cs)CWithExt(im)meth4 Extent=[61:1 - 61:14]
// CHECK: usrs.m c:objc(cs)CWithExt Extent=[63:1 - 67:2]
// CHECK: usrs.m c:objc(cs)CWithExt(im)meth1 Extent=[64:1 - 64:27]
// CHECK: usrs.m c:objc(cs)CWithExt(im)meth2 Extent=[65:1 - 65:27]
// CHECK: usrs.m c:objc(cs)CWithExt(im)meth3 Extent=[66:1 - 66:27]
// CHECK: usrs.m c:objc(cy)CWithExt at Bar Extent=[68:1 - 70:2]
-// CHECK: usrs.m c:objc(cy)CWithExt at Bar(im)meth4 Extent=[69:1 - 69:27]
+// CHECK: usrs.m c:objc(cs)CWithExt(im)meth4 Extent=[69:1 - 69:27]
// CHECK: usrs.m c:@F at aux_1 Extent=[72:6 - 72:26]
// CHECK: usrs.m c:@F at test_multi_declaration Extent=[73:5 - 77:2]
// CHECK: usrs.m c:usrs.m at 980@F at test_multi_declaration@foo Extent=[74:3 - 74:14]
Modified: cfe/branches/Apple/sill/tools/libclang/CIndexUSRs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/sill/tools/libclang/CIndexUSRs.cpp?rev=125037&r1=125036&r2=125037&view=diff
==============================================================================
--- cfe/branches/Apple/sill/tools/libclang/CIndexUSRs.cpp (original)
+++ cfe/branches/Apple/sill/tools/libclang/CIndexUSRs.cpp Mon Feb 7 13:59:55 2011
@@ -283,26 +283,14 @@
}
void USRGenerator::VisitObjCMethodDecl(ObjCMethodDecl *D) {
- Decl *container = cast<Decl>(D->getDeclContext());
-
- // The USR for a method declared in a class extension is based on
+ // The USR for a method declared in a class extension or category is based on
// the ObjCInterfaceDecl, not the ObjCCategoryDecl.
- do {
- if (ObjCCategoryDecl *CD = dyn_cast<ObjCCategoryDecl>(container))
- if (CD->IsClassExtension()) {
- // ID can be null with invalid code.
- if (ObjCInterfaceDecl *ID = CD->getClassInterface()) {
- Visit(ID);
- break;
- }
- // Invalid code. Can't generate USR.
- IgnoreResults = true;
- return;
- }
-
- Visit(container);
+ ObjCInterfaceDecl *ID = D->getClassInterface();
+ if (!ID) {
+ IgnoreResults = true;
+ return;
}
- while (false);
+ Visit(ID);
// Ideally we would use 'GenObjCMethod', but this is such a hot path
// for Objective-C code that we don't want to use
More information about the llvm-branch-commits
mailing list