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

A testcase for iwyu crash while analyzing llvm 7+ #601

Conversation

trixirt
Copy link
Contributor

@trixirt trixirt commented Nov 2, 2018

This testcase reproduces a problem with iwyu-ing llvm.
The problem still exists.
I am testing a fix on the clang side.
Irregardless of where the fix happens, a reproducing test is needed.

@trixirt
Copy link
Contributor Author

trixirt commented Nov 9, 2018

No surprise checks are failing.
The 2nd failure is the same one i squashed by fiddling with the tests flags in master-realpath.

@trixirt
Copy link
Contributor Author

trixirt commented Nov 17, 2018

A link to the clang change.
https://reviews.llvm.org/D54047

@kimgr
Copy link
Contributor

kimgr commented Dec 16, 2018

I ran this crash through a debugger, and this actually seems to hit InstantiateImplicitMethods in iwyu.cc, not ParseFunctionTemplates.

So I don't think this has anything to do with late-parsed templates, but rather is a more pressing problem with us trying to force-instantiate implicit ctors/dtors.

@kimgr
Copy link
Contributor

kimgr commented Jul 11, 2019

This is most likely related to #419 (it's crashing on a NULL TUScope with a similar backtrace).

@kimgr
Copy link
Contributor

kimgr commented Oct 27, 2020

This is a good testcase, but we don't have any XFAIL facility in the current infrastructure, so we can never merge it can't merge it until the bug is fixed. It's still referenced from the open bug issue, so available for reference. Closing.

@kimgr kimgr closed this Oct 27, 2020
kimgr added a commit to kimgr/include-what-you-use that referenced this pull request May 23, 2021
In some scenarios when looking up and defining implicit methods, Sema
assumes that its TUScope member is non-null.

It turns out Sema resets TUScope at the end of parsing the translation
unit, so the AST visitors are not expected to need a translation unit
decl scope.

Since our function template parsing and instantiation of implicit
methods triggers quite a lot of Sema code, we've hit quite a few crashes
on this in more complex scenarios with templates.

Explicitly wire TUScope to Sema::getCurScope, to ensure there is a scope
available for lookup and method synthesis.

This fixes examples posted in include-what-you-use#151, include-what-you-use#419, include-what-you-use#601 and include-what-you-use#820.
kimgr added a commit to kimgr/include-what-you-use that referenced this pull request May 23, 2021
In some scenarios when looking up and defining implicit methods, Sema
assumes that its TUScope member is non-null.

It turns out Sema resets TUScope at the end of parsing the translation
unit, so the AST visitors are not expected to need a translation unit
decl scope.

Since our function template parsing and instantiation of implicit
methods triggers quite a lot of Sema code, we've hit quite a few crashes
on this in more complex scenarios with templates.

Explicitly wire TUScope to Sema::getCurScope, to ensure there is a scope
available for lookup and method synthesis.

This fixes examples posted in include-what-you-use#151, include-what-you-use#419, include-what-you-use#601 and include-what-you-use#820.
kimgr added a commit to kimgr/include-what-you-use that referenced this pull request Jun 6, 2021
In some scenarios when looking up and defining implicit methods, Sema
assumes that its TUScope member is non-null.

It turns out Sema resets TUScope at the end of parsing the translation
unit, so the AST visitors are not expected to need a translation unit
decl scope.

Since our function template parsing and instantiation of implicit
methods triggers quite a lot of Sema code, we've hit quite a few crashes
on this in more complex scenarios with templates.

Explicitly wire TUScope to Sema::getCurScope, to ensure there is a scope
available for lookup and method synthesis.

This fixes examples posted in include-what-you-use#151, include-what-you-use#419, include-what-you-use#601 and include-what-you-use#820.
kimgr added a commit to kimgr/include-what-you-use that referenced this pull request Jun 6, 2021
In some scenarios when looking up and defining implicit methods, Sema
assumes that its TUScope member is non-null.

It turns out Sema resets TUScope at the end of parsing the translation
unit, so the AST visitors are not expected to need a translation unit
decl scope.

Since our function template parsing and instantiation of implicit
methods triggers quite a lot of Sema code, we've hit quite a few crashes
on this in more complex scenarios with templates.

Explicitly wire TUScope to Sema::getCurScope, to ensure there is a scope
available for lookup and method synthesis.

This fixes examples posted in include-what-you-use#151, include-what-you-use#419, include-what-you-use#601, include-what-you-use#673 and include-what-you-use#820.

Use minimal repro from include-what-you-use#673 to build a half-hearted testcase.
kimgr added a commit that referenced this pull request Jun 6, 2021
In some scenarios when looking up and defining implicit methods, Sema
assumes that its TUScope member is non-null.

It turns out Sema resets TUScope at the end of parsing the translation
unit, so the AST visitors are not expected to need a translation unit
decl scope.

Since our function template parsing and instantiation of implicit
methods triggers quite a lot of Sema code, we've hit quite a few crashes
on this in more complex scenarios with templates.

Explicitly wire TUScope to Sema::getCurScope, to ensure there is a scope
available for lookup and method synthesis.

This fixes examples posted in #151, #419, #601, #673 and #820.

Use minimal repro from #673 to build a half-hearted testcase.
@kimgr kimgr added this to the iwyu 0.17 milestone Jun 7, 2021
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