Files
Nathan Hawes 117f03b2f5 [Driver][Index] Add driver support to specify an overriding output path to record in the index data
The frontend supports this via new options -index-unit-output-path and
-index-unit-output-path-filelist that mirror -o and -output-filelist. These are
intended to allow sharing index data across builds in separate directories (so
different -o values) that are otherwise equivalent as far as the index data is
concerned (e.g. an ASAN build and a non-ASAN build) by supplying the same
-index-unit-output-path for both.

This change updates the driver to add these new options to the frontend
invocation 1) when a new "index-unit-output-path" entry is specified for one
or more input files in the -output-file-map json or 2) if -index-file is
specified, when a new -index-unit-output-path driver option is passed.

Resolves rdar://problem/74816412
2021-03-06 13:44:14 +10:00

69 lines
2.0 KiB
C++

//===--- Util.h - Common Driver Utilities -----------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_DRIVER_UTIL_H
#define SWIFT_DRIVER_UTIL_H
#include "swift/Basic/FileTypes.h"
#include "swift/Basic/LLVM.h"
#include "llvm/ADT/SmallVector.h"
namespace llvm {
namespace opt {
class Arg;
} // end namespace opt
} // end namespace llvm
namespace swift {
namespace driver {
/// An input argument from the command line and its inferred type.
using InputPair = std::pair<file_types::ID, const llvm::opt::Arg *>;
/// Type used for a list of input arguments.
using InputFileList = SmallVector<InputPair, 16>;
enum class LinkKind {
None,
Executable,
DynamicLibrary,
StaticLibrary
};
/// Used by a Job to request a "filelist": a file containing a list of all
/// input or output files of a certain type.
///
/// The Compilation is responsible for generating this file before running
/// the Job this info is attached to.
struct FilelistInfo {
enum class WhichFiles : unsigned {
InputJobs,
SourceInputActions,
InputJobsAndSourceInputActions,
Output,
IndexUnitOutputPaths,
/// Batch mode frontend invocations may have so many supplementary
/// outputs that they don't comfortably fit as command-line arguments.
/// In that case, add a FilelistInfo to record the path to the file.
/// The type is ignored.
SupplementaryOutput,
};
StringRef path;
file_types::ID type;
WhichFiles whichFiles;
};
} // end namespace driver
} // end namespace swift
#endif