Skip to content

Renamed swift::types to swift::file_types. #15328

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
Mar 22, 2018
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
50 changes: 26 additions & 24 deletions include/swift/Driver/Action.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "swift/Basic/LLVM.h"
#include "swift/Driver/Util.h"
#include "swift/Frontend/Types.h"
#include "swift/Frontend/FileTypes.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringSwitch.h"
Expand Down Expand Up @@ -67,8 +67,7 @@ class Action {
void *operator new(size_t size) { return ::operator new(size); };

protected:
Action(ActionClass Kind, types::ID Type)
: Kind(Kind), Type(Type) {
Action(ActionClass Kind, file_types::ID Type) : Kind(Kind), Type(Type) {
assert(Kind == getKind() && "not enough bits");
assert(Type == getType() && "not enough bits");
}
Expand All @@ -79,15 +78,15 @@ class Action {
const char *getClassName() const { return Action::getClassName(getKind()); }

ActionClass getKind() const { return static_cast<ActionClass>(Kind); }
types::ID getType() const { return static_cast<types::ID>(Type); }
file_types::ID getType() const { return static_cast<file_types::ID>(Type); }
};

class InputAction : public Action {
virtual void anchor();
const llvm::opt::Arg &Input;

public:
InputAction(const llvm::opt::Arg &Input, types::ID Type)
InputAction(const llvm::opt::Arg &Input, file_types::ID Type)
: Action(Action::Input, Type), Input(Input) {}
const llvm::opt::Arg &getInputArg() const { return Input; }

Expand All @@ -100,7 +99,8 @@ class JobAction : public Action {
TinyPtrVector<const Action *> Inputs;
virtual void anchor();
protected:
JobAction(ActionClass Kind, ArrayRef<const Action *> Inputs, types::ID Type)
JobAction(ActionClass Kind, ArrayRef<const Action *> Inputs,
file_types::ID Type)
: Action(Kind, Type), Inputs(Inputs) {}

public:
Expand Down Expand Up @@ -151,13 +151,11 @@ class CompileJobAction : public JobAction {
InputInfo inputInfo;

public:
CompileJobAction(types::ID OutputType)
CompileJobAction(file_types::ID OutputType)
: JobAction(Action::CompileJob, None, OutputType), inputInfo() {}

CompileJobAction(Action *Input, types::ID OutputType,
InputInfo info)
: JobAction(Action::CompileJob, Input, OutputType),
inputInfo(info) {}
CompileJobAction(Action *Input, file_types::ID OutputType, InputInfo info)
: JobAction(Action::CompileJob, Input, OutputType), inputInfo(info) {}

InputInfo getInputInfo() const {
return inputInfo;
Expand All @@ -174,7 +172,7 @@ class InterpretJobAction : public JobAction {

public:
explicit InterpretJobAction()
: JobAction(Action::InterpretJob, llvm::None, types::TY_Nothing) {}
: JobAction(Action::InterpretJob, llvm::None, file_types::TY_Nothing) {}

static bool classof(const Action *A) {
return A->getKind() == Action::InterpretJob;
Expand All @@ -190,7 +188,8 @@ class BackendJobAction : public JobAction {
// This index specifies which of the files to select for the input.
size_t InputIndex;
public:
BackendJobAction(const Action *Input, types::ID OutputType, size_t InputIndex)
BackendJobAction(const Action *Input, file_types::ID OutputType,
size_t InputIndex)
: JobAction(Action::BackendJob, Input, OutputType),
InputIndex(InputIndex) {}
static bool classof(const Action *A) {
Expand All @@ -212,8 +211,8 @@ class REPLJobAction : public JobAction {
Mode RequestedMode;
public:
REPLJobAction(Mode mode)
: JobAction(Action::REPLJob, llvm::None, types::TY_Nothing),
RequestedMode(mode) {}
: JobAction(Action::REPLJob, llvm::None, file_types::TY_Nothing),
RequestedMode(mode) {}

Mode getRequestedMode() const { return RequestedMode; }

Expand All @@ -226,7 +225,8 @@ class MergeModuleJobAction : public JobAction {
virtual void anchor();
public:
MergeModuleJobAction(ArrayRef<const Action *> Inputs)
: JobAction(Action::MergeModuleJob, Inputs, types::TY_SwiftModuleFile) {}
: JobAction(Action::MergeModuleJob, Inputs,
file_types::TY_SwiftModuleFile) {}

static bool classof(const Action *A) {
return A->getKind() == Action::MergeModuleJob;
Expand All @@ -237,7 +237,7 @@ class ModuleWrapJobAction : public JobAction {
virtual void anchor();
public:
ModuleWrapJobAction(ArrayRef<const Action *> Inputs)
: JobAction(Action::ModuleWrapJob, Inputs, types::TY_Object) {}
: JobAction(Action::ModuleWrapJob, Inputs, file_types::TY_Object) {}

static bool classof(const Action *A) {
return A->getKind() == Action::ModuleWrapJob;
Expand All @@ -248,7 +248,8 @@ class AutolinkExtractJobAction : public JobAction {
virtual void anchor();
public:
AutolinkExtractJobAction(ArrayRef<const Action *> Inputs)
: JobAction(Action::AutolinkExtractJob, Inputs, types::TY_AutolinkFile) {}
: JobAction(Action::AutolinkExtractJob, Inputs,
file_types::TY_AutolinkFile) {}

static bool classof(const Action *A) {
return A->getKind() == Action::AutolinkExtractJob;
Expand All @@ -259,7 +260,7 @@ class GenerateDSYMJobAction : public JobAction {
virtual void anchor();
public:
explicit GenerateDSYMJobAction(const Action *Input)
: JobAction(Action::GenerateDSYMJob, Input, types::TY_dSYM) {}
: JobAction(Action::GenerateDSYMJob, Input, file_types::TY_dSYM) {}

static bool classof(const Action *A) {
return A->getKind() == Action::GenerateDSYMJob;
Expand All @@ -270,7 +271,7 @@ class VerifyDebugInfoJobAction : public JobAction {
virtual void anchor();
public:
explicit VerifyDebugInfoJobAction(const Action *Input)
: JobAction(Action::VerifyDebugInfoJob, Input, types::TY_Nothing) {}
: JobAction(Action::VerifyDebugInfoJob, Input, file_types::TY_Nothing) {}

static bool classof(const Action *A) {
return A->getKind() == Action::VerifyDebugInfoJob;
Expand All @@ -283,9 +284,10 @@ class GeneratePCHJobAction : public JobAction {
virtual void anchor();
public:
GeneratePCHJobAction(const Action *Input, StringRef persistentPCHDir)
: JobAction(Action::GeneratePCHJob, Input,
persistentPCHDir.empty() ? types::TY_PCH : types::TY_Nothing),
PersistentPCHDir(persistentPCHDir) {}
: JobAction(Action::GeneratePCHJob, Input,
persistentPCHDir.empty() ? file_types::TY_PCH
: file_types::TY_Nothing),
PersistentPCHDir(persistentPCHDir) {}

bool isPersistentPCH() const { return !PersistentPCHDir.empty(); }
StringRef getPersistentPCHDir() const { return PersistentPCHDir; }
Expand All @@ -301,7 +303,7 @@ class LinkJobAction : public JobAction {

public:
LinkJobAction(ArrayRef<const Action *> Inputs, LinkKind K)
: JobAction(Action::LinkJob, Inputs, types::TY_Image), Kind(K) {
: JobAction(Action::LinkJob, Inputs, file_types::TY_Image), Kind(K) {
assert(Kind != LinkKind::None);
}

Expand Down
4 changes: 2 additions & 2 deletions include/swift/Driver/Driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include "swift/Basic/OptionSet.h"
#include "swift/Basic/Sanitizers.h"
#include "swift/Driver/Util.h"
#include "swift/Frontend/FileTypes.h"
#include "swift/Frontend/OutputFileMap.h"
#include "swift/Frontend/Types.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
Expand Down Expand Up @@ -78,7 +78,7 @@ class OutputInfo {
Mode CompilerMode = Mode::StandardCompile;

/// The output type which should be used for compile actions.
types::ID CompilerOutputType = types::ID::TY_INVALID;
file_types::ID CompilerOutputType = file_types::ID::TY_INVALID;

/// Describes if and how the output of compile actions should be
/// linked together.
Expand Down
30 changes: 15 additions & 15 deletions include/swift/Driver/Job.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include "swift/Basic/LLVM.h"
#include "swift/Driver/Action.h"
#include "swift/Driver/Util.h"
#include "swift/Frontend/FileTypes.h"
#include "swift/Frontend/OutputFileMap.h"
#include "swift/Frontend/Types.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PointerIntPair.h"
Expand Down Expand Up @@ -109,15 +109,15 @@ class CommandOutput {

/// A CommandOutput designates one type of output as primary, though there
/// may be multiple outputs of that type.
types::ID PrimaryOutputType;
file_types::ID PrimaryOutputType;

/// A CommandOutput also restricts its attention regarding additional-outputs
/// to a subset of the PrimaryOutputs associated with its PrimaryInputs;
/// sometimes multiple commands operate on the same PrimaryInput, in different
/// phases (eg. autolink-extract and link both operate on the same .o file),
/// so Jobs cannot _just_ rely on the presence of a primary output in the
/// DerivedOutputFileMap.
llvm::SmallSet<types::ID, 4> AdditionalOutputTypes;
llvm::SmallSet<file_types::ID, 4> AdditionalOutputTypes;

/// The list of inputs for this \c CommandOutput. Each input in the list has
/// two names (often but not always the same), of which the second (\c
Expand All @@ -135,23 +135,21 @@ class CommandOutput {
// If there is an entry in the DerivedOutputMap for a given (\p
// PrimaryInputFile, \p Type) pair, return a nonempty StringRef, otherwise
// return an empty StringRef.
StringRef
getOutputForInputAndType(StringRef PrimaryInputFile, types::ID Type) const;
StringRef getOutputForInputAndType(StringRef PrimaryInputFile,
file_types::ID Type) const;

/// Add an entry to the \c DerivedOutputMap if it doesn't exist. If an entry
/// already exists for \p PrimaryInputFile of type \p type, then either
/// overwrite the entry (if \p overwrite is \c true) or assert that it has
/// the same value as \p OutputFile.
void ensureEntry(StringRef PrimaryInputFile,
types::ID Type,
StringRef OutputFile,
bool Overwrite);
void ensureEntry(StringRef PrimaryInputFile, file_types::ID Type,
StringRef OutputFile, bool Overwrite);

public:
CommandOutput(types::ID PrimaryOutputType, OutputFileMap &Derived);
CommandOutput(file_types::ID PrimaryOutputType, OutputFileMap &Derived);

/// Return the primary output type for this CommandOutput.
types::ID getPrimaryOutputType() const;
file_types::ID getPrimaryOutputType() const;

/// Associate a new \p PrimaryOutputFile (of type \c getPrimaryOutputType())
/// with the provided \p Input pair of Base and Primary inputs.
Expand Down Expand Up @@ -186,12 +184,13 @@ class CommandOutput {
/// an additional output named \p OutputFilename of type \p type with the
/// first primary input. If the provided \p type is the primary output type,
/// overwrite the existing entry assocaited with the first primary input.
void setAdditionalOutputForType(types::ID type, StringRef OutputFilename);
void setAdditionalOutputForType(file_types::ID type,
StringRef OutputFilename);

/// Assuming (and asserting) that there are one or more input pairs, return
/// the _additional_ (not primary) output of type \p type associated with the
/// first primary input.
StringRef getAdditionalOutputForType(types::ID type) const;
StringRef getAdditionalOutputForType(file_types::ID type) const;

/// Return a vector of additional (not primary) outputs of type \p type
/// associated with the primary inputs.
Expand All @@ -202,12 +201,13 @@ class CommandOutput {
/// length is _either_ zero, one, or equal to the size of the set of inputs,
/// as these are the only valid arity relationships between primary and
/// additional outputs.
SmallVector<StringRef, 16> getAdditionalOutputsForType(types::ID type) const;
SmallVector<StringRef, 16>
getAdditionalOutputsForType(file_types::ID type) const;

/// Assuming (and asserting) that there is only one input pair, return any
/// output -- primary or additional -- of type \p type associated with that
/// the sole primary input.
StringRef getAnyOutputForType(types::ID type) const;
StringRef getAnyOutputForType(file_types::ID type) const;

/// Return the whole derived output map.
const OutputFileMap &getDerivedOutputMap() const;
Expand Down
7 changes: 4 additions & 3 deletions include/swift/Driver/PrettyStackTrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifndef SWIFT_DRIVER_PRETTYSTACKTRACE_H
#define SWIFT_DRIVER_PRETTYSTACKTRACE_H

#include "swift/Frontend/Types.h"
#include "swift/Frontend/FileTypes.h"
#include "llvm/Support/PrettyStackTrace.h"

namespace swift {
Expand Down Expand Up @@ -57,14 +57,15 @@ class PrettyStackTraceDriverCommandOutputAddition
: public llvm::PrettyStackTraceEntry {
const CommandOutput *TheCommandOutput;
StringRef PrimaryInput;
types::ID NewOutputType;
file_types::ID NewOutputType;
StringRef NewOutputName;
const char *Description;

public:
PrettyStackTraceDriverCommandOutputAddition(const char *desc,
const CommandOutput *A,
StringRef Primary, types::ID type,
StringRef Primary,
file_types::ID type,
StringRef New)
: TheCommandOutput(A), PrimaryInput(Primary), NewOutputType(type),
NewOutputName(New), Description(desc) {}
Expand Down
4 changes: 2 additions & 2 deletions include/swift/Driver/ToolChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "swift/Basic/LLVM.h"
#include "swift/Driver/Action.h"
#include "swift/Frontend/Types.h"
#include "swift/Frontend/FileTypes.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Option/Option.h"

Expand Down Expand Up @@ -224,7 +224,7 @@ class ToolChain {
/// Return the default language type to use for the given extension.
/// If the extension is empty or is otherwise not recognized, return
/// the invalid type \c TY_INVALID.
virtual types::ID lookupTypeForExtension(StringRef Ext) const;
virtual file_types::ID lookupTypeForExtension(StringRef Ext) const;

/// Check whether a clang library with a given name exists.
///
Expand Down
6 changes: 3 additions & 3 deletions include/swift/Driver/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define SWIFT_DRIVER_UTIL_H

#include "swift/Basic/LLVM.h"
#include "swift/Frontend/Types.h"
#include "swift/Frontend/FileTypes.h"
#include "llvm/ADT/SmallVector.h"

namespace llvm {
Expand All @@ -27,7 +27,7 @@ namespace swift {

namespace driver {
/// An input argument from the command line and its inferred type.
typedef std::pair<types::ID, const llvm::opt::Arg *> InputPair;
typedef std::pair<file_types::ID, const llvm::opt::Arg *> InputPair;
/// Type used for a list of input arguments.
typedef SmallVector<InputPair, 16> InputFileList;

Expand Down Expand Up @@ -55,7 +55,7 @@ namespace driver {
};

StringRef path;
types::ID type;
file_types::ID type;
WhichFiles whichFiles;
};

Expand Down
Loading