blob: bfa8c8ba02e5626a18de8ef17b5e851ab67475d4 [file] [log] [blame]
Daniel Dunbar8adfcff2009-11-19 07:19:04 +00001//===--- CC1Options.td - Options for clang -cc1 ---------------------------===//
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// This file defines the options accepted by clang -cc1.
11//
12//===----------------------------------------------------------------------===//
13
14// Include the common option parsing interfaces.
15include "OptParser.td"
16
Daniel Dunbar33a33d82009-11-24 00:54:16 +000017//===----------------------------------------------------------------------===//
Daniel Dunbar8adfcff2009-11-19 07:19:04 +000018// Target Options
Daniel Dunbar33a33d82009-11-24 00:54:16 +000019//===----------------------------------------------------------------------===//
Daniel Dunbar8adfcff2009-11-19 07:19:04 +000020
Charles Davis98b7c5c2010-06-11 01:06:47 +000021def cxx_abi : Separate<"-cxx-abi">,
22 HelpText<"Target a particular C++ ABI type">;
Daniel Dunbar8adfcff2009-11-19 07:19:04 +000023def target_abi : Separate<"-target-abi">,
24 HelpText<"Target a particular ABI type">;
Daniel Dunbar38b48af2009-12-18 06:30:12 +000025def target_cpu : Separate<"-target-cpu">,
26 HelpText<"Target a specific cpu type">;
Daniel Dunbar31db76c2009-11-20 01:46:44 +000027def target_feature : Separate<"-target-feature">,
Daniel Dunbar8adfcff2009-11-19 07:19:04 +000028 HelpText<"Target specific attributes">;
Daniel Dunbar39065a52010-08-11 23:07:42 +000029def target_linker_version : Separate<"-target-linker-version">,
30 HelpText<"Target linker version">;
Daniel Dunbar31db76c2009-11-20 01:46:44 +000031def triple : Separate<"-triple">,
Daniel Dunbar8adfcff2009-11-19 07:19:04 +000032 HelpText<"Specify target triple (e.g. i686-apple-darwin9)">;
Daniel Dunbarce6bf1e2009-11-29 09:32:20 +000033def triple_EQ : Joined<"-triple=">, Alias<triple>;
Daniel Dunbar50a44872009-11-20 17:23:30 +000034
Daniel Dunbar33a33d82009-11-24 00:54:16 +000035//===----------------------------------------------------------------------===//
Daniel Dunbare2814d82009-11-22 22:08:20 +000036// Analyzer Options
Daniel Dunbar33a33d82009-11-24 00:54:16 +000037//===----------------------------------------------------------------------===//
Daniel Dunbare2814d82009-11-22 22:08:20 +000038
39def analysis_CFGDump : Flag<"-cfg-dump">,
40 HelpText<"Display Control-Flow Graphs">;
41def analysis_CFGView : Flag<"-cfg-view">,
42 HelpText<"View Control-Flow Graphs using GraphViz">;
Ted Kremenek9b823e82010-08-03 00:09:51 +000043def analysis_UnoptimizedCFG : Flag<"-unoptimized-cfg">,
44 HelpText<"View Control-Flow Graphs using GraphViz">;
Daniel Dunbare2814d82009-11-22 22:08:20 +000045def analysis_DisplayLiveVariables : Flag<"-dump-live-variables">,
46 HelpText<"Print results of live variable analysis">;
Ted Kremenek6dd66ed2010-02-14 02:45:18 +000047def analysis_LLVMConventionChecker : Flag<"-analyzer-check-llvm-conventions">,
48 HelpText<"Check code for LLVM codebase conventions (domain-specific)">;
Ted Kremenekfb3f8932010-02-05 01:50:36 +000049def analysis_SecuritySyntacticChecks : Flag<"-analyzer-check-security-syntactic">,
Daniel Dunbare2814d82009-11-22 22:08:20 +000050 HelpText<"Perform quick security checks that require no data flow">;
Ted Kremenekcd9902b2010-02-05 01:52:40 +000051def analysis_WarnDeadStores : Flag<"-analyzer-check-dead-stores">,
Daniel Dunbare2814d82009-11-22 22:08:20 +000052 HelpText<"Warn about stores to dead variables">;
53def analysis_WarnUninitVals : Flag<"-warn-uninit-values">,
54 HelpText<"Warn about uses of uninitialized variables">;
Ted Kremenekfa15be42010-02-05 01:57:44 +000055def analysis_WarnObjCMethSigs : Flag<"-analyzer-check-objc-methodsigs">,
Daniel Dunbare2814d82009-11-22 22:08:20 +000056 HelpText<"Warn about Objective-C method signatures with type incompatibilities">;
Ted Kremenek7909fc82010-02-05 01:59:21 +000057def analysis_WarnObjCDealloc : Flag<"-analyzer-check-objc-missing-dealloc">,
Daniel Dunbare2814d82009-11-22 22:08:20 +000058 HelpText<"Warn about Objective-C classes that lack a correct implementation of -dealloc">;
Ted Kremenek2ade5362010-02-05 01:55:01 +000059def analysis_WarnObjCUnusedIvars : Flag<"-analyzer-check-objc-unused-ivars">,
Daniel Dunbare2814d82009-11-22 22:08:20 +000060 HelpText<"Warn about private ivars that are never used">;
Ted Kremenek565e4652010-02-05 02:06:54 +000061def analysis_ObjCMemChecker : Flag<"-analyzer-check-objc-mem">,
Daniel Dunbare2814d82009-11-22 22:08:20 +000062 HelpText<"Run the [Core] Foundation reference count checker">;
63def analysis_WarnSizeofPointer : Flag<"-warn-sizeof-pointer">,
64 HelpText<"Warn about unintended use of sizeof() on pointer expressions">;
Tom Care1fafd1d2010-08-06 22:23:07 +000065def analysis_WarnIdempotentOps : Flag<"-analyzer-check-idempotent-operations">,
66 HelpText<"Warn about idempotent operations">;
Daniel Dunbare2814d82009-11-22 22:08:20 +000067
68def analyzer_store : Separate<"-analyzer-store">,
69 HelpText<"Source Code Analysis - Abstract Memory Store Models">;
70def analyzer_store_EQ : Joined<"-analyzer-store=">, Alias<analyzer_store>;
71
72def analyzer_constraints : Separate<"-analyzer-constraints">,
73 HelpText<"Source Code Analysis - Symbolic Constraint Engines">;
74def analyzer_constraints_EQ : Joined<"-analyzer-constraints=">,
75 Alias<analyzer_constraints>;
76
77def analyzer_output : Separate<"-analyzer-output">,
78 HelpText<"Source Code Analysis - Output Options">;
79def analyzer_output_EQ : Joined<"-analyzer-output=">,
80 Alias<analyzer_output>;
81
82def analyzer_opt_analyze_headers : Flag<"-analyzer-opt-analyze-headers">,
83 HelpText<"Force the static analyzer to analyze functions defined in header files">;
Ted Kremenekfc576512009-12-07 22:06:12 +000084def analyzer_opt_analyze_nested_blocks : Flag<"-analyzer-opt-analyze-nested-blocks">,
85 HelpText<"Analyze the definitions of blocks in addition to functions">;
Daniel Dunbare2814d82009-11-22 22:08:20 +000086def analyzer_display_progress : Flag<"-analyzer-display-progress">,
87 HelpText<"Emit verbose output about the analyzer's progress">;
88def analyzer_experimental_checks : Flag<"-analyzer-experimental-checks">,
89 HelpText<"Use experimental path-sensitive checks">;
90def analyzer_experimental_internal_checks :
91 Flag<"-analyzer-experimental-internal-checks">,
92 HelpText<"Use new default path-sensitive checks currently in testing">;
93def analyze_function : Separate<"-analyze-function">,
94 HelpText<"Run analysis on specific function">;
95def analyze_function_EQ : Joined<"-analyze-function=">, Alias<analyze_function>;
96def analyzer_eagerly_assume : Flag<"-analyzer-eagerly-assume">,
97 HelpText<"Eagerly assume the truth/falseness of some symbolic constraints">;
98def analyzer_no_purge_dead : Flag<"-analyzer-no-purge-dead">,
99 HelpText<"Don't remove dead symbols, bindings, and constraints before processing a statement">;
100def trim_egraph : Flag<"-trim-egraph">,
101 HelpText<"Only show error-related paths in the analysis graph">;
102def analyzer_viz_egraph_graphviz : Flag<"-analyzer-viz-egraph-graphviz">,
103 HelpText<"Display exploded graph using GraphViz">;
104def analyzer_viz_egraph_ubigraph : Flag<"-analyzer-viz-egraph-ubigraph">,
105 HelpText<"Display exploded graph using Ubigraph">;
Zhongxing Xu7b99d122010-05-06 02:59:29 +0000106def analyzer_inline_call : Flag<"-analyzer-inline-call">,
107 HelpText<"Experimental transfer function inlining callees when its definition is available.">;
Zhongxing Xuc09289d2010-04-13 06:44:31 +0000108def analyzer_max_nodes : Separate<"-analyzer-max-nodes">,
109 HelpText<"The maximum number of nodes the analyzer can generate">;
Zhongxing Xu6362b892010-05-18 00:28:37 +0000110def analyzer_max_loop : Separate<"-analyzer-max-loop">,
111 HelpText<"The maximum number of times the analyzer will go through a loop">;
Daniel Dunbare2814d82009-11-22 22:08:20 +0000112
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000113//===----------------------------------------------------------------------===//
Daniel Dunbar50a44872009-11-20 17:23:30 +0000114// CodeGen Options
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000115//===----------------------------------------------------------------------===//
Daniel Dunbar50a44872009-11-20 17:23:30 +0000116
117def disable_llvm_optzns : Flag<"-disable-llvm-optzns">,
118 HelpText<"Don't run LLVM optimization passes">;
John McCall824e19e2010-02-12 23:47:27 +0000119def disable_llvm_verifier : Flag<"-disable-llvm-verifier">,
120 HelpText<"Don't run the LLVM IR verifier pass">;
Daniel Dunbar50a44872009-11-20 17:23:30 +0000121def disable_red_zone : Flag<"-disable-red-zone">,
122 HelpText<"Do not emit code that uses the red zone.">;
Daniel Dunbarf2d8b9f2009-12-18 02:43:17 +0000123def dwarf_debug_flags : Separate<"-dwarf-debug-flags">,
124 HelpText<"The string to embed in the Dwarf debug flags record.">;
Daniel Dunbar50a44872009-11-20 17:23:30 +0000125def g : Flag<"-g">, HelpText<"Generate source level debug information">;
Mike Stump9c276ae2009-12-12 01:27:46 +0000126def fcatch_undefined_behavior : Flag<"-fcatch-undefined-behavior">,
127 HelpText<"Generate runtime checks for undefined behavior.">;
Daniel Dunbar50a44872009-11-20 17:23:30 +0000128def fno_common : Flag<"-fno-common">,
129 HelpText<"Compile common globals like normal definitions">;
130def no_implicit_float : Flag<"-no-implicit-float">,
131 HelpText<"Don't generate implicit floating point instructions (x86-only)">;
Chris Lattner7255a2d2010-06-22 00:03:40 +0000132def finstrument_functions : Flag<"-finstrument-functions">,
133 HelpText<"Generate calls to instrument function entry and exit">;
Daniel Dunbar50a44872009-11-20 17:23:30 +0000134def fno_merge_all_constants : Flag<"-fno-merge-all-constants">,
135 HelpText<"Disallow merging of constants.">;
Anders Carlssona508b7d2010-02-06 23:23:06 +0000136def fno_threadsafe_statics : Flag<"-fno-threadsafe-statics">,
137 HelpText<"Do not emit code to make initialization of local statics thread safe">;
Anders Carlsson824d7ea2010-02-11 08:02:13 +0000138def fdump_vtable_layouts : Flag<"-fdump-vtable-layouts">,
139 HelpText<"Dump the layouts of all vtables that will be emitted in a translation unit">;
Chris Lattnerbbea7162010-04-13 00:38:24 +0000140def ffunction_sections : Flag<"-ffunction-sections">,
141 HelpText<"Place each function in its own section (ELF Only)">;
142def fdata_sections : Flag<"-fdata-sections">,
143 HelpText<"Place each data in its own section (ELF Only)">;
Eric Christopherf84d4092010-08-07 23:08:14 +0000144def funroll_loops : Flag<"-funroll-loops">,
145 HelpText<"Turn on loop unroller">;
Daniel Dunbarf219e7c2009-11-29 07:18:39 +0000146def masm_verbose : Flag<"-masm-verbose">,
147 HelpText<"Generate verbose assembly output">;
148def mcode_model : Separate<"-mcode-model">,
149 HelpText<"The code model to use">;
150def mdebug_pass : Separate<"-mdebug-pass">,
151 HelpText<"Enable additional debug output">;
152def mdisable_fp_elim : Flag<"-mdisable-fp-elim">,
153 HelpText<"Disable frame pointer elimination optimization">;
Daniel Dunbar87667aa2009-12-08 19:49:51 +0000154def mfloat_abi : Separate<"-mfloat-abi">,
Daniel Dunbar3b315262009-11-30 08:42:00 +0000155 HelpText<"The float ABI to use">;
Daniel Dunbarf219e7c2009-11-29 07:18:39 +0000156def mlimit_float_precision : Separate<"-mlimit-float-precision">,
157 HelpText<"Limit float precision to the given value">;
158def mno_zero_initialized_in_bss : Flag<"-mno-zero-initialized-in-bss">,
159 HelpText<"Do not put zero initialized data in the BSS">;
Daniel Dunbar1ad66482010-07-01 01:31:45 +0000160def momit_leaf_frame_pointer : Flag<"-momit-leaf-frame-pointer">,
161 HelpText<"Omit frame pointer setup for leaf functions.">;
Daniel Dunbar87667aa2009-12-08 19:49:51 +0000162def msoft_float : Flag<"-msoft-float">,
Daniel Dunbar3b315262009-11-30 08:42:00 +0000163 HelpText<"Use software floating point">;
Daniel Dunbar4ecc9b72010-05-27 05:39:39 +0000164def mrelax_all : Flag<"-mrelax-all">,
165 HelpText<"Relax all machine instructions">;
Daniel Dunbarf219e7c2009-11-29 07:18:39 +0000166def mrelocation_model : Separate<"-mrelocation-model">,
167 HelpText<"The relocation model to use">;
168def munwind_tables : Flag<"-munwind-tables">,
169 HelpText<"Generate unwinding tables for all functions">;
John McCalld46f9852010-02-19 01:32:20 +0000170def mconstructor_aliases : Flag<"-mconstructor-aliases">,
171 HelpText<"Emit complete constructors and destructors as aliases when possible">;
Daniel Dunbar50a44872009-11-20 17:23:30 +0000172def O : Joined<"-O">, HelpText<"Optimization level">;
173def Os : Flag<"-Os">, HelpText<"Optimize for size">;
Daniel Dunbar1bed0c32009-11-20 23:28:07 +0000174
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000175//===----------------------------------------------------------------------===//
Daniel Dunbar1bed0c32009-11-20 23:28:07 +0000176// Dependency Output Options
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000177//===----------------------------------------------------------------------===//
178
Daniel Dunbar1bed0c32009-11-20 23:28:07 +0000179def dependency_file : Separate<"-dependency-file">,
180 HelpText<"Filename (or -) to write dependency output to">;
181def sys_header_deps : Flag<"-sys-header-deps">,
182 HelpText<"Include system headers in dependency output">;
Chris Lattner3edbeb72010-03-29 17:55:58 +0000183def MQ : Separate<"-MQ">, HelpText<"Specify target to quote for dependency">;
Daniel Dunbar1bed0c32009-11-20 23:28:07 +0000184def MT : Separate<"-MT">, HelpText<"Specify target for dependency">;
185def MP : Flag<"-MP">,
186 HelpText<"Create phony target for each dependency (other than main file)">;
Daniel Dunbar21affc02009-11-23 23:41:17 +0000187
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000188//===----------------------------------------------------------------------===//
Daniel Dunbar21affc02009-11-23 23:41:17 +0000189// Diagnostic Options
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000190//===----------------------------------------------------------------------===//
Daniel Dunbar21affc02009-11-23 23:41:17 +0000191
192def dump_build_information : Separate<"-dump-build-information">,
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000193 MetaVarName<"<filename>">,
Daniel Dunbar21affc02009-11-23 23:41:17 +0000194 HelpText<"output a dump of some build information to a file">;
Daniel Dunbar21affc02009-11-23 23:41:17 +0000195def fno_show_column : Flag<"-fno-show-column">,
196 HelpText<"Do not include column number on diagnostics">;
Daniel Dunbar21affc02009-11-23 23:41:17 +0000197def fno_show_source_location : Flag<"-fno-show-source-location">,
198 HelpText<"Do not include source location information with diagnostics">;
Jeffrey Yasskin5edbdcc2010-06-11 05:57:47 +0000199def fshow_overloads_EQ : Joined<"-fshow-overloads=">,
200 HelpText<"Which overload candidates to show when overload resolution fails: "
201 "best|all; defaults to all">;
Daniel Dunbar21affc02009-11-23 23:41:17 +0000202def fno_caret_diagnostics : Flag<"-fno-caret-diagnostics">,
203 HelpText<"Do not include source line and caret with diagnostics">;
Daniel Dunbar21affc02009-11-23 23:41:17 +0000204def fno_diagnostics_fixit_info : Flag<"-fno-diagnostics-fixit-info">,
205 HelpText<"Do not include fixit information in diagnostics">;
Douglas Gregord93256e2010-01-28 06:00:51 +0000206def fdiagnostics_binary : Flag<"-fdiagnostics-binary">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000207def w : Flag<"-w">, HelpText<"Suppress all warnings">;
Daniel Dunbar21affc02009-11-23 23:41:17 +0000208def pedantic : Flag<"-pedantic">;
Daniel Dunbar21affc02009-11-23 23:41:17 +0000209def pedantic_errors : Flag<"-pedantic-errors">;
210
211// This gets all -W options, including -Werror, -W[no-]system-headers, etc. The
212// driver has stripped off -Wa,foo etc. The driver has also translated -W to
213// -Wextra, so we don't need to worry about it.
214def W : Joined<"-W">;
215
216def fdiagnostics_print_source_range_info : Flag<"-fdiagnostics-print-source-range-info">,
217 HelpText<"Print source range spans in numeric form">;
Daniel Dunbar21affc02009-11-23 23:41:17 +0000218def fdiagnostics_show_option : Flag<"-fdiagnostics-show-option">,
219 HelpText<"Print diagnostic name with mappable diagnostics">;
Chris Lattner6fbe8392010-05-04 21:55:25 +0000220def fdiagnostics_show_category : Separate<"-fdiagnostics-show-category">,
221 HelpText<"Print diagnostic category">;
222
Chris Lattner124fca52010-01-09 21:54:33 +0000223def ftabstop : Separate<"-ftabstop">, MetaVarName<"<N>">,
224 HelpText<"Set the tab stop distance.">;
Chris Lattnerc1002142010-04-07 20:37:06 +0000225def ferror_limit : Separate<"-ferror-limit">, MetaVarName<"<N>">,
226 HelpText<"Set the maximum number of errors to emit before stopping (0 = no limit).">;
Douglas Gregor6c1cb992010-05-04 17:13:42 +0000227def fmacro_backtrace_limit : Separate<"-fmacro-backtrace-limit">, MetaVarName<"<N>">,
228 HelpText<"Set the maximum number of entries to print in a macro instantiation backtrace (0 = no limit).">;
Douglas Gregor575cf372010-04-20 07:18:24 +0000229def ftemplate_backtrace_limit : Separate<"-ftemplate-backtrace-limit">, MetaVarName<"<N>">,
230 HelpText<"Set the maximum number of entries to print in a template instantiation backtrace (0 = no limit).">;
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000231def fmessage_length : Separate<"-fmessage-length">, MetaVarName<"<N>">,
Daniel Dunbar21affc02009-11-23 23:41:17 +0000232 HelpText<"Format message diagnostics so that they fit within N columns or fewer, when possible.">;
Daniel Dunbar21affc02009-11-23 23:41:17 +0000233def fcolor_diagnostics : Flag<"-fcolor-diagnostics">,
234 HelpText<"Use colors in diagnostics">;
Daniel Dunbar21affc02009-11-23 23:41:17 +0000235def Wno_rewrite_macros : Flag<"-Wno-rewrite-macros">,
236 HelpText<"Silence ObjC rewriting warnings">;
John McCall4b7a8342010-03-15 10:54:44 +0000237def Wwrite_strings : Flag<"-Wwrite-strings">,
John McCalla61e5a22010-08-13 07:05:45 +0000238 HelpText<"Remove const qualifier from string literals">;
Daniel Dunbar21affc02009-11-23 23:41:17 +0000239def verify : Flag<"-verify">,
240 HelpText<"Verify emitted diagnostics and warnings">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000241
242//===----------------------------------------------------------------------===//
243// Frontend Options
244//===----------------------------------------------------------------------===//
245
Daniel Dunbar8ff5b282009-12-11 23:00:49 +0000246// This isn't normally used, it is just here so we can parse a
247// CompilerInvocation out of a driver-derived argument vector.
248def cc1 : Flag<"-cc1">;
249
Douglas Gregor9bed8792010-02-09 19:21:46 +0000250def ast_merge : Separate<"-ast-merge">,
251 MetaVarName<"<ast file>">,
252 HelpText<"Merge the given AST file into the translation unit being compiled.">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000253def code_completion_at : Separate<"-code-completion-at">,
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000254 MetaVarName<"<file>:<line>:<column>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000255 HelpText<"Dump code-completion information at a location">;
Daniel Dunbare14b5f52009-12-03 05:11:16 +0000256def remap_file : Separate<"-remap-file">,
257 MetaVarName<"<from>;<to>">,
258 HelpText<"Replace the contents of the <from> file with the contents of the <to> file">;
Daniel Dunbarce6bf1e2009-11-29 09:32:20 +0000259def code_completion_at_EQ : Joined<"-code-completion-at=">,
260 Alias<code_completion_at>;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000261def no_code_completion_debug_printer : Flag<"-no-code-completion-debug-printer">,
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000262 HelpText<"Don't use the \"debug\" code-completion print">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000263def code_completion_macros : Flag<"-code-completion-macros">,
264 HelpText<"Include macros in code-completion results">;
Douglas Gregord8e8a582010-05-25 21:41:55 +0000265def code_completion_patterns : Flag<"-code-completion-patterns">,
266 HelpText<"Include code patterns in code-completion results">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000267def disable_free : Flag<"-disable-free">,
268 HelpText<"Disable freeing of memory on exit">;
Daniel Dunbar9b5e9ae2009-12-03 07:01:58 +0000269def help : Flag<"-help">,
270 HelpText<"Print this help text">;
271def _help : Flag<"--help">, Alias<help>;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000272def x : Separate<"-x">, HelpText<"Input language type">;
273def cxx_inheritance_view : Separate<"-cxx-inheritance-view">,
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000274 MetaVarName<"<class name>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000275 HelpText<"View C++ inheritance for a specified class">;
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000276def o : Separate<"-o">, MetaVarName<"<path>">, HelpText<"Specify output file">;
277def load : Separate<"-load">, MetaVarName<"<dsopath>">,
Daniel Dunbarefba2272009-12-03 05:11:05 +0000278 HelpText<"Load the named plugin (dynamic shared object)">;
Daniel Dunbar3177aae2010-06-16 16:59:23 +0000279def plugin : Separate<"-plugin">, MetaVarName<"<name>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000280 HelpText<"Use the named plugin action (use \"help\" to list available options)">;
Daniel Dunbar3177aae2010-06-16 16:59:23 +0000281def plugin_arg : JoinedAndSeparate<"-plugin-arg-">,
282 MetaVarName<"<name> <arg>">,
283 HelpText<"Pass <arg> to plugin <name>">;
Daniel Dunbar8b9adfe2009-12-15 00:06:45 +0000284def resource_dir : Separate<"-resource-dir">,
285 HelpText<"The directory which holds the compiler resource files">;
Daniel Dunbar9b5e9ae2009-12-03 07:01:58 +0000286def version : Flag<"-version">,
287 HelpText<"Print the compiler version">;
288def _version : Flag<"--version">, Alias<version>;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000289
290def Action_Group : OptionGroup<"<action group>">;
291let Group = Action_Group in {
292
293def Eonly : Flag<"-Eonly">,
294 HelpText<"Just run preprocessor, no output (for timings)">;
295def E : Flag<"-E">,
296 HelpText<"Run preprocessor, emit preprocessed file">;
297def dump_raw_tokens : Flag<"-dump-raw-tokens">,
298 HelpText<"Lex file in raw mode and dump raw tokens">;
299def analyze : Flag<"-analyze">,
300 HelpText<"Run static analysis engine">;
301def dump_tokens : Flag<"-dump-tokens">,
302 HelpText<"Run preprocessor, dump internal rep of tokens">;
Daniel Dunbar27585952010-03-19 19:44:04 +0000303def init_only : Flag<"-init-only">,
304 HelpText<"Only execute frontend initialization">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000305def fsyntax_only : Flag<"-fsyntax-only">,
306 HelpText<"Run parser and perform semantic analysis">;
307def fixit : Flag<"-fixit">,
308 HelpText<"Apply fix-it advice to the input source">;
Nick Lewyckyba5f6ec2010-04-24 01:30:46 +0000309def fixit_EQ : Joined<"-fixit=">,
310 HelpText<"Apply fix-it advice creating a file with the given suffix">;
Douglas Gregorf033f1d2010-07-20 20:18:03 +0000311def print_preamble : Flag<"-print-preamble">,
312 HelpText<"Print the \"preamble\" of a file, which is a candidate for implicit"
313 " precompiled headers.">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000314def emit_html : Flag<"-emit-html">,
315 HelpText<"Output input source as HTML">;
316def ast_print : Flag<"-ast-print">,
317 HelpText<"Build ASTs and then pretty-print them">;
318def ast_print_xml : Flag<"-ast-print-xml">,
319 HelpText<"Build ASTs and then print them in XML format">;
320def ast_dump : Flag<"-ast-dump">,
321 HelpText<"Build ASTs and then debug dump them">;
322def ast_view : Flag<"-ast-view">,
323 HelpText<"Build ASTs and view them with GraphViz">;
Douglas Gregorf78cc432010-05-07 15:41:56 +0000324def boostcon : Flag<"-boostcon">,
325 HelpText<"BoostCon workshop mode">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000326def print_decl_contexts : Flag<"-print-decl-contexts">,
327 HelpText<"Print DeclContexts and their Decls">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000328def emit_pth : Flag<"-emit-pth">,
329 HelpText<"Generate pre-tokenized header file">;
330def emit_pch : Flag<"-emit-pch">,
331 HelpText<"Generate pre-compiled header file">;
332def S : Flag<"-S">,
333 HelpText<"Emit native assembly code">;
334def emit_llvm : Flag<"-emit-llvm">,
335 HelpText<"Build ASTs then convert to LLVM, emit .ll file">;
336def emit_llvm_bc : Flag<"-emit-llvm-bc">,
337 HelpText<"Build ASTs then convert to LLVM, emit .bc file">;
338def emit_llvm_only : Flag<"-emit-llvm-only">,
339 HelpText<"Build ASTs and convert to LLVM, discarding output">;
Daniel Dunbar32148ce2010-05-25 18:41:01 +0000340def emit_codegen_only : Flag<"-emit-codegen-only">,
341 HelpText<"Generate machine code, but discard output">;
Daniel Dunbarda1573f2010-02-03 01:18:43 +0000342def emit_obj : Flag<"-emit-obj">,
343 HelpText<"Emit native object files">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000344def rewrite_test : Flag<"-rewrite-test">,
345 HelpText<"Rewriter playground">;
346def rewrite_objc : Flag<"-rewrite-objc">,
347 HelpText<"Rewrite ObjC into C (code rewriter example)">;
348def rewrite_macros : Flag<"-rewrite-macros">,
349 HelpText<"Expand macros without full preprocessing">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000350
351}
352
353def relocatable_pch : Flag<"-relocatable-pch">,
354 HelpText<"Whether to build a relocatable precompiled header">;
Sebastian Redld6ac4522010-07-09 00:00:58 +0000355def chained_pch : Flag<"-chained-pch">,
356 HelpText<"Whether to chain the new precompiled header to the old one.">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000357def print_stats : Flag<"-print-stats">,
358 HelpText<"Print performance metrics and statistics">;
359def ftime_report : Flag<"-ftime-report">,
360 HelpText<"Print the amount of time each phase of compilation takes">;
Anders Carlsson46116ce2010-04-10 19:09:13 +0000361def fdump_record_layouts : Flag<"-fdump-record-layouts">,
Daniel Dunbarb69eca52010-04-08 02:59:56 +0000362 HelpText<"Dump record layout information">;
Nick Lewycky1450f262010-08-13 17:31:00 +0000363def fix_what_you_can : Flag<"-fix-what-you-can">,
364 HelpText<"Apply fix-it advice even in the presence of unfixable errors">;
Daniel Dunbarb69eca52010-04-08 02:59:56 +0000365
Daniel Dunbar3f87fb02010-04-15 06:09:03 +0000366// Generic forwarding to LLVM options. This should only be used for debugging
367// and experimental features.
368def mllvm : Separate<"-mllvm">,
369 HelpText<"Additional arguments to forward to LLVM's option processing">;
370
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000371//===----------------------------------------------------------------------===//
372// Language Options
373//===----------------------------------------------------------------------===//
374
375def fno_builtin : Flag<"-fno-builtin">,
376 HelpText<"Disable implicit builtin knowledge of functions">;
377def faltivec : Flag<"-faltivec">,
378 HelpText<"Enable AltiVec vector initializer syntax">;
Benjamin Kramerc53e3652010-04-09 19:40:47 +0000379def fno_access_control : Flag<"-fno-access-control">,
John McCall380509a2010-04-09 19:09:08 +0000380 HelpText<"Disable C++ access control">;
Nuno Lopesfc284482009-12-16 16:59:22 +0000381def fno_assume_sane_operator_new : Flag<"-fno-assume-sane-operator-new">,
Nuno Lopes99860172009-12-17 22:37:33 +0000382 HelpText<"Don't assume that C++'s global operator new can't alias any pointer">;
Chandler Carrutheb5d7b72010-04-17 20:17:31 +0000383def fgnu_keywords : Flag<"-fgnu-keywords">,
384 HelpText<"Allow GNU-extension keywords regardless of language standard">;
385def fno_gnu_keywords : Flag<"-fno-gnu-keywords">,
386 HelpText<"Disallow GNU-extension keywords regardless of language standard">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000387def fdollars_in_identifiers : Flag<"-fdollars-in-identifiers">,
388 HelpText<"Allow '$' in identifiers">;
Daniel Dunbar8663b182009-12-16 20:10:18 +0000389def fno_dollars_in_identifiers : Flag<"-fno-dollars-in-identifiers">,
390 HelpText<"Disallow '$' in identifiers">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000391def femit_all_decls : Flag<"-femit-all-decls">,
392 HelpText<"Emit all declarations, even if unused">;
393def fblocks : Flag<"-fblocks">,
394 HelpText<"enable the 'blocks' language feature">;
395def fheinous_gnu_extensions : Flag<"-fheinous-gnu-extensions">;
396def fexceptions : Flag<"-fexceptions">,
397 HelpText<"Enable support for exception handling">;
Daniel Dunbar73482882010-02-10 18:48:44 +0000398def fsjlj_exceptions : Flag<"-fsjlj-exceptions">,
399 HelpText<"Use SjLj style exceptions">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000400def ffreestanding : Flag<"-ffreestanding">,
401 HelpText<"Assert that the compilation takes place in a freestanding environment">;
402def fgnu_runtime : Flag<"-fgnu-runtime">,
403 HelpText<"Generate output compatible with the standard GNU Objective-C runtime">;
John McCall279b5eb2010-08-12 23:36:15 +0000404def fhidden_weak_vtables : Flag<"-fhidden-weak-vtables">,
405 HelpText<"Generate weak vtables and RTTI with hidden visibility">;
Daniel Dunbarce6bf1e2009-11-29 09:32:20 +0000406def std_EQ : Joined<"-std=">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000407 HelpText<"Language standard to compile for">;
Dan Gohmanc31176d2010-01-08 02:20:44 +0000408def fmath_errno : Flag<"-fmath-errno">,
409 HelpText<"Require math functions to indicate errors by setting errno">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000410def fms_extensions : Flag<"-fms-extensions">,
411 HelpText<"Accept some non-standard constructs used in Microsoft header files ">;
412def main_file_name : Separate<"-main-file-name">,
413 HelpText<"Main file name to use for debug info">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000414def fno_elide_constructors : Flag<"-fno-elide-constructors">,
415 HelpText<"Disable C++ copy constructor elision">;
416def fno_lax_vector_conversions : Flag<"-fno-lax-vector-conversions">,
417 HelpText<"Disallow implicit conversions between vectors with a different number of elements or different element types">;
418def fno_operator_names : Flag<"-fno-operator-names">,
419 HelpText<"Do not treat C++ operator name keywords as synonyms for operators">;
Daniel Dunbarefb0fa92010-03-20 04:15:41 +0000420def fno_signed_char : Flag<"-fno-signed-char">,
421 HelpText<"Char is unsigned">;
Douglas Gregora0068fc2010-07-09 17:35:33 +0000422def fno_spell_checking : Flag<"-fno-spell-checking">,
423 HelpText<"Disable spell-checking">;
Daniel Dunbarefb0fa92010-03-20 04:15:41 +0000424def fno_use_cxa_atexit : Flag<"-fno-use-cxa-atexit">,
425 HelpText<"Don't use __cxa_atexit for calling destructors">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000426def fconstant_string_class : Separate<"-fconstant-string-class">,
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000427 MetaVarName<"<class name>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000428 HelpText<"Specify the class to use for constant Objective-C string objects.">;
Fariborz Jahanian33e982b2010-04-22 20:26:39 +0000429def fno_constant_cfstrings : Flag<"-fno-constant-cfstrings">,
430 HelpText<"Enable creation of CodeFoundation-type constant strings">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000431def fobjc_gc : Flag<"-fobjc-gc">,
432 HelpText<"Enable Objective-C garbage collection">;
433def fobjc_gc_only : Flag<"-fobjc-gc-only">,
434 HelpText<"Use GC exclusively for Objective-C related memory management">;
Daniel Dunbarf643b9b2010-04-24 17:56:46 +0000435def fobjc_dispatch_method_EQ : Joined<"-fobjc-dispatch-method=">,
436 HelpText<"Objective-C dispatch method to use">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000437def print_ivar_layout : Flag<"-print-ivar-layout">,
438 HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
439def fobjc_nonfragile_abi : Flag<"-fobjc-nonfragile-abi">,
440 HelpText<"enable objective-c's nonfragile abi">;
Fariborz Jahanian412e7982010-02-09 19:31:38 +0000441def fobjc_nonfragile_abi2 : Flag<"-fobjc-nonfragile-abi2">,
442 HelpText<"enable objective-c's enhanced nonfragile abi">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000443def ftrapv : Flag<"-ftrapv">,
444 HelpText<"Trap on integer overflow">;
Chris Lattnera4d71452010-06-26 21:25:03 +0000445def fwrapv : Flag<"-fwrapv">,
446 HelpText<"Treat signed integer overflow as two's complement">;
Daniel Dunbar76743522009-11-29 02:39:08 +0000447def pic_level : Separate<"-pic-level">,
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000448 HelpText<"Value for __PIC__">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000449def pthread : Flag<"-pthread">,
450 HelpText<"Support POSIX threads in generated code">;
451def fpascal_strings : Flag<"-fpascal-strings">,
452 HelpText<"Recognize and construct Pascal-style string literals">;
453def fno_rtti : Flag<"-fno-rtti">,
454 HelpText<"Disable generation of rtti information">;
Douglas Gregorfae3b2f2010-07-27 00:27:13 +0000455def fno_validate_pch : Flag<"-fno-validate-pch">,
456 HelpText<"Disable validation of precompiled headers">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000457def fshort_wchar : Flag<"-fshort-wchar">,
458 HelpText<"Force wchar_t to be a short unsigned int">;
459def static_define : Flag<"-static-define">,
460 HelpText<"Should __STATIC__ be defined">;
461def stack_protector : Separate<"-stack-protector">,
462 HelpText<"Enable stack protectors">;
463def fvisibility : Separate<"-fvisibility">,
464 HelpText<"Default symbol visibility">;
Douglas Gregor7cf84d62010-06-15 17:05:35 +0000465def fvisibility_inlines_hidden : Flag<"-fvisibility-inlines-hidden">,
466 HelpText<"Give inline C++ member functions default visibility by default">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000467def ftemplate_depth : Separate<"-ftemplate-depth">,
468 HelpText<"Maximum depth of recursive template instantiation">;
469def trigraphs : Flag<"-trigraphs">,
470 HelpText<"Process trigraph sequences">;
471def fwritable_strings : Flag<"-fwritable-strings">,
472 HelpText<"Store string literals as writable data">;
Daniel Dunbarfb937b82010-04-15 15:06:22 +0000473def fno_bitfield_type_align : Flag<"-fno-bitfield-type-align">,
474 HelpText<"Ignore bit-field types when aligning structures">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000475
476//===----------------------------------------------------------------------===//
477// Header Search Options
478//===----------------------------------------------------------------------===//
479
480def nostdinc : Flag<"-nostdinc">,
481 HelpText<"Disable standard #include directories">;
Douglas Gregor4c2bcad2010-03-24 20:13:48 +0000482def nostdincxx : Flag<"-nostdinc++">,
483 HelpText<"Disable standard #include directories for the C++ standard library">;
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000484def nobuiltininc : Flag<"-nobuiltininc">,
485 HelpText<"Disable builtin #include directories">;
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000486def F : JoinedOrSeparate<"-F">, MetaVarName<"<directory>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000487 HelpText<"Add directory to framework include search path">;
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000488def I : JoinedOrSeparate<"-I">, MetaVarName<"<directory>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000489 HelpText<"Add directory to include search path">;
Daniel Dunbarb94ffa42009-12-09 10:01:26 +0000490def idirafter : JoinedOrSeparate<"-idirafter">, MetaVarName<"<directory>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000491 HelpText<"Add directory to AFTER include search path">;
Daniel Dunbarb94ffa42009-12-09 10:01:26 +0000492def iquote : JoinedOrSeparate<"-iquote">, MetaVarName<"<directory>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000493 HelpText<"Add directory to QUOTE include search path">;
Daniel Dunbarb94ffa42009-12-09 10:01:26 +0000494def isystem : JoinedOrSeparate<"-isystem">, MetaVarName<"<directory>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000495 HelpText<"Add directory to SYSTEM include search path">;
Daniel Dunbarb94ffa42009-12-09 10:01:26 +0000496def iprefix : JoinedOrSeparate<"-iprefix">, MetaVarName<"<prefix>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000497 HelpText<"Set the -iwithprefix/-iwithprefixbefore prefix">;
Daniel Dunbarb94ffa42009-12-09 10:01:26 +0000498def iwithprefix : JoinedOrSeparate<"-iwithprefix">, MetaVarName<"<dir>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000499 HelpText<"Set directory to SYSTEM include search path with prefix">;
Mike Stumpe4cb2a42009-12-09 18:09:35 +0000500def iwithprefixbefore : JoinedOrSeparate<"-iwithprefixbefore">,
501 MetaVarName<"<dir>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000502 HelpText<"Set directory to include search path with prefix">;
Daniel Dunbarb94ffa42009-12-09 10:01:26 +0000503def isysroot : JoinedOrSeparate<"-isysroot">, MetaVarName<"<dir>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000504 HelpText<"Set the system root directory (usually /)">;
505def v : Flag<"-v">, HelpText<"Enable verbose output">;
506
507//===----------------------------------------------------------------------===//
508// Preprocessor Options
509//===----------------------------------------------------------------------===//
510
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000511def D : JoinedOrSeparate<"-D">, MetaVarName<"<macro>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000512 HelpText<"Predefine the specified macro">;
Daniel Dunbarb94ffa42009-12-09 10:01:26 +0000513def include_ : JoinedOrSeparate<"-include">, MetaVarName<"<file>">, EnumName<"include">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000514 HelpText<"Include file before parsing">;
Daniel Dunbarb94ffa42009-12-09 10:01:26 +0000515def imacros : JoinedOrSeparate<"-imacros">, MetaVarName<"<file>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000516 HelpText<"Include macros from file before parsing">;
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000517def include_pch : Separate<"-include-pch">, MetaVarName<"<file>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000518 HelpText<"Include precompiled header file">;
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000519def include_pth : Separate<"-include-pth">, MetaVarName<"<file>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000520 HelpText<"Include file before parsing">;
Douglas Gregorf4f6c9d2010-07-26 21:36:20 +0000521def preamble_bytes_EQ : Joined<"-preamble-bytes=">,
Douglas Gregor3d398aa2010-07-26 16:29:14 +0000522 HelpText<"Assume that the precompiled header is a precompiled preamble "
523 "covering the first N bytes of the main file">;
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000524def token_cache : Separate<"-token-cache">, MetaVarName<"<path>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000525 HelpText<"Use specified token cache file">;
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000526def U : JoinedOrSeparate<"-U">, MetaVarName<"<macro>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000527 HelpText<"Undefine the specified macro">;
Daniel Dunbarb737fb12009-12-03 07:01:46 +0000528def undef : Flag<"-undef">, MetaVarName<"<macro>">,
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000529 HelpText<"undef all system defines">;
Douglas Gregor94dc8f62010-03-19 16:15:56 +0000530def detailed_preprocessing_record : Flag<"-detailed-preprocessing-record">,
531 HelpText<"include a detailed record of preprocessing actions">;
532
Daniel Dunbar33a33d82009-11-24 00:54:16 +0000533//===----------------------------------------------------------------------===//
534// Preprocessed Output Options
535//===----------------------------------------------------------------------===//
536
537def P : Flag<"-P">,
538 HelpText<"Disable linemarker output in -E mode">;
539def C : Flag<"-C">,
540 HelpText<"Enable comment output in -E mode">;
541def CC : Flag<"-CC">,
542 HelpText<"Enable comment output in -E mode, even from macro expansions">;
543def dM : Flag<"-dM">,
544 HelpText<"Print macro definitions in -E mode instead of normal output">;
545def dD : Flag<"-dD">,
546 HelpText<"Print macro definitions in -E mode in addition to normal output">;