mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[driver] Add -working-directory option
Adds a -working-directory option which can be used to modify how relative paths are resolved. It affects all other paths used in driver options (controlled by a new ArgumentIsPath flag on options) as well as the contents of output file maps and auxilliary file paths generated implicitly by the compiler itself. rdar://37713856
This commit is contained in:
@@ -39,14 +39,23 @@ public:
|
||||
~OutputFileMap() = default;
|
||||
|
||||
/// Loads an OutputFileMap from the given \p Path, if possible.
|
||||
static std::unique_ptr<OutputFileMap> loadFromPath(StringRef Path);
|
||||
///
|
||||
/// When non-empty, \p workingDirectory is used to resolve relative paths in
|
||||
/// the output file map.
|
||||
static std::unique_ptr<OutputFileMap>
|
||||
loadFromPath(StringRef Path, StringRef workingDirectory);
|
||||
|
||||
static std::unique_ptr<OutputFileMap> loadFromBuffer(StringRef Data);
|
||||
static std::unique_ptr<OutputFileMap>
|
||||
loadFromBuffer(StringRef Data, StringRef workingDirectory);
|
||||
|
||||
/// Loads an OutputFileMap from the given \p Buffer, taking ownership
|
||||
/// of the buffer in the process.
|
||||
///
|
||||
/// When non-empty, \p workingDirectory is used to resolve relative paths in
|
||||
/// the output file map.
|
||||
static std::unique_ptr<OutputFileMap>
|
||||
loadFromBuffer(std::unique_ptr<llvm::MemoryBuffer> Buffer);
|
||||
loadFromBuffer(std::unique_ptr<llvm::MemoryBuffer> Buffer,
|
||||
StringRef workingDirectory);
|
||||
|
||||
/// Get the map of outputs for the given \p Input, if present in the
|
||||
/// OutputFileMap. (If not present, returns nullptr.)
|
||||
@@ -69,8 +78,12 @@ private:
|
||||
/// \brief Parses the given \p Buffer into the OutputFileMap, taking ownership
|
||||
/// of \p Buffer in the process.
|
||||
///
|
||||
/// When non-empty, \p workingDirectory is used to resolve relative paths in
|
||||
/// the output file map.
|
||||
///
|
||||
/// \returns true on error, false on success
|
||||
bool parse(std::unique_ptr<llvm::MemoryBuffer> Buffer);
|
||||
bool parse(std::unique_ptr<llvm::MemoryBuffer> Buffer,
|
||||
StringRef workingDirectory);
|
||||
};
|
||||
|
||||
} // end namespace driver
|
||||
|
||||
Reference in New Issue
Block a user