clang 20.0.0git
|
#include "clang/AST/RawCommentList.h"
Classes | |
struct | CommentLine |
Public Types | |
enum | CommentKind { RCK_Invalid , RCK_OrdinaryBCPL , RCK_OrdinaryC , RCK_BCPLSlash , RCK_BCPLExcl , RCK_JavaDoc , RCK_Qt , RCK_Merged } |
Public Member Functions | |
RawComment () | |
RawComment (const SourceManager &SourceMgr, SourceRange SR, const CommentOptions &CommentOpts, bool Merged) | |
CommentKind | getKind () const LLVM_READONLY |
bool | isInvalid () const LLVM_READONLY |
bool | isMerged () const LLVM_READONLY |
bool | isAttached () const LLVM_READONLY |
Is this comment attached to any declaration? | |
void | setAttached () |
bool | isTrailingComment () const LLVM_READONLY |
Returns true if it is a comment that should be put after a member: | |
bool | isAlmostTrailingComment () const LLVM_READONLY |
Returns true if it is a probable typo: | |
bool | isOrdinary () const LLVM_READONLY |
Returns true if this comment is not a documentation comment. | |
bool | isDocumentation () const LLVM_READONLY |
Returns true if this comment any kind of a documentation comment. | |
StringRef | getRawText (const SourceManager &SourceMgr) const |
Returns raw comment text with comment markers. | |
SourceRange | getSourceRange () const LLVM_READONLY |
SourceLocation | getBeginLoc () const LLVM_READONLY |
SourceLocation | getEndLoc () const LLVM_READONLY |
const char * | getBriefText (const ASTContext &Context) const |
bool | hasUnsupportedSplice (const SourceManager &SourceMgr) const |
std::string | getFormattedText (const SourceManager &SourceMgr, DiagnosticsEngine &Diags) const |
Returns sanitized comment text, suitable for presentation in editor UIs. | |
std::vector< CommentLine > | getFormattedLines (const SourceManager &SourceMgr, DiagnosticsEngine &Diags) const |
Returns sanitized comment text as separated lines with locations in source, suitable for further processing and rendering requiring source locations. | |
comments::FullComment * | parse (const ASTContext &Context, const Preprocessor *PP, const Decl *D) const |
Parse the comment, assuming it is attached to decl D . | |
Friends | |
class | ASTReader |
Definition at line 32 of file RawCommentList.h.
Definition at line 34 of file RawCommentList.h.
|
inline |
Definition at line 45 of file RawCommentList.h.
RawComment::RawComment | ( | const SourceManager & | SourceMgr, |
SourceRange | SR, | ||
const CommentOptions & | CommentOpts, | ||
bool | Merged | ||
) |
Definition at line 108 of file RawCommentList.cpp.
References clang::SourceRange::getBegin(), clang::SourceManager::getBufferData(), clang::SourceManager::getDecomposedLoc(), clang::SourceRange::getEnd(), getRawText(), clang::Invalid, isOrdinaryKind(), onlyWhitespaceOnLineBefore(), clang::CommentOptions::ParseAllComments, RCK_Invalid, and RCK_Merged.
|
inline |
Definition at line 108 of file RawCommentList.h.
References clang::SourceRange::getBegin().
Referenced by clang::RawCommentList::addComment().
|
inline |
Definition at line 111 of file RawCommentList.h.
|
inline |
Definition at line 109 of file RawCommentList.h.
References clang::SourceRange::getEnd().
Referenced by clang::RawCommentList::addComment().
std::vector< RawComment::CommentLine > RawComment::getFormattedLines | ( | const SourceManager & | SourceMgr, |
DiagnosticsEngine & | Diags | ||
) | const |
Returns sanitized comment text as separated lines with locations in source, suitable for further processing and rendering requiring source locations.
Definition at line 376 of file RawCommentList.cpp.
References Begin, clang::comments::tok::eof, clang::comments::Token::getLocation(), clang::SourceLocation::getLocWithOffset(), clang::SourceManager::getPresumedLoc(), getRawText(), getSourceRange(), clang::comments::Lexer::getSpelling(), clang::SourceManager::getSpellingColumnNumber(), clang::comments::Token::is(), clang::comments::Token::isNot(), clang::comments::Lexer::lex(), clang::Line, Loc, clang::comments::tok::newline, and clang::Result.
Referenced by getFormattedText(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::recordEnumConstants(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::recordObjCInstanceVariables(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::recordObjCMethods(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::recordObjCProperties(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitClassTemplatePartialSpecializationDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitClassTemplateSpecializationDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitConceptDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitCXXConstructorDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitCXXConversionDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitCXXDestructorDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitCXXMethodDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitCXXRecordDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitEnumDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitFieldDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitFunctionDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitFunctionTemplateDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitNamespaceDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitObjCCategoryDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitObjCInterfaceDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitObjCProtocolDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitRecordDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitTypedefNameDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitVarDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitVarTemplateDecl(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitVarTemplatePartialSpecializationDecl(), and clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::VisitVarTemplateSpecializationDecl().
std::string RawComment::getFormattedText | ( | const SourceManager & | SourceMgr, |
DiagnosticsEngine & | Diags | ||
) | const |
Returns sanitized comment text, suitable for presentation in editor UIs.
E.g. will transform: // This is a long multiline comment. // Parts of it might be indented. /* The comments styles might be mixed. */ into "This is a long multiline comment.\n" " Parts of it might be indented.\n" "The comments styles might be mixed." Also removes leading indentation and sanitizes some common cases: /* This is a first line.
Definition at line 358 of file RawCommentList.cpp.
References getFormattedLines(), getRawText(), clang::Line, and clang::Result.
|
inline |
Definition at line 50 of file RawCommentList.h.
Referenced by clang::Sema::ActOnComment(), and clang::RawCommentList::addComment().
|
inline |
Returns raw comment text with comment markers.
Definition at line 98 of file RawCommentList.h.
Referenced by getFormattedLines(), getFormattedText(), hasUnsupportedSplice(), parse(), and RawComment().
|
inline |
Definition at line 107 of file RawCommentList.h.
Referenced by clang::ASTContext::addComment(), getFormattedLines(), and parse().
|
inline |
Definition at line 118 of file RawCommentList.h.
References getRawText(), isInvalid(), and Text.
Referenced by clang::Sema::ActOnComment().
|
inline |
Returns true if it is a probable typo:
Definition at line 83 of file RawCommentList.h.
Referenced by clang::Sema::ActOnComment().
|
inline |
Is this comment attached to any declaration?
Definition at line 63 of file RawCommentList.h.
|
inline |
Returns true if this comment any kind of a documentation comment.
Definition at line 93 of file RawCommentList.h.
References isInvalid(), and isOrdinary().
Referenced by clang::ASTContext::cacheRawCommentForDecl(), and clang::ASTContext::getRawCommentForDeclNoCacheImpl().
|
inline |
Definition at line 54 of file RawCommentList.h.
References RCK_Invalid.
Referenced by clang::RawCommentList::addComment(), hasUnsupportedSplice(), and isDocumentation().
|
inline |
Definition at line 58 of file RawCommentList.h.
References RCK_Merged.
|
inline |
Returns true if this comment is not a documentation comment.
Definition at line 88 of file RawCommentList.h.
References RCK_OrdinaryBCPL, and RCK_OrdinaryC.
Referenced by clang::RawCommentList::addComment(), and isDocumentation().
|
inline |
Returns true if it is a comment that should be put after a member:
Definition at line 76 of file RawCommentList.h.
Referenced by clang::RawCommentList::addComment(), and clang::ASTContext::getRawCommentForDeclNoCacheImpl().
comments::FullComment * RawComment::parse | ( | const ASTContext & | Context, |
const Preprocessor * | PP, | ||
const Decl * | D | ||
) | const |
Parse the comment, assuming it is attached to decl D
.
Definition at line 202 of file RawCommentList.cpp.
References D, clang::ASTContext::getAllocator(), clang::ASTContext::getCommentCommandTraits(), clang::ASTContext::getDiagnostics(), getRawText(), clang::ASTContext::getSourceManager(), getSourceRange(), and P.
Referenced by clang::ASTContext::getCommentForDecl(), and clang::ASTContext::getLocalCommentForDeclUncached().
|
inline |
Definition at line 67 of file RawCommentList.h.
|
friend |
Definition at line 207 of file RawCommentList.h.