From 5c8897d37df81cb89847bf2acfc61a06cb86cf10 Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Thu, 28 Jun 2012 16:25:36 +0000 Subject: [PATCH] Remove redundant check. llvm-svn: 159355 --- clang/lib/AST/ASTContext.cpp | 2 ++ clang/tools/libclang/CIndex.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 820288eae38b..f208f06111e4 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 250e9e7b2d5d..c7d1523349f1 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 -- GitLab