From 46d1ea40d77aa66527cc48183750710b55d74914 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Tue, 18 Oct 2011 16:50:06 +0000 Subject: [PATCH] [libclang] Since an objc extension semantically continues the interface of the class don't use unique USRs for them, otherwise we fail to associate @implementation methods with the methods in extensions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142361 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Index/usrs.m | 4 ++-- tools/libclang/CIndexUSRs.cpp | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/test/Index/usrs.m b/test/Index/usrs.m index 826abb53f3..a76394b746 100644 --- a/test/Index/usrs.m +++ b/test/Index/usrs.m @@ -118,9 +118,9 @@ int test_multi_declaration(void) { // CHECK: usrs.m c:usrs.m@551@F@local_func@x Extent=[49:23 - 49:28] // CHECK: usrs.m c:objc(cs)CWithExt Extent=[51:1 - 53:5] // CHECK: usrs.m c:objc(cs)CWithExt(im)meth1 Extent=[52:1 - 52:14] -// CHECK: usrs.m c:objc(ext)CWithExt@usrs.m@612 Extent=[54:1 - 56:5] +// CHECK: usrs.m c:objc(cs)CWithExt Extent=[54:1 - 56:5] // CHECK: usrs.m c:objc(cs)CWithExt(im)meth2 Extent=[55:1 - 55:14] -// CHECK: usrs.m c:objc(ext)CWithExt@usrs.m@654 Extent=[57:1 - 59:5] +// CHECK: usrs.m c:objc(cs)CWithExt 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@Bar Extent=[60:1 - 62:5] // CHECK: usrs.m c:objc(cs)CWithExt(im)meth4 Extent=[61:1 - 61:14] diff --git a/tools/libclang/CIndexUSRs.cpp b/tools/libclang/CIndexUSRs.cpp index 195463cbe2..f6e9aa358e 100644 --- a/tools/libclang/CIndexUSRs.cpp +++ b/tools/libclang/CIndexUSRs.cpp @@ -336,11 +336,9 @@ void USRGenerator::VisitObjCContainerDecl(ObjCContainerDecl *D) { IgnoreResults = true; return; } - // Specially handle class extensions, which are anonymous categories. - // We want to mangle in the location to uniquely distinguish them. if (CD->IsClassExtension()) { - Out << "objc(ext)" << ID->getName() << '@'; - GenLoc(CD); + // An extension semantically continues the interface of the class. + GenObjCClass(ID->getName()); } else GenObjCCategory(ID->getName(), CD->getName()); -- 2.40.0