From 75b0ed9df930bb4965941f9edad0e3bf7f4a3ae3 Mon Sep 17 00:00:00 2001 From: Travis Cardwell Date: Tue, 8 Oct 2024 10:20:42 +0900 Subject: [PATCH] Add VerbatimLineComment API (#26) --- hs-bindgen-libclang/cbits/doxygen_wrappers.h | 8 ++++++++ .../src/HsBindgen/Clang/Doxygen.hs | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/hs-bindgen-libclang/cbits/doxygen_wrappers.h b/hs-bindgen-libclang/cbits/doxygen_wrappers.h index bcbf283b..5899504b 100644 --- a/hs-bindgen-libclang/cbits/doxygen_wrappers.h +++ b/hs-bindgen-libclang/cbits/doxygen_wrappers.h @@ -135,6 +135,14 @@ static inline void wrap_VerbatimBlockLineComment_getText(const CXComment* Commen *result = clang_VerbatimBlockLineComment_getText(*Comment); } +/** + * Comment type 'CXComment_VerbatimLine' + */ + +static inline void wrap_VerbatimLineComment_getText(const CXComment* Comment, CXString* result) { + *result = clang_VerbatimLineComment_getText(*Comment); +} + /** * Comment type 'CXComment_FullComment' */ diff --git a/hs-bindgen-libclang/src/HsBindgen/Clang/Doxygen.hs b/hs-bindgen-libclang/src/HsBindgen/Clang/Doxygen.hs index e69f0230..798229ba 100644 --- a/hs-bindgen-libclang/src/HsBindgen/Clang/Doxygen.hs +++ b/hs-bindgen-libclang/src/HsBindgen/Clang/Doxygen.hs @@ -42,6 +42,8 @@ module HsBindgen.Clang.Doxygen ( , clang_TParamCommandComment_getIndex -- * Comment type 'CXComment_VerbatimBlockLine' , clang_VerbatimBlockLineComment_getText + -- * Comment type 'CXComment_VerbatimLine' + , clang_VerbatimLineComment_getText -- * Comment type 'CXComment_FullComment' , clang_FullComment_getAsHTML , clang_FullComment_getAsXML @@ -427,6 +429,21 @@ clang_VerbatimBlockLineComment_getText comment = onHaskellHeap comment $ \comment' -> preallocate_ $ wrap_VerbatimBlockLineComment_getText comment' +{------------------------------------------------------------------------------- + Comment type 'CXComment_VerbatimLine' +-------------------------------------------------------------------------------} + +foreign import capi unsafe "doxygen_wrappers.h wrap_VerbatimLineComment_getText" + wrap_VerbatimLineComment_getText :: R CXComment_ -> W CXString_ -> IO () + +-- | Get the text contained in the AST node. +-- +-- +clang_VerbatimLineComment_getText :: CXComment -> IO Text +clang_VerbatimLineComment_getText comment = + onHaskellHeap comment $ \comment' -> + preallocate_ $ wrap_VerbatimLineComment_getText comment' + {------------------------------------------------------------------------------- Comment type 'CXComment_FullComment' -------------------------------------------------------------------------------}