Review fixes:

Rename isThereAPrimaryInputWithAFilenameAt to isInputPrimary.
Remove spurious delayed_function_body_parsing.
Simply return type of getOutputFilenamesFromCommandLineOrFilelist.
This commit is contained in:
David Ungar
2017-11-28 13:28:10 -08:00
parent b4681b154d
commit d16ae98e2a
4 changed files with 7 additions and 13 deletions

View File

@@ -158,7 +158,7 @@ public:
: Optional<StringRef>(); : Optional<StringRef>();
} }
bool isThereAPrimaryInputWithAFilenameAt(unsigned i) const { bool isInputPrimary(unsigned i) const {
assertMustNotBeMoreThanOnePrimaryInput(); assertMustNotBeMoreThanOnePrimaryInput();
if (Optional<SelectedInput> primaryInput = getOptionalPrimaryInput()) if (Optional<SelectedInput> primaryInput = getOptionalPrimaryInput())
return primaryInput->isFilename() && primaryInput->Index == i; return primaryInput->isFilename() && primaryInput->Index == i;

View File

@@ -21,10 +21,6 @@ def triple : Separate<["-"], "triple">, Alias<target>;
def color_diagnostics : Flag<["-"], "color-diagnostics">, def color_diagnostics : Flag<["-"], "color-diagnostics">,
HelpText<"Print diagnostics in color">; 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">, def primary_file : Separate<["-"], "primary-file">,
HelpText<"Produce output for this file, not the whole module">; HelpText<"Produce output for this file, not the whole module">;

View File

@@ -288,7 +288,7 @@ private:
/// Returns the output filenames on the command line or in the output /// Returns the output filenames on the command line or in the output
/// filelist. If there /// filelist. If there
/// were neither -o's nor an output filelist, returns an empty vector. /// were neither -o's nor an output filelist, returns an empty vector.
const std::vector<std::string> &getOutputFilenamesFromCommandLineOrFilelist(); ArrayRef<std::string> getOutputFilenamesFromCommandLineOrFilelist();
bool checkForUnusedOutputPaths() const; bool checkForUnusedOutputPaths() const;
@@ -671,7 +671,7 @@ bool FrontendArgsToOptionsConverter::computeFallbackModuleName() {
// selected". // selected".
return false; return false;
} }
const std::vector<std::string> &outputFilenames = ArrayRef<std::string> outputFilenames =
getOutputFilenamesFromCommandLineOrFilelist(); getOutputFilenamesFromCommandLineOrFilelist();
bool isOutputAUniqueOrdinaryFile = bool isOutputAUniqueOrdinaryFile =
@@ -689,7 +689,7 @@ bool FrontendArgsToOptionsConverter::computeOutputFilenames() {
FrontendOptions::doesActionProduceOutput(Opts.RequestedAction) || FrontendOptions::doesActionProduceOutput(Opts.RequestedAction) ||
!FrontendOptions::doesActionProduceTextualOutput(Opts.RequestedAction)); !FrontendOptions::doesActionProduceTextualOutput(Opts.RequestedAction));
const std::vector<std::string> &outputFilenamesFromCommandLineOrFilelist = ArrayRef<std::string> outputFilenamesFromCommandLineOrFilelist =
getOutputFilenamesFromCommandLineOrFilelist(); getOutputFilenamesFromCommandLineOrFilelist();
if (outputFilenamesFromCommandLineOrFilelist.size() > 1) { if (outputFilenamesFromCommandLineOrFilelist.size() > 1) {
@@ -887,7 +887,7 @@ void FrontendArgsToOptionsConverter::computeLLVMArgs() {
} }
} }
const std::vector<std::string> & ArrayRef<std::string>
FrontendArgsToOptionsConverter::getOutputFilenamesFromCommandLineOrFilelist() { FrontendArgsToOptionsConverter::getOutputFilenamesFromCommandLineOrFilelist() {
if (cachedOutputFilenamesFromCommandLineOrFilelist) { if (cachedOutputFilenamesFromCommandLineOrFilelist) {
return *cachedOutputFilenamesFromCommandLineOrFilelist; return *cachedOutputFilenamesFromCommandLineOrFilelist;

View File

@@ -741,8 +741,7 @@ bool CompilerInstance::setUpForFileAt(unsigned i) {
if (SILMode || (MainMode && filename(File) == "main.swift")) if (SILMode || (MainMode && filename(File) == "main.swift"))
MainBufferID = ExistingBufferID.getValue(); MainBufferID = ExistingBufferID.getValue();
if (Invocation.getFrontendOptions() if (Invocation.getFrontendOptions().Inputs.isInputPrimary(i))
.Inputs.isThereAPrimaryInputWithAFilenameAt(i))
PrimaryBufferID = ExistingBufferID.getValue(); PrimaryBufferID = ExistingBufferID.getValue();
return false; // replaced by a memory buffer. return false; // replaced by a memory buffer.
@@ -784,8 +783,7 @@ bool CompilerInstance::setUpForFileAt(unsigned i) {
if (SILMode || (MainMode && filename(File) == "main.swift")) if (SILMode || (MainMode && filename(File) == "main.swift"))
MainBufferID = BufferID; MainBufferID = BufferID;
if (Invocation.getFrontendOptions() if (Invocation.getFrontendOptions().Inputs.isInputPrimary(i))
.Inputs.isThereAPrimaryInputWithAFilenameAt(i))
PrimaryBufferID = BufferID; PrimaryBufferID = BufferID;
return false; return false;