diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 820288eae38b80f40c91e44084c75463d145e9fd..f208f06111e4597e18b24cf4b40f81deff8444d6 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -155,6 +155,8 @@ const RawComment *ASTContext::getRawCommentForDecl(const Decl *D) const { return Pos->second; const RawComment *RC = getRawCommentForDeclNoCache(D); + // If we found a comment, it should be a documentation comment. + assert(!RC || RC->isDocumentation()); DeclComments[D] = RC; return RC; } diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 250e9e7b2d5dcb096cc7fc66020fbecd9ea83012..c7d1523349f13cb6f499ec2cb541ef35622505f3 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -5715,7 +5715,7 @@ CXString clang_Cursor_getBriefCommentText(CXCursor C) { const ASTContext &Context = getCursorContext(C); const RawComment *RC = Context.getRawCommentForDecl(D); - if (RC && RC->isDocumentation()) { + if (RC) { StringRef BriefText = RC->getBriefText(Context); // Don't duplicate the string because RawComment ensures that this memory