21
21
22
22
namespace llvm {
23
23
class MemoryBuffer ;
24
+ namespace opt {
25
+ class ArgList ;
26
+ class Arg ;
27
+ } // namespace opt
24
28
}
25
29
26
30
namespace swift {
@@ -84,17 +88,17 @@ class FrontendInputs {
84
88
85
89
// Input filename readers
86
90
ArrayRef<std::string> getInputFilenames () const { return InputFilenames; }
87
- bool hasInputFilenames () const { return !getInputFilenames ().empty (); }
91
+ bool haveInputFilenames () const { return !getInputFilenames ().empty (); }
88
92
unsigned inputFilenameCount () const { return getInputFilenames ().size (); }
89
93
90
- bool hasUniqueInputFilename () const { return inputFilenameCount () == 1 ; }
94
+ bool haveUniqueInputFilename () const { return inputFilenameCount () == 1 ; }
91
95
const std::string &getFilenameOfFirstInput () const {
92
- assert (hasInputFilenames ());
96
+ assert (haveInputFilenames ());
93
97
return getInputFilenames ()[0 ];
94
98
}
95
99
96
100
bool isReadingFromStdin () const {
97
- return hasUniqueInputFilename () && getFilenameOfFirstInput () == " -" ;
101
+ return haveUniqueInputFilename () && getFilenameOfFirstInput () == " -" ;
98
102
}
99
103
100
104
// If we have exactly one input filename, and its extension is "bc" or "ll",
@@ -123,32 +127,32 @@ class FrontendInputs {
123
127
124
128
// Primary count readers:
125
129
126
- bool hasUniquePrimaryInput () const { return primaryInputCount () == 1 ; }
130
+ bool haveUniquePrimaryInput () const { return primaryInputCount () == 1 ; }
127
131
128
- bool hasPrimaryInputs () const { return primaryInputCount () > 0 ; }
132
+ bool havePrimaryInputs () const { return primaryInputCount () > 0 ; }
129
133
130
- bool isWholeModule () const { return !hasPrimaryInputs (); }
134
+ bool isWholeModule () const { return !havePrimaryInputs (); }
131
135
132
136
// Count-dependend readers:
133
137
134
138
Optional<SelectedInput> getOptionalPrimaryInput () const {
135
- return hasPrimaryInputs () ? Optional<SelectedInput>(getPrimaryInputs ()[0 ])
136
- : Optional<SelectedInput>();
139
+ return havePrimaryInputs () ? Optional<SelectedInput>(getPrimaryInputs ()[0 ])
140
+ : Optional<SelectedInput>();
137
141
}
138
142
139
143
SelectedInput getRequiredUniquePrimaryInput () const {
140
- assert (hasUniquePrimaryInput ());
144
+ assert (haveUniquePrimaryInput ());
141
145
return getPrimaryInputs ()[0 ];
142
146
}
143
147
144
148
Optional<SelectedInput> getOptionalUniquePrimaryInput () const {
145
- return hasUniquePrimaryInput ()
149
+ return haveUniquePrimaryInput ()
146
150
? Optional<SelectedInput>(getPrimaryInputs ()[0 ])
147
151
: Optional<SelectedInput>();
148
152
}
149
153
150
- bool hasAPrimaryInputFile () const {
151
- return hasPrimaryInputs () && getOptionalPrimaryInput ()->isFilename ();
154
+ bool haveAPrimaryInputFile () const {
155
+ return havePrimaryInputs () && getOptionalPrimaryInput ()->isFilename ();
152
156
}
153
157
154
158
Optional<StringRef> getOptionalUniquePrimaryInputFilename () const {
@@ -158,15 +162,15 @@ class FrontendInputs {
158
162
: Optional<StringRef>();
159
163
}
160
164
161
- bool isInputPrimary (unsigned i) const {
165
+ bool isPrimaryInputAFileAt (unsigned i) const {
162
166
assertMustNotBeMoreThanOnePrimaryInput ();
163
167
if (Optional<SelectedInput> primaryInput = getOptionalPrimaryInput ())
164
168
return primaryInput->isFilename () && primaryInput->Index == i;
165
169
return false ;
166
170
}
167
171
168
172
Optional<unsigned > primaryInputFileIndex () const {
169
- return hasAPrimaryInputFile ()
173
+ return haveAPrimaryInputFile ()
170
174
? Optional<unsigned >(getOptionalPrimaryInput ()->Index )
171
175
: None;
172
176
}
@@ -180,10 +184,13 @@ class FrontendInputs {
180
184
181
185
public:
182
186
// Multi-facet readers
187
+ StringRef baseNameOfOutput (const llvm::opt::ArgList &Args,
188
+ StringRef ModuleName) const ;
189
+
183
190
bool shouldTreatAsSIL () const ;
184
191
185
192
// / Return true for error
186
- bool verifyInputs (DiagnosticEngine &diags , bool treatAsSIL ,
193
+ bool verifyInputs (DiagnosticEngine &Diags , bool TreatAsSIL ,
187
194
bool isREPLRequested, bool isNoneRequested) const ;
188
195
189
196
// Input filename writers
@@ -243,8 +250,6 @@ class FrontendInputs {
243
250
244
251
// / Options for controlling the behavior of the frontend.
245
252
class FrontendOptions {
246
- friend class FrontendArgsToOptionsConverter ;
247
-
248
253
public:
249
254
FrontendInputs Inputs;
250
255
@@ -274,9 +279,12 @@ class FrontendOptions {
274
279
return getSingleOutputFilename () == " -" ;
275
280
}
276
281
bool isOutputFileDirectory () const ;
277
- bool hasNamedOutputFile () const {
282
+ bool isOutputFilePlainFile () const ;
283
+ bool haveNamedOutputFile () const {
278
284
return !OutputFilenames.empty () && !isOutputFilenameStdout ();
279
285
}
286
+ void setOutputFileList (DiagnosticEngine &Diags,
287
+ const llvm::opt::ArgList &Args);
280
288
281
289
// / A list of arbitrary modules to import and make implicitly visible.
282
290
std::vector<std::string> ImplicitImportModuleNames;
@@ -532,25 +540,10 @@ class FrontendOptions {
532
540
533
541
bool isCompilingExactlyOneSwiftFile () const {
534
542
return InputKind == InputFileKind::IFK_Swift &&
535
- Inputs.hasUniqueInputFilename ();
543
+ Inputs.haveUniqueInputFilename ();
536
544
}
537
545
538
- private:
539
- static const char *suffixForPrincipalOutputFileForAction (ActionType);
540
-
541
- bool hasUnusedDependenciesFilePath () const ;
542
- static bool canActionEmitDependencies (ActionType);
543
- bool hasUnusedObjCHeaderOutputPath () const ;
544
- static bool canActionEmitHeader (ActionType);
545
- bool hasUnusedLoadedModuleTracePath () const ;
546
- static bool canActionEmitLoadedModuleTrace (ActionType);
547
- bool hasUnusedModuleOutputPath () const ;
548
- static bool canActionEmitModule (ActionType);
549
- bool hasUnusedModuleDocOutputPath () const ;
550
- static bool canActionEmitModuleDoc (ActionType);
551
-
552
- static bool doesActionProduceOutput (ActionType);
553
- static bool doesActionProduceTextualOutput (ActionType);
546
+ void setModuleName (DiagnosticEngine &Diags, const llvm::opt::ArgList &Args);
554
547
};
555
548
556
549
}
0 commit comments