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(cxx_extractor): don't crash when modules are on #5554

Merged
merged 4 commits into from Apr 5, 2023

Conversation

zrlk
Copy link
Contributor

@zrlk zrlk commented Mar 28, 2023

In service of #5543.

This PR should only affect the behavior of the extractor where it would have either crashed because of a null dereference or due to a CHECK-fail. The conditions leading to these cases occur when modules are turned on.

Copy link
Contributor

@shahms shahms left a comment

Choose a reason for hiding this comment

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

Please add a test for this.

kythe/cxx/extractor/cxx_extractor.cc Outdated Show resolved Hide resolved
kythe/cxx/extractor/cxx_extractor.cc Outdated Show resolved Hide resolved
kythe/cxx/extractor/cxx_extractor.cc Outdated Show resolved Hide resolved
kythe/cxx/extractor/cxx_extractor.cc Outdated Show resolved Hide resolved
@zrlk
Copy link
Contributor Author

zrlk commented Apr 4, 2023

It appears that the OSS Bazel rules don't support header-only modules (the feature this PR is intended to stop exploding). An internal test would probably work; otherwise I think we're looking at a sh test with the cxx_extractor binary (ugh) or a hand-edited xa (ugh). I would be happy to be proven incorrect.

@shahms
Copy link
Contributor

shahms commented Apr 4, 2023

None of the existing extractor integration tests use the Bazel rules or shell, see, for example: https://github.com/kythe/kythe/blob/master/kythe/cxx/extractor/testdata/root_directory_test.cc

Is there some reason that approach won't work here?

@zrlk
Copy link
Contributor Author

zrlk commented Apr 4, 2023

Aha, I had been trying to tie everything together with Bazel (cc_extractor_test/cc_bazel_extractor_test). The approach you suggested should work.

zrlk added 3 commits April 4, 2023 23:12
In service of kythe#5543.

This PR should only affect the behavior of the extractor
where it would have either crashed because of a null
dereference or due to a CHECK-fail. The conditions
leading to these cases occur when modules are turned on.
@zrlk
Copy link
Contributor Author

zrlk commented Apr 5, 2023

OK, the new test hits the new code path. I expect to refine the set of flags as I dig deeper into this. (also ugh -Xclang)

Copy link
Contributor

@shahms shahms left a comment

Choose a reason for hiding this comment

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

Thanks!

@zrlk zrlk merged commit a18df6c into kythe:master Apr 5, 2023
5 checks passed
@zrlk zrlk deleted the extract-modules branch April 5, 2023 17:02
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.

None yet

2 participants