This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Fix crash when looking up type coming from the ClangModuleDeclVendor
ClosedPublic

Authored by teemperor on Jul 19 2019, 6:28 AM.

Details

Summary

We assume in LLDB that every type comes from an ASTContext with an associated ClangASTContext.
However the types inside the ClangModuleDeclVendor don't have a ClangASTContext so we end up
crashing whenever we create a CompilerType for one of these types.

Simplest way to trigger this bug is to just look up NSObject from a module:

(lldb) expr @import Foundation
(lldb) type lookup NSObject                                                                                                                                                                                                                                                                
Assertion failed: (m_type_system != nullptr), function CompilerType, file /Users/teemperor/llvm1/llvm-project/lldb/source/Symbol/CompilerType.cpp, line 39.

This patch just creates a ClangASTContext for the ASTContext used by ClangModuleDeclVendor.

Diff Detail

Repository
rL LLVM

Event Timeline

teemperor created this revision.Jul 19 2019, 6:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 19 2019, 6:28 AM
davide accepted this revision.Jul 19 2019, 3:48 PM

No brainer.

This revision is now accepted and ready to land.Jul 19 2019, 3:48 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2019, 3:33 AM