[PATCH] D54047: Check TUScope is valid before use
Kim Gräsman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 7 13:34:15 PDT 2021
kimgr added a comment.
This was eventually fixed in IWYU based on @jkorous' suggestion above. I believe the problem is/was:
- After code is parsed and the AST is built, Sema resets its `TUScope` member to null
- We use Sema to lookup and define default constructors before traversing the AST using a RAV
- Some yet-not-fully-identified constructs cause Sema to need a TUScope for this (something to do with `LazilyCreateBuiltin`, but I haven't been able to construct a reduced testcase)
So in https://github.com/include-what-you-use/include-what-you-use/commit/5e7843434169a8af333305ebd6e1434cc3cffb66, we explicitly re-point `Sema::TUScope` to `Sema::getCurScope()`, which seems to have fixed the crash.
This revision can be closed.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54047/new/
https://reviews.llvm.org/D54047
More information about the cfe-commits
mailing list