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