class RawComment

Declaration

class RawComment { /* full declaration omitted */ };

Declared at: clang/include/clang/AST/RawCommentList.h:32

Member Variables

private clang::SourceRange Range
private llvm::StringRef RawText
private const char* BriefText
private bool RawTextValid
True if RawText is valid
private bool BriefTextValid
True if BriefText is valid
private unsigned int Kind
private bool IsAttached
True if comment is attached to a declaration in ASTContext.
private bool IsTrailingComment
private bool IsAlmostTrailingComment

Method Overview

  • public RawComment(const clang::SourceManager & SourceMgr, clang::SourceRange SR, const clang::CommentOptions & CommentOpts, bool Merged)
  • public RawComment()
  • private RawComment(clang::SourceRange SR, clang::RawComment::CommentKind K, bool IsTrailingComment, bool IsAlmostTrailingComment)
  • private const char * extractBriefText(const clang::ASTContext & Context) const
  • public clang::SourceLocation getBeginLoc() const
  • public const char * getBriefText(const clang::ASTContext & Context) const
  • public clang::SourceLocation getEndLoc() const
  • public std::vector<CommentLine> getFormattedLines(const clang::SourceManager & SourceMgr, clang::DiagnosticsEngine & Diags) const
  • public std::string getFormattedText(const clang::SourceManager & SourceMgr, clang::DiagnosticsEngine & Diags) const
  • public clang::RawComment::CommentKind getKind() const
  • public llvm::StringRef getRawText(const clang::SourceManager & SourceMgr) const
  • private llvm::StringRef getRawTextSlow(const clang::SourceManager & SourceMgr) const
  • public clang::SourceRange getSourceRange() const
  • public bool isAlmostTrailingComment() const
  • public bool isAttached() const
  • public bool isDocumentation() const
  • public bool isInvalid() const
  • public bool isMerged() const
  • public bool isOrdinary() const
  • public bool isTrailingComment() const
  • public comments::FullComment * parse(const clang::ASTContext & Context, const clang::Preprocessor * PP, const clang::Decl * D) const
  • public void setAttached()

Methods

RawComment(
    const clang::SourceManager& SourceMgr,
    clang::SourceRange SR,
    const clang::CommentOptions& CommentOpts,
    bool Merged)

Declared at: clang/include/clang/AST/RawCommentList.h:47

Parameters

const clang::SourceManager& SourceMgr
clang::SourceRange SR
const clang::CommentOptions& CommentOpts
bool Merged

RawComment()

Declared at: clang/include/clang/AST/RawCommentList.h:45

RawComment(clang::SourceRange SR,
           clang::RawComment::CommentKind K,
           bool IsTrailingComment,
           bool IsAlmostTrailingComment)

Description

Constructor for AST deserialization.

Declared at: clang/include/clang/AST/RawCommentList.h:179

Parameters

clang::SourceRange SR
clang::RawComment::CommentKind K
bool IsTrailingComment
bool IsAlmostTrailingComment

const char* extractBriefText(
    const clang::ASTContext& Context) const

Declared at: clang/include/clang/AST/RawCommentList.h:188

Parameters

const clang::ASTContext& Context

clang::SourceLocation getBeginLoc() const

Declared at: clang/include/clang/AST/RawCommentList.h:108

const char* getBriefText(
    const clang::ASTContext& Context) const

Declared at: clang/include/clang/AST/RawCommentList.h:111

Parameters

const clang::ASTContext& Context

clang::SourceLocation getEndLoc() const

Declared at: clang/include/clang/AST/RawCommentList.h:109

std::vector<CommentLine> getFormattedLines(
    const clang::SourceManager& SourceMgr,
    clang::DiagnosticsEngine& Diags) const

Description

Returns sanitized comment text as separated lines with locations in source, suitable for further processing and rendering requiring source locations.

Declared at: clang/include/clang/AST/RawCommentList.h:154

Parameters

const clang::SourceManager& SourceMgr
clang::DiagnosticsEngine& Diags

std::string getFormattedText(
    const clang::SourceManager& SourceMgr,
    clang::DiagnosticsEngine& Diags) const

Description

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. * This is a second line. It is indented. * This is a third line. */ and /* This is a first line. This is a second line. It is indented. This is a third line. */ will both turn into: "This is a first line.\n" " This is a second line. It is indented.\n" "This is a third line."

Declared at: clang/include/clang/AST/RawCommentList.h:139

Parameters

const clang::SourceManager& SourceMgr
clang::DiagnosticsEngine& Diags

clang::RawComment::CommentKind getKind() const

Declared at: clang/include/clang/AST/RawCommentList.h:50

llvm::StringRef getRawText(
    const clang::SourceManager& SourceMgr) const

Description

Returns raw comment text with comment markers.

Declared at: clang/include/clang/AST/RawCommentList.h:98

Parameters

const clang::SourceManager& SourceMgr

llvm::StringRef getRawTextSlow(
    const clang::SourceManager& SourceMgr) const

Declared at: clang/include/clang/AST/RawCommentList.h:186

Parameters

const clang::SourceManager& SourceMgr

clang::SourceRange getSourceRange() const

Declared at: clang/include/clang/AST/RawCommentList.h:107

bool isAlmostTrailingComment() const

Description

Returns true if it is a probable typo:

Declared at: clang/include/clang/AST/RawCommentList.h:83

bool isAttached() const

Description

Is this comment attached to any declaration?

Declared at: clang/include/clang/AST/RawCommentList.h:63

bool isDocumentation() const

Description

Returns true if this comment any kind of a documentation comment.

Declared at: clang/include/clang/AST/RawCommentList.h:93

bool isInvalid() const

Declared at: clang/include/clang/AST/RawCommentList.h:54

bool isMerged() const

Declared at: clang/include/clang/AST/RawCommentList.h:58

bool isOrdinary() const

Description

Returns true if this comment is not a documentation comment.

Declared at: clang/include/clang/AST/RawCommentList.h:88

bool isTrailingComment() const

Description

Returns true if it is a comment that should be put after a member:

Declared at: clang/include/clang/AST/RawCommentList.h:76

comments::FullComment* parse(
    const clang::ASTContext& Context,
    const clang::Preprocessor* PP,
    const clang::Decl* D) const

Description

Parse the comment, assuming it is attached to decl \c D.

Declared at: clang/include/clang/AST/RawCommentList.h:158

Parameters

const clang::ASTContext& Context
const clang::Preprocessor* PP
const clang::Decl* D

void setAttached()

Declared at: clang/include/clang/AST/RawCommentList.h:67