mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Reorder attributes in FrontendInputsAndOutputs
This commit is contained in:
@@ -33,8 +33,8 @@ class FrontendInputsAndOutputs {
|
||||
friend class ArgsToFrontendInputsConverter;
|
||||
|
||||
std::vector<InputFile> AllInputs;
|
||||
typedef llvm::StringMap<unsigned> InputFileMap;
|
||||
InputFileMap PrimaryInputs;
|
||||
|
||||
llvm::StringMap<unsigned> PrimaryInputs;
|
||||
|
||||
public:
|
||||
FrontendInputsAndOutputs() = default;
|
||||
@@ -43,6 +43,8 @@ public:
|
||||
|
||||
// Readers:
|
||||
|
||||
// All inputs:
|
||||
|
||||
ArrayRef<InputFile> getAllInputs() const { return AllInputs; }
|
||||
|
||||
std::vector<std::string> getInputFilenames() const;
|
||||
@@ -53,22 +55,25 @@ public:
|
||||
|
||||
bool hasSingleInput() const { return inputCount() == 1; }
|
||||
|
||||
const InputFile &firstInput() const { return AllInputs[0]; }
|
||||
InputFile &firstInput() { return AllInputs[0]; }
|
||||
|
||||
const InputFile &lastInput() const { return AllInputs.back(); }
|
||||
|
||||
StringRef getFilenameOfFirstInput() const;
|
||||
|
||||
bool isReadingFromStdin() const;
|
||||
|
||||
// If we have exactly one input filename, and its extension is "bc" or "ll",
|
||||
// treat the input as LLVM_IR.
|
||||
bool shouldTreatAsLLVM() const;
|
||||
void forEachInput(llvm::function_ref<void(const InputFile &)> fn) const;
|
||||
|
||||
// Primary input readers
|
||||
// Primaries:
|
||||
|
||||
private:
|
||||
void assertMustNotBeMoreThanOnePrimaryInput() const;
|
||||
const InputFile &firstPrimaryInput() const;
|
||||
const InputFile &lastPrimaryInput() const;
|
||||
|
||||
bool areAllNonPrimariesSIB() const;
|
||||
void
|
||||
forEachPrimaryInput(llvm::function_ref<void(const InputFile &)> fn) const;
|
||||
|
||||
public:
|
||||
unsigned primaryInputCount() const { return PrimaryInputs.size(); }
|
||||
|
||||
// Primary count readers:
|
||||
@@ -79,6 +84,11 @@ public:
|
||||
|
||||
bool isWholeModule() const { return !hasPrimaryInputs(); }
|
||||
|
||||
/// Fails an assertion if there is more than one primary input.
|
||||
/// Used in situations where only one primary input can be handled
|
||||
/// and where batch mode has not been implemented yet.
|
||||
void assertMustNotBeMoreThanOnePrimaryInput() const;
|
||||
|
||||
// Count-dependend readers:
|
||||
|
||||
/// \return the unique primary input, if one exists.
|
||||
@@ -96,28 +106,25 @@ public:
|
||||
|
||||
// Multi-facet readers
|
||||
|
||||
// If we have exactly one input filename, and its extension is "bc" or "ll",
|
||||
// treat the input as LLVM_IR.
|
||||
bool shouldTreatAsLLVM() const;
|
||||
bool shouldTreatAsSIL() const;
|
||||
|
||||
bool areAllNonPrimariesSIB() const;
|
||||
|
||||
/// \return true for error
|
||||
bool verifyInputs(DiagnosticEngine &diags, bool treatAsSIL,
|
||||
bool isREPLRequested, bool isNoneRequested) const;
|
||||
|
||||
// Writers
|
||||
|
||||
void addInputFile(StringRef file, llvm::MemoryBuffer *buffer = nullptr) {
|
||||
addInput(InputFile(file, false, buffer));
|
||||
}
|
||||
void addPrimaryInputFile(StringRef file,
|
||||
llvm::MemoryBuffer *buffer = nullptr) {
|
||||
addInput(InputFile(file, true, buffer));
|
||||
}
|
||||
// Changing inputs
|
||||
|
||||
public:
|
||||
void clearInputs();
|
||||
void addInput(const InputFile &input);
|
||||
|
||||
void clearInputs() {
|
||||
AllInputs.clear();
|
||||
PrimaryInputs.clear();
|
||||
}
|
||||
void addInputFile(StringRef file, llvm::MemoryBuffer *buffer = nullptr);
|
||||
void addPrimaryInputFile(StringRef file,
|
||||
llvm::MemoryBuffer *buffer = nullptr);
|
||||
};
|
||||
|
||||
} // namespace swift
|
||||
|
||||
Reference in New Issue
Block a user