Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remap the target (Xcode) SDK directory to the host SDK directory.
This is mostly useful for Swift support; it allows LLDB to substitute a matching SDK it shipped with instead of the sysroot path that was used at compile time. The goal of this is to make the Xcode SDK something that behaves more like the compiler's resource directory, as in that it ships with LLDB rather than with the debugged program. This important primarily for importing Swift and Clang modules in the expression evaluator, and getting at the APINotes from the SDK in Swift. For a cross-debugging scenario, this means you have to have an SDK for your target installed alongside LLDB. In Xcode this will always be the case. rdar://problem/60640017 Differential Revision: https://reviews.llvm.org/D76471
- Loading branch information
1 parent
276d2b7
commit 1e05d7b
Showing
22 changed files
with
440 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
//===-- XcodeSDK.h ----------------------------------------------*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLDB_UTILITY_SDK_H | ||
#define LLDB_UTILITY_SDK_H | ||
|
||
#include "llvm/ADT/StringRef.h" | ||
#include "llvm/Support/VersionTuple.h" | ||
#include <tuple> | ||
|
||
namespace lldb_private { | ||
|
||
/// An abstraction for Xcode-style SDKs that works like \ref ArchSpec. | ||
class XcodeSDK { | ||
std::string m_name; | ||
|
||
public: | ||
XcodeSDK() = default; | ||
XcodeSDK(std::string &&name) : m_name(std::move(name)) {} | ||
static XcodeSDK GetAnyMacOS() { return XcodeSDK("MacOSX.sdk"); } | ||
|
||
enum Type : int { | ||
MacOSX = 0, | ||
iPhoneSimulator, | ||
iPhoneOS, | ||
AppleTVSimulator, | ||
AppleTVOS, | ||
WatchSimulator, | ||
watchOS, | ||
bridgeOS, | ||
Linux, | ||
numSDKTypes, | ||
unknown = -1 | ||
}; | ||
static llvm::StringRef GetNameForType(Type type); | ||
|
||
/// The merge function follows a strict order to maintain monotonicity: | ||
/// 1. SDK with the higher SDKType wins. | ||
/// 2. The newer SDK wins. | ||
void Merge(XcodeSDK other); | ||
|
||
XcodeSDK &operator=(XcodeSDK other); | ||
bool operator==(XcodeSDK other); | ||
|
||
/// Return parsed SDK number, and SDK version number. | ||
std::tuple<Type, llvm::VersionTuple> Parse() const; | ||
llvm::VersionTuple GetVersion() const; | ||
Type GetType() const; | ||
llvm::StringRef GetString() const; | ||
|
||
static bool SDKSupportsModules(Type type, llvm::VersionTuple version); | ||
static bool SDKSupportsModules(Type desired_type, const FileSpec &sdk_path); | ||
static llvm::StringRef GetSDKNameForType(Type type); | ||
}; | ||
|
||
} // namespace lldb_private | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.