From a43ec186a4a1351efd881a2c823773b6d437f9cb Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Sat, 11 Aug 2012 00:51:43 +0000 Subject: Attaching comments to declarations: find comment attached to any redeclaration Not only look for the comment near the declaration itself, but also walk the redeclaration chain: the previous declaration might have had a documentation comment. llvm-svn: 161722 --- clang/tools/libclang/CIndex.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'clang/tools/libclang/CIndex.cpp') diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index b1e4bad14d6..bd27b4cad12 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -5689,7 +5689,7 @@ CXSourceRange clang_Cursor_getCommentRange(CXCursor C) { const Decl *D = getCursorDecl(C); ASTContext &Context = getCursorContext(C); - const RawComment *RC = Context.getRawCommentForDecl(D); + const RawComment *RC = Context.getRawCommentForAnyRedecl(D); if (!RC) return clang_getNullRange(); @@ -5702,7 +5702,7 @@ CXString clang_Cursor_getRawCommentText(CXCursor C) { const Decl *D = getCursorDecl(C); ASTContext &Context = getCursorContext(C); - const RawComment *RC = Context.getRawCommentForDecl(D); + const RawComment *RC = Context.getRawCommentForAnyRedecl(D); StringRef RawText = RC ? RC->getRawText(Context.getSourceManager()) : StringRef(); @@ -5717,7 +5717,7 @@ CXString clang_Cursor_getBriefCommentText(CXCursor C) { const Decl *D = getCursorDecl(C); const ASTContext &Context = getCursorContext(C); - const RawComment *RC = Context.getRawCommentForDecl(D); + const RawComment *RC = Context.getRawCommentForAnyRedecl(D); if (RC) { StringRef BriefText = RC->getBriefText(Context); -- cgit v1.2.3