Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 33a33d8

Browse files
committed
Sketch the rest of the clang -cc1 option definitions, aka fun with C-x C-(.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89721 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 8cfe5a7 commit 33a33d8

File tree

3 files changed

+263
-13
lines changed

3 files changed

+263
-13
lines changed

include/clang/Driver/CC1Options.td

Lines changed: 241 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
// Include the common option parsing interfaces.
1515
include "OptParser.td"
1616

17+
//===----------------------------------------------------------------------===//
1718
// Target Options
19+
//===----------------------------------------------------------------------===//
1820

1921
def target_abi : Separate<"-target-abi">,
2022
HelpText<"Target a particular ABI type">;
@@ -25,7 +27,9 @@ def target_feature : Separate<"-target-feature">,
2527
def triple : Separate<"-triple">,
2628
HelpText<"Specify target triple (e.g. i686-apple-darwin9)">;
2729

30+
//===----------------------------------------------------------------------===//
2831
// Analyzer Options
32+
//===----------------------------------------------------------------------===//
2933

3034
def analysis_CFGDump : Flag<"-cfg-dump">,
3135
HelpText<"Display Control-Flow Graphs">;
@@ -89,7 +93,9 @@ def analyzer_viz_egraph_graphviz : Flag<"-analyzer-viz-egraph-graphviz">,
8993
def analyzer_viz_egraph_ubigraph : Flag<"-analyzer-viz-egraph-ubigraph">,
9094
HelpText<"Display exploded graph using Ubigraph">;
9195

96+
//===----------------------------------------------------------------------===//
9297
// CodeGen Options
98+
//===----------------------------------------------------------------------===//
9399

94100
def disable_llvm_optzns : Flag<"-disable-llvm-optzns">,
95101
HelpText<"Don't run LLVM optimization passes">;
@@ -105,7 +111,10 @@ def fno_merge_all_constants : Flag<"-fno-merge-all-constants">,
105111
def O : Joined<"-O">, HelpText<"Optimization level">;
106112
def Os : Flag<"-Os">, HelpText<"Optimize for size">;
107113

114+
//===----------------------------------------------------------------------===//
108115
// Dependency Output Options
116+
//===----------------------------------------------------------------------===//
117+
109118
def dependency_file : Separate<"-dependency-file">,
110119
HelpText<"Filename (or -) to write dependency output to">;
111120
def sys_header_deps : Flag<"-sys-header-deps">,
@@ -114,28 +123,23 @@ def MT : Separate<"-MT">, HelpText<"Specify target for dependency">;
114123
def MP : Flag<"-MP">,
115124
HelpText<"Create phony target for each dependency (other than main file)">;
116125

126+
//===----------------------------------------------------------------------===//
117127
// Diagnostic Options
128+
//===----------------------------------------------------------------------===//
118129

119130
def dump_build_information : Separate<"-dump-build-information">,
120131
MetaVarName<"filename">,
121132
HelpText<"output a dump of some build information to a file">;
122-
123133
def fno_show_column : Flag<"-fno-show-column">,
124134
HelpText<"Do not include column number on diagnostics">;
125-
126135
def fno_show_source_location : Flag<"-fno-show-source-location">,
127136
HelpText<"Do not include source location information with diagnostics">;
128-
129137
def fno_caret_diagnostics : Flag<"-fno-caret-diagnostics">,
130138
HelpText<"Do not include source line and caret with diagnostics">;
131-
132139
def fno_diagnostics_fixit_info : Flag<"-fno-diagnostics-fixit-info">,
133140
HelpText<"Do not include fixit information in diagnostics">;
134-
135-
def w : Flag<"w">, HelpText<"Suppress all warnings">;
136-
141+
def w : Flag<"-w">, HelpText<"Suppress all warnings">;
137142
def pedantic : Flag<"-pedantic">;
138-
139143
def pedantic_errors : Flag<"-pedantic-errors">;
140144

141145
// This gets all -W options, including -Werror, -W[no-]system-headers, etc. The
@@ -145,18 +149,242 @@ def W : Joined<"-W">;
145149

146150
def fdiagnostics_print_source_range_info : Flag<"-fdiagnostics-print-source-range-info">,
147151
HelpText<"Print source range spans in numeric form">;
148-
149152
def fdiagnostics_show_option : Flag<"-fdiagnostics-show-option">,
150153
HelpText<"Print diagnostic name with mappable diagnostics">;
151-
152154
def fmessage_length : Separate<"-fmessage-length">, MetaVarName<"N">,
153155
HelpText<"Format message diagnostics so that they fit within N columns or fewer, when possible.">;
154-
155156
def fcolor_diagnostics : Flag<"-fcolor-diagnostics">,
156157
HelpText<"Use colors in diagnostics">;
157-
158158
def Wno_rewrite_macros : Flag<"-Wno-rewrite-macros">,
159159
HelpText<"Silence ObjC rewriting warnings">;
160-
161160
def verify : Flag<"-verify">,
162161
HelpText<"Verify emitted diagnostics and warnings">;
162+
163+
//===----------------------------------------------------------------------===//
164+
// Frontend Options
165+
//===----------------------------------------------------------------------===//
166+
167+
def code_completion_at : Separate<"-code-completion-at">,
168+
MetaVarName<"file:line:column">,
169+
HelpText<"Dump code-completion information at a location">;
170+
def no_code_completion_debug_printer : Flag<"-no-code-completion-debug-printer">,
171+
HelpText<"Don't the \"debug\" code-completion print">;
172+
def code_completion_macros : Flag<"-code-completion-macros">,
173+
HelpText<"Include macros in code-completion results">;
174+
def disable_free : Flag<"-disable-free">,
175+
HelpText<"Disable freeing of memory on exit">;
176+
def empty_input_only : Flag<"-empty-input-only">,
177+
HelpText<"Force running on an empty input file">;
178+
def x : Separate<"-x">, HelpText<"Input language type">;
179+
def cxx_inheritance_view : Separate<"-cxx-inheritance-view">,
180+
MetaVarName<"class name">,
181+
HelpText<"View C++ inheritance for a specified class">;
182+
def fixit_at : Separate<"-fixit-at">, MetaVarName<"source-location">,
183+
HelpText<"Perform Fix-It modifications at the given source location">;
184+
def o : Separate<"-o">, MetaVarName<"path">, HelpText<"Specify output file">;
185+
def plugin : Separate<"-plugin">,
186+
HelpText<"Use the named plugin action (use \"help\" to list available options)">;
187+
188+
def Action_Group : OptionGroup<"<action group>">;
189+
let Group = Action_Group in {
190+
191+
def Eonly : Flag<"-Eonly">,
192+
HelpText<"Just run preprocessor, no output (for timings)">;
193+
def E : Flag<"-E">,
194+
HelpText<"Run preprocessor, emit preprocessed file">;
195+
def dump_raw_tokens : Flag<"-dump-raw-tokens">,
196+
HelpText<"Lex file in raw mode and dump raw tokens">;
197+
def analyze : Flag<"-analyze">,
198+
HelpText<"Run static analysis engine">;
199+
def dump_tokens : Flag<"-dump-tokens">,
200+
HelpText<"Run preprocessor, dump internal rep of tokens">;
201+
def parse_noop : Flag<"-parse-noop">,
202+
HelpText<"Run parser with noop callbacks (for timings)">;
203+
def fsyntax_only : Flag<"-fsyntax-only">,
204+
HelpText<"Run parser and perform semantic analysis">;
205+
def fixit : Flag<"-fixit">,
206+
HelpText<"Apply fix-it advice to the input source">;
207+
def parse_print_callbacks : Flag<"-parse-print-callbacks">,
208+
HelpText<"Run parser and print each callback invoked">;
209+
def emit_html : Flag<"-emit-html">,
210+
HelpText<"Output input source as HTML">;
211+
def ast_print : Flag<"-ast-print">,
212+
HelpText<"Build ASTs and then pretty-print them">;
213+
def ast_print_xml : Flag<"-ast-print-xml">,
214+
HelpText<"Build ASTs and then print them in XML format">;
215+
def ast_dump : Flag<"-ast-dump">,
216+
HelpText<"Build ASTs and then debug dump them">;
217+
def ast_view : Flag<"-ast-view">,
218+
HelpText<"Build ASTs and view them with GraphViz">;
219+
def print_decl_contexts : Flag<"-print-decl-contexts">,
220+
HelpText<"Print DeclContexts and their Decls">;
221+
def dump_record_layouts : Flag<"-dump-record-layouts">,
222+
HelpText<"Dump record layout information">;
223+
def emit_pth : Flag<"-emit-pth">,
224+
HelpText<"Generate pre-tokenized header file">;
225+
def emit_pch : Flag<"-emit-pch">,
226+
HelpText<"Generate pre-compiled header file">;
227+
def S : Flag<"-S">,
228+
HelpText<"Emit native assembly code">;
229+
def emit_llvm : Flag<"-emit-llvm">,
230+
HelpText<"Build ASTs then convert to LLVM, emit .ll file">;
231+
def emit_llvm_bc : Flag<"-emit-llvm-bc">,
232+
HelpText<"Build ASTs then convert to LLVM, emit .bc file">;
233+
def emit_llvm_only : Flag<"-emit-llvm-only">,
234+
HelpText<"Build ASTs and convert to LLVM, discarding output">;
235+
def rewrite_test : Flag<"-rewrite-test">,
236+
HelpText<"Rewriter playground">;
237+
def rewrite_objc : Flag<"-rewrite-objc">,
238+
HelpText<"Rewrite ObjC into C (code rewriter example)">;
239+
def rewrite_macros : Flag<"-rewrite-macros">,
240+
HelpText<"Expand macros without full preprocessing">;
241+
def rewrite_blocks : Flag<"-rewrite-blocks">,
242+
HelpText<"Rewrite Blocks to C">;
243+
244+
}
245+
246+
def relocatable_pch : Flag<"-relocatable-pch">,
247+
HelpText<"Whether to build a relocatable precompiled header">;
248+
def print_stats : Flag<"-print-stats">,
249+
HelpText<"Print performance metrics and statistics">;
250+
def ftime_report : Flag<"-ftime-report">,
251+
HelpText<"Print the amount of time each phase of compilation takes">;
252+
253+
//===----------------------------------------------------------------------===//
254+
// Language Options
255+
//===----------------------------------------------------------------------===//
256+
257+
def fno_builtin : Flag<"-fno-builtin">,
258+
HelpText<"Disable implicit builtin knowledge of functions">;
259+
def faltivec : Flag<"-faltivec">,
260+
HelpText<"Enable AltiVec vector initializer syntax">;
261+
def faccess_control : Flag<"-faccess-control">,
262+
HelpText<"Enable C++ access control">;
263+
def fsigned_char : Flag<"-fsigned-char">,
264+
HelpText<"Force char to be a signed/unsigned type">;
265+
def fdollars_in_identifiers : Flag<"-fdollars-in-identifiers">,
266+
HelpText<"Allow '$' in identifiers">;
267+
def femit_all_decls : Flag<"-femit-all-decls">,
268+
HelpText<"Emit all declarations, even if unused">;
269+
def fblocks : Flag<"-fblocks">,
270+
HelpText<"enable the 'blocks' language feature">;
271+
def fheinous_gnu_extensions : Flag<"-fheinous-gnu-extensions">;
272+
def fexceptions : Flag<"-fexceptions">,
273+
HelpText<"Enable support for exception handling">;
274+
def ffreestanding : Flag<"-ffreestanding">,
275+
HelpText<"Assert that the compilation takes place in a freestanding environment">;
276+
def fgnu_runtime : Flag<"-fgnu-runtime">,
277+
HelpText<"Generate output compatible with the standard GNU Objective-C runtime">;
278+
def std_EQ : Joined<"-std">,
279+
HelpText<"Language standard to compile for">;
280+
def fms_extensions : Flag<"-fms-extensions">,
281+
HelpText<"Accept some non-standard constructs used in Microsoft header files ">;
282+
def main_file_name : Separate<"-main-file-name">,
283+
HelpText<"Main file name to use for debug info">;
284+
def fno_math_errno : Flag<"-fno-math-errno">,
285+
HelpText<"Don't require math functions to respect errno">;
286+
def fno_elide_constructors : Flag<"-fno-elide-constructors">,
287+
HelpText<"Disable C++ copy constructor elision">;
288+
def fno_lax_vector_conversions : Flag<"-fno-lax-vector-conversions">,
289+
HelpText<"Disallow implicit conversions between vectors with a different number of elements or different element types">;
290+
def fno_operator_names : Flag<"-fno-operator-names">,
291+
HelpText<"Do not treat C++ operator name keywords as synonyms for operators">;
292+
def fconstant_string_class : Separate<"-fconstant-string-class">,
293+
MetaVarName<"class name">,
294+
HelpText<"Specify the class to use for constant Objective-C string objects.">;
295+
def fobjc_gc : Flag<"-fobjc-gc">,
296+
HelpText<"Enable Objective-C garbage collection">;
297+
def fobjc_gc_only : Flag<"-fobjc-gc-only">,
298+
HelpText<"Use GC exclusively for Objective-C related memory management">;
299+
def print_ivar_layout : Flag<"-print-ivar-layout">,
300+
HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
301+
def fobjc_nonfragile_abi : Flag<"-fobjc-nonfragile-abi">,
302+
HelpText<"enable objective-c's nonfragile abi">;
303+
def ftrapv : Flag<"-ftrapv">,
304+
HelpText<"Trap on integer overflow">;
305+
def pic_level : Separate<"pic-level">,
306+
HelpText<"-Value for __PIC__">;
307+
def pthread : Flag<"-pthread">,
308+
HelpText<"Support POSIX threads in generated code">;
309+
def fpascal_strings : Flag<"-fpascal-strings">,
310+
HelpText<"Recognize and construct Pascal-style string literals">;
311+
def fno_rtti : Flag<"-fno-rtti">,
312+
HelpText<"Disable generation of rtti information">;
313+
def fshort_wchar : Flag<"-fshort-wchar">,
314+
HelpText<"Force wchar_t to be a short unsigned int">;
315+
def static_define : Flag<"-static-define">,
316+
HelpText<"Should __STATIC__ be defined">;
317+
def stack_protector : Separate<"-stack-protector">,
318+
HelpText<"Enable stack protectors">;
319+
def fvisibility : Separate<"-fvisibility">,
320+
HelpText<"Default symbol visibility">;
321+
def ftemplate_depth : Separate<"-ftemplate-depth">,
322+
HelpText<"Maximum depth of recursive template instantiation">;
323+
def trigraphs : Flag<"-trigraphs">,
324+
HelpText<"Process trigraph sequences">;
325+
def fwritable_strings : Flag<"-fwritable-strings">,
326+
HelpText<"Store string literals as writable data">;
327+
328+
//===----------------------------------------------------------------------===//
329+
// Header Search Options
330+
//===----------------------------------------------------------------------===//
331+
332+
def nostdinc : Flag<"-nostdinc">,
333+
HelpText<"Disable standard #include directories">;
334+
def nobuiltininc : Flag<"-nobuiltininc">,
335+
HelpText<"Disable builtin #include directories">;
336+
def F : Separate<"-F">, MetaVarName<"directory">,
337+
HelpText<"Add directory to framework include search path">;
338+
def I : Separate<"-I">, MetaVarName<"directory">,
339+
HelpText<"Add directory to include search path">;
340+
def idirafter : Separate<"-idirafter">, MetaVarName<"directory">,
341+
HelpText<"Add directory to AFTER include search path">;
342+
def iquote : Separate<"-iquote">, MetaVarName<"directory">,
343+
HelpText<"Add directory to QUOTE include search path">;
344+
def isystem : Separate<"-isystem">, MetaVarName<"directory">,
345+
HelpText<"Add directory to SYSTEM include search path">;
346+
def iprefix : Separate<"-iprefix">, MetaVarName<"prefix">,
347+
HelpText<"Set the -iwithprefix/-iwithprefixbefore prefix">;
348+
def iwithprefix : Separate<"-iwithprefix">, MetaVarName<"dir">,
349+
HelpText<"Set directory to SYSTEM include search path with prefix">;
350+
def iwithprefixbefore : Separate<"-iwithprefixbefore">, MetaVarName<"dir">,
351+
HelpText<"Set directory to include search path with prefix">;
352+
def isysroot : Separate<"-isysroot">, MetaVarName<"dir">,
353+
HelpText<"Set the system root directory (usually /)">;
354+
def v : Flag<"-v">, HelpText<"Enable verbose output">;
355+
356+
//===----------------------------------------------------------------------===//
357+
// Preprocessor Options
358+
//===----------------------------------------------------------------------===//
359+
360+
def D : Separate<"-D">, MetaVarName<"macro">,
361+
HelpText<"Predefine the specified macro">;
362+
def include_ : Separate<"-include">, MetaVarName<"file">, EnumName<"include">,
363+
HelpText<"Include file before parsing">;
364+
def imacros : Separate<"-imacros">, MetaVarName<"file">,
365+
HelpText<"Include macros from file before parsing">;
366+
def include_pch : Separate<"-include-pch">, MetaVarName<"file">,
367+
HelpText<"Include precompiled header file">;
368+
def include_pth : Separate<"-include-pth">, MetaVarName<"file">,
369+
HelpText<"Include file before parsing">;
370+
def token_cache : Separate<"-token-cache">, MetaVarName<"path">,
371+
HelpText<"Use specified token cache file">;
372+
def U : Separate<"-U">, MetaVarName<"macro">,
373+
HelpText<"Undefine the specified macro">;
374+
def undef : Flag<"-undef">, MetaVarName<"macro">,
375+
HelpText<"undef all system defines">;
376+
377+
//===----------------------------------------------------------------------===//
378+
// Preprocessed Output Options
379+
//===----------------------------------------------------------------------===//
380+
381+
def P : Flag<"-P">,
382+
HelpText<"Disable linemarker output in -E mode">;
383+
def C : Flag<"-C">,
384+
HelpText<"Enable comment output in -E mode">;
385+
def CC : Flag<"-CC">,
386+
HelpText<"Enable comment output in -E mode, even from macro expansions">;
387+
def dM : Flag<"-dM">,
388+
HelpText<"Print macro definitions in -E mode instead of normal output">;
389+
def dD : Flag<"-dD">,
390+
HelpText<"Print macro definitions in -E mode in addition to normal output">;

lib/Driver/CC1Options.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,22 @@ static void ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args) {
216216
Opts.Warnings = getAllArgValues(Args, OPT_W);
217217
}
218218

219+
static void ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args) {
220+
}
221+
222+
static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
223+
}
224+
225+
static void ParseLangArgs(LangOptions &Opts, ArgList &Args) {
226+
}
227+
228+
static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args) {
229+
}
230+
231+
static void ParsePreprocessorOutputArgs(PreprocessorOutputOptions &Opts,
232+
ArgList &Args) {
233+
}
234+
219235
static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args) {
220236
using namespace cc1options;
221237
Opts.ABI = getLastArgValue(Args, OPT_target_abi);
@@ -252,5 +268,10 @@ void CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
252268
ParseCodeGenArgs(Res.getCodeGenOpts(), *InputArgs);
253269
ParseDependencyOutputArgs(Res.getDependencyOutputOpts(), *InputArgs);
254270
ParseDiagnosticArgs(Res.getDiagnosticOpts(), *InputArgs);
271+
ParseFrontendArgs(Res.getFrontendOpts(), *InputArgs);
272+
ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), *InputArgs);
273+
ParseLangArgs(Res.getLangOpts(), *InputArgs);
274+
ParsePreprocessorArgs(Res.getPreprocessorOpts(), *InputArgs);
275+
ParsePreprocessorOutputArgs(Res.getPreprocessorOutputOpts(), *InputArgs);
255276
ParseTargetArgs(Res.getTargetOpts(), *InputArgs);
256277
}

tools/clang-cc/Options.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@ DumpDefines("dD", llvm::cl::desc("Print macro definitions in -E mode in "
745745
"addition to normal output"));
746746

747747
}
748+
748749
//===----------------------------------------------------------------------===//
749750
// Target Options
750751
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)