diff options
author | QuietMisdreavus <QuietMisdreavus@users.noreply.github.com> | 2025-03-26 17:46:21 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-26 17:46:21 -0600 |
commit | 3386156b1e8418083e99833d3d22420cf439c039 (patch) | |
tree | 1bc99c12f97d2e3f9c220cf399f04724da67b132 /llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp | |
parent | 78d7dd297f20a7b993ff177d956b0b7446a906f7 (diff) | |
download | llvm-3386156b1e8418083e99833d3d22420cf439c039.zip llvm-3386156b1e8418083e99833d3d22420cf439c039.tar.gz llvm-3386156b1e8418083e99833d3d22420cf439c039.tar.bz2 |
[clang][ExtractAPI] fix a couple crashes when used via libclang (#132297)
This PR fixes two crashes in ExtractAPI that occur when decls are
requested via libclang:
- A null-dereference would sometimes happen in
`DeclarationFragmentsBuilder::getFragmentsForClassTemplateSpecialization`
when the template being processed was loaded indirectly via a typedef,
with parameters filled in. The first commit loads the template parameter
locations ahead of time to perform a null check before dereferencing.
- An assertion (or another null-dereference) was happening in
`CXXRecordDecl::bases` when processing a forward-declaration (i.e. a
record without a definition). The second commit guards the use of
`bases` in `ExtractAPIVisitorBase::getBases` by first checking that the
decl in question has a complete definition.
The added test `extract-api-cursor-cpp` adds tests for these two
scenarios to protect against the crash in the future.
Fixes rdar://140592475, fixes rdar://123430367
Diffstat (limited to 'llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp')
0 files changed, 0 insertions, 0 deletions