Skip to content

Commit

Permalink
CXX_METHOD too
Browse files Browse the repository at this point in the history
  • Loading branch information
bkietz committed Nov 4, 2024
1 parent 812b9a3 commit 2b60022
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion cmake_modules/trike/test_trike.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def test_basic(tmp_path):
int foo;
/// beyond available resources
int bar;
/// summed up
int foobar() const { return foo + bar; }
};
/// rEVERSEpASCAL never caught on for some reason
Expand Down Expand Up @@ -104,12 +106,22 @@ def test_basic(tmp_path):
clang_cursor_kind="FIELD_DECL",
),
),
(
trike.DeclarationContext(directive="cpp:function", namespace="baz::Quux"),
"int foobar() const",
trike.Comment(
path,
next_line=25,
text=["/// summed up"],
clang_cursor_kind="CXX_METHOD",
),
),
(
trike.DeclarationContext(directive="cpp:type", namespace="baz"),
"cHAR = char",
trike.Comment(
path,
next_line=27,
next_line=29,
text=["/// rEVERSEpASCAL never caught on for some reason"],
clang_cursor_kind="TYPE_ALIAS_DECL",
),
Expand Down
2 changes: 1 addition & 1 deletion cmake_modules/trike/trike/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def get_documentable_declaration(
# CLASS_TEMPLATE for struct templates. We decide whether to use
# cpp:struct or cpp:class based on the referencing directive.
directive = "cpp:struct"
elif "FUNCTION" in clang_cursor_kind:
elif "FUNCTION" in clang_cursor_kind or clang_cursor_kind == "CXX_METHOD":
directive = "cpp:function"
elif "VAR" in clang_cursor_kind:
directive = "cpp:var"
Expand Down

0 comments on commit 2b60022

Please sign in to comment.