Author: Zequan Wu Date: 2022-02-09T13:20:45-08:00 New Revision: 48d889079a8a050bb41defd5688e0b213c1c5655
URL: https://github.com/llvm/llvm-project/commit/48d889079a8a050bb41defd5688e0b213c1c5655 DIFF: https://github.com/llvm/llvm-project/commit/48d889079a8a050bb41defd5688e0b213c1c5655.diff LOG: [LLDB][NativePDB] fix that FindSymbolScope never finds scope of a symbol if it doesn't open a scope Added: Modified: lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp index dc0969a0ce7c6..ddc52a6ec9276 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp @@ -118,12 +118,6 @@ static llvm::Optional<PdbCompilandSymId> FindSymbolScope(PdbIndex &index, std::vector<PdbCompilandSymId> scope_stack; while (begin != end) { - if (id.offset == begin.offset()) { - // We have a match! Return the top of the stack - if (scope_stack.empty()) - return llvm::None; - return scope_stack.back(); - } if (begin.offset() > id.offset) { // We passed it. We couldn't even find this symbol record. lldbassert(false && "Invalid compiland symbol id!"); @@ -136,7 +130,7 @@ static llvm::Optional<PdbCompilandSymId> FindSymbolScope(PdbIndex &index, // We can use the end offset of the scope to determine whether or not // we can just outright skip this entire scope. uint32_t scope_end = getScopeEndOffset(*begin); - if (scope_end < id.modi) { + if (scope_end < id.offset) { begin = syms.at(scope_end); } else { // The symbol we're looking for is somewhere in this scope. @@ -147,8 +141,10 @@ static llvm::Optional<PdbCompilandSymId> FindSymbolScope(PdbIndex &index, } ++begin; } - - return llvm::None; + if (scope_stack.empty()) + return llvm::None; + // We have a match! Return the top of the stack + return scope_stack.back(); } static clang::TagTypeKind TranslateUdtKind(const TagRecord &cr) { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits