mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Rename hasUniqueInput to hasSingleInput.
This commit is contained in:
@@ -99,7 +99,7 @@ public:
|
|||||||
|
|
||||||
bool hasInputs() const { return !AllFiles.empty(); }
|
bool hasInputs() const { return !AllFiles.empty(); }
|
||||||
|
|
||||||
bool hasUniqueInput() const { return inputCount() == 1; }
|
bool hasSingleInput() const { return inputCount() == 1; }
|
||||||
|
|
||||||
const StringRef getFilenameOfFirstInput() const {
|
const StringRef getFilenameOfFirstInput() const {
|
||||||
assert(hasInputs());
|
assert(hasInputs());
|
||||||
@@ -110,7 +110,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isReadingFromStdin() const {
|
bool isReadingFromStdin() const {
|
||||||
return hasUniqueInput() && getFilenameOfFirstInput() == "-";
|
return hasSingleInput() && getFilenameOfFirstInput() == "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have exactly one input filename, and its extension is "bc" or "ll",
|
// If we have exactly one input filename, and its extension is "bc" or "ll",
|
||||||
@@ -488,7 +488,7 @@ public:
|
|||||||
StringRef determineFallbackModuleName() const;
|
StringRef determineFallbackModuleName() const;
|
||||||
|
|
||||||
bool isCompilingExactlyOneSwiftFile() const {
|
bool isCompilingExactlyOneSwiftFile() const {
|
||||||
return InputKind == InputFileKind::IFK_Swift && Inputs.hasUniqueInput();
|
return InputKind == InputFileKind::IFK_Swift && Inputs.hasSingleInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -757,7 +757,7 @@ std::string FrontendArgsToOptionsConverter::determineBaseNameOfOutput() const {
|
|||||||
} else if (auto UserSpecifiedModuleName =
|
} else if (auto UserSpecifiedModuleName =
|
||||||
Args.getLastArg(options::OPT_module_name)) {
|
Args.getLastArg(options::OPT_module_name)) {
|
||||||
nameToStem = UserSpecifiedModuleName->getValue();
|
nameToStem = UserSpecifiedModuleName->getValue();
|
||||||
} else if (Opts.Inputs.hasUniqueInput()) {
|
} else if (Opts.Inputs.hasSingleInput()) {
|
||||||
nameToStem = Opts.Inputs.getFilenameOfFirstInput();
|
nameToStem = Opts.Inputs.getFilenameOfFirstInput();
|
||||||
} else
|
} else
|
||||||
nameToStem = "";
|
nameToStem = "";
|
||||||
@@ -1646,7 +1646,7 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
|
|||||||
} else if (const InputFile *input =
|
} else if (const InputFile *input =
|
||||||
FrontendOpts.Inputs.getUniquePrimaryInput()) {
|
FrontendOpts.Inputs.getUniquePrimaryInput()) {
|
||||||
Opts.MainInputFilename = input->getFile();
|
Opts.MainInputFilename = input->getFile();
|
||||||
} else if (FrontendOpts.Inputs.hasUniqueInput()) {
|
} else if (FrontendOpts.Inputs.hasSingleInput()) {
|
||||||
Opts.MainInputFilename = FrontendOpts.Inputs.getFilenameOfFirstInput();
|
Opts.MainInputFilename = FrontendOpts.Inputs.getFilenameOfFirstInput();
|
||||||
}
|
}
|
||||||
Opts.OutputFilenames = FrontendOpts.OutputFilenames;
|
Opts.OutputFilenames = FrontendOpts.OutputFilenames;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ using namespace swift;
|
|||||||
using namespace llvm::opt;
|
using namespace llvm::opt;
|
||||||
|
|
||||||
bool FrontendInputs::shouldTreatAsLLVM() const {
|
bool FrontendInputs::shouldTreatAsLLVM() const {
|
||||||
if (hasUniqueInput()) {
|
if (hasSingleInput()) {
|
||||||
StringRef Input(getFilenameOfFirstInput());
|
StringRef Input(getFilenameOfFirstInput());
|
||||||
return llvm::sys::path::extension(Input).endswith(LLVM_BC_EXTENSION) ||
|
return llvm::sys::path::extension(Input).endswith(LLVM_BC_EXTENSION) ||
|
||||||
llvm::sys::path::extension(Input).endswith(LLVM_IR_EXTENSION);
|
llvm::sys::path::extension(Input).endswith(LLVM_IR_EXTENSION);
|
||||||
@@ -37,7 +37,7 @@ bool FrontendInputs::shouldTreatAsLLVM() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool FrontendInputs::shouldTreatAsSIL() const {
|
bool FrontendInputs::shouldTreatAsSIL() const {
|
||||||
if (hasUniqueInput()) {
|
if (hasSingleInput()) {
|
||||||
// If we have exactly one input filename, and its extension is "sil",
|
// If we have exactly one input filename, and its extension is "sil",
|
||||||
// treat the input as SIL.
|
// treat the input as SIL.
|
||||||
StringRef Input(getFilenameOfFirstInput());
|
StringRef Input(getFilenameOfFirstInput());
|
||||||
|
|||||||
@@ -541,7 +541,7 @@ static bool performCompile(CompilerInstance &Instance,
|
|||||||
auto &LLVMContext = getGlobalLLVMContext();
|
auto &LLVMContext = getGlobalLLVMContext();
|
||||||
|
|
||||||
// Load in bitcode file.
|
// Load in bitcode file.
|
||||||
assert(Invocation.getFrontendOptions().Inputs.hasUniqueInput() &&
|
assert(Invocation.getFrontendOptions().Inputs.hasSingleInput() &&
|
||||||
"We expect a single input for bitcode input!");
|
"We expect a single input for bitcode input!");
|
||||||
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> FileBufOrErr =
|
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> FileBufOrErr =
|
||||||
llvm::MemoryBuffer::getFileOrSTDIN(
|
llvm::MemoryBuffer::getFileOrSTDIN(
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ private:
|
|||||||
std::vector<std::string> InputFilenames;
|
std::vector<std::string> InputFilenames;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool hasUniqueInput() const { return InputFilenames.size() == 1; }
|
bool hasSingleInput() const { return InputFilenames.size() == 1; }
|
||||||
const std::string &getFilenameOfFirstInput() const {
|
const std::string &getFilenameOfFirstInput() const {
|
||||||
return InputFilenames[0];
|
return InputFilenames[0];
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ int modulewrap_main(ArrayRef<const char *> Args, const char *Argv0,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Invocation.hasUniqueInput()) {
|
if (!Invocation.hasSingleInput()) {
|
||||||
Instance.getDiags().diagnose(SourceLoc(),
|
Instance.getDiags().diagnose(SourceLoc(),
|
||||||
diag::error_mode_requires_one_input_file);
|
diag::error_mode_requires_one_input_file);
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user