Skip to content

Commit a9134b2

Browse files
Merge pull request #52 from adrian-prantl/mark-api
Mark all Swift-specific changes in API with comments. NFC
2 parents d0d3541 + cd0c5bf commit a9134b2

10 files changed

+65
-8
lines changed

lldb/source/API/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
## BEGIN SWIFT
12
set(LLVM_NO_RTTI 1)
23

34
include(AddLLVM)
45

56
if (LLDB_ENABLE_SWIFT_SUPPORT)
67
include(SwiftAddCustomCommandTarget)
78
endif()
9+
## END SWIFT
810

911
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
1012
add_definitions( -DEXPORT_LIBLLDB )
@@ -106,7 +108,9 @@ add_lldb_library(liblldb SHARED
106108
lldbTarget
107109
lldbUtility
108110
${LLDB_ALL_PLUGINS}
111+
## BEGIN SWIFT
109112
${SWIFT_ALL_LIBS}
113+
## END SWIFT
110114
LINK_COMPONENTS
111115
Support
112116

@@ -180,6 +184,7 @@ if(LLDB_BUILD_FRAMEWORK)
180184
include(LLDBFramework)
181185
endif()
182186

187+
## BEGIN SWIFT
183188
set(lib_dir "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}")
184189

185190
if(EXISTS ${SWIFT_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/swift/clang)
@@ -241,3 +246,4 @@ if(LLDB_BUILT_STANDALONE)
241246
DESTINATION lib${LLVM_LIBDIR_SUFFIX}/lldb/)
242247
endif()
243248
endif()
249+
## END SWIFT

lldb/source/API/SBExpressionOptions.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ void SBExpressionOptions::SetCancelCallback(
185185
m_opaque_up->SetCancelCallback(callback, baton);
186186
}
187187

188+
// BEGIN SWIFT
189+
188190
bool SBExpressionOptions::GetPlaygroundTransformEnabled() const {
189191
return m_opaque_up->GetPlaygroundTransformEnabled();
190192
}
@@ -206,6 +208,8 @@ void SBExpressionOptions::SetREPLMode(bool enable_repl_mode) {
206208
SetTrapExceptions(false);
207209
}
208210

211+
// END SWIFT
212+
209213
bool SBExpressionOptions::GetGenerateDebugInfo() {
210214
LLDB_RECORD_METHOD_NO_ARGS(bool, SBExpressionOptions, GetGenerateDebugInfo);
211215

lldb/source/API/SBFrame.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include "lldb/Symbol/Variable.h"
3131
#include "lldb/Symbol/VariableList.h"
3232
#include "lldb/Target/ExecutionContext.h"
33-
#include "lldb/Target/LanguageRuntime.h"
3433
#include "lldb/Target/Process.h"
3534
#include "lldb/Target/RegisterContext.h"
3635
#include "lldb/Target/StackFrame.h"
@@ -52,6 +51,10 @@
5251

5352
#include "llvm/Support/PrettyStackTrace.h"
5453

54+
// BEGIN SWIFT
55+
#include "lldb/Target/LanguageRuntime.h"
56+
// END SWIFT
57+
5558
using namespace lldb;
5659
using namespace lldb_private;
5760

@@ -1205,6 +1208,7 @@ lldb::LanguageType SBFrame::GuessLanguage() const {
12051208
return eLanguageTypeUnknown;
12061209
}
12071210

1211+
// BEGIN SWIFT
12081212
bool SBFrame::IsSwiftThunk() const {
12091213
std::unique_lock<std::recursive_mutex> lock;
12101214
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
@@ -1229,6 +1233,7 @@ bool SBFrame::IsSwiftThunk() const {
12291233
return false;
12301234
return runtime->IsSymbolARuntimeThunk(*sc.symbol);
12311235
}
1236+
// END SWIFT
12321237

12331238
const char *SBFrame::GetFunctionName() const {
12341239
LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBFrame, GetFunctionName);

lldb/source/API/SBFunction.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,14 @@ bool SBFunction::GetIsOptimized() {
245245
return false;
246246
}
247247

248+
// BEGIN SWIFT
248249
bool SBFunction::GetCanThrow() {
249250
if (m_opaque_ptr) {
250251
return m_opaque_ptr->CanThrow();
251252
}
252253
return false;
253254
}
255+
// END SWIFT
254256

255257
namespace lldb_private {
256258
namespace repro {

lldb/source/API/SBHostOS.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ SBFileSpec SBHostOS::GetLLDBPath(lldb::PathType path_type) {
8080
fspec = GetClangResourceDir();
8181
break;
8282

83+
// BEGIN SWIFT
8384
case ePathTypeSwiftDir:
8485
break;
86+
// END SWIFT
8587
}
8688

8789
SBFileSpec sb_fspec;

lldb/source/API/SBModule.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@
2323
#include "lldb/Symbol/Symtab.h"
2424
#include "lldb/Symbol/TypeSystem.h"
2525
#include "lldb/Symbol/VariableList.h"
26-
#include "lldb/Target/Language.h"
2726
#include "lldb/Target/Target.h"
2827
#include "lldb/Utility/StreamString.h"
2928

29+
// BEGIN SWIFT
30+
#include "lldb/Target/Language.h"
31+
// END SWIFT
32+
3033
using namespace lldb;
3134
using namespace lldb_private;
3235

@@ -674,6 +677,7 @@ lldb::SBAddress SBModule::GetObjectFileHeaderAddress() const {
674677
return LLDB_RECORD_RESULT(sb_addr);
675678
}
676679

680+
// BEGIN SWIFT
677681
lldb::SBError SBModule::IsTypeSystemCompatible(lldb::LanguageType language) {
678682
SBError sb_error;
679683
ModuleSP module_sp(GetSP());
@@ -691,6 +695,7 @@ lldb::SBError SBModule::IsTypeSystemCompatible(lldb::LanguageType language) {
691695
}
692696
return sb_error;
693697
}
698+
// END SWIFT
694699

695700
lldb::SBAddress SBModule::GetObjectFileEntryPointAddress() const {
696701
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBAddress, SBModule,

lldb/source/API/SBTarget.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@
2525
#include "lldb/API/SBStringList.h"
2626
#include "lldb/API/SBStructuredData.h"
2727
#include "lldb/API/SBSymbolContextList.h"
28-
#include "lldb/Breakpoint/Breakpoint.h"
2928
#include "lldb/Breakpoint/BreakpointID.h"
3029
#include "lldb/Breakpoint/BreakpointIDList.h"
3130
#include "lldb/Breakpoint/BreakpointList.h"
3231
#include "lldb/Breakpoint/BreakpointLocation.h"
33-
#include "lldb/Breakpoint/BreakpointPrecondition.h"
3432
#include "lldb/Core/Address.h"
3533
#include "lldb/Core/AddressResolver.h"
3634
#include "lldb/Core/AddressResolverName.h"
@@ -71,6 +69,10 @@
7169
#include "llvm/Support/PrettyStackTrace.h"
7270
#include "llvm/Support/Regex.h"
7371

72+
// BEGIN SWIFT
73+
#include "lldb/Breakpoint/BreakpointPrecondition.h"
74+
// END SWIFT
75+
7476
using namespace lldb;
7577
using namespace lldb_private;
7678

@@ -1078,11 +1080,14 @@ SBTarget::BreakpointCreateForException(lldb::LanguageType language,
10781080
(lldb::LanguageType, bool, bool), language, catch_bp,
10791081
throw_bp);
10801082

1083+
// BEGIN SWIFT
10811084
SBStringList no_extra_args;
10821085
return BreakpointCreateForException(language, catch_bp, throw_bp,
10831086
no_extra_args);
1087+
// END SWIFT
10841088
}
10851089

1090+
// BEGIN SWIFT
10861091
lldb::SBBreakpoint
10871092
SBTarget::BreakpointCreateForException(lldb::LanguageType language,
10881093
bool catch_bp, bool throw_bp,
@@ -1118,6 +1123,7 @@ SBTarget::BreakpointCreateForException(lldb::LanguageType language,
11181123

11191124
return LLDB_RECORD_RESULT(sb_bp);
11201125
}
1126+
// END SWIFT
11211127

11221128
lldb::SBBreakpoint SBTarget::BreakpointCreateFromScript(
11231129
const char *class_name, SBStructuredData &extra_args,
@@ -1874,6 +1880,7 @@ lldb::SBType SBTarget::FindFirstType(const char *typename_cstr) {
18741880
}
18751881

18761882
// Didn't find the type in the symbols; Try the loaded language runtimes
1883+
// BEGIN SWIFT
18771884
// FIXME: This depends on clang, but should be able to support any
18781885
// TypeSystem/compiler.
18791886
if (auto process_sp = target_sp->GetProcessSP()) {
@@ -1892,6 +1899,7 @@ lldb::SBType SBTarget::FindFirstType(const char *typename_cstr) {
18921899
}
18931900
}
18941901
}
1902+
// END SWIFT
18951903

18961904
// No matches, search for basic typename matches
18971905
for (auto *type_system : target_sp->GetScratchTypeSystems())
@@ -1937,6 +1945,7 @@ lldb::SBTypeList SBTarget::FindTypes(const char *typename_cstr) {
19371945
}
19381946

19391947
// Try the loaded language runtimes
1948+
// BEGIN SWIFT
19401949
// FIXME: This depends on clang, but should be able to support any
19411950
// TypeSystem/compiler.
19421951
if (auto process_sp = target_sp->GetProcessSP()) {
@@ -1956,6 +1965,7 @@ lldb::SBTypeList SBTarget::FindTypes(const char *typename_cstr) {
19561965
}
19571966
}
19581967
}
1968+
// END SWIFT
19591969

19601970
if (sb_type_list.GetSize() == 0) {
19611971
// No matches, search for basic typename matches

lldb/source/API/SBThread.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -412,14 +412,17 @@ size_t SBThread::GetStopDescription(char *dst, size_t dst_len) {
412412
SBValue SBThread::GetStopReturnValue() {
413413
LLDB_RECORD_METHOD_NO_ARGS(lldb::SBValue, SBThread, GetStopReturnValue);
414414

415+
// BEGIN SWIFT
415416
bool is_swift_error_value = false;
416417
SBValue return_value = GetStopReturnOrErrorValue(is_swift_error_value);
417418
if (is_swift_error_value)
418419
return SBValue();
419420
else
420421
return return_value;
422+
// END SWIFT
421423
}
422424

425+
// BEGIN SWIFT
423426
SBValue SBThread::GetStopErrorValue() {
424427
bool is_swift_error_value = false;
425428
SBValue return_value = GetStopReturnOrErrorValue(is_swift_error_value);
@@ -448,6 +451,7 @@ SBValue SBThread::GetStopReturnOrErrorValue(bool &is_swift_error_value) {
448451

449452
return LLDB_RECORD_RESULT(SBValue(return_valobj_sp));
450453
}
454+
// END SWIFT
451455

452456
void SBThread::SetThread(const ThreadSP &lldb_object_sp) {
453457
m_opaque_sp->SetThreadSP(lldb_object_sp);

lldb/source/API/SBType.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ bool SBType::IsReferenceType() {
158158

159159
if (!IsValid())
160160
return false;
161+
162+
// BEGIN SWIFT
163+
161164
// FIXME: Swift class types are really like references, they are
162165
// accessed by the same operator as Values, but their value is the
163166
// location of the type. But reporting true from the Compiler Type
@@ -170,6 +173,8 @@ bool SBType::IsReferenceType() {
170173
if (flags & eTypeIsSwift)
171174
return flags & eTypeHasValue;
172175

176+
// END SWIFT
177+
173178
return m_opaque_sp->GetCompilerType(true).IsReferenceType();
174179
}
175180

lldb/source/API/SystemInitializerFull.cpp

+18-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "lldb/Initialization/SystemInitializerCommon.h"
2020
#include "lldb/Interpreter/CommandInterpreter.h"
2121
#include "lldb/Symbol/ClangASTContext.h"
22-
#include "lldb/Symbol/SwiftASTContext.h"
2322
#include "lldb/Utility/Timer.h"
2423

2524
#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
@@ -55,7 +54,6 @@
5554
#include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h"
5655
#include "Plugins/InstrumentationRuntime/TSan/TSanRuntime.h"
5756
#include "Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h"
58-
#include "Plugins/InstrumentationRuntime/SwiftRuntimeReporting/SwiftRuntimeReporting.h"
5957
#include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
6058
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
6159
#include "Plugins/Language/ObjC/ObjCLanguage.h"
@@ -119,11 +117,13 @@
119117
#include "lldb/Host/windows/windows.h"
120118
#endif
121119

122-
#if defined(__APPLE__) || defined(__linux__) || defined(_WIN32)
120+
// BEGIN SWIFT
123121
#include "Plugins/ExpressionParser/Swift/SwiftREPL.h"
122+
#include "Plugins/InstrumentationRuntime/SwiftRuntimeReporting/SwiftRuntimeReporting.h"
124123
#include "Plugins/Language/Swift/SwiftLanguage.h"
124+
#include "lldb/Symbol/SwiftASTContext.h"
125125
#include "lldb/Target/SwiftLanguageRuntime.h"
126-
#endif
126+
// END SWIFT
127127

128128
#include "llvm/Support/TargetSelect.h"
129129

@@ -140,6 +140,7 @@ SystemInitializerFull::SystemInitializerFull() {}
140140

141141
SystemInitializerFull::~SystemInitializerFull() {}
142142

143+
// BEGIN SWIFT
143144
static void SwiftInitialize() {
144145
#if defined(__APPLE__) || defined(__linux__) || defined(_WIN32)
145146
SwiftLanguage::Initialize();
@@ -155,6 +156,7 @@ static void SwiftTerminate() {
155156
SwiftREPL::Terminate();
156157
#endif
157158
}
159+
// END SWIFT
158160

159161
#define LLDB_PROCESS_AArch64(op) \
160162
ABIMacOSX_arm64::op(); \
@@ -231,7 +233,9 @@ llvm::Error SystemInitializerFull::Initialize() {
231233
llvm::InitializeAllDisassemblers();
232234

233235
ClangASTContext::Initialize();
236+
// BEGIN SWIFT
234237
SwiftASTContext::Initialize();
238+
// END SWIFT
235239

236240
#define LLVM_TARGET(t) LLDB_PROCESS_ ## t(Initialize)
237241
#include "llvm/Config/Targets.def"
@@ -251,7 +255,9 @@ llvm::Error SystemInitializerFull::Initialize() {
251255
ThreadSanitizerRuntime::Initialize();
252256
UndefinedBehaviorSanitizerRuntime::Initialize();
253257
MainThreadCheckerRuntime::Initialize();
258+
// BEGIN SWIFT
254259
SwiftRuntimeReporting::Initialize();
260+
// END SWIFT
255261

256262
SymbolVendorELF::Initialize();
257263
breakpad::SymbolFileBreakpad::Initialize();
@@ -277,7 +283,9 @@ llvm::Error SystemInitializerFull::Initialize() {
277283
CPlusPlusLanguage::Initialize();
278284
ObjCLanguage::Initialize();
279285
ObjCPlusPlusLanguage::Initialize();
286+
// BEGIN SWIFT
280287
::SwiftInitialize();
288+
// END SWIFT
281289

282290
#if defined(_WIN32)
283291
ProcessWindows::Initialize();
@@ -332,7 +340,9 @@ void SystemInitializerFull::Terminate() {
332340
PluginManager::Terminate();
333341

334342
ClangASTContext::Terminate();
343+
// BEGIN SWIFT
335344
SwiftASTContext::Terminate();
345+
// END SWIFT
336346

337347
ArchitectureArm::Terminate();
338348
ArchitectureMips::Terminate();
@@ -352,7 +362,9 @@ void SystemInitializerFull::Terminate() {
352362
ThreadSanitizerRuntime::Terminate();
353363
UndefinedBehaviorSanitizerRuntime::Terminate();
354364
MainThreadCheckerRuntime::Terminate();
365+
// BEGIN SWIFT
355366
SwiftRuntimeReporting::Terminate();
367+
// END SWIFT
356368
SymbolVendorELF::Terminate();
357369
breakpad::SymbolFileBreakpad::Terminate();
358370
SymbolFileDWARF::Terminate();
@@ -374,7 +386,9 @@ void SystemInitializerFull::Terminate() {
374386
SystemRuntimeMacOSX::Terminate();
375387
RenderScriptRuntime::Terminate();
376388

389+
// BEGIN SWIFT
377390
::SwiftTerminate();
391+
// END SWIFT
378392

379393
CPlusPlusLanguage::Terminate();
380394
ObjCLanguage::Terminate();

0 commit comments

Comments
 (0)