Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #12567 valueFlowBailoutIncompleteVar with nested enum #6224

Merged
merged 3 commits into from
Apr 3, 2024

Conversation

chrchr-github
Copy link
Collaborator

No description provided.

@chrchr-github chrchr-github marked this pull request as ready for review April 3, 2024 11:11
temp = scope->functionOf->findRecordInNestedList(tok1->str());
if (!temp && scope->functionOf->nestedIn)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need to be added upon the deeper the enum is placed? If yes this should probably be a loop.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you have an example? I'd rather not add something without a test.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just wrap both of them within another struct and/or namespace and see if it is found.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

namespace N {
    struct S1 {
        enum E { E1 } e;
    };
	namespace O {
		struct S2 {
			static void f();
		};
	}
}
void N::O::S2::f() {
    S1 s;
    s.e = S1::E1;
}
if (!temp && scope->functionOf) {
                    temp = scope->functionOf->findRecordInNestedList(tok1->str());
                    const Scope* nested = scope->functionOf->nestedIn;
                    while (!temp && nested) {
                        temp = nested->findRecordInNestedList(tok1->str());
                        nested = nested->nestedIn;
                    }
                }

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's exactly what I was thinking of.

@firewave firewave merged commit edfcc31 into danmar:main Apr 3, 2024
64 checks passed
@chrchr-github chrchr-github deleted the chr_Fix12567 branch April 3, 2024 21:43
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