This fixes a crash when declaring a destructor with a wrong name, then
writing result to pch file and loading it again. The PCH storage uses
DeclarationNameKey as key and it is the same key for both the invalid
destructor and the implicit one that was created because the other one
was invalid. When querying for the Foo::~Foo we end up getting
Foo::~Bar, which is then rejected and we end up with nullptr in
CXXRecordDecl::GetDestructor().
Details
Details
- Reviewers
sammccall - Commits
- rGeed0af6179ca: [clang] Exclude invalid destructors from lookups.
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
addressed review comments
clang/test/PCH/cxx-invalid-destructor.cpp | ||
---|---|---|
3 | We need this, otherwise the PCH file is rejected for containing errors. |
split into separate block, add a comment why