@@ -152,8 +152,8 @@ static Optional<bool> normalizeSimpleNegativeFlag(OptSpecifier Opt, unsigned,
152
152
// / argument.
153
153
static void denormalizeSimpleFlag (SmallVectorImpl<const char *> &Args,
154
154
const char *Spelling,
155
- CompilerInvocation::StringAllocator,
156
- Option::OptionClass, unsigned , /* T*/ ...) {
155
+ CompilerInvocation::StringAllocator, unsigned ,
156
+ /* T*/ ...) {
157
157
Args.push_back (Spelling);
158
158
}
159
159
@@ -193,41 +193,12 @@ static auto makeBooleanOptionNormalizer(bool Value, bool OtherValue,
193
193
194
194
static auto makeBooleanOptionDenormalizer (bool Value) {
195
195
return [Value](SmallVectorImpl<const char *> &Args, const char *Spelling,
196
- CompilerInvocation::StringAllocator, Option::OptionClass,
197
- unsigned , bool KeyPath) {
196
+ CompilerInvocation::StringAllocator, unsigned , bool KeyPath) {
198
197
if (KeyPath == Value)
199
198
Args.push_back (Spelling);
200
199
};
201
200
}
202
201
203
- static void denormalizeStringImpl (SmallVectorImpl<const char *> &Args,
204
- const char *Spelling,
205
- CompilerInvocation::StringAllocator SA,
206
- Option::OptionClass OptClass, unsigned ,
207
- Twine Value) {
208
- switch (OptClass) {
209
- case Option::SeparateClass:
210
- case Option::JoinedOrSeparateClass:
211
- Args.push_back (Spelling);
212
- Args.push_back (SA (Value));
213
- break ;
214
- case Option::JoinedClass:
215
- Args.push_back (SA (Twine (Spelling) + Value));
216
- break ;
217
- default :
218
- llvm_unreachable (" Cannot denormalize an option with option class "
219
- " incompatible with string denormalization." );
220
- }
221
- }
222
-
223
- template <typename T>
224
- static void
225
- denormalizeString (SmallVectorImpl<const char *> &Args, const char *Spelling,
226
- CompilerInvocation::StringAllocator SA,
227
- Option::OptionClass OptClass, unsigned TableIndex, T Value) {
228
- denormalizeStringImpl (Args, Spelling, SA, OptClass, TableIndex, Twine (Value));
229
- }
230
-
231
202
static Optional<SimpleEnumValue>
232
203
findValueTableByName (const SimpleEnumValueTable &Table, StringRef Name) {
233
204
for (int I = 0 , E = Table.Size ; I != E; ++I)
@@ -269,13 +240,12 @@ static llvm::Optional<unsigned> normalizeSimpleEnum(OptSpecifier Opt,
269
240
static void denormalizeSimpleEnumImpl (SmallVectorImpl<const char *> &Args,
270
241
const char *Spelling,
271
242
CompilerInvocation::StringAllocator SA,
272
- Option::OptionClass OptClass,
273
243
unsigned TableIndex, unsigned Value) {
274
244
assert (TableIndex < SimpleEnumValueTablesSize);
275
245
const SimpleEnumValueTable &Table = SimpleEnumValueTables[TableIndex];
276
246
if (auto MaybeEnumVal = findValueTableByValue (Table, Value)) {
277
- denormalizeString ( Args, Spelling, SA, OptClass, TableIndex,
278
- MaybeEnumVal->Name );
247
+ Args. push_back ( Spelling);
248
+ Args. push_back ( MaybeEnumVal->Name );
279
249
} else {
280
250
llvm_unreachable (" The simple enum value was not correctly defined in "
281
251
" the tablegen option description" );
@@ -286,12 +256,24 @@ template <typename T>
286
256
static void denormalizeSimpleEnum (SmallVectorImpl<const char *> &Args,
287
257
const char *Spelling,
288
258
CompilerInvocation::StringAllocator SA,
289
- Option::OptionClass OptClass,
290
259
unsigned TableIndex, T Value) {
291
- return denormalizeSimpleEnumImpl (Args, Spelling, SA, OptClass, TableIndex,
260
+ return denormalizeSimpleEnumImpl (Args, Spelling, SA, TableIndex,
292
261
static_cast <unsigned >(Value));
293
262
}
294
263
264
+ static void denormalizeSimpleEnumJoined (SmallVectorImpl<const char *> &Args,
265
+ const char *Spelling,
266
+ CompilerInvocation::StringAllocator SA,
267
+ unsigned TableIndex, unsigned Value) {
268
+ assert (TableIndex < SimpleEnumValueTablesSize);
269
+ const SimpleEnumValueTable &Table = SimpleEnumValueTables[TableIndex];
270
+ if (auto MaybeEnumVal = findValueTableByValue (Table, Value))
271
+ Args.push_back (SA (Twine (Spelling) + MaybeEnumVal->Name ));
272
+ else
273
+ llvm_unreachable (" The simple enum value was not correctly defined in "
274
+ " the tablegen option description" );
275
+ }
276
+
295
277
static Optional<std::string> normalizeString (OptSpecifier Opt, int TableIndex,
296
278
const ArgList &Args,
297
279
DiagnosticsEngine &Diags) {
@@ -301,6 +283,25 @@ static Optional<std::string> normalizeString(OptSpecifier Opt, int TableIndex,
301
283
return std::string (Arg->getValue ());
302
284
}
303
285
286
+ static void denormalizeString (SmallVectorImpl<const char *> &Args,
287
+ const char *Spelling,
288
+ CompilerInvocation::StringAllocator SA, unsigned ,
289
+ Twine Value) {
290
+ Args.push_back (Spelling);
291
+ Args.push_back (SA (Value));
292
+ }
293
+
294
+ template <typename T,
295
+ std::enable_if_t <!std::is_convertible<T, Twine>::value &&
296
+ std::is_constructible<Twine, T>::value,
297
+ bool > = false >
298
+ static void denormalizeString (SmallVectorImpl<const char *> &Args,
299
+ const char *Spelling,
300
+ CompilerInvocation::StringAllocator SA,
301
+ unsigned TableIndex, T Value) {
302
+ denormalizeString (Args, Spelling, SA, TableIndex, Twine (Value));
303
+ }
304
+
304
305
template <typename IntTy>
305
306
static Optional<IntTy> normalizeStringIntegral (OptSpecifier Opt, int ,
306
307
const ArgList &Args,
@@ -316,23 +317,6 @@ static Optional<IntTy> normalizeStringIntegral(OptSpecifier Opt, int,
316
317
return Res;
317
318
}
318
319
319
- static Optional<std::vector<std::string>>
320
- normalizeStringVector (OptSpecifier Opt, int , const ArgList &Args,
321
- DiagnosticsEngine &) {
322
- return Args.getAllArgValues (Opt);
323
- }
324
-
325
- static void denormalizeStringVector (SmallVectorImpl<const char *> &Args,
326
- const char *Spelling,
327
- CompilerInvocation::StringAllocator SA,
328
- Option::OptionClass OptClass,
329
- unsigned TableIndex,
330
- const std::vector<std::string> &Values) {
331
- for (const std::string &Value : Values) {
332
- denormalizeString (Args, Spelling, SA, OptClass, TableIndex, Value);
333
- }
334
- }
335
-
336
320
static Optional<std::string> normalizeTriple (OptSpecifier Opt, int TableIndex,
337
321
const ArgList &Args,
338
322
DiagnosticsEngine &Diags) {
@@ -2105,6 +2089,7 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
2105
2089
Opts.LLVMArgs = Args.getAllArgValues (OPT_mllvm);
2106
2090
Opts.ASTDumpDecls = Args.hasArg (OPT_ast_dump, OPT_ast_dump_EQ);
2107
2091
Opts.ASTDumpAll = Args.hasArg (OPT_ast_dump_all, OPT_ast_dump_all_EQ);
2092
+ Opts.ModuleMapFiles = Args.getAllArgValues (OPT_fmodule_map_file);
2108
2093
// Only the -fmodule-file=<file> form.
2109
2094
for (const auto *A : Args.filtered (OPT_fmodule_file)) {
2110
2095
StringRef Val = A->getValue ();
@@ -4001,8 +3986,7 @@ void CompilerInvocation::generateCC1CommandLine(
4001
3986
(Extracted != \
4002
3987
static_cast <decltype (this ->KEYPATH )>( \
4003
3988
(IMPLIED_CHECK) ? (IMPLIED_VALUE) : (DEFAULT_VALUE)))) \
4004
- DENORMALIZER (Args, SPELLING, SA, Option::KIND##Class, TABLE_INDEX, \
4005
- Extracted); \
3989
+ DENORMALIZER (Args, SPELLING, SA, TABLE_INDEX, Extracted); \
4006
3990
}(EXTRACTOR (this ->KEYPATH )); \
4007
3991
}
4008
3992
0 commit comments