clang 8.0.0

Public Types | Public Member Functions | Public Attributes | Friends | List of all members
clang::RawComment Class Reference

`#include "clang/AST/RawCommentList.h"`

Collaboration diagram for clang::RawComment:
[legend]

## 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? More...
void | setAttached ()
bool | isTrailingComment () const LLVM_READONLY
| Returns true if it is a comment that should be put after a member: More...
bool | isAlmostTrailingComment () const LLVM_READONLY
| Returns true if it is a probable typo: More...
bool | isOrdinary () const LLVM_READONLY
| Returns true if this comment is not a documentation comment. More...
bool | isDocumentation () const LLVM_READONLY
| Returns true if this comment any kind of a documentation comment. More...
StringRef | getRawText (const SourceManager &SourceMgr) const
| Returns raw comment text with comment markers. More...
SourceRange | getSourceRange () const LLVM_READONLY
SourceLocation | getBeginLoc () const LLVM_READONLY
SourceLocation | getEndLoc () const LLVM_READONLY
const char * | getBriefText (const ASTContext &Context) const
comments::FullComment * | parse (const ASTContext &Context, const Preprocessor *PP, const Decl *D) const
| Parse the comment, assuming it is attached to decl `D`. More...

## Public Attributes
*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: * * and * * will both turn into: * "This is a first line.\n" * " This is a second line. It is indented.\n" * "This is a third line." */ std::string getFormattedText(const SourceManager &SourceMgr
| Returns sanitized comment text, suitable for presentation in editor UIs. More...
*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 DiagnosticsEngine &Diags | const

## Friends
class | ASTReader

## Detailed Description

Definition at line 28 of file RawCommentList.h.

## Member Enumeration Documentation

## ◆ CommentKind

enum clang::RawComment::CommentKind

Enumerator
RCK_Invalid | Invalid comment.
RCK_OrdinaryBCPL | Any normal BCPL comments.
RCK_OrdinaryC | Any normal C comment.
RCK_BCPLSlash | /// stuff
RCK_BCPLExcl | //! stuff
RCK_JavaDoc | /** stuff */
RCK_Qt | /*! stuff */ , also used by HeaderDoc
RCK_Merged | Two or more documentation comments merged together.

Definition at line 30 of file RawCommentList.h.

## Constructor & Destructor Documentation

## ◆ RawComment() [1/2]

clang::RawComment::RawComment | ( |  | ) |
| inline

Definition at line 41 of file RawCommentList.h.

## ◆ RawComment() [2/2]

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

Definition at line 109 of file RawCommentList.cpp.

References clang::SourceRange::getBegin(), clang::SourceManager::getBufferData(), clang::SourceManager::getDecomposedLoc(), clang::SourceRange::getEnd(), getRawText(), isOrdinaryKind(), onlyWhitespaceOnLineBefore(), clang::CommentOptions::ParseAllComments, RCK_Invalid, and RCK_Merged.

## Member Function Documentation

## ◆ getBeginLoc()

SourceLocation clang::RawComment::getBeginLoc | ( |  | ) | const
| inline

Definition at line 104 of file RawCommentList.h.

Referenced by clang::BeforeThanCompare< RawComment >::operator()().

## ◆ getBriefText()

const char* clang::RawComment::getBriefText | ( | const ASTContext & | Context | ) | const
| inline

Definition at line 107 of file RawCommentList.h.

## ◆ getEndLoc()

SourceLocation clang::RawComment::getEndLoc | ( |  | ) | const
| inline

Definition at line 105 of file RawCommentList.h.

## ◆ getKind()

CommentKind clang::RawComment::getKind | ( |  | ) | const
| inline

Definition at line 46 of file RawCommentList.h.

Referenced by clang::Sema::ActOnComment().

## ◆ getRawText()

StringRef clang::RawComment::getRawText | ( | const SourceManager & | SourceMgr | ) | const
| inline

Returns raw comment text with comment markers.

Definition at line 94 of file RawCommentList.h.

Referenced by parse(), and RawComment().

## ◆ getSourceRange()

SourceRange clang::RawComment::getSourceRange | ( |  | ) | const
| inline

Definition at line 103 of file RawCommentList.h.

Referenced by clang::ASTContext::addComment(), and parse().

## ◆ isAlmostTrailingComment()

bool clang::RawComment::isAlmostTrailingComment | ( |  | ) | const
| inline

Returns true if it is a probable typo:

//< stuff
/*< stuff */

Definition at line 79 of file RawCommentList.h.

Referenced by clang::Sema::ActOnComment().

## ◆ isAttached()

bool clang::RawComment::isAttached | ( |  | ) | const
| inline

Is this comment attached to any declaration?

Definition at line 59 of file RawCommentList.h.

## ◆ isDocumentation()

bool clang::RawComment::isDocumentation | ( |  | ) | const
| inline

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

Definition at line 89 of file RawCommentList.h.

References isInvalid().

Referenced by clang::ASTContext::getRawCommentForAnyRedecl().

## ◆ isInvalid()

bool clang::RawComment::isInvalid | ( |  | ) | const
| inline

Definition at line 50 of file RawCommentList.h.

## ◆ isMerged()

bool clang::RawComment::isMerged | ( |  | ) | const
| inline

Definition at line 54 of file RawCommentList.h.

## ◆ isOrdinary()

bool clang::RawComment::isOrdinary | ( |  | ) | const
| inline

Returns true if this comment is not a documentation comment.

Definition at line 84 of file RawCommentList.h.

## ◆ isTrailingComment()

bool clang::RawComment::isTrailingComment | ( |  | ) | const
| inline

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

///< stuff
//!< stuff
/**< stuff */
/*!< stuff */

Definition at line 72 of file RawCommentList.h.

## ◆ parse()

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 203 of file RawCommentList.cpp.

References clang::ASTContext::getAllocator(), clang::SourceRange::getBegin(), clang::ASTContext::getCommentCommandTraits(), clang::ASTContext::getDiagnostics(), getRawText(), clang::ASTContext::getSourceManager(), and getSourceRange().

Referenced by clang::ASTContext::getCommentForDecl(), and clang::ASTContext::getLocalCommentForDeclUncached().

## ◆ setAttached()

void clang::RawComment::setAttached | ( |  | ) |
| inline

Definition at line 63 of file RawCommentList.h.

## Friends And Related Function Documentation

## ◆ ASTReader

friend class ASTReader
| friend

Definition at line 171 of file RawCommentList.h.

## Member Data Documentation

## ◆ cases

* 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 clang::RawComment::cases

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.

Definition at line 135 of file RawCommentList.h.

## ◆ const

* 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 DiagnosticsEngine& Diags clang::RawComment::const

Definition at line 135 of file RawCommentList.h.

The documentation for this class was generated from the following files:

- include/clang/AST/RawCommentList.h
- lib/AST/RawCommentList.cpp