File tree Expand file tree Collapse file tree 2 files changed +6
-17
lines changed Expand file tree Collapse file tree 2 files changed +6
-17
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ add_dependencies(type_graph libdrgn)
24
24
target_link_libraries (type_graph
25
25
container_info
26
26
symbol_service
27
+ Boost::headers
27
28
28
29
LLDB
29
30
"-L${DRGN_PATH} /.libs"
Original file line number Diff line number Diff line change 15
15
*/
16
16
#include " LLDBParser.h"
17
17
18
+ #include < boost/scope_exit.hpp>
18
19
#include < glog/logging.h>
19
20
#include < lldb/API/LLDB.h>
20
21
@@ -68,26 +69,13 @@ Type& LLDBParser::parse(lldb::SBType& root) {
68
69
return enumerateType (root);
69
70
}
70
71
71
- struct DepthGuard {
72
- explicit DepthGuard (int & depth) : depth_(depth) {
73
- ++depth_;
74
- }
75
- ~DepthGuard () {
76
- --depth_;
77
- }
78
-
79
- private:
80
- int & depth_;
81
- };
82
-
83
72
Type& LLDBParser::enumerateType (lldb::SBType& type) {
84
73
// Avoid re-enumerating an already-processsed type
85
74
if (auto it = lldb_types_.find (type); it != lldb_types_.end ())
86
75
return it->second ;
87
76
88
- DepthGuard guard (depth_);
89
-
90
- bool isTypeIncomplete = !type.IsTypeComplete ();
77
+ ++depth_;
78
+ BOOST_SCOPE_EXIT_ALL (&) { --depth_; };
91
79
92
80
std::optional<std::reference_wrapper<Type>> t;
93
81
try {
@@ -128,11 +116,11 @@ Type& LLDBParser::enumerateType(lldb::SBType& type) {
128
116
throw LLDBParserError{" Unhandled type class: " + std::to_string (kind)};
129
117
}
130
118
} catch (const LLDBParserError& e) {
131
- if (!isTypeIncomplete )
119
+ if (type. IsTypeComplete () )
132
120
throw ;
133
121
}
134
122
135
- if (isTypeIncomplete ) {
123
+ if (!type. IsTypeComplete () ) {
136
124
return makeType<Incomplete>(type, *t);
137
125
}
138
126
You can’t perform that action at this time.
0 commit comments