mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Last round of small changes
This commit is contained in:
@@ -425,15 +425,15 @@ private:
|
||||
void setUpDiagnosticOptions();
|
||||
bool setUpModuleLoaders();
|
||||
Optional<unsigned> setUpCodeCompletionBuffer();
|
||||
bool setupInputs(Optional<unsigned> codeCompletionBufferID);
|
||||
bool setUpInputs(Optional<unsigned> codeCompletionBufferID);
|
||||
bool isInputSwift() {
|
||||
return Invocation.getInputKind() == InputFileKind::IFK_Swift;
|
||||
}
|
||||
bool isInSILMode() {
|
||||
return Invocation.getInputKind() == InputFileKind::IFK_SIL;
|
||||
}
|
||||
bool setupForInput(const InputFile &input);
|
||||
void setupForBuffer(llvm::MemoryBuffer *buffer, bool isPrimary);
|
||||
bool setUpForInput(const InputFile &input);
|
||||
void setUpForBuffer(llvm::MemoryBuffer *buffer, bool isPrimary);
|
||||
bool setUpForFile(StringRef file, bool isPrimary);
|
||||
|
||||
public:
|
||||
|
||||
@@ -179,7 +179,8 @@ private:
|
||||
continue;
|
||||
hadDuplicates = addFile(A->getValue()) || hadDuplicates;
|
||||
}
|
||||
return false; // Don't bail out for duplicates, too many tests depend on it.
|
||||
return false; // FIXME: Don't bail out for duplicates, too many tests depend
|
||||
// on it.
|
||||
}
|
||||
|
||||
bool doesCommandLineIncludeFilelist() { return FilelistPathArg; }
|
||||
@@ -203,14 +204,13 @@ private:
|
||||
for (auto file : llvm::make_range(llvm::line_iterator(*FilelistBuffer),
|
||||
llvm::line_iterator()))
|
||||
hadDuplicates = addFile(file) || hadDuplicates;
|
||||
return false; // Don't bail out for duplicates, too many tests depend on it.
|
||||
return false; // FIXME: Don't bail out for duplicates, too many tests depend
|
||||
// on it.
|
||||
}
|
||||
|
||||
bool addFile(StringRef file) {
|
||||
if (Files.count(file) == 0) {
|
||||
Files.insert(file);
|
||||
if (Files.insert(file))
|
||||
return false;
|
||||
}
|
||||
Diags.diagnose(SourceLoc(), diag::error_duplicate_input_file, file);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ bool CompilerInstance::setup(const CompilerInvocation &Invok) {
|
||||
if (isInSILMode())
|
||||
Invocation.getLangOptions().EnableAccessControl = false;
|
||||
|
||||
return setupInputs(codeCompletionBufferID);
|
||||
return setUpInputs(codeCompletionBufferID);
|
||||
}
|
||||
|
||||
void CompilerInstance::setUpLLVMArguments() {
|
||||
@@ -129,6 +129,7 @@ void CompilerInstance::setUpDiagnosticOptions() {
|
||||
Diagnostics.setWarningsAsErrors(true);
|
||||
}
|
||||
}
|
||||
|
||||
bool CompilerInstance::setUpModuleLoaders() {
|
||||
if (hasSourceImport()) {
|
||||
bool immediate = FrontendOptions::isActionImmediate(
|
||||
@@ -175,10 +176,10 @@ Optional<unsigned> CompilerInstance::setUpCodeCompletionBuffer() {
|
||||
return codeCompletionBufferID;
|
||||
}
|
||||
|
||||
bool CompilerInstance::setupInputs(Optional<unsigned> codeCompletionBufferID) {
|
||||
bool CompilerInstance::setUpInputs(Optional<unsigned> codeCompletionBufferID) {
|
||||
for (const InputFile &input :
|
||||
Invocation.getFrontendOptions().Inputs.getAllFiles())
|
||||
if (setupForInput(input))
|
||||
if (setUpForInput(input))
|
||||
return true;
|
||||
|
||||
// Set the primary file to the code-completion point if one exists.
|
||||
@@ -196,14 +197,14 @@ bool CompilerInstance::setupInputs(Optional<unsigned> codeCompletionBufferID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CompilerInstance::setupForInput(const InputFile &input) {
|
||||
bool CompilerInstance::setUpForInput(const InputFile &input) {
|
||||
if (llvm::MemoryBuffer *inputBuffer = input.buffer()) {
|
||||
setupForBuffer(inputBuffer, input.isPrimary());
|
||||
setUpForBuffer(inputBuffer, input.isPrimary());
|
||||
return false;
|
||||
}
|
||||
return setUpForFile(input.file(), input.isPrimary());
|
||||
}
|
||||
void CompilerInstance::setupForBuffer(llvm::MemoryBuffer *buffer,
|
||||
void CompilerInstance::setUpForBuffer(llvm::MemoryBuffer *buffer,
|
||||
bool isPrimary) {
|
||||
auto copy = llvm::MemoryBuffer::getMemBufferCopy(
|
||||
buffer->getBuffer(), buffer->getBufferIdentifier());
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
// SIL_FILES: this mode requires a single input file
|
||||
|
||||
// RUN: not %target-swift-frontend -parse-sil -emit-sil %s %s 2>&1 | %FileCheck -check-prefix=DUPLICATE_FILES %s
|
||||
// RUN: not %target-swift-frontend -parse-sil -emit-sil %s %S/../Inputs/empty.swift 2>&1 | %FileCheck -check-prefix=SIL_FILES %s
|
||||
// DUPLICATE_FILES: duplicate input file 'SOURCE_DIR/test/Driver/options.swift'
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user