[ExtractAPI] Include virtual keyword for methods (#145412)

This information was being left out of the symbol graph.

rdar://131780883
This commit is contained in:
Prajwal Nadig 2025-06-24 00:10:43 +01:00 committed by GitHub
parent 4b9f7cd856
commit 23b66a68f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -883,6 +883,9 @@ DeclarationFragments DeclarationFragmentsBuilder::getFragmentsForCXXMethod(
if (Method->isVolatile())
Fragments.append("volatile", DeclarationFragments::FragmentKind::Keyword)
.appendSpace();
if (Method->isVirtual())
Fragments.append("virtual", DeclarationFragments::FragmentKind::Keyword)
.appendSpace();
// Build return type
DeclarationFragments After;

View File

@ -45,11 +45,19 @@ class Foo {
// GETCOUNT-NEXT: ]
// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix SETL
void setLength(int length) noexcept;
virtual void setLength(int length) noexcept;
// SETL: "!testRelLabel": "memberOf $ c:@S@Foo@F@setLength#I# $ c:@S@Foo"
// SETL-LABEL: "!testLabel": "c:@S@Foo@F@setLength#I#"
// SETL: "declarationFragments": [
// SETL-NEXT: {
// SETL-NEXT: "kind": "keyword",
// SETL-NEXT: "spelling": "virtual"
// SETL-NEXT: },
// SETL-NEXT: {
// SETL-NEXT: "kind": "text",
// SETL-NEXT: "spelling": " "
// SETL-NEXT: },
// SETL-NEXT: {
// SETL-NEXT: "kind": "typeIdentifier",
// SETL-NEXT: "preciseIdentifier": "c:v",
// SETL-NEXT: "spelling": "void"