From: Dmitri Gribenko Date: Thu, 28 Jun 2012 16:25:36 +0000 (+0000) Subject: Remove redundant check. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8376f5934a18b950ac7323d8a38ed231623010fa;p=clang Remove redundant check. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159355 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 820288eae3..f208f06111 100644 --- a/lib/AST/ASTContext.cpp +++ b/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/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 250e9e7b2d..c7d1523349 100644 --- a/tools/libclang/CIndex.cpp +++ b/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