Skip to content

Commit d3fc779

Browse files
[clang][ExtractAPI] Ensure that class properties have a kind of "Type Property"
Generated symbol graphs should distinguish between type properties and instance properties. Differential Revision: https://reviews.llvm.org/D130581
1 parent 7f0387d commit d3fc779

File tree

2 files changed

+753
-3
lines changed

2 files changed

+753
-3
lines changed

clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ Object serializeSymbolKind(const APIRecord &Record, Language Lang) {
351351
Kind["displayName"] = "Instance Variable";
352352
break;
353353
case APIRecord::RK_ObjCMethod:
354-
if (dyn_cast<ObjCMethodRecord>(&Record)->IsInstanceMethod) {
354+
if (cast<ObjCMethodRecord>(&Record)->IsInstanceMethod) {
355355
Kind["identifier"] = AddLangPrefix("method");
356356
Kind["displayName"] = "Instance Method";
357357
} else {
@@ -360,8 +360,13 @@ Object serializeSymbolKind(const APIRecord &Record, Language Lang) {
360360
}
361361
break;
362362
case APIRecord::RK_ObjCProperty:
363-
Kind["identifier"] = AddLangPrefix("property");
364-
Kind["displayName"] = "Instance Property";
363+
if (cast<ObjCPropertyRecord>(&Record)->isClassProperty()) {
364+
Kind["identifier"] = AddLangPrefix("type.property");
365+
Kind["displayName"] = "Type Property";
366+
} else {
367+
Kind["identifier"] = AddLangPrefix("property");
368+
Kind["displayName"] = "Instance Property";
369+
}
365370
break;
366371
case APIRecord::RK_ObjCInterface:
367372
Kind["identifier"] = AddLangPrefix("class");

0 commit comments

Comments
 (0)