From d16ae98e2ad6d97c9c99aa6c57e4e67d91ae9188 Mon Sep 17 00:00:00 2001 From: David Ungar Date: Tue, 28 Nov 2017 13:28:10 -0800 Subject: [PATCH] Review fixes: Rename isThereAPrimaryInputWithAFilenameAt to isInputPrimary. Remove spurious delayed_function_body_parsing. Simply return type of getOutputFilenamesFromCommandLineOrFilelist. --- include/swift/Frontend/FrontendOptions.h | 2 +- include/swift/Option/FrontendOptions.td | 4 ---- lib/Frontend/CompilerInvocation.cpp | 8 ++++---- lib/Frontend/Frontend.cpp | 6 ++---- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/include/swift/Frontend/FrontendOptions.h b/include/swift/Frontend/FrontendOptions.h index d147a8f9337..07a433aa99e 100644 --- a/include/swift/Frontend/FrontendOptions.h +++ b/include/swift/Frontend/FrontendOptions.h @@ -158,7 +158,7 @@ public: : Optional(); } - bool isThereAPrimaryInputWithAFilenameAt(unsigned i) const { + bool isInputPrimary(unsigned i) const { assertMustNotBeMoreThanOnePrimaryInput(); if (Optional primaryInput = getOptionalPrimaryInput()) return primaryInput->isFilename() && primaryInput->Index == i; diff --git a/include/swift/Option/FrontendOptions.td b/include/swift/Option/FrontendOptions.td index 42eb8717651..4b59e5ef25f 100644 --- a/include/swift/Option/FrontendOptions.td +++ b/include/swift/Option/FrontendOptions.td @@ -21,10 +21,6 @@ def triple : Separate<["-"], "triple">, Alias; def color_diagnostics : Flag<["-"], "color-diagnostics">, HelpText<"Print diagnostics in color">; -def delayed_function_body_parsing : - Flag<["-"], "delayed-function-body-parsing">, - HelpText<"Delay function body parsing until the end of all files">; - def primary_file : Separate<["-"], "primary-file">, HelpText<"Produce output for this file, not the whole module">; diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 24cf4c60359..70ee532bf51 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -288,7 +288,7 @@ private: /// Returns the output filenames on the command line or in the output /// filelist. If there /// were neither -o's nor an output filelist, returns an empty vector. - const std::vector &getOutputFilenamesFromCommandLineOrFilelist(); + ArrayRef getOutputFilenamesFromCommandLineOrFilelist(); bool checkForUnusedOutputPaths() const; @@ -671,7 +671,7 @@ bool FrontendArgsToOptionsConverter::computeFallbackModuleName() { // selected". return false; } - const std::vector &outputFilenames = + ArrayRef outputFilenames = getOutputFilenamesFromCommandLineOrFilelist(); bool isOutputAUniqueOrdinaryFile = @@ -689,7 +689,7 @@ bool FrontendArgsToOptionsConverter::computeOutputFilenames() { FrontendOptions::doesActionProduceOutput(Opts.RequestedAction) || !FrontendOptions::doesActionProduceTextualOutput(Opts.RequestedAction)); - const std::vector &outputFilenamesFromCommandLineOrFilelist = + ArrayRef outputFilenamesFromCommandLineOrFilelist = getOutputFilenamesFromCommandLineOrFilelist(); if (outputFilenamesFromCommandLineOrFilelist.size() > 1) { @@ -887,7 +887,7 @@ void FrontendArgsToOptionsConverter::computeLLVMArgs() { } } -const std::vector & +ArrayRef FrontendArgsToOptionsConverter::getOutputFilenamesFromCommandLineOrFilelist() { if (cachedOutputFilenamesFromCommandLineOrFilelist) { return *cachedOutputFilenamesFromCommandLineOrFilelist; diff --git a/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp index b2ad9ea9d91..3857efa8d51 100644 --- a/lib/Frontend/Frontend.cpp +++ b/lib/Frontend/Frontend.cpp @@ -741,8 +741,7 @@ bool CompilerInstance::setUpForFileAt(unsigned i) { if (SILMode || (MainMode && filename(File) == "main.swift")) MainBufferID = ExistingBufferID.getValue(); - if (Invocation.getFrontendOptions() - .Inputs.isThereAPrimaryInputWithAFilenameAt(i)) + if (Invocation.getFrontendOptions().Inputs.isInputPrimary(i)) PrimaryBufferID = ExistingBufferID.getValue(); return false; // replaced by a memory buffer. @@ -784,8 +783,7 @@ bool CompilerInstance::setUpForFileAt(unsigned i) { if (SILMode || (MainMode && filename(File) == "main.swift")) MainBufferID = BufferID; - if (Invocation.getFrontendOptions() - .Inputs.isThereAPrimaryInputWithAFilenameAt(i)) + if (Invocation.getFrontendOptions().Inputs.isInputPrimary(i)) PrimaryBufferID = BufferID; return false;