Skip to content

Commit 743d7c9

Browse files
author
git apple-llvm automerger
committed
Merge commit '9e9626b3d5aa' from llvm.org/main into next
2 parents ec7eed3 + 9e9626b commit 743d7c9

File tree

3 files changed

+63
-3
lines changed

3 files changed

+63
-3
lines changed

lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ lldb::ChildCacheState GenericOptionalFrontend::Update() {
7474

7575
if (m_stdlib == StdLib::LibCxx)
7676
engaged_sp = m_backend.GetChildMemberWithName("__engaged_");
77-
else if (m_stdlib == StdLib::LibStdcpp)
78-
engaged_sp = m_backend.GetChildMemberWithName("_M_payload")
79-
->GetChildMemberWithName("_M_engaged");
77+
else if (m_stdlib == StdLib::LibStdcpp) {
78+
if (ValueObjectSP payload = m_backend.GetChildMemberWithName("_M_payload"))
79+
engaged_sp = payload->GetChildMemberWithName("_M_engaged");
80+
}
8081

8182
if (!engaged_sp)
8283
return lldb::ChildCacheState::eRefetch;

lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,9 @@ LibStdcppSharedPtrSyntheticFrontEnd::CalculateNumChildren() {
379379

380380
lldb::ValueObjectSP
381381
LibStdcppSharedPtrSyntheticFrontEnd::GetChildAtIndex(uint32_t idx) {
382+
if (!m_ptr_obj)
383+
return nullptr;
384+
382385
if (idx == 0)
383386
return m_ptr_obj->GetSP();
384387
if (idx == 1) {
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// This smoke test ensures that LLDB doesn't crash when formatting types from MSVC's STL.
2+
// FIXME: LLDB currently has no built-in formatters for MSVC's STL (#24834)
3+
4+
// REQUIRES: target-windows
5+
// RUN: %build --compiler=clang-cl -o %t.exe --std c++20 -- %s
6+
// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "b main" -o "run" -o "fr v" -o c | FileCheck %s
7+
8+
#include <bitset>
9+
#include <coroutine>
10+
#include <deque>
11+
#include <forward_list>
12+
#include <list>
13+
#include <map>
14+
#include <memory>
15+
#include <optional>
16+
#include <set>
17+
#include <string>
18+
#include <tuple>
19+
#include <unordered_map>
20+
#include <unordered_set>
21+
#include <variant>
22+
#include <vector>
23+
24+
int main() {
25+
std::shared_ptr<int> foo;
26+
std::weak_ptr<int> weak = foo;
27+
std::unique_ptr<int> unique(new int(42));
28+
std::optional<int> opt;
29+
std::string str = "str";
30+
std::string longStr = "string that is long enough such that no SSO can happen";
31+
std::wstring wStr = L"wstr";
32+
std::wstring longWStr = L"string that is long enough such that no SSO can happen";
33+
std::tuple<int, bool, float> tuple{1, false, 4.2};
34+
std::coroutine_handle<> coroHandle;
35+
std::bitset<16> bitset(123);
36+
37+
std::map<int, int> map{{1, 2}, {2, 4}, {3, 6}, {4, 8}, {5, 10}};
38+
auto mapIt = map.find(3);
39+
auto mapItEnd = map.find(9);
40+
std::set<int> set{1, 2, 3};
41+
std::multimap<int, int> mMap{{1, 2}, {1, 1}, {2, 4}};
42+
std::multiset<int> mSet{1, 2, 3};
43+
44+
std::variant<int, float, std::string, std::monostate> variant;
45+
std::list<int> list{1, 2, 3};
46+
std::forward_list<int> fwList{1, 2, 3};
47+
48+
std::unordered_map<int, int> uMap{{1, 2}, {2, 4}, {3, 6}};
49+
std::unordered_set<int> uSet{1, 2, 4};
50+
std::unordered_multimap<int, int> uMMap{{1, 2}, {1, 1}, {2, 4}};
51+
std::unordered_multiset<int> uMSet{1, 1, 2};
52+
std::deque<int> deque{1, 2, 3};
53+
std::vector<int> vec{1, 2, 3};
54+
}
55+
56+
// CHECK: Process {{.*}} exited with status = 0 (0x00000000)

0 commit comments

Comments
 (0)