xref: /llvm-project/clang/lib/Frontend/CompilerInvocation.cpp (revision f5835ea2e786daa075324b20b0bc7aee4f201df5)
1 //===--- CompilerInvocation.cpp -------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "clang/Frontend/CompilerInvocation.h"
11 #include "llvm/ADT/StringExtras.h"
12 #include "llvm/Support/ErrorHandling.h"
13 using namespace clang;
14 
15 static const char *getAnalysisName(Analyses Kind) {
16   switch (Kind) {
17   default:
18     llvm::llvm_unreachable("Unknown analysis store!");
19 #define ANALYSIS(NAME, CMDFLAG, DESC, SCOPE)\
20   case NAME: return "-" CMDFLAG;
21 #include "clang/Frontend/Analyses.def"
22   }
23 }
24 
25 static const char *getAnalysisStoreName(AnalysisStores Kind) {
26   switch (Kind) {
27   default:
28     llvm::llvm_unreachable("Unknown analysis store!");
29 #define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATFN) \
30   case NAME##Model: return CMDFLAG;
31 #include "clang/Frontend/Analyses.def"
32   }
33 }
34 
35 static const char *getAnalysisConstraintName(AnalysisConstraints Kind) {
36   switch (Kind) {
37   default:
38     llvm::llvm_unreachable("Unknown analysis constraints!");
39 #define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN) \
40   case NAME##Model: return CMDFLAG;
41 #include "clang/Frontend/Analyses.def"
42   }
43 }
44 
45 static const char *getAnalysisDiagClientName(AnalysisDiagClients Kind) {
46   switch (Kind) {
47   default:
48     llvm::llvm_unreachable("Unknown analysis client!");
49 #define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN, AUTOCREATE) \
50   case PD_##NAME: return CMDFLAG;
51 #include "clang/Frontend/Analyses.def"
52   }
53 }
54 
55 static void AnalyzerOptsToArgs(const AnalyzerOptions &Opts,
56                                std::vector<std::string> &Res) {
57   for (unsigned i = 0, e = Opts.AnalysisList.size(); i != e; ++i)
58     Res.push_back(getAnalysisName(Opts.AnalysisList[i]));
59   if (Opts.AnalysisStoreOpt != BasicStoreModel) {
60     Res.push_back("-analyzer-store");
61     Res.push_back(getAnalysisStoreName(Opts.AnalysisStoreOpt));
62   }
63   if (Opts.AnalysisConstraintsOpt != RangeConstraintsModel) {
64     Res.push_back("-analyzer-constraints");
65     Res.push_back(getAnalysisConstraintName(Opts.AnalysisConstraintsOpt));
66   }
67   if (Opts.AnalysisDiagOpt != PD_HTML) {
68     Res.push_back("-analyzer-output");
69     Res.push_back(getAnalysisDiagClientName(Opts.AnalysisDiagOpt));
70   }
71   if (!Opts.AnalyzeSpecificFunction.empty()) {
72     Res.push_back("-analyze-function");
73     Res.push_back(Opts.AnalyzeSpecificFunction);
74   }
75   if (Opts.AnalyzeAll)
76     Res.push_back("-analyzer-opt-analyze-headers");
77   if (Opts.AnalyzerDisplayProgress)
78     Res.push_back("-analyzer-display-progress");
79   if (Opts.EagerlyAssume)
80     Res.push_back("-analyzer-eagerly-assume");
81   if (!Opts.PurgeDead)
82     Res.push_back("-analyzer-no-purge-dead");
83   if (Opts.TrimGraph)
84     Res.push_back("-trim-egraph");
85   if (Opts.VisualizeEGDot)
86     Res.push_back("-analyzer-viz-egraph-graphviz");
87   if (Opts.VisualizeEGDot)
88     Res.push_back("-analyzer-viz-egraph-ubigraph");
89   if (Opts.EnableExperimentalChecks)
90     Res.push_back("-analyzer-experimental-checks");
91   if (Opts.EnableExperimentalInternalChecks)
92     Res.push_back("-analyzer-experimental-internal-checks");
93 }
94 
95 static void CodeGenOptsToArgs(const CodeGenOptions &Opts,
96                               std::vector<std::string> &Res) {
97   if (Opts.DebugInfo)
98     Res.push_back("-g");
99   if (Opts.DisableLLVMOpts)
100     Res.push_back("-disable-llvm-optzns");
101   if (Opts.DisableRedZone)
102     Res.push_back("-disable-red-zone");
103   if (!Opts.MergeAllConstants)
104     Res.push_back("-fno-merge-all-constants");
105   if (Opts.NoCommon)
106     Res.push_back("-fno-common");
107   if (Opts.NoImplicitFloat)
108     Res.push_back("-no-implicit-float");
109   if (Opts.OptimizeSize) {
110     assert(Opts.OptimizationLevel == 2 && "Invalid options!");
111     Res.push_back("-Os");
112   } else if (Opts.OptimizationLevel != 0)
113     Res.push_back("-O" + llvm::utostr(Opts.OptimizationLevel));
114   // SimplifyLibCalls is only derived.
115   // TimePasses is only derived.
116   // UnitAtATime is unused.
117   // UnrollLoops is only derived.
118   // VerifyModule is only derived.
119   // Inlining is only derived.
120 }
121 
122 static void DependencyOutputOptsToArgs(const DependencyOutputOptions &Opts,
123                                        std::vector<std::string> &Res) {
124   if (Opts.IncludeSystemHeaders)
125     Res.push_back("-sys-header-deps");
126   if (Opts.UsePhonyTargets)
127     Res.push_back("-MP");
128   if (!Opts.OutputFile.empty()) {
129     Res.push_back("-dependency-file");
130     Res.push_back(Opts.OutputFile);
131   }
132   for (unsigned i = 0, e = Opts.Targets.size(); i != e; ++i) {
133     Res.push_back("-MT");
134     Res.push_back(Opts.Targets[i]);
135   }
136 }
137 
138 static void DiagnosticOptsToArgs(const DiagnosticOptions &Opts,
139                                  std::vector<std::string> &Res) {
140   if (Opts.IgnoreWarnings)
141     Res.push_back("-w");
142   if (Opts.NoRewriteMacros)
143     Res.push_back("-Wno-rewrite-macros");
144   if (Opts.Pedantic)
145     Res.push_back("-pedantic");
146   if (Opts.PedanticErrors)
147     Res.push_back("-pedantic-errors");
148   if (!Opts.ShowColumn)
149     Res.push_back("-fno-show-column");
150   if (!Opts.ShowLocation)
151     Res.push_back("-fno-show-source-location");
152   if (!Opts.ShowCarets)
153     Res.push_back("-fno-caret-diagnostics");
154   if (!Opts.ShowFixits)
155     Res.push_back("-fno-diagnostics-fixit-info");
156   if (Opts.ShowSourceRanges)
157     Res.push_back("-fdiagnostics-print-source-range-info");
158   if (Opts.ShowColors)
159     Res.push_back("-fcolor-diagnostics");
160   if (Opts.VerifyDiagnostics)
161     Res.push_back("-verify");
162   if (Opts.ShowOptionNames)
163     Res.push_back("-fdiagnostics-show-option");
164   if (Opts.MessageLength) {
165     Res.push_back("-fmessage-length");
166     Res.push_back(llvm::utostr(Opts.MessageLength));
167   }
168   if (!Opts.DumpBuildInformation.empty()) {
169     Res.push_back("-dump-build-information");
170     Res.push_back(Opts.DumpBuildInformation);
171   }
172   for (unsigned i = 0, e = Opts.Warnings.size(); i != e; ++i)
173     Res.push_back("-W" + Opts.Warnings[i]);
174 }
175 
176 static const char *getInputKindName(FrontendOptions::InputKind Kind) {
177   switch (Kind) {
178   case FrontendOptions::IK_None: break;
179   case FrontendOptions::IK_AST: return "ast";
180   case FrontendOptions::IK_Asm: return "assembler-with-cpp";
181   case FrontendOptions::IK_C: return "c";
182   case FrontendOptions::IK_CXX: return "c++";
183   case FrontendOptions::IK_ObjC: return "objective-c";
184   case FrontendOptions::IK_ObjCXX: return "objective-c++";
185   case FrontendOptions::IK_OpenCL: return "cl";
186   case FrontendOptions::IK_PreprocessedC: return "cpp-output";
187   case FrontendOptions::IK_PreprocessedCXX: return "c++-cpp-output";
188   case FrontendOptions::IK_PreprocessedObjC: return "objective-c-cpp-output";
189   case FrontendOptions::IK_PreprocessedObjCXX: return "objective-c++-cpp-output";
190   }
191 
192   llvm::llvm_unreachable("Unexpected language kind!");
193   return 0;
194 }
195 
196 static const char *getActionName(frontend::ActionKind Kind) {
197   switch (Kind) {
198   case frontend::PluginAction:
199   case frontend::InheritanceView:
200     llvm::llvm_unreachable("Invalid kind!");
201 
202   case frontend::ASTDump:                return "-ast-dump";
203   case frontend::ASTPrint:               return "-ast-print";
204   case frontend::ASTPrintXML:            return "-ast-print-xml";
205   case frontend::ASTView:                return "-ast-view";
206   case frontend::DumpRawTokens:          return "-dump-raw-tokens";
207   case frontend::DumpRecordLayouts:      return "-dump-record-layouts";
208   case frontend::DumpTokens:             return "-dump-tokens";
209   case frontend::EmitAssembly:           return "-S";
210   case frontend::EmitBC:                 return "-emit-llvm-bc";
211   case frontend::EmitHTML:               return "-emit-html";
212   case frontend::EmitLLVM:               return "-emit-llvm";
213   case frontend::EmitLLVMOnly:           return "-emit-llvm-only";
214   case frontend::FixIt:                  return "-fixit";
215   case frontend::GeneratePCH:            return "-emit-pch";
216   case frontend::GeneratePTH:            return "-emit-pth";
217   case frontend::ParseNoop:              return "-parse-noop";
218   case frontend::ParsePrintCallbacks:    return "-parse-print-callbacks";
219   case frontend::ParseSyntaxOnly:        return "-fsyntax-only";
220   case frontend::PrintDeclContext:       return "-print-decl-contexts";
221   case frontend::PrintPreprocessedInput: return "-E";
222   case frontend::RewriteBlocks:          return "-rewrite-blocks";
223   case frontend::RewriteMacros:          return "-rewrite-macros";
224   case frontend::RewriteObjC:            return "-rewrite-objc";
225   case frontend::RewriteTest:            return "-rewrite-test";
226   case frontend::RunAnalysis:            return "-analyze";
227   case frontend::RunPreprocessorOnly:    return "-Eonly";
228   }
229 
230   llvm::llvm_unreachable("Unexpected language kind!");
231   return 0;
232 }
233 
234 static void FrontendOptsToArgs(const FrontendOptions &Opts,
235                                std::vector<std::string> &Res) {
236   if (!Opts.DebugCodeCompletionPrinter)
237     Res.push_back("-no-code-completion-debug-printer");
238   if (Opts.DisableFree)
239     Res.push_back("-disable-free");
240   if (Opts.EmptyInputOnly)
241     Res.push_back("-empty-input-only");
242   if (Opts.RelocatablePCH)
243     Res.push_back("-relocatable-pch");
244   if (Opts.ShowMacrosInCodeCompletion)
245     Res.push_back("-code-completion-macros");
246   if (Opts.ShowStats)
247     Res.push_back("-stats");
248   if (Opts.ShowTimers)
249     Res.push_back("-ftime-report");
250 
251   bool NeedLang = false;
252   for (unsigned i = 0, e = Opts.Inputs.size(); i != e; ++i)
253     if (FrontendOptions::getInputKindForExtension(Opts.Inputs[i].second) !=
254         Opts.Inputs[i].first)
255       NeedLang = true;
256   if (NeedLang) {
257     Res.push_back("-x");
258     Res.push_back(getInputKindName(Opts.Inputs[0].first));
259   }
260   for (unsigned i = 0, e = Opts.Inputs.size(); i != e; ++i) {
261     assert((!NeedLang || Opts.Inputs[i].first == Opts.Inputs[0].first) &&
262            "Unable to represent this input vector!");
263     Res.push_back(Opts.Inputs[i].second);
264   }
265 
266   if (!Opts.OutputFile.empty()) {
267     Res.push_back("-o");
268     Res.push_back(Opts.OutputFile);
269   }
270   if (!Opts.ViewClassInheritance.empty()) {
271     Res.push_back("-cxx-inheritance-view");
272     Res.push_back(Opts.ViewClassInheritance);
273   }
274   for (unsigned i = 0, e = Opts.FixItLocations.size(); i != e; ++i) {
275     Res.push_back("-fixit-at");
276     Res.push_back(Opts.FixItLocations[i].FileName + ":" +
277                   llvm::utostr(Opts.FixItLocations[i].Line) + ":" +
278                   llvm::utostr(Opts.FixItLocations[i].Column));
279   }
280   if (!Opts.CodeCompletionAt.FileName.empty()) {
281     Res.push_back("-code-completion-at");
282     Res.push_back(Opts.CodeCompletionAt.FileName + ":" +
283                   llvm::utostr(Opts.CodeCompletionAt.Line) + ":" +
284                   llvm::utostr(Opts.CodeCompletionAt.Column));
285   }
286   if (Opts.ProgramAction != frontend::InheritanceView &&
287       Opts.ProgramAction != frontend::PluginAction)
288     Res.push_back(getActionName(Opts.ProgramAction));
289   if (!Opts.ActionName.empty()) {
290     Res.push_back("-plugin");
291     Res.push_back(Opts.ActionName);
292   }
293 }
294 
295 static void HeaderSearchOptsToArgs(const HeaderSearchOptions &Opts,
296                                    std::vector<std::string> &Res) {
297   if (Opts.Sysroot != "/") {
298     Res.push_back("-isysroot");
299     Res.push_back(Opts.Sysroot);
300   }
301 
302   /// User specified include entries.
303   for (unsigned i = 0, e = Opts.UserEntries.size(); i != e; ++i) {
304     const HeaderSearchOptions::Entry &E = Opts.UserEntries[i];
305     if (E.IsFramework && (E.Group != frontend::Angled || E.IsUserSupplied))
306       llvm::llvm_report_error("Invalid option set!");
307     if (E.IsUserSupplied) {
308       if (E.Group == frontend::After) {
309         Res.push_back("-idirafter");
310       } else if (E.Group == frontend::Quoted) {
311         Res.push_back("-iquoted");
312       } else if (E.Group == frontend::System) {
313         Res.push_back("-isystem");
314       } else {
315         assert(E.Group == frontend::Angled && "Invalid group!");
316         Res.push_back(E.IsFramework ? "-F" : "-I");
317       }
318     } else {
319       if (E.Group != frontend::Angled && E.Group != frontend::System)
320         llvm::llvm_report_error("Invalid option set!");
321       Res.push_back(E.Group == frontend::Angled ? "-iwithprefixbefore" :
322                     "-iwithprefix");
323     }
324     Res.push_back(E.Path);
325   }
326 
327   if (!Opts.EnvIncPath.empty()) {
328     // FIXME: Provide an option for this, and move env detection to driver.
329     llvm::llvm_report_error("Not yet implemented!");
330   }
331   if (!Opts.CEnvIncPath.empty()) {
332     // FIXME: Provide an option for this, and move env detection to driver.
333     llvm::llvm_report_error("Not yet implemented!");
334   }
335   if (!Opts.ObjCEnvIncPath.empty()) {
336     // FIXME: Provide an option for this, and move env detection to driver.
337     llvm::llvm_report_error("Not yet implemented!");
338   }
339   if (!Opts.CXXEnvIncPath.empty()) {
340     // FIXME: Provide an option for this, and move env detection to driver.
341     llvm::llvm_report_error("Not yet implemented!");
342   }
343   if (!Opts.ObjCXXEnvIncPath.empty()) {
344     // FIXME: Provide an option for this, and move env detection to driver.
345     llvm::llvm_report_error("Not yet implemented!");
346   }
347   if (!Opts.BuiltinIncludePath.empty()) {
348     // FIXME: Provide an option for this, and move to driver.
349   }
350   if (!Opts.UseStandardIncludes)
351     Res.push_back("-nostdinc");
352   if (Opts.Verbose)
353     Res.push_back("-v");
354 }
355 
356 static void LangOptsToArgs(const LangOptions &Opts,
357                            std::vector<std::string> &Res) {
358   LangOptions DefaultLangOpts;
359 
360   // FIXME: Need to set -std to get all the implicit options.
361 
362   // FIXME: We want to only pass options relative to the defaults, which
363   // requires constructing a target. :(
364   //
365   // It would be better to push the all target specific choices into the driver,
366   // so that everything below that was more uniform.
367 
368   if (Opts.Trigraphs)
369     Res.push_back("-trigraphs");
370   // Implicit based on the input kind:
371   //   AsmPreprocessor, CPlusPlus, ObjC1, ObjC2, OpenCL
372   // Implicit based on the input language standard:
373   //   BCPLComment, C99, CPlusPlus0x, Digraphs, GNUInline, ImplicitInt, GNUMode
374   if (Opts.DollarIdents)
375     Res.push_back("-fdollars-in-identifiers");
376   if (Opts.Microsoft)
377     Res.push_back("-fms-extensions=1");
378   if (Opts.ObjCNonFragileABI)
379     Res.push_back("-fobjc-nonfragile-abi");
380   // NoInline is implicit.
381   if (!Opts.CXXOperatorNames)
382     Res.push_back("-fno-operator-names");
383   if (Opts.PascalStrings)
384     Res.push_back("-fpascal-strings");
385   if (Opts.WritableStrings)
386     Res.push_back("-fwritable-strings");
387   if (!Opts.LaxVectorConversions)
388     Res.push_back("-fno-lax-vector-conversions");
389   if (Opts.AltiVec)
390     Res.push_back("-faltivec");
391   if (Opts.Exceptions)
392     Res.push_back("-fexceptions");
393   if (!Opts.Rtti)
394     Res.push_back("-fno-rtti");
395   if (!Opts.NeXTRuntime)
396     Res.push_back("-fgnu-runtime");
397   if (Opts.Freestanding)
398     Res.push_back("-ffreestanding");
399   if (Opts.NoBuiltin)
400     Res.push_back("-fno-builtin");
401   if (Opts.ThreadsafeStatics)
402     llvm::llvm_report_error("FIXME: Not yet implemented!");
403   if (Opts.POSIXThreads)
404     Res.push_back("-pthread");
405   if (Opts.Blocks)
406     Res.push_back("-fblocks=1");
407   if (Opts.EmitAllDecls)
408     Res.push_back("-femit-all-decls");
409   if (!Opts.MathErrno)
410     Res.push_back("-fno-math-errno");
411   if (Opts.OverflowChecking)
412     Res.push_back("-ftrapv");
413   if (Opts.HeinousExtensions)
414     Res.push_back("-fheinous-gnu-extensions");
415   // Optimize is implicit.
416   // OptimizeSize is implicit.
417   if (Opts.Static)
418     Res.push_back("-static-define");
419   if (Opts.PICLevel) {
420     Res.push_back("-pic-level");
421     Res.push_back(llvm::utostr(Opts.PICLevel));
422   }
423   if (Opts.ObjCGCBitmapPrint)
424     Res.push_back("-print-ivar-layout");
425   // FIXME: Don't forget to update when the default changes!
426   if (Opts.AccessControl)
427     Res.push_back("-faccess-control");
428   if (!Opts.CharIsSigned)
429     Res.push_back("-fsigned-char=0");
430   if (Opts.ShortWChar)
431     Res.push_back("-fshort-wchar");
432   if (!Opts.ElideConstructors)
433     Res.push_back("-fno-elide-constructors");
434   if (Opts.getGCMode() != LangOptions::NonGC) {
435     if (Opts.getGCMode() == LangOptions::HybridGC) {
436       Res.push_back("-fobjc-gc");
437     } else {
438       assert(Opts.getGCMode() == LangOptions::GCOnly && "Invalid GC mode!");
439       Res.push_back("-fobjc-gc-only");
440     }
441   }
442   if (Opts.getVisibilityMode() != LangOptions::Default) {
443     Res.push_back("-fvisibility");
444     if (Opts.getVisibilityMode() == LangOptions::Hidden) {
445       Res.push_back("hidden");
446     } else {
447       assert(Opts.getVisibilityMode() == LangOptions::Protected &&
448              "Invalid visibility!");
449       Res.push_back("protected");
450     }
451   }
452   if (Opts.getStackProtectorMode() != 0) {
453     Res.push_back("-stack-protector");
454     Res.push_back(llvm::utostr(Opts.getStackProtectorMode()));
455   }
456   if (Opts.getMainFileName()) {
457     Res.push_back("-main-file-name");
458     Res.push_back(Opts.getMainFileName());
459   }
460   if (Opts.InstantiationDepth != DefaultLangOpts.InstantiationDepth) {
461     Res.push_back("-ftemplate-depth");
462     Res.push_back(llvm::utostr(Opts.InstantiationDepth));
463   }
464   if (Opts.ObjCConstantStringClass) {
465     Res.push_back("-fconstant-string-class");
466     Res.push_back(Opts.ObjCConstantStringClass);
467   }
468 }
469 
470 static void PreprocessorOptsToArgs(const PreprocessorOptions &Opts,
471                                    std::vector<std::string> &Res) {
472   for (unsigned i = 0, e = Opts.Macros.size(); i != e; ++i)
473     Res.push_back((Opts.Macros[i].second ? "-U" : "-D") + Opts.Macros[i].first);
474   for (unsigned i = 0, e = Opts.Includes.size(); i != e; ++i) {
475     Res.push_back("-include");
476     Res.push_back(Opts.Includes[i]);
477   }
478   for (unsigned i = 0, e = Opts.MacroIncludes.size(); i != e; ++i) {
479     Res.push_back("-imacros");
480     Res.push_back(Opts.Includes[i]);
481   }
482   if (!Opts.UsePredefines)
483     Res.push_back("-undef");
484   if (!Opts.ImplicitPCHInclude.empty()) {
485     Res.push_back("-implicit-pch-include");
486     Res.push_back(Opts.ImplicitPCHInclude);
487   }
488   if (!Opts.ImplicitPTHInclude.empty()) {
489     Res.push_back("-implicit-pth-include");
490     Res.push_back(Opts.ImplicitPTHInclude);
491   }
492   if (!Opts.TokenCache.empty()) {
493     Res.push_back("-token-cache");
494     Res.push_back(Opts.TokenCache);
495   }
496 }
497 
498 static void PreprocessorOutputOptsToArgs(const PreprocessorOutputOptions &Opts,
499                                          std::vector<std::string> &Res) {
500   if (!Opts.ShowCPP && !Opts.ShowMacros)
501     llvm::llvm_report_error("Invalid option combination!");
502 
503   if (Opts.ShowCPP && Opts.ShowMacros)
504     Res.push_back("-dD");
505   else if (!Opts.ShowCPP && Opts.ShowMacros)
506     Res.push_back("-dM");
507 
508   if (!Opts.ShowLineMarkers)
509     Res.push_back("-P");
510   if (Opts.ShowComments)
511     Res.push_back("-C");
512   if (Opts.ShowMacroComments)
513     Res.push_back("-CC");
514 }
515 
516 static void TargetOptsToArgs(const TargetOptions &Opts,
517                              std::vector<std::string> &Res) {
518   Res.push_back("-triple");
519   Res.push_back(Opts.Triple);
520   if (!Opts.CPU.empty()) {
521     Res.push_back("-target-cpu");
522     Res.push_back(Opts.CPU);
523   }
524   if (!Opts.ABI.empty()) {
525     Res.push_back("-target-abi");
526     Res.push_back(Opts.ABI);
527   }
528   for (unsigned i = 0, e = Opts.Features.size(); i != e; ++i) {
529     Res.push_back("-target-feature");
530     Res.push_back(Opts.Features[i]);
531   }
532 }
533 
534 void CompilerInvocation::toArgs(std::vector<std::string> &Res) {
535   AnalyzerOptsToArgs(getAnalyzerOpts(), Res);
536   CodeGenOptsToArgs(getCodeGenOpts(), Res);
537   DependencyOutputOptsToArgs(getDependencyOutputOpts(), Res);
538   DiagnosticOptsToArgs(getDiagnosticOpts(), Res);
539   FrontendOptsToArgs(getFrontendOpts(), Res);
540   HeaderSearchOptsToArgs(getHeaderSearchOpts(), Res);
541   LangOptsToArgs(getLangOpts(), Res);
542   PreprocessorOptsToArgs(getPreprocessorOpts(), Res);
543   PreprocessorOutputOptsToArgs(getPreprocessorOutputOpts(), Res);
544   TargetOptsToArgs(getTargetOpts(), Res);
545 }
546