[Lldb-commits] [PATCH] D146536: SymbolFile: ensure that we have a value before invoking `getBitWidth`
Saleem Abdulrasool via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 21 09:08:59 PDT 2023
compnerd created this revision.
compnerd added reviewers: rnk, sgraenitz.
Herald added a project: All.
compnerd requested review of this revision.
Herald added a project: LLDB.
Ensure that the variant returned by `member->getValue()` has a value and
is not `Empty`. Failure to do so will trigger an assertion failure in
`llvm::pdb::Variant::getBitWidth()`. This can occur when the `static`
member is a forward declaration.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D146536
Files:
lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
Index: lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -1301,7 +1301,10 @@
auto value = member->getValue();
clang::QualType qual_type = decl->getType();
unsigned type_width = m_ast.getASTContext().getIntWidth(qual_type);
- unsigned constant_width = value.getBitWidth();
+ // If we have an incomplete type, the value may be empty, which will
+ // trigger an assertion failure on `getBitWidth`.
+ unsigned constant_width =
+ value.Type == llvm::pdb::Empty ? - 1 : value.getBitWidth();
if (qual_type->isIntegralOrEnumerationType()) {
if (type_width >= constant_width) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146536.507007.patch
Type: text/x-patch
Size: 842 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230321/6c78ac3f/attachment-0001.bin>
More information about the lldb-commits
mailing list