Skip to content

[lldb][swift] Fix building with disabled swift support #1891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lldb/source/API/SystemInitializerFull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
#include "lldb/Utility/Timer.h"
#include "llvm/Support/TargetSelect.h"

// BEGIN SWIFT
#ifdef LLDB_ENABLE_SWIFT
#include "Plugins/ExpressionParser/Swift/SwiftREPL.h"
#include "Plugins/InstrumentationRuntime/SwiftRuntimeReporting/SwiftRuntimeReporting.h"
#include "Plugins/Language/Swift/SwiftLanguage.h"
#include "Plugins/TypeSystem/Swift/SwiftASTContext.h"
#include "lldb/Target/SwiftLanguageRuntime.h"
// END SWIFT
#endif //LLDB_ENABLE_SWIFT

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Core/ValueObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
#include "lldb/Utility/StreamString.h"
#include "lldb/lldb-private-types.h"

// BEGIN SWIFT
#ifdef LLDB_ENABLE_SWIFT
#include "Plugins/TypeSystem/Swift/SwiftASTContext.h"
// END SWIFT
#endif //LLDB_ENABLE_SWIFT

#include "llvm/Support/Compiler.h"

Expand Down
2 changes: 2 additions & 0 deletions lldb/source/Core/ValueObjectDynamicValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
#include "lldb/Utility/Status.h"
#include "lldb/lldb-types.h"

#ifdef LLDB_ENABLE_SWIFT
#include "Plugins/TypeSystem/Swift/SwiftASTContext.h"
#endif // LLDB_ENABLE_SWIFT

#include <string.h>
namespace lldb_private {
Expand Down
5 changes: 4 additions & 1 deletion lldb/source/Expression/IRExecutionUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/LanguageRuntime.h"
#include "lldb/Target/SwiftLanguageRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
Expand All @@ -35,6 +34,10 @@
#include "lldb/../../source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
#include "lldb/../../source/Plugins/ObjectFile/JIT/ObjectFileJIT.h"

#ifdef LLDB_ENABLE_SWIFT
#include "lldb/Target/SwiftLanguageRuntime.h"
#endif //LLDB_ENABLE_SWIFT

using namespace lldb_private;

IRExecutionUnit::IRExecutionUnit(std::unique_ptr<llvm::LLVMContext> &context_up,
Expand Down
2 changes: 2 additions & 0 deletions lldb/source/Expression/Materializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegisterValue.h"

#ifdef LLDB_ENABLE_SWIFT
#include "Plugins/TypeSystem/Swift/SwiftASTContext.h"
#endif //LLDB_ENABLE_SWIFT

#include <memory>

Expand Down
2 changes: 2 additions & 0 deletions lldb/source/Expression/UserExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"

#ifdef LLDB_ENABLE_SWIFT
#include "Plugins/TypeSystem/Swift/SwiftASTContext.h"
#endif //LLDB_ENABLE_SWIFT

using namespace lldb_private;

Expand Down
7 changes: 7 additions & 0 deletions lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/MipsABIFlags.h"

#ifdef LLDB_ENABLE_SWIFT
#include "swift/ABI/ObjectFile.h"
#endif //LLDB_ENABLE_SWIFT

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

llvm::StringRef ObjectFileELF::GetReflectionSectionIdentifier(
swift::ReflectionSectionKind section) {
#ifdef LLDB_ENABLE_SWIFT
swift::SwiftObjectFileFormatELF file_format_elf;
return file_format_elf.getSectionName(section);
#else
llvm_unreachable("Swift support disabled");
#endif //LLDB_ENABLE_SWIFT
}
8 changes: 7 additions & 1 deletion lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/SwiftLanguageRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadList.h"
Expand All @@ -47,7 +46,10 @@
#include "llvm/Support/MemoryBuffer.h"

#include "ObjectFileMachO.h"
#ifdef LLDB_ENABLE_SWIFT
#include "swift/ABI/ObjectFile.h"
#include "lldb/Target/SwiftLanguageRuntime.h"
#endif //LLDB_ENABLE_SWIFT

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

llvm::StringRef ObjectFileMachO::GetReflectionSectionIdentifier(
swift::ReflectionSectionKind section) {
#ifdef LLDB_ENABLE_SWIFT
swift::SwiftObjectFileFormatMachO file_format_mach_o;
return file_format_mach_o.getSectionName(section);
#else
llvm_unreachable("Swift support disabled");
#endif //LLDB_ENABLE_SWIFT
}
6 changes: 6 additions & 0 deletions lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
#include "llvm/Support/Error.h"
#include "llvm/Support/MemoryBuffer.h"

#ifdef LLDB_ENABLE_SWIFT
#include "swift/ABI/ObjectFile.h"
#endif //LLDB_ENABLE_SWIFT

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

llvm::StringRef ObjectFilePECOFF::GetReflectionSectionIdentifier(
swift::ReflectionSectionKind section) {
#ifdef LLDB_ENABLE_SWIFT
swift::SwiftObjectFileFormatCOFF file_format_coff;
return file_format_coff.getSectionName(section);
#else
llvm_unreachable("Swift support disabled");
#endif //LLDB_ENABLE_SWIFT
}
2 changes: 2 additions & 0 deletions lldb/source/Target/ABI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
#include "llvm/Support/TargetRegistry.h"
#include <cctype>

#ifdef LLDB_ENABLE_SWIFT
#include "Plugins/TypeSystem/Swift/SwiftASTContext.h"
#endif //LLDB_ENABLE_SWIFT

using namespace lldb;
using namespace lldb_private;
Expand Down
5 changes: 4 additions & 1 deletion lldb/source/Target/ThreadPlanCallFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/SwiftLanguageRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlanRunToAddress.h"
Expand All @@ -27,6 +26,10 @@

#include <memory>

#ifdef LLDB_ENABLE_SWIFT
#include "lldb/Target/SwiftLanguageRuntime.h"
#endif //LLDB_ENABLE_SWIFT

using namespace lldb;
using namespace lldb_private;

Expand Down
5 changes: 4 additions & 1 deletion lldb/source/Target/ThreadPlanStepOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/SwiftLanguageRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/ThreadPlanStepOverRange.h"
#include "lldb/Target/ThreadPlanStepThrough.h"
#include "lldb/Utility/Log.h"

#include <memory>

#ifdef LLDB_ENABLE_SWIFT
#include "lldb/Target/SwiftLanguageRuntime.h"
#endif // LLDB_ENABLE_SWIFT

using namespace lldb;
using namespace lldb_private;

Expand Down
6 changes: 5 additions & 1 deletion lldb/unittests/Symbol/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ set(SWIFT_SOURCES
TestSwiftASTContext.cpp
TestTypeSystemSwiftTypeRef.cpp
)
set(SWIFT_LIBS
lldbPluginTypeSystemSwift
)
set(LLVM_OPTIONAL_SOURCES ${SWIFT_SOURCES})
if (NOT LLDB_ENABLE_SWIFT_SUPPORT)
unset(SWIFT_SOURCES)
unset(SWIFT_LIBS)
endif()

add_lldb_unittest(SymbolTests
Expand All @@ -27,7 +31,7 @@ add_lldb_unittest(SymbolTests
lldbPluginSymbolFileDWARF
lldbPluginSymbolFileSymtab
lldbPluginTypeSystemClang
lldbPluginTypeSystemSwift
${SWIFT_LIBS}
LLVMTestingSupport
)

Expand Down