diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2012-06-26 20:39:18 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2012-06-26 20:39:18 +0000 |
commit | 2d44d77fed3200e2eff289f55493317e90d3398c (patch) | |
tree | d1d93511e3b05ef54497369d2d0ca603499d2862 /tools/libclang/CIndex.cpp | |
parent | 5283c99365ec4697a5a6bb2b2505469a9aa474d5 (diff) |
Implement a lexer for structured comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159223 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndex.cpp')
-rw-r--r-- | tools/libclang/CIndex.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index df8adb419e..250e9e7b2d 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -5707,6 +5707,24 @@ CXString clang_Cursor_getRawCommentText(CXCursor C) { } // end: extern "C" +CXString clang_Cursor_getBriefCommentText(CXCursor C) { + if (!clang_isDeclaration(C.kind)) + return createCXString((const char *) NULL); + + const Decl *D = getCursorDecl(C); + const ASTContext &Context = getCursorContext(C); + const RawComment *RC = Context.getRawCommentForDecl(D); + + if (RC && RC->isDocumentation()) { + StringRef BriefText = RC->getBriefText(Context); + + // Don't duplicate the string because RawComment ensures that this memory + // will not go away. + return createCXString(BriefText, false); + } + + return createCXString((const char *) NULL); +} //===----------------------------------------------------------------------===// // C++ AST instrospection. |