Skip to content

Commit 1b025ba

Browse files
committed
ModuleObjcMessageTrace: specify whether the owning context is an interface or category
1 parent b1fa3e6 commit 1b025ba

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/FrontendTool/LoadedModuleTrace.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,14 @@ class ObjcMethodReferenceCollector: public SourceEntityWalker {
838838
else
839839
return "method";
840840
}
841+
static StringRef selectMethodOwnerKey(const clang::NamedDecl* clangD) {
842+
assert(clangD);
843+
if (isa<clang::ObjCInterfaceDecl>(clangD))
844+
return "interface_type";
845+
if (isa<clang::ObjCCategoryDecl>(clangD))
846+
return "category_type";
847+
return "type";
848+
}
841849
public:
842850
void setFileBeforeVisiting(SourceFile *SF) {
843851
assert(SF && "need to visit actual source files");
@@ -857,7 +865,7 @@ class ObjcMethodReferenceCollector: public SourceEntityWalker {
857865
->getParent())) {
858866
auto pName = parent->getName();
859867
if (!pName.empty())
860-
out.attribute("type", pName);
868+
out.attribute(selectMethodOwnerKey(parent), pName);
861869
}
862870
out.attribute(selectMethodKey(clangD), clangD->getNameAsString());
863871
out.attribute("declared_at", Loc.printToString(SM));

test/IDE/objc_send_collector.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ public func testProperties(_ x: FooClassBase) {
1616
// CHECK-DAG: "instance_method": "fooBaseInstanceFunc0"
1717
// CHECK-DAG: "instance_method": "fooBaseInstanceFunc1:"
1818
// CHECK-DAG: "class_method": "fooBaseClassFunc0"
19-
// CHECK-DAG: "type": "FooClassBase"
19+
// CHECK-DAG: "interface_type": "FooClassBase"
2020
// CHECK-DAG: "declared_at": "SOURCE_DIR/test/IDE/Inputs/mock-sdk/Foo.framework/Headers/Foo.h
2121
// CHECK-DAG: "referenced_at": "SOURCE_DIR/test/IDE/objc_send_collector.swift"

0 commit comments

Comments
 (0)