Skip to content

Commit 44872a7

Browse files
authored
Merge pull request #1891 from Teemperor/FixSwiftlessBuild
[lldb][swift] Fix building with disabled swift support
2 parents a3d3122 + 44a25a4 commit 44872a7

File tree

13 files changed

+49
-9
lines changed

13 files changed

+49
-9
lines changed

lldb/source/API/SystemInitializerFull.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
#include "lldb/Utility/Timer.h"
1818
#include "llvm/Support/TargetSelect.h"
1919

20-
// BEGIN SWIFT
20+
#ifdef LLDB_ENABLE_SWIFT
2121
#include "Plugins/ExpressionParser/Swift/SwiftREPL.h"
2222
#include "Plugins/InstrumentationRuntime/SwiftRuntimeReporting/SwiftRuntimeReporting.h"
2323
#include "Plugins/Language/Swift/SwiftLanguage.h"
2424
#include "Plugins/TypeSystem/Swift/SwiftASTContext.h"
2525
#include "lldb/Target/SwiftLanguageRuntime.h"
26-
// END SWIFT
26+
#endif //LLDB_ENABLE_SWIFT
2727

2828
#pragma clang diagnostic push
2929
#pragma clang diagnostic ignored "-Wglobal-constructors"

lldb/source/Core/ValueObject.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
#include "lldb/Utility/StreamString.h"
5252
#include "lldb/lldb-private-types.h"
5353

54-
// BEGIN SWIFT
54+
#ifdef LLDB_ENABLE_SWIFT
5555
#include "Plugins/TypeSystem/Swift/SwiftASTContext.h"
56-
// END SWIFT
56+
#endif //LLDB_ENABLE_SWIFT
5757

5858
#include "llvm/Support/Compiler.h"
5959

lldb/source/Core/ValueObjectDynamicValue.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
#include "lldb/Utility/Status.h"
2323
#include "lldb/lldb-types.h"
2424

25+
#ifdef LLDB_ENABLE_SWIFT
2526
#include "Plugins/TypeSystem/Swift/SwiftASTContext.h"
27+
#endif // LLDB_ENABLE_SWIFT
2628

2729
#include <string.h>
2830
namespace lldb_private {

lldb/source/Expression/IRExecutionUnit.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "lldb/Symbol/SymbolVendor.h"
2626
#include "lldb/Target/ExecutionContext.h"
2727
#include "lldb/Target/LanguageRuntime.h"
28-
#include "lldb/Target/SwiftLanguageRuntime.h"
2928
#include "lldb/Target/Target.h"
3029
#include "lldb/Utility/DataBufferHeap.h"
3130
#include "lldb/Utility/DataExtractor.h"
@@ -35,6 +34,10 @@
3534
#include "lldb/../../source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
3635
#include "lldb/../../source/Plugins/ObjectFile/JIT/ObjectFileJIT.h"
3736

37+
#ifdef LLDB_ENABLE_SWIFT
38+
#include "lldb/Target/SwiftLanguageRuntime.h"
39+
#endif //LLDB_ENABLE_SWIFT
40+
3841
using namespace lldb_private;
3942

4043
IRExecutionUnit::IRExecutionUnit(std::unique_ptr<llvm::LLVMContext> &context_up,

lldb/source/Expression/Materializer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
#include "lldb/Utility/Log.h"
2424
#include "lldb/Utility/RegisterValue.h"
2525

26+
#ifdef LLDB_ENABLE_SWIFT
2627
#include "Plugins/TypeSystem/Swift/SwiftASTContext.h"
28+
#endif //LLDB_ENABLE_SWIFT
2729

2830
#include <memory>
2931

lldb/source/Expression/UserExpression.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@
4444
#include "lldb/Utility/Log.h"
4545
#include "lldb/Utility/StreamString.h"
4646

47+
#ifdef LLDB_ENABLE_SWIFT
4748
#include "Plugins/TypeSystem/Swift/SwiftASTContext.h"
49+
#endif //LLDB_ENABLE_SWIFT
4850

4951
using namespace lldb_private;
5052

lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@
4040
#include "llvm/Support/MathExtras.h"
4141
#include "llvm/Support/MemoryBuffer.h"
4242
#include "llvm/Support/MipsABIFlags.h"
43+
44+
#ifdef LLDB_ENABLE_SWIFT
4345
#include "swift/ABI/ObjectFile.h"
46+
#endif //LLDB_ENABLE_SWIFT
4447

4548
#define CASE_AND_STREAM(s, def, width) \
4649
case def: \
@@ -3407,6 +3410,10 @@ ObjectFileELF::GetLoadableData(Target &target) {
34073410

34083411
llvm::StringRef ObjectFileELF::GetReflectionSectionIdentifier(
34093412
swift::ReflectionSectionKind section) {
3413+
#ifdef LLDB_ENABLE_SWIFT
34103414
swift::SwiftObjectFileFormatELF file_format_elf;
34113415
return file_format_elf.getSectionName(section);
3416+
#else
3417+
llvm_unreachable("Swift support disabled");
3418+
#endif //LLDB_ENABLE_SWIFT
34123419
}

lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "lldb/Target/Platform.h"
2828
#include "lldb/Target/Process.h"
2929
#include "lldb/Target/SectionLoadList.h"
30-
#include "lldb/Target/SwiftLanguageRuntime.h"
3130
#include "lldb/Target/Target.h"
3231
#include "lldb/Target/Thread.h"
3332
#include "lldb/Target/ThreadList.h"
@@ -47,7 +46,10 @@
4746
#include "llvm/Support/MemoryBuffer.h"
4847

4948
#include "ObjectFileMachO.h"
49+
#ifdef LLDB_ENABLE_SWIFT
5050
#include "swift/ABI/ObjectFile.h"
51+
#include "lldb/Target/SwiftLanguageRuntime.h"
52+
#endif //LLDB_ENABLE_SWIFT
5153

5254
#if defined(__APPLE__)
5355
#include <TargetConditionals.h>
@@ -6474,6 +6476,10 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
64746476

64756477
llvm::StringRef ObjectFileMachO::GetReflectionSectionIdentifier(
64766478
swift::ReflectionSectionKind section) {
6479+
#ifdef LLDB_ENABLE_SWIFT
64776480
swift::SwiftObjectFileFormatMachO file_format_mach_o;
64786481
return file_format_mach_o.getSectionName(section);
6482+
#else
6483+
llvm_unreachable("Swift support disabled");
6484+
#endif //LLDB_ENABLE_SWIFT
64796485
}

lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
#include "llvm/Support/Error.h"
3434
#include "llvm/Support/MemoryBuffer.h"
3535

36+
#ifdef LLDB_ENABLE_SWIFT
3637
#include "swift/ABI/ObjectFile.h"
38+
#endif //LLDB_ENABLE_SWIFT
3739

3840
#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ
3941
#define IMAGE_NT_SIGNATURE 0x00004550 // PE00
@@ -1257,6 +1259,10 @@ uint32_t ObjectFilePECOFF::GetPluginVersion() { return 1; }
12571259

12581260
llvm::StringRef ObjectFilePECOFF::GetReflectionSectionIdentifier(
12591261
swift::ReflectionSectionKind section) {
1262+
#ifdef LLDB_ENABLE_SWIFT
12601263
swift::SwiftObjectFileFormatCOFF file_format_coff;
12611264
return file_format_coff.getSectionName(section);
1265+
#else
1266+
llvm_unreachable("Swift support disabled");
1267+
#endif //LLDB_ENABLE_SWIFT
12621268
}

lldb/source/Target/ABI.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
#include "llvm/Support/TargetRegistry.h"
2020
#include <cctype>
2121

22+
#ifdef LLDB_ENABLE_SWIFT
2223
#include "Plugins/TypeSystem/Swift/SwiftASTContext.h"
24+
#endif //LLDB_ENABLE_SWIFT
2325

2426
using namespace lldb;
2527
using namespace lldb_private;

lldb/source/Target/ThreadPlanCallFunction.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "lldb/Target/Process.h"
1919
#include "lldb/Target/RegisterContext.h"
2020
#include "lldb/Target/StopInfo.h"
21-
#include "lldb/Target/SwiftLanguageRuntime.h"
2221
#include "lldb/Target/Target.h"
2322
#include "lldb/Target/Thread.h"
2423
#include "lldb/Target/ThreadPlanRunToAddress.h"
@@ -27,6 +26,10 @@
2726

2827
#include <memory>
2928

29+
#ifdef LLDB_ENABLE_SWIFT
30+
#include "lldb/Target/SwiftLanguageRuntime.h"
31+
#endif //LLDB_ENABLE_SWIFT
32+
3033
using namespace lldb;
3134
using namespace lldb_private;
3235

lldb/source/Target/ThreadPlanStepOut.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@
2020
#include "lldb/Target/Process.h"
2121
#include "lldb/Target/RegisterContext.h"
2222
#include "lldb/Target/StopInfo.h"
23-
#include "lldb/Target/SwiftLanguageRuntime.h"
2423
#include "lldb/Target/Target.h"
2524
#include "lldb/Target/ThreadPlanStepOverRange.h"
2625
#include "lldb/Target/ThreadPlanStepThrough.h"
2726
#include "lldb/Utility/Log.h"
2827

2928
#include <memory>
3029

30+
#ifdef LLDB_ENABLE_SWIFT
31+
#include "lldb/Target/SwiftLanguageRuntime.h"
32+
#endif // LLDB_ENABLE_SWIFT
33+
3134
using namespace lldb;
3235
using namespace lldb_private;
3336

lldb/unittests/Symbol/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ set(SWIFT_SOURCES
22
TestSwiftASTContext.cpp
33
TestTypeSystemSwiftTypeRef.cpp
44
)
5+
set(SWIFT_LIBS
6+
lldbPluginTypeSystemSwift
7+
)
58
set(LLVM_OPTIONAL_SOURCES ${SWIFT_SOURCES})
69
if (NOT LLDB_ENABLE_SWIFT_SUPPORT)
710
unset(SWIFT_SOURCES)
11+
unset(SWIFT_LIBS)
812
endif()
913

1014
add_lldb_unittest(SymbolTests
@@ -27,7 +31,7 @@ add_lldb_unittest(SymbolTests
2731
lldbPluginSymbolFileDWARF
2832
lldbPluginSymbolFileSymtab
2933
lldbPluginTypeSystemClang
30-
lldbPluginTypeSystemSwift
34+
${SWIFT_LIBS}
3135
LLVMTestingSupport
3236
)
3337

0 commit comments

Comments
 (0)