@@ -152,8 +152,8 @@ static Optional<bool> normalizeSimpleNegativeFlag(OptSpecifier Opt, unsigned,
152152// / argument.
153153static void denormalizeSimpleFlag (SmallVectorImpl<const char *> &Args,
154154 const char *Spelling,
155- CompilerInvocation::StringAllocator,
156- Option::OptionClass, unsigned , /* T*/ ...) {
155+ CompilerInvocation::StringAllocator, unsigned ,
156+ /* T*/ ...) {
157157 Args.push_back (Spelling);
158158}
159159
@@ -193,41 +193,12 @@ static auto makeBooleanOptionNormalizer(bool Value, bool OtherValue,
193193
194194static auto makeBooleanOptionDenormalizer (bool Value) {
195195 return [Value](SmallVectorImpl<const char *> &Args, const char *Spelling,
196- CompilerInvocation::StringAllocator, Option::OptionClass,
197- unsigned , bool KeyPath) {
196+ CompilerInvocation::StringAllocator, unsigned , bool KeyPath) {
198197 if (KeyPath == Value)
199198 Args.push_back (Spelling);
200199 };
201200}
202201
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-
231202static Optional<SimpleEnumValue>
232203findValueTableByName (const SimpleEnumValueTable &Table, StringRef Name) {
233204 for (int I = 0 , E = Table.Size ; I != E; ++I)
@@ -269,13 +240,12 @@ static llvm::Optional<unsigned> normalizeSimpleEnum(OptSpecifier Opt,
269240static void denormalizeSimpleEnumImpl (SmallVectorImpl<const char *> &Args,
270241 const char *Spelling,
271242 CompilerInvocation::StringAllocator SA,
272- Option::OptionClass OptClass,
273243 unsigned TableIndex, unsigned Value) {
274244 assert (TableIndex < SimpleEnumValueTablesSize);
275245 const SimpleEnumValueTable &Table = SimpleEnumValueTables[TableIndex];
276246 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 );
279249 } else {
280250 llvm_unreachable (" The simple enum value was not correctly defined in "
281251 " the tablegen option description" );
@@ -286,12 +256,24 @@ template <typename T>
286256static void denormalizeSimpleEnum (SmallVectorImpl<const char *> &Args,
287257 const char *Spelling,
288258 CompilerInvocation::StringAllocator SA,
289- Option::OptionClass OptClass,
290259 unsigned TableIndex, T Value) {
291- return denormalizeSimpleEnumImpl (Args, Spelling, SA, OptClass, TableIndex,
260+ return denormalizeSimpleEnumImpl (Args, Spelling, SA, TableIndex,
292261 static_cast <unsigned >(Value));
293262}
294263
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+
295277static Optional<std::string> normalizeString (OptSpecifier Opt, int TableIndex,
296278 const ArgList &Args,
297279 DiagnosticsEngine &Diags) {
@@ -301,6 +283,25 @@ static Optional<std::string> normalizeString(OptSpecifier Opt, int TableIndex,
301283 return std::string (Arg->getValue ());
302284}
303285
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+
304305template <typename IntTy>
305306static Optional<IntTy> normalizeStringIntegral (OptSpecifier Opt, int ,
306307 const ArgList &Args,
@@ -316,23 +317,6 @@ static Optional<IntTy> normalizeStringIntegral(OptSpecifier Opt, int,
316317 return Res;
317318}
318319
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-
336320static Optional<std::string> normalizeTriple (OptSpecifier Opt, int TableIndex,
337321 const ArgList &Args,
338322 DiagnosticsEngine &Diags) {
@@ -2105,6 +2089,7 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
21052089 Opts.LLVMArgs = Args.getAllArgValues (OPT_mllvm);
21062090 Opts.ASTDumpDecls = Args.hasArg (OPT_ast_dump, OPT_ast_dump_EQ);
21072091 Opts.ASTDumpAll = Args.hasArg (OPT_ast_dump_all, OPT_ast_dump_all_EQ);
2092+ Opts.ModuleMapFiles = Args.getAllArgValues (OPT_fmodule_map_file);
21082093 // Only the -fmodule-file=<file> form.
21092094 for (const auto *A : Args.filtered (OPT_fmodule_file)) {
21102095 StringRef Val = A->getValue ();
@@ -4001,8 +3986,7 @@ void CompilerInvocation::generateCC1CommandLine(
40013986 (Extracted != \
40023987 static_cast <decltype (this ->KEYPATH )>( \
40033988 (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); \
40063990 }(EXTRACTOR (this ->KEYPATH )); \
40073991 }
40083992
0 commit comments