File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -375,6 +375,8 @@ CPPINTEROP_API bool IsVariable(TCppScope_t scope);
375375// / namespace, variable, or a function).
376376CPPINTEROP_API std::string GetName (TCppScope_t klass);
377377
378+ CPPINTEROP_API std::string GetDocString (TCppScope_t scope);
379+
378380// / This is similar to GetName() function, but besides
379381// / the name, it also gets the template arguments.
380382CPPINTEROP_API std::string GetCompleteName (TCppScope_t klass);
Original file line number Diff line number Diff line change 1212#include " Compatibility.h"
1313
1414#include " clang/AST/Attrs.inc"
15+ #include " clang/AST/Comment.h"
1516#include " clang/AST/CXXInheritance.h"
1617#include " clang/AST/Decl.h"
1718#include " clang/AST/DeclAccessPair.h"
@@ -613,6 +614,15 @@ bool IsVariable(TCppScope_t scope) {
613614 return llvm::isa_and_nonnull<clang::VarDecl>(D);
614615}
615616
617+ std::string GetDocString (TCppScope_t scope) {
618+ auto *D = static_cast <Decl*>(scope);
619+ auto &AST = getASTContext (D);
620+ const clang::RawComment *Comment = AST.getRawCommentForAnyRedecl (D);
621+ if (!Comment)
622+ return " " ;
623+ return Comment->getFormattedText (AST.getSourceManager (), AST.getDiagnostics ());
624+ }
625+
616626std::string GetName (TCppType_t klass) {
617627 auto * D = (clang::NamedDecl*)klass;
618628
You can’t perform that action at this time.
0 commit comments