Skip to content

Unified checks for unevaluated context#5362

Merged
chrchr-github merged 2 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_uneval
Aug 23, 2023
Merged

Unified checks for unevaluated context#5362
chrchr-github merged 2 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_uneval

Conversation

@chrchr-github
Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread lib/astutils.cpp
bool isUnevaluated(const Token *tok)
{
return Token::Match(tok, "sizeof|typeof|offsetof|decltype|__typeof__ (");
return Token::Match(tok, "alignof|_Alignof|_alignof|__alignof|__alignof__|decltype|offsetof|sizeof|typeid|typeof|__typeof__ (");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be tok->previous() so we can also skip template parameters as well.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will that work at every call site? Do you mean something like x<decltype(y)>?

Copy link
Copy Markdown
Contributor

@pfultz2 pfultz2 Aug 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean something like A<x == y> or A<x + y>.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, but none of the code was even trying to do that, so I'd rather not add it in this PR.

Copy link
Copy Markdown
Collaborator

@danmar danmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@chrchr-github chrchr-github merged commit 8cd6194 into cppcheck-opensource:main Aug 23, 2023
@chrchr-github chrchr-github deleted the chr_uneval branch August 23, 2023 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants