Skip to content

Commit c0a9722

Browse files
[lldb][NFC] Move some ctors and tors to cpp files (#67165)
This prevents undefined vtable errors when linking these libraries from out-of-tree. I'm facing this issue as I work on my new language plugin.
1 parent 8b2290d commit c0a9722

File tree

4 files changed

+41
-20
lines changed

4 files changed

+41
-20
lines changed

lldb/include/lldb/Core/UserSettingsController.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ namespace lldb_private {
3232

3333
class Properties {
3434
public:
35-
Properties() = default;
35+
Properties();
3636

37-
Properties(const lldb::OptionValuePropertiesSP &collection_sp)
38-
: m_collection_sp(collection_sp) {}
37+
Properties(const lldb::OptionValuePropertiesSP &collection_sp);
3938

40-
virtual ~Properties() = default;
39+
virtual ~Properties();
4140

4241
virtual lldb::OptionValuePropertiesSP GetValueProperties() const {
4342
// This function is virtual in case subclasses want to lazily implement

lldb/include/lldb/Symbol/Function.h

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ using CallSiteParameterArray = llvm::SmallVector<CallSiteParameter, 0>;
267267
class CallEdge {
268268
public:
269269
enum class AddrType : uint8_t { Call, AfterCall };
270-
virtual ~CallEdge() = default;
270+
~CallEdge();
271271

272272
/// Get the callee's definition.
273273
///
@@ -305,10 +305,7 @@ class CallEdge {
305305

306306
protected:
307307
CallEdge(AddrType caller_address_type, lldb::addr_t caller_address,
308-
bool is_tail_call, CallSiteParameterArray &&parameters)
309-
: caller_address(caller_address),
310-
caller_address_type(caller_address_type), is_tail_call(is_tail_call),
311-
parameters(std::move(parameters)) {}
308+
bool is_tail_call, CallSiteParameterArray &&parameters);
312309

313310
/// Helper that finds the load address of \p unresolved_pc, a file address
314311
/// which refers to an instruction within \p caller.
@@ -339,11 +336,7 @@ class DirectCallEdge : public CallEdge {
339336
/// return PC within the calling function to identify a specific call site.
340337
DirectCallEdge(const char *symbol_name, AddrType caller_address_type,
341338
lldb::addr_t caller_address, bool is_tail_call,
342-
CallSiteParameterArray &&parameters)
343-
: CallEdge(caller_address_type, caller_address, is_tail_call,
344-
std::move(parameters)) {
345-
lazy_callee.symbol_name = symbol_name;
346-
}
339+
CallSiteParameterArray &&parameters);
347340

348341
Function *GetCallee(ModuleList &images, ExecutionContext &exe_ctx) override;
349342

@@ -370,12 +363,9 @@ class IndirectCallEdge : public CallEdge {
370363
public:
371364
/// Construct a call edge using a DWARFExpression to identify the callee, and
372365
/// a return PC within the calling function to identify a specific call site.
373-
IndirectCallEdge(DWARFExpressionList call_target, AddrType caller_address_type,
374-
lldb::addr_t caller_address, bool is_tail_call,
375-
CallSiteParameterArray &&parameters)
376-
: CallEdge(caller_address_type, caller_address, is_tail_call,
377-
std::move(parameters)),
378-
call_target(std::move(call_target)) {}
366+
IndirectCallEdge(DWARFExpressionList call_target,
367+
AddrType caller_address_type, lldb::addr_t caller_address,
368+
bool is_tail_call, CallSiteParameterArray &&parameters);
379369

380370
Function *GetCallee(ModuleList &images, ExecutionContext &exe_ctx) override;
381371

lldb/source/Core/UserSettingsController.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ class Property;
3030
using namespace lldb;
3131
using namespace lldb_private;
3232

33+
Properties::Properties() = default;
34+
35+
Properties::Properties(const lldb::OptionValuePropertiesSP &collection_sp)
36+
: m_collection_sp(collection_sp) {}
37+
38+
Properties::~Properties() = default;
39+
3340
lldb::OptionValueSP
3441
Properties::GetPropertyValue(const ExecutionContext *exe_ctx,
3542
llvm::StringRef path, Status &error) const {

lldb/source/Symbol/Function.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ size_t InlineFunctionInfo::MemorySize() const {
122122
/// @name Call site related structures
123123
/// @{
124124

125+
CallEdge::~CallEdge() = default;
126+
127+
CallEdge::CallEdge(AddrType caller_address_type, lldb::addr_t caller_address,
128+
bool is_tail_call, CallSiteParameterArray &&parameters)
129+
: caller_address(caller_address), caller_address_type(caller_address_type),
130+
is_tail_call(is_tail_call), parameters(std::move(parameters)) {}
131+
125132
lldb::addr_t CallEdge::GetLoadAddress(lldb::addr_t unresolved_pc,
126133
Function &caller, Target &target) {
127134
Log *log = GetLog(LLDBLog::Step);
@@ -185,12 +192,30 @@ void DirectCallEdge::ParseSymbolFileAndResolve(ModuleList &images) {
185192
resolved = true;
186193
}
187194

195+
DirectCallEdge::DirectCallEdge(const char *symbol_name,
196+
AddrType caller_address_type,
197+
lldb::addr_t caller_address, bool is_tail_call,
198+
CallSiteParameterArray &&parameters)
199+
: CallEdge(caller_address_type, caller_address, is_tail_call,
200+
std::move(parameters)) {
201+
lazy_callee.symbol_name = symbol_name;
202+
}
203+
188204
Function *DirectCallEdge::GetCallee(ModuleList &images, ExecutionContext &) {
189205
ParseSymbolFileAndResolve(images);
190206
assert(resolved && "Did not resolve lazy callee");
191207
return lazy_callee.def;
192208
}
193209

210+
IndirectCallEdge::IndirectCallEdge(DWARFExpressionList call_target,
211+
AddrType caller_address_type,
212+
lldb::addr_t caller_address,
213+
bool is_tail_call,
214+
CallSiteParameterArray &&parameters)
215+
: CallEdge(caller_address_type, caller_address, is_tail_call,
216+
std::move(parameters)),
217+
call_target(std::move(call_target)) {}
218+
194219
Function *IndirectCallEdge::GetCallee(ModuleList &images,
195220
ExecutionContext &exe_ctx) {
196221
Log *log = GetLog(LLDBLog::Step);

0 commit comments

Comments
 (0)