Skip to content

Commit

Permalink
token.h: flagged some functions with RET_NONNULL
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Sep 1, 2024
1 parent 0672a75 commit 3dbfd80
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/token.h
Original file line number Diff line number Diff line change
Expand Up @@ -919,9 +919,9 @@ class CPPCHECKLIB Token {
* @param prepend Insert the new token before this token when it's not
* the first one on the tokens list.
*/
Token* insertToken(const std::string& tokenStr, const std::string& originalNameStr = emptyString, const std::string& macroNameStr = emptyString, bool prepend = false);
RET_NONNULL Token* insertToken(const std::string& tokenStr, const std::string& originalNameStr = emptyString, const std::string& macroNameStr = emptyString, bool prepend = false);

Token* insertTokenBefore(const std::string& tokenStr, const std::string& originalNameStr = emptyString, const std::string& macroNameStr = emptyString)
RET_NONNULL Token* insertTokenBefore(const std::string& tokenStr, const std::string& originalNameStr = emptyString, const std::string& macroNameStr = emptyString)
{
return insertToken(tokenStr, originalNameStr, macroNameStr, true);
}
Expand Down Expand Up @@ -1224,22 +1224,22 @@ class CPPCHECKLIB Token {
/**
* @return the first token of the next argument. Does only work on argument
* lists. Requires that Tokenizer::createLinks2() has been called before.
* Returns 0, if there is no next argument.
* Returns nullptr, if there is no next argument.
*/
const Token* nextArgument() const;
Token *nextArgument();

/**
* @return the first token of the next argument. Does only work on argument
* lists. Should be used only before Tokenizer::createLinks2() was called.
* Returns 0, if there is no next argument.
* Returns nullptr, if there is no next argument.
*/
const Token* nextArgumentBeforeCreateLinks2() const;

/**
* @return the first token of the next template argument. Does only work on template argument
* lists. Requires that Tokenizer::createLinks2() has been called before.
* Returns 0, if there is no next argument.
* Returns nullptr, if there is no next argument.
*/
const Token* nextTemplateArgument() const;

Expand Down Expand Up @@ -1477,14 +1477,14 @@ class CPPCHECKLIB Token {
return nullptr;

}
Token *astTop() {
RET_NONNULL Token *astTop() {
Token *ret = this;
while (ret->mImpl->mAstParent)
ret = ret->mImpl->mAstParent;
return ret;
}

const Token *astTop() const {
RET_NONNULL const Token *astTop() const {
const Token *ret = this;
while (ret->mImpl->mAstParent)
ret = ret->mImpl->mAstParent;
Expand Down

0 comments on commit 3dbfd80

Please sign in to comment.