Skip to content

Fix findEnumerator() with nested enum (refs #10045)#5454

Merged
chrchr-github merged 2 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_nestedenum
Sep 18, 2023
Merged

Fix findEnumerator() with nested enum (refs #10045)#5454
chrchr-github merged 2 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_nestedenum

Conversation

@chrchr-github
Copy link
Copy Markdown
Collaborator

No description provided.

@chrchr-github chrchr-github merged commit 10c1ac9 into cppcheck-opensource:main Sep 18, 2023
" enum E { E0 };\n"
"};\n"
"S::S() {\n"
" E e = E::E0;\n"
Copy link
Copy Markdown
Collaborator

@danmar danmar Sep 18, 2023

Choose a reason for hiding this comment

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

@chrchr-github sorry for late review

I fear that your code doesn't handle inner scopes well:

    GET_SYMBOL_DB("struct S {\n"
                  "    S();\n"
                  "    enum E { E0 };\n"
                  "};\n"
                  "S::S() {\n"
                  "    if (x) { E e = E::E0; }\n"
                  "}\n");

The condition you added scope->functionOf && will be false right?

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.

I tried to improve it here: #5459

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.

2 participants