Skip to content

Commit ece5408

Browse files
Add TextComment API (#26)
1 parent d172d23 commit ece5408

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

hs-bindgen-libclang/cbits/doxygen_wrappers.h

+8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ static inline enum CXCommentKind wrap_Comment_getKind(const CXComment* Comment)
1919
return clang_Comment_getKind(*Comment);
2020
}
2121

22+
/**
23+
* Comment type 'CXComment_Text'
24+
*/
25+
26+
static inline void wrap_TextComment_getText(const CXComment* Comment, CXString* result) {
27+
*result = clang_TextComment_getText(*Comment);
28+
}
29+
2230
/**
2331
* Comment type 'CXComment_InlineCommand'
2432
*/

hs-bindgen-libclang/src/HsBindgen/Clang/Doxygen.hs

+17
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ module HsBindgen.Clang.Doxygen (
1313
, CXCommentKind(..)
1414
, clang_Cursor_getParsedComment
1515
, clang_Comment_getKind
16+
-- * Comment type 'CXComment_Text'
17+
, clang_TextComment_getText
1618
-- * Comment type 'CXComment_InlineCommand'
1719
, clang_InlineCommandComment_getCommandName
1820
, clang_InlineCommandComment_getRenderKind
@@ -66,6 +68,21 @@ clang_Comment_getKind comment =
6668
onHaskellHeap comment $ \comment' ->
6769
wrap_Comment_getKind comment'
6870

71+
{-------------------------------------------------------------------------------
72+
Comment type 'CXComment_Text'
73+
-------------------------------------------------------------------------------}
74+
75+
foreign import capi unsafe "doxygen_wrappers.h wrap_TextComment_getText"
76+
wrap_TextComment_getText :: R CXComment_ -> W CXString_ -> IO ()
77+
78+
-- | Get the text contained in the AST node.
79+
--
80+
-- <https://clang.llvm.org/doxygen/group__CINDEX__COMMENT.html#gae9a27e851356181beac36bbff6e638e2>
81+
clang_TextComment_getText :: CXComment -> IO Text
82+
clang_TextComment_getText comment =
83+
onHaskellHeap comment $ \comment' ->
84+
preallocate_ $ wrap_TextComment_getText comment'
85+
6986
{-------------------------------------------------------------------------------
7087
Comment type 'CXComment_InlineCommand'
7188
-------------------------------------------------------------------------------}

0 commit comments

Comments
 (0)