clang-tools 17.0.0git
|
Functions | |
Token | getPreviousToken (SourceLocation Location, const SourceManager &SM, const LangOptions &LangOpts, bool SkipComments=true) |
Returns previous token or tok::unknown if not found. | |
SourceLocation | findPreviousTokenStart (SourceLocation Start, const SourceManager &SM, const LangOptions &LangOpts) |
SourceLocation | findPreviousTokenKind (SourceLocation Start, const SourceManager &SM, const LangOptions &LangOpts, tok::TokenKind TK) |
SourceLocation | findNextTerminator (SourceLocation Start, const SourceManager &SM, const LangOptions &LangOpts) |
std::optional< Token > | findNextTokenIncludingComments (SourceLocation Start, const SourceManager &SM, const LangOptions &LangOpts) |
std::optional< Token > | findNextTokenSkippingComments (SourceLocation Start, const SourceManager &SM, const LangOptions &LangOpts) |
bool | rangeContainsExpansionsOrDirectives (SourceRange Range, const SourceManager &SM, const LangOptions &LangOpts) |
Re-lex the provide Range and return false if either a macro spans multiple tokens, a pre-processor directive or failure to retrieve the next token is found, otherwise true . | |
std::optional< Token > | getQualifyingToken (tok::TokenKind TK, CharSourceRange Range, const ASTContext &Context, const SourceManager &SM) |
Assuming that Range spans a CVR-qualified type, returns the token in Range that is responsible for the qualification. | |
static bool | breakAndReturnEnd (const Stmt &S) |
static bool | breakAndReturnEndPlus1Token (const Stmt &S) |
static SourceLocation | getSemicolonAfterStmtEndLoc (const SourceLocation &EndLoc, const SourceManager &SM, const LangOptions &LangOpts) |
SourceLocation | getUnifiedEndLoc (const Stmt &S, const SourceManager &SM, const LangOptions &LangOpts) |
Stmt->getEndLoc does not always behave the same way depending on Token type. | |
template<typename TokenKind , typename... TokenKinds> | |
SourceLocation | findPreviousAnyTokenKind (SourceLocation Start, const SourceManager &SM, const LangOptions &LangOpts, TokenKind TK, TokenKinds... TKs) |
template<typename TokenKind , typename... TokenKinds> | |
SourceLocation | findNextAnyTokenKind (SourceLocation Start, const SourceManager &SM, const LangOptions &LangOpts, TokenKind TK, TokenKinds... TKs) |
|
static |
Definition at line 179 of file LexerUtils.cpp.
Referenced by getUnifiedEndLoc().
|
static |
Definition at line 183 of file LexerUtils.cpp.
Referenced by getUnifiedEndLoc().
SourceLocation clang::tidy::utils::lexer::findNextAnyTokenKind | ( | SourceLocation | Start, |
const SourceManager & | SM, | ||
const LangOptions & | LangOpts, | ||
TokenKind | TK, | ||
TokenKinds... | TKs | ||
) |
Definition at line 64 of file LexerUtils.h.
Referenced by findNextTerminator().
SourceLocation clang::tidy::utils::lexer::findNextTerminator | ( | SourceLocation | Start, |
const SourceManager & | SM, | ||
const LangOptions & | LangOpts | ||
) |
Definition at line 73 of file LexerUtils.cpp.
References findNextAnyTokenKind().
Referenced by clang::tidy::cppcoreguidelines::changePrivateDestructorVisibilityTo(), clang::tidy::performance::TriviallyDestructibleCheck::check(), and clang::tidy::readability::declRanges().
std::optional< Token > clang::tidy::utils::lexer::findNextTokenIncludingComments | ( | SourceLocation | Start, |
const SourceManager & | SM, | ||
const LangOptions & | LangOpts | ||
) |
Definition at line 79 of file LexerUtils.cpp.
Referenced by clang::tidy::modernize::NS::getNamespaceBackRange().
std::optional< Token > clang::tidy::utils::lexer::findNextTokenSkippingComments | ( | SourceLocation | Start, |
const SourceManager & | SM, | ||
const LangOptions & | LangOpts | ||
) |
Definition at line 102 of file LexerUtils.cpp.
Referenced by clang::tidy::modernize::UseEqualsDefaultCheck::check(), clang::tidy::modernize::NS::getCleanedNamespaceFrontRange(), clang::tidy::readability::getNamespaceNameAsWritten(), and getSemicolonAfterStmtEndLoc().
SourceLocation clang::tidy::utils::lexer::findPreviousAnyTokenKind | ( | SourceLocation | Start, |
const SourceManager & | SM, | ||
const LangOptions & | LangOpts, | ||
TokenKind | TK, | ||
TokenKinds... | TKs | ||
) |
Definition at line 40 of file LexerUtils.h.
References findPreviousTokenStart().
Referenced by clang::tidy::utils::fixit::changeReferencee(), and clang::tidy::readability::findStartOfIndirection().
SourceLocation clang::tidy::utils::lexer::findPreviousTokenKind | ( | SourceLocation | Start, |
const SourceManager & | SM, | ||
const LangOptions & | LangOpts, | ||
tok::TokenKind | TK | ||
) |
Definition at line 50 of file LexerUtils.cpp.
References findPreviousTokenStart().
Referenced by clang::tidy::utils::fixit::changePointer(), clang::tidy::readability::declRanges(), and clang::tidy::cppcoreguidelines::findDefaultCaptureEnd().
SourceLocation clang::tidy::utils::lexer::findPreviousTokenStart | ( | SourceLocation | Start, |
const SourceManager & | SM, | ||
const LangOptions & | LangOpts | ||
) |
Definition at line 37 of file LexerUtils.cpp.
Referenced by clang::tidy::readability::declRanges(), findPreviousAnyTokenKind(), findPreviousTokenKind(), and clang::tidy::utils::fixit::skipLParensBackwards().
Token clang::tidy::utils::lexer::getPreviousToken | ( | SourceLocation | Location, |
const SourceManager & | SM, | ||
const LangOptions & | LangOpts, | ||
bool | SkipComments | ||
) |
Returns previous token or tok::unknown
if not found.
Definition at line 16 of file LexerUtils.cpp.
Referenced by clang::tidy::utils::fixit::changeVarDeclToReference(), clang::tidy::bugprone::SuspiciousSemicolonCheck::check(), clang::tidy::readability::DeleteNullPointerCheck::check(), clang::tidy::readability::declRanges(), clang::tidy::bugprone::getCommentsBeforeLoc(), and clang::tidy::utils::fixit::skipLParensBackwards().
std::optional< Token > clang::tidy::utils::lexer::getQualifyingToken | ( | tok::TokenKind | TK, |
CharSourceRange | Range, | ||
const ASTContext & | Context, | ||
const SourceManager & | SM | ||
) |
Assuming that Range
spans a CVR-qualified type, returns the token in Range
that is responsible for the qualification.
Range
must be valid with respect to SM
. Returns std::nullopt
if no qualifying tokens are found.
Definition at line 140 of file LexerUtils.cpp.
Referenced by clang::tidy::readability::AvoidConstParamsInDecls::check(), and clang::tidy::readability::findConstToRemove().
|
static |
Definition at line 189 of file LexerUtils.cpp.
References findNextTokenSkippingComments().
Referenced by getUnifiedEndLoc().
SourceLocation clang::tidy::utils::lexer::getUnifiedEndLoc | ( | const Stmt & | S, |
const SourceManager & | SM, | ||
const LangOptions & | LangOpts | ||
) |
Stmt->getEndLoc does not always behave the same way depending on Token type.
See implementation for exceptions.
Definition at line 226 of file LexerUtils.cpp.
References breakAndReturnEnd(), breakAndReturnEndPlus1Token(), and getSemicolonAfterStmtEndLoc().
Referenced by clang::tidy::modernize::UseEqualsDefaultCheck::check(), and clang::tidy::readability::findEndLocation().
bool clang::tidy::utils::lexer::rangeContainsExpansionsOrDirectives | ( | SourceRange | Range, |
const SourceManager & | SM, | ||
const LangOptions & | LangOpts | ||
) |
Re-lex the provide Range
and return false
if either a macro spans multiple tokens, a pre-processor directive or failure to retrieve the next token is found, otherwise true
.
Definition at line 116 of file LexerUtils.cpp.
Referenced by clang::tidy::modernize::UseEqualsDefaultCheck::check(), and clang::tidy::readability::declRanges().