r292968 - [docs] Add TableGen-based generator for command line argument documentation,

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 24 11:39:47 PST 2017


Author: rsmith
Date: Tue Jan 24 13:39:46 2017
New Revision: 292968

URL: http://llvm.org/viewvc/llvm-project?rev=292968&view=rev
Log:
[docs] Add TableGen-based generator for command line argument documentation,
and generate documentation for all (non-hidden) options supported by the
'clang' driver.

Added:
    cfe/trunk/docs/ClangCommandLineReference.rst
    cfe/trunk/include/clang/Driver/ClangOptionDocs.td
    cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp
Modified:
    cfe/trunk/docs/index.rst
    cfe/trunk/include/clang/Driver/CLCompatOptions.td
    cfe/trunk/include/clang/Driver/Options.h
    cfe/trunk/include/clang/Driver/Options.td
    cfe/trunk/utils/TableGen/CMakeLists.txt
    cfe/trunk/utils/TableGen/TableGen.cpp
    cfe/trunk/utils/TableGen/TableGenBackends.h

Added: cfe/trunk/docs/ClangCommandLineReference.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=292968&view=auto
==============================================================================
--- cfe/trunk/docs/ClangCommandLineReference.rst (added)
+++ cfe/trunk/docs/ClangCommandLineReference.rst Tue Jan 24 13:39:46 2017
@@ -0,0 +1,3286 @@
+..
+  -------------------------------------------------------------------
+  NOTE: This file is automatically generated by running clang-tblgen
+  -gen-opt-docs. Do not edit this file by hand!!
+  -------------------------------------------------------------------
+
+=====================================
+Clang command line argument reference
+=====================================
+.. contents::
+   :local:
+
+Introduction
+============
+
+This page lists the command line arguments currently supported by the
+GCC-compatible ``clang`` and ``clang++`` drivers.
+
+
+.. program:: clang
+.. program:: clang0
+.. option:: -A<arg>, --assert <arg>, --assert=<arg>
+
+.. program:: clang1
+.. option:: -B<arg>, --prefix <arg>, --prefix=<arg>
+
+.. program:: clang2
+.. option:: -C, --comments
+
+.. program:: clang3
+.. option:: -CC, --comments-in-macros
+
+.. program:: clang4
+.. option:: -F<arg>
+
+Add directory to framework include search path
+
+.. program:: clang5
+.. option:: -G<arg>
+
+.. program:: clang6
+.. option:: -G=<arg>
+
+.. program:: clang7
+.. option:: -H, --trace-includes
+
+Show header includes and nesting depth
+
+.. program:: clang8
+.. option:: -Mach
+
+.. program:: clang9
+.. option:: -ObjC
+
+Treat source input files as Objective-C inputs
+
+.. program:: clang10
+.. option:: -ObjC++
+
+Treat source input files as Objective-C++ inputs
+
+.. program:: clang11
+.. option:: -P, --no-line-commands
+
+Disable linemarker output in -E mode
+
+.. program:: clang12
+.. option:: -Q
+
+.. program:: clang13
+.. option:: -Qn
+
+.. program:: clang14
+.. option:: -Qunused-arguments
+
+Don't emit warning for unused driver arguments
+
+.. program:: clang15
+.. option:: -Wa,<arg>,<arg2>...
+
+Pass the comma separated arguments in <arg> to the assembler
+
+.. program:: clang16
+.. option:: -Wlarge-by-value-copy=<arg>
+
+.. program:: clang17
+.. option:: -Wp,<arg>,<arg2>...
+
+Pass the comma separated arguments in <arg> to the preprocessor
+
+.. program:: clang18
+.. option:: -X<arg>
+
+.. program:: clang19
+.. option:: -X
+
+.. program:: clang20
+.. option:: -Xanalyzer <arg>
+
+Pass <arg> to the static analyzer
+
+.. program:: clang21
+.. option:: -Xarch\_<arg1> <arg2>
+
+.. program:: clang22
+.. option:: -Xassembler <arg>
+
+Pass <arg> to the assembler
+
+.. program:: clang23
+.. option:: -Xcuda-fatbinary <arg>
+
+Pass <arg> to fatbinary invocation
+
+.. program:: clang24
+.. option:: -Xcuda-ptxas <arg>
+
+Pass <arg> to the ptxas assembler
+
+.. program:: clang25
+.. option:: -Xpreprocessor <arg>
+
+Pass <arg> to the preprocessor
+
+.. program:: clang26
+.. option:: -Z<arg>
+
+.. program:: clang27
+.. option:: -a<arg>, --profile-blocks
+
+.. program:: clang28
+.. option:: -all\_load
+
+.. program:: clang29
+.. option:: -allowable\_client <arg>
+
+.. program:: clang30
+.. option:: --analyze
+
+Run the static analyzer
+
+.. program:: clang31
+.. option:: --analyze-auto
+
+.. program:: clang32
+.. option:: --analyzer-no-default-checks
+
+.. program:: clang33
+.. option:: --analyzer-output<arg>
+
+Static analyzer report output format (html\|plist\|plist-multi-file\|plist-html\|text).
+
+.. program:: clang34
+.. option:: -ansi, --ansi
+
+.. program:: clang35
+.. option:: -arch <arg>
+
+.. program:: clang36
+.. option:: -arch\_errors\_fatal
+
+.. program:: clang37
+.. option:: -arch\_only <arg>
+
+.. program:: clang38
+.. option:: -arcmt-migrate-emit-errors
+
+Emit ARC errors even if the migrator can fix them
+
+.. program:: clang39
+.. option:: -arcmt-migrate-report-output <arg>
+
+Output path for the plist report
+
+.. program:: clang40
+.. option:: -bind\_at\_load
+
+.. program:: clang41
+.. option:: -bundle
+
+.. program:: clang42
+.. option:: -bundle\_loader <arg>
+
+.. program:: clang43
+.. option:: -c, --compile
+
+Only run preprocess, compile, and assemble steps
+
+.. program:: clang44
+.. option:: -client\_name<arg>
+
+.. program:: clang45
+.. option:: -compatibility\_version<arg>
+
+.. program:: clang46
+.. option:: --constant-cfstrings
+
+.. program:: clang47
+.. option:: -coverage, --coverage
+
+.. program:: clang48
+.. option:: --cuda-compile-host-device
+
+Compile CUDA code for both host and device (default).  Has no effect on non-CUDA compilations.
+
+.. program:: clang49
+.. option:: --cuda-device-only
+
+Compile CUDA code for device only
+
+.. program:: clang50
+.. option:: --cuda-gpu-arch=<arg>, --no-cuda-gpu-arch=<arg>
+
+CUDA GPU architecture (e.g. sm\_35).  May be specified more than once.
+
+.. program:: clang51
+.. option:: --cuda-host-only
+
+Compile CUDA code for host only.  Has no effect on non-CUDA compilations.
+
+.. program:: clang52
+.. option:: --cuda-noopt-device-debug, --no-cuda-noopt-device-debug
+
+Enable device-side debug info generation. Disables ptxas optimizations.
+
+.. program:: clang53
+.. option:: -current\_version<arg>
+
+.. program:: clang54
+.. option:: -dead\_strip
+
+.. program:: clang55
+.. option:: -dependency-dot <arg>
+
+Filename to write DOT-formatted header dependencies to
+
+.. program:: clang56
+.. option:: -dependency-file <arg>
+
+Filename (or -) to write dependency output to
+
+.. program:: clang57
+.. option:: -dumpmachine
+
+.. program:: clang58
+.. option:: -dumpversion
+
+.. program:: clang59
+.. option:: --dyld-prefix=<arg>, --dyld-prefix <arg>
+
+.. program:: clang60
+.. option:: -dylib\_file <arg>
+
+.. program:: clang61
+.. option:: -dylinker
+
+.. program:: clang62
+.. option:: -dylinker\_install\_name<arg>
+
+.. program:: clang63
+.. option:: -dynamic
+
+.. program:: clang64
+.. option:: -dynamiclib
+
+.. program:: clang65
+.. option:: -emit-ast
+
+Emit Clang AST files for source inputs
+
+.. program:: clang66
+.. option:: -exported\_symbols\_list <arg>
+
+.. program:: clang67
+.. option:: -faligned-new=<arg>
+
+.. program:: clang68
+.. option:: -fcuda-approx-transcendentals, -fno-cuda-approx-transcendentals
+
+Use approximate transcendental functions
+
+.. program:: clang69
+.. option:: -fcuda-flush-denormals-to-zero, -fno-cuda-flush-denormals-to-zero
+
+Flush denormal floating point values to zero in CUDA device mode.
+
+.. program:: clang70
+.. option:: -fheinous-gnu-extensions
+
+.. program:: clang71
+.. option:: -flat\_namespace
+
+.. program:: clang72
+.. option:: -fopenmp-targets=<arg1>,<arg2>...
+
+Specify comma-separated list of triples OpenMP offloading targets to be supported
+
+.. program:: clang73
+.. option:: -force\_cpusubtype\_ALL
+
+.. program:: clang74
+.. option:: -force\_flat\_namespace
+
+.. program:: clang75
+.. option:: -force\_load <arg>
+
+.. program:: clang76
+.. option:: -framework <arg>
+
+.. program:: clang77
+.. option:: --gcc-toolchain=<arg>, -gcc-toolchain <arg>
+
+Use the gcc toolchain at the given directory
+
+.. program:: clang78
+.. option:: -gcodeview
+
+Generate CodeView debug information
+
+.. program:: clang79
+.. option:: -headerpad\_max\_install\_names<arg>
+
+.. program:: clang80
+.. option:: -help, --help
+
+Display available options
+
+.. program:: clang81
+.. option:: --help-hidden
+
+.. program:: clang82
+.. option:: -image\_base <arg>
+
+.. program:: clang83
+.. option:: -index-header-map
+
+Make the next included directory (-I or -F) an indexer header map
+
+.. program:: clang84
+.. option:: -init <arg>
+
+.. program:: clang85
+.. option:: -install\_name <arg>
+
+.. program:: clang86
+.. option:: -keep\_private\_externs
+
+.. program:: clang87
+.. option:: -lazy\_framework <arg>
+
+.. program:: clang88
+.. option:: -lazy\_library <arg>
+
+.. program:: clang89
+.. option:: -mbig-endian, -EB
+
+.. program:: clang90
+.. option:: --migrate
+
+Run the migrator
+
+.. program:: clang91
+.. option:: -mlinker-version=<arg>
+
+.. program:: clang92
+.. option:: -mlittle-endian, -EL
+
+.. program:: clang93
+.. option:: -mllvm <arg>
+
+Additional arguments to forward to LLVM's option processing
+
+.. program:: clang94
+.. option:: -module-dependency-dir <arg>
+
+Directory to dump module dependencies to
+
+.. program:: clang95
+.. option:: -multi\_module
+
+.. program:: clang96
+.. option:: -multiply\_defined <arg>
+
+.. program:: clang97
+.. option:: -multiply\_defined\_unused <arg>
+
+.. program:: clang98
+.. option:: --no-cuda-version-check
+
+Don't error out if the detected version of the CUDA install is too low for the requested CUDA gpu architecture.
+
+.. program:: clang99
+.. option:: -no-integrated-cpp, --no-integrated-cpp
+
+.. program:: clang100
+.. option:: -no\_dead\_strip\_inits\_and\_terms
+
+.. program:: clang101
+.. option:: -nobuiltininc
+
+Disable builtin #include directories
+
+.. program:: clang102
+.. option:: -nocudainc
+
+.. program:: clang103
+.. option:: -nocudalib
+
+.. program:: clang104
+.. option:: -nodefaultlibs
+
+.. program:: clang105
+.. option:: -nofixprebinding
+
+.. program:: clang106
+.. option:: -nolibc
+
+.. program:: clang107
+.. option:: -nomultidefs
+
+.. program:: clang108
+.. option:: -nopie
+
+.. program:: clang109
+.. option:: -noprebind
+
+.. program:: clang110
+.. option:: -noseglinkedit
+
+.. program:: clang111
+.. option:: -nostartfiles
+
+.. program:: clang112
+.. option:: -nostdinc, --no-standard-includes
+
+.. program:: clang113
+.. option:: -nostdinc++
+
+Disable standard #include directories for the C++ standard library
+
+.. program:: clang114
+.. option:: -nostdlib, --no-standard-libraries
+
+.. program:: clang115
+.. option:: -nostdlibinc
+
+.. program:: clang116
+.. option:: -o<file>, --output <arg>, --output=<arg>
+
+Write output to <file>
+
+.. program:: clang117
+.. option:: -objcmt-atomic-property
+
+Make migration to 'atomic' properties
+
+.. program:: clang118
+.. option:: -objcmt-migrate-all
+
+Enable migration to modern ObjC
+
+.. program:: clang119
+.. option:: -objcmt-migrate-annotation
+
+Enable migration to property and method annotations
+
+.. program:: clang120
+.. option:: -objcmt-migrate-designated-init
+
+Enable migration to infer NS\_DESIGNATED\_INITIALIZER for initializer methods
+
+.. program:: clang121
+.. option:: -objcmt-migrate-instancetype
+
+Enable migration to infer instancetype for method result type
+
+.. program:: clang122
+.. option:: -objcmt-migrate-literals
+
+Enable migration to modern ObjC literals
+
+.. program:: clang123
+.. option:: -objcmt-migrate-ns-macros
+
+Enable migration to NS\_ENUM/NS\_OPTIONS macros
+
+.. program:: clang124
+.. option:: -objcmt-migrate-property
+
+Enable migration to modern ObjC property
+
+.. program:: clang125
+.. option:: -objcmt-migrate-property-dot-syntax
+
+Enable migration of setter/getter messages to property-dot syntax
+
+.. program:: clang126
+.. option:: -objcmt-migrate-protocol-conformance
+
+Enable migration to add protocol conformance on classes
+
+.. program:: clang127
+.. option:: -objcmt-migrate-readonly-property
+
+Enable migration to modern ObjC readonly property
+
+.. program:: clang128
+.. option:: -objcmt-migrate-readwrite-property
+
+Enable migration to modern ObjC readwrite property
+
+.. program:: clang129
+.. option:: -objcmt-migrate-subscripting
+
+Enable migration to modern ObjC subscripting
+
+.. program:: clang130
+.. option:: -objcmt-ns-nonatomic-iosonly
+
+Enable migration to use NS\_NONATOMIC\_IOSONLY macro for setting property's 'atomic' attribute
+
+.. program:: clang131
+.. option:: -objcmt-returns-innerpointer-property
+
+Enable migration to annotate property with NS\_RETURNS\_INNER\_POINTER
+
+.. program:: clang132
+.. option:: -objcmt-whitelist-dir-path=<arg>, -objcmt-white-list-dir-path=<arg>
+
+Only modify files with a filename contained in the provided directory path
+
+.. program:: clang133
+.. option:: -object
+
+.. program:: clang134
+.. option:: -p, --profile
+
+.. program:: clang135
+.. option:: -pagezero\_size<arg>
+
+.. program:: clang136
+.. option:: -pg
+
+Enable mcount instrumentation
+
+.. program:: clang137
+.. option:: -pie
+
+.. program:: clang138
+.. option:: -pipe, --pipe
+
+Use pipes between commands, when possible
+
+.. program:: clang139
+.. option:: -prebind
+
+.. program:: clang140
+.. option:: -prebind\_all\_twolevel\_modules
+
+.. program:: clang141
+.. option:: -preload
+
+.. program:: clang142
+.. option:: --print-diagnostic-categories
+
+.. program:: clang143
+.. option:: -print-file-name=<file>, --print-file-name=<file>, --print-file-name <arg>
+
+Print the full library path of <file>
+
+.. program:: clang144
+.. option:: -print-ivar-layout
+
+Enable Objective-C Ivar layout bitmap print trace
+
+.. program:: clang145
+.. option:: -print-libgcc-file-name, --print-libgcc-file-name
+
+Print the library path for the currently used compiler runtime library ("libgcc.a" or "libclang\_rt.builtins.\*.a")
+
+.. program:: clang146
+.. option:: -print-multi-directory, --print-multi-directory
+
+.. program:: clang147
+.. option:: -print-multi-lib, --print-multi-lib
+
+.. program:: clang148
+.. option:: -print-prog-name=<name>, --print-prog-name=<name>, --print-prog-name <arg>
+
+Print the full program path of <name>
+
+.. program:: clang149
+.. option:: -print-search-dirs, --print-search-dirs
+
+Print the paths used for finding libraries and programs
+
+.. program:: clang150
+.. option:: -private\_bundle
+
+.. program:: clang151
+.. option:: -pthread, -no-pthread
+
+Support POSIX threads in generated code
+
+.. program:: clang152
+.. option:: -pthreads
+
+.. program:: clang153
+.. option:: -rdynamic
+
+.. program:: clang154
+.. option:: -read\_only\_relocs <arg>
+
+.. program:: clang155
+.. option:: -relocatable-pch, --relocatable-pch
+
+Whether to build a relocatable precompiled header
+
+.. program:: clang156
+.. option:: -remap
+
+.. program:: clang157
+.. option:: -rewrite-legacy-objc
+
+Rewrite Legacy Objective-C source to C++
+
+.. program:: clang158
+.. option:: -rtlib=<arg>, --rtlib=<arg>, --rtlib <arg>
+
+Compiler runtime library to use
+
+.. program:: clang159
+.. option:: -save-stats=<arg>, --save-stats=<arg>, -save-stats (equivalent to -save-stats=cwd), --save-stats (equivalent to -save-stats=cwd)
+
+Save llvm statistics.
+
+.. program:: clang160
+.. option:: -save-temps=<arg>, --save-temps=<arg>, -save-temps (equivalent to -save-temps=cwd), --save-temps (equivalent to -save-temps=cwd)
+
+Save intermediate compilation results.
+
+.. program:: clang161
+.. option:: -sectalign <arg1> <arg2> <arg3>
+
+.. program:: clang162
+.. option:: -sectcreate <arg1> <arg2> <arg3>
+
+.. program:: clang163
+.. option:: -sectobjectsymbols <arg1> <arg2>
+
+.. program:: clang164
+.. option:: -sectorder <arg1> <arg2> <arg3>
+
+.. program:: clang165
+.. option:: -seg1addr<arg>
+
+.. program:: clang166
+.. option:: -seg\_addr\_table <arg>
+
+.. program:: clang167
+.. option:: -seg\_addr\_table\_filename <arg>
+
+.. program:: clang168
+.. option:: -segaddr <arg1> <arg2>
+
+.. program:: clang169
+.. option:: -segcreate <arg1> <arg2> <arg3>
+
+.. program:: clang170
+.. option:: -seglinkedit
+
+.. program:: clang171
+.. option:: -segprot <arg1> <arg2> <arg3>
+
+.. program:: clang172
+.. option:: -segs\_read\_<arg>
+
+.. program:: clang173
+.. option:: -segs\_read\_only\_addr <arg>
+
+.. program:: clang174
+.. option:: -segs\_read\_write\_addr <arg>
+
+.. program:: clang175
+.. option:: -serialize-diagnostics <arg>, --serialize-diagnostics <arg>
+
+Serialize compiler diagnostics to a file
+
+.. program:: clang176
+.. option:: -shared, --shared
+
+.. program:: clang177
+.. option:: -shared-libasan
+
+.. program:: clang178
+.. option:: -shared-libgcc
+
+.. program:: clang179
+.. option:: -single\_module
+
+.. program:: clang180
+.. option:: -specs=<arg>, --specs=<arg>
+
+.. program:: clang181
+.. option:: -static, --static
+
+.. program:: clang182
+.. option:: -static-libgcc
+
+.. program:: clang183
+.. option:: -static-libstdc++
+
+.. program:: clang184
+.. option:: -std-default=<arg>
+
+.. program:: clang185
+.. option:: -stdlib=<arg>, --stdlib=<arg>, --stdlib <arg>
+
+C++ standard library to use
+
+.. program:: clang186
+.. option:: -sub\_library<arg>
+
+.. program:: clang187
+.. option:: -sub\_umbrella<arg>
+
+.. program:: clang188
+.. option:: --sysroot=<arg>, --sysroot <arg>
+
+.. program:: clang189
+.. option:: --target-help
+
+.. program:: clang190
+.. option:: --target=<arg>, -target <arg>
+
+Generate code for the given target
+
+.. program:: clang191
+.. option:: -time
+
+Time individual commands
+
+.. program:: clang192
+.. option:: -traditional, --traditional
+
+.. program:: clang193
+.. option:: -traditional-cpp, --traditional-cpp
+
+Enable some traditional CPP emulation
+
+.. program:: clang194
+.. option:: -twolevel\_namespace
+
+.. program:: clang195
+.. option:: -twolevel\_namespace\_hints
+
+.. program:: clang196
+.. option:: -umbrella <arg>
+
+.. program:: clang197
+.. option:: -unexported\_symbols\_list <arg>
+
+.. program:: clang198
+.. option:: -v, --verbose
+
+Show commands to run and use verbose output
+
+.. program:: clang199
+.. option:: --verify-debug-info
+
+Verify the binary representation of debug output
+
+.. program:: clang200
+.. option:: --version
+
+.. program:: clang201
+.. option:: -w, --no-warnings
+
+Suppress all warnings
+
+.. program:: clang202
+.. option:: -weak-l<arg>
+
+.. program:: clang203
+.. option:: -weak\_framework <arg>
+
+.. program:: clang204
+.. option:: -weak\_library <arg>
+
+.. program:: clang205
+.. option:: -weak\_reference\_mismatches <arg>
+
+.. program:: clang206
+.. option:: -whatsloaded
+
+.. program:: clang207
+.. option:: -whyload
+
+.. program:: clang208
+.. option:: -working-directory<arg>, -working-directory=<arg>
+
+Resolve file paths relative to the specified directory
+
+.. program:: clang209
+.. option:: -x<language>, --language <arg>, --language=<arg>
+
+Treat subsequent input files as having type <language>
+
+.. program:: clang210
+.. option:: -y<arg>
+
+Actions
+=======
+The action to perform on the input.
+
+.. program:: clang211
+.. option:: -E, --preprocess
+
+Only run the preprocessor
+
+.. program:: clang212
+.. option:: -S, --assemble
+
+Only run preprocess and compilation steps
+
+.. program:: clang213
+.. option:: -emit-llvm
+
+Use the LLVM representation for assembler and object files
+
+.. program:: clang214
+.. option:: -fsyntax-only
+
+.. program:: clang215
+.. option:: -module-file-info
+
+Provide information about a particular module file
+
+.. program:: clang216
+.. option:: --precompile
+
+Only precompile the input
+
+.. program:: clang217
+.. option:: -rewrite-objc
+
+Rewrite Objective-C source to C++
+
+.. program:: clang218
+.. option:: -verify-pch
+
+Load and verify that a pre-compiled header file is not stale
+
+Compilation flags
+=================
+
+Flags controlling the behavior of Clang during compilation. These flags have
+no effect during actions that do not perform compilation.
+
+.. program:: clang219
+.. option:: -D<arg>, --define-macro <arg>, --define-macro=<arg>
+
+.. program:: clang220
+.. option:: -U<arg>, --undefine-macro <arg>, --undefine-macro=<arg>
+
+.. program:: clang221
+.. option:: -Xclang <arg>
+
+Pass <arg> to the clang compiler
+
+.. program:: clang222
+.. option:: -fcomment-block-commands=<arg>,<arg2>...
+
+Treat each comma separated argument in <arg> as a documentation comment block command
+
+.. program:: clang223
+.. option:: -fdeclspec, -fno-declspec
+
+Allow \_\_declspec as a keyword
+
+.. program:: clang224
+.. option:: -fdepfile-entry=<arg>
+
+.. program:: clang225
+.. option:: -fdiagnostics-fixit-info, -fno-diagnostics-fixit-info
+
+.. program:: clang226
+.. option:: -fdiagnostics-format=<arg>
+
+.. program:: clang227
+.. option:: -fdiagnostics-parseable-fixits
+
+Print fix-its in machine parseable form
+
+.. program:: clang228
+.. option:: -fdiagnostics-print-source-range-info
+
+Print source range spans in numeric form
+
+.. program:: clang229
+.. option:: -fdiagnostics-show-category=<arg>
+
+.. program:: clang230
+.. option:: -fexperimental-new-pass-manager, -fno-experimental-new-pass-manager
+
+Enables an experimental new pass manager in LLVM.
+
+.. program:: clang231
+.. option:: -finline-functions, -fno-inline-functions
+
+Inline suitable functions
+
+.. program:: clang232
+.. option:: -finline-hint-functions
+
+Inline functions which are (explicitly or implicitly) marked inline
+
+.. program:: clang233
+.. option:: -fno-crash-diagnostics
+
+.. program:: clang234
+.. option:: -fno-sanitize-blacklist
+
+Don't use blacklist file for sanitizers
+
+.. program:: clang235
+.. option:: -fparse-all-comments
+
+.. program:: clang236
+.. option:: -fsanitize-address-field-padding=<arg>
+
+Level of field padding for AddressSanitizer
+
+.. program:: clang237
+.. option:: -fsanitize-address-use-after-scope, -fno-sanitize-address-use-after-scope
+
+Enable use-after-scope detection in AddressSanitizer
+
+.. program:: clang238
+.. option:: -fsanitize-blacklist=<arg>
+
+Path to blacklist file for sanitizers
+
+.. program:: clang239
+.. option:: -fsanitize-cfi-cross-dso, -fno-sanitize-cfi-cross-dso
+
+Enable control flow integrity (CFI) checks for cross-DSO calls.
+
+.. program:: clang240
+.. option:: -fsanitize-coverage=<arg1>,<arg2>..., -fno-sanitize-coverage=<arg1>,<arg2>...
+
+Specify the type of coverage instrumentation for Sanitizers
+
+.. program:: clang241
+.. option:: -fsanitize-link-c++-runtime
+
+.. program:: clang242
+.. option:: -fsanitize-memory-track-origins, -fno-sanitize-memory-track-origins
+
+Enable origins tracking in MemorySanitizer
+
+.. program:: clang243
+.. option:: -fsanitize-memory-track-origins=<arg>
+
+Enable origins tracking in MemorySanitizer
+
+.. program:: clang244
+.. option:: -fsanitize-memory-use-after-dtor
+
+Enable use-after-destroy detection in MemorySanitizer
+
+.. program:: clang245
+.. option:: -fsanitize-recover, -fno-sanitize-recover
+
+.. program:: clang246
+.. option:: -fsanitize-recover=<arg1>,<arg2>..., -fno-sanitize-recover=<arg1>,<arg2>...
+
+Enable recovery for specified sanitizers
+
+.. program:: clang247
+.. option:: -fsanitize-stats, -fno-sanitize-stats
+
+Enable sanitizer statistics gathering.
+
+.. program:: clang248
+.. option:: -fsanitize-thread-atomics, -fno-sanitize-thread-atomics
+
+Enable atomic operations instrumentation in ThreadSanitizer (default)
+
+.. program:: clang249
+.. option:: -fsanitize-thread-func-entry-exit, -fno-sanitize-thread-func-entry-exit
+
+Enable function entry/exit instrumentation in ThreadSanitizer (default)
+
+.. program:: clang250
+.. option:: -fsanitize-thread-memory-access, -fno-sanitize-thread-memory-access
+
+Enable memory access instrumentation in ThreadSanitizer (default)
+
+.. program:: clang251
+.. option:: -fsanitize-trap=<arg1>,<arg2>..., -fno-sanitize-trap=<arg1>,<arg2>...
+
+Enable trapping for specified sanitizers
+
+.. program:: clang252
+.. option:: -fsanitize-undefined-strip-path-components=<number>
+
+Strip (or keep only, if negative) a given number of path components when emitting check metadata.
+
+.. program:: clang253
+.. option:: -fsanitize-undefined-trap-on-error, -fno-sanitize-undefined-trap-on-error
+
+.. program:: clang254
+.. option:: -fsanitize=<check>,<arg2>..., -fno-sanitize=<arg1>,<arg2>...
+
+Turn on runtime checks for various forms of undefined or suspicious behavior. See user manual for available checks
+
+.. program:: clang255
+.. option:: --param <arg>, --param=<arg>
+
+.. program:: clang256
+.. option:: -std=<arg>, --std=<arg>, --std <arg>
+
+Language standard to compile for
+
+Include path management
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Flags controlling how ``#include``\s are resolved to files.
+
+.. program:: clang257
+.. option:: -I<arg>, --include-directory <arg>, --include-directory=<arg>
+
+Add directory to include search path
+
+.. program:: clang258
+.. option:: -I-, --include-barrier
+
+.. program:: clang259
+.. option:: --cuda-path=<arg>
+
+CUDA installation path
+
+.. program:: clang260
+.. option:: -cxx-isystem<directory>
+
+Add directory to the C++ SYSTEM include search path
+
+.. program:: clang261
+.. option:: -fbuild-session-file=<file>
+
+Use the last modification time of <file> as the build session timestamp
+
+.. program:: clang262
+.. option:: -fbuild-session-timestamp=<time since Epoch in seconds>
+
+Time when the current build session started
+
+.. program:: clang263
+.. option:: -fmodules-cache-path=<directory>
+
+Specify the module cache path
+
+.. program:: clang264
+.. option:: -fmodules-disable-diagnostic-validation
+
+Disable validation of the diagnostic options when loading the module
+
+.. program:: clang265
+.. option:: -fmodules-prune-after=<seconds>
+
+Specify the interval (in seconds) after which a module file will be considered unused
+
+.. program:: clang266
+.. option:: -fmodules-prune-interval=<seconds>
+
+Specify the interval (in seconds) between attempts to prune the module cache
+
+.. program:: clang267
+.. option:: -fmodules-user-build-path <directory>
+
+Specify the module user build path
+
+.. program:: clang268
+.. option:: -fmodules-validate-once-per-build-session
+
+Don't verify input files for the modules if the module has been successfully validated or loaded during this build session
+
+.. program:: clang269
+.. option:: -fmodules-validate-system-headers
+
+Validate the system headers that a module depends on when loading the module
+
+.. program:: clang270
+.. option:: -fprebuilt-module-path=<directory>
+
+Specify the prebuilt module path
+
+.. program:: clang271
+.. option:: -i<arg>
+
+.. program:: clang272
+.. option:: -idirafter<arg>, --include-directory-after <arg>, --include-directory-after=<arg>
+
+Add directory to AFTER include search path
+
+.. program:: clang273
+.. option:: -iframework<arg>
+
+Add directory to SYSTEM framework search path
+
+.. program:: clang274
+.. option:: -imacros<file>, --imacros<file>, --imacros=<arg>
+
+Include macros from file before parsing
+
+.. program:: clang275
+.. option:: -include<file>, --include<file>, --include=<arg>
+
+Include file before parsing
+
+.. program:: clang276
+.. option:: -include-pch <file>
+
+Include precompiled header file
+
+.. program:: clang277
+.. option:: -iprefix<dir>, --include-prefix <arg>, --include-prefix=<arg>
+
+Set the -iwithprefix/-iwithprefixbefore prefix
+
+.. program:: clang278
+.. option:: -iquote<directory>
+
+Add directory to QUOTE include search path
+
+.. program:: clang279
+.. option:: -isysroot<dir>
+
+Set the system root directory (usually /)
+
+.. program:: clang280
+.. option:: -isystem<directory>
+
+Add directory to SYSTEM include search path
+
+.. program:: clang281
+.. option:: -isystem-after<directory>
+
+Add directory to end of the SYSTEM include search path
+
+.. program:: clang282
+.. option:: -ivfsoverlay<arg>
+
+Overlay the virtual filesystem described by file over the real file system
+
+.. program:: clang283
+.. option:: -iwithprefix<dir>, --include-with-prefix <arg>, --include-with-prefix-after <arg>, --include-with-prefix-after=<arg>, --include-with-prefix=<arg>
+
+Set directory to SYSTEM include search path with prefix
+
+.. program:: clang284
+.. option:: -iwithprefixbefore<dir>, --include-with-prefix-before <arg>, --include-with-prefix-before=<arg>
+
+Set directory to include search path with prefix
+
+.. program:: clang285
+.. option:: -iwithsysroot<directory>
+
+Add directory to SYSTEM include search path, absolute paths are relative to -isysroot
+
+.. program:: clang286
+.. option:: --ptxas-path=<arg>
+
+Path to ptxas (used for compiling CUDA code)
+
+.. program:: clang287
+.. option:: --system-header-prefix=<prefix>, --no-system-header-prefix=<prefix>, --system-header-prefix <arg>
+
+Treat all #include paths starting with <prefix> as including a system header.
+
+Dependency file generation
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Flags controlling generation of a dependency file for ``make``-like build
+systems.
+
+.. program:: clang288
+.. option:: -M, --dependencies
+
+Like -MD, but also implies -E and writes to stdout by default
+
+.. program:: clang289
+.. option:: -MD, --write-dependencies
+
+Write a depfile containing user and system headers
+
+.. program:: clang290
+.. option:: -MF<file>
+
+Write depfile output from -MMD, -MD, -MM, or -M to <file>
+
+.. program:: clang291
+.. option:: -MG, --print-missing-file-dependencies
+
+Add missing headers to depfile
+
+.. program:: clang292
+.. option:: -MJ<arg>
+
+Write a compilation database entry per input
+
+.. program:: clang293
+.. option:: -MM, --user-dependencies
+
+Like -MMD, but also implies -E and writes to stdout by default
+
+.. program:: clang294
+.. option:: -MMD, --write-user-dependencies
+
+Write a depfile containing user headers
+
+.. program:: clang295
+.. option:: -MP
+
+Create phony target for each dependency (other than main file)
+
+.. program:: clang296
+.. option:: -MQ<arg>
+
+Specify name of main file output to quote in depfile
+
+.. program:: clang297
+.. option:: -MT<arg>
+
+Specify name of main file output in depfile
+
+.. program:: clang298
+.. option:: -MV
+
+Use NMake/Jom format for the depfile
+
+Dumping preprocessor state
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Flags allowing the state of the preprocessor to be dumped in various ways.
+
+.. program:: clang299
+.. option:: -d
+
+.. program:: clang300
+.. option:: -d<arg>
+
+.. program:: clang301
+.. option:: -dA
+
+.. program:: clang302
+.. option:: -dD
+
+Print macro definitions in -E mode in addition to normal output
+
+.. program:: clang303
+.. option:: -dI
+
+Print include directives in -E mode in addition to normal output
+
+.. program:: clang304
+.. option:: -dM
+
+Print macro definitions in -E mode instead of normal output
+
+Diagnostic flags
+~~~~~~~~~~~~~~~~
+
+Flags controlling which warnings, errors, and remarks Clang will generate.
+See the :doc:`full list of warning and remark flags <DiagnosticsReference>`.
+
+.. program:: clang305
+.. option:: -R<remark>
+
+Enable the specified remark
+
+.. program:: clang306
+.. option:: -Rpass-analysis=<arg>
+
+Report transformation analysis from optimization passes whose name matches the given POSIX regular expression
+
+.. program:: clang307
+.. option:: -Rpass-missed=<arg>
+
+Report missed transformations by optimization passes whose name matches the given POSIX regular expression
+
+.. program:: clang308
+.. option:: -Rpass=<arg>
+
+Report transformations performed by optimization passes whose name matches the given POSIX regular expression
+
+.. program:: clang309
+.. option:: -W<warning>, --extra-warnings, --warn-<arg>, --warn-=<arg>
+
+Enable the specified warning
+
+.. program:: clang310
+.. option:: -WCL4
+
+.. program:: clang311
+.. option:: -Wall, --all-warnings
+
+.. program:: clang312
+.. option:: -Wdeprecated, -Wno-deprecated
+
+.. program:: clang313
+.. option:: -Wextra
+
+.. program:: clang314
+.. option:: -Wnonportable-cfstrings<arg>, -Wno-nonportable-cfstrings<arg>
+
+.. program:: clang315
+.. option:: -Wwrite-strings, -Wno-write-strings
+
+Target-independent compilation options
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. program:: clang316
+.. option:: -Wframe-larger-than=<arg>
+
+.. program:: clang317
+.. option:: -fPIC, -fno-PIC
+
+.. program:: clang318
+.. option:: -fPIE, -fno-PIE
+
+.. program:: clang319
+.. option:: -faccess-control, -fno-access-control
+
+.. program:: clang320
+.. option:: -faligned-allocation, -faligned-new, -fno-aligned-allocation
+
+Enable C++17 aligned allocation functions
+
+.. program:: clang321
+.. option:: -fallow-unsupported
+
+.. program:: clang322
+.. option:: -faltivec, -fno-altivec, -maltivec
+
+Enable AltiVec vector initializer syntax
+
+.. program:: clang323
+.. option:: -fansi-escape-codes
+
+Use ANSI escape codes for diagnostics
+
+.. program:: clang324
+.. option:: -fapple-kext, -findirect-virtual-calls, -fterminated-vtables
+
+Use Apple's kernel extensions ABI
+
+.. program:: clang325
+.. option:: -fapple-pragma-pack, -fno-apple-pragma-pack
+
+Enable Apple gcc-compatible #pragma pack handling
+
+.. program:: clang326
+.. option:: -fapplication-extension, -fno-application-extension
+
+Restrict code to those available for App Extensions
+
+.. program:: clang327
+.. option:: -fasm, -fno-asm
+
+.. program:: clang328
+.. option:: -fasm-blocks, -fno-asm-blocks
+
+.. program:: clang329
+.. option:: -fassociative-math, -fno-associative-math
+
+.. program:: clang330
+.. option:: -fassume-sane-operator-new, -fno-assume-sane-operator-new
+
+.. program:: clang331
+.. option:: -fast
+
+.. program:: clang332
+.. option:: -fastcp
+
+.. program:: clang333
+.. option:: -fastf
+
+.. program:: clang334
+.. option:: -fasynchronous-unwind-tables, -fno-asynchronous-unwind-tables
+
+.. program:: clang335
+.. option:: -fautolink, -fno-autolink
+
+.. program:: clang336
+.. option:: -fblocks, -fno-blocks
+
+Enable the 'blocks' language feature
+
+.. program:: clang337
+.. option:: -fbootclasspath=<arg>, --bootclasspath <arg>, --bootclasspath=<arg>
+
+.. program:: clang338
+.. option:: -fborland-extensions, -fno-borland-extensions
+
+Accept non-standard constructs supported by the Borland compiler
+
+.. program:: clang339
+.. option:: -fbracket-depth=<arg>
+
+.. program:: clang340
+.. option:: -fbuiltin, -fno-builtin
+
+.. program:: clang341
+.. option:: -fbuiltin-module-map
+
+Load the clang builtins module map file.
+
+.. program:: clang342
+.. option:: -fcaret-diagnostics, -fno-caret-diagnostics
+
+.. program:: clang343
+.. option:: -fclasspath=<arg>, --CLASSPATH <arg>, --CLASSPATH=<arg>, --classpath <arg>, --classpath=<arg>
+
+.. program:: clang344
+.. option:: -fcolor-diagnostics, -fno-color-diagnostics
+
+Use colors in diagnostics
+
+.. program:: clang345
+.. option:: -fcommon, -fno-common
+
+.. program:: clang346
+.. option:: -fcompile-resource=<arg>, --resource <arg>, --resource=<arg>
+
+.. program:: clang347
+.. option:: -fconstant-cfstrings, -fno-constant-cfstrings
+
+.. program:: clang348
+.. option:: -fconstant-string-class=<arg>
+
+.. program:: clang349
+.. option:: -fconstexpr-backtrace-limit=<arg>
+
+.. program:: clang350
+.. option:: -fconstexpr-depth=<arg>
+
+.. program:: clang351
+.. option:: -fconstexpr-steps=<arg>
+
+.. program:: clang352
+.. option:: -fcoroutines-ts, -fno-coroutines-ts
+
+Enable support for the C++ Coroutines TS
+
+.. program:: clang353
+.. option:: -fcoverage-mapping, -fno-coverage-mapping
+
+Generate coverage mapping to enable code coverage analysis
+
+.. program:: clang354
+.. option:: -fcreate-profile
+
+.. program:: clang355
+.. option:: -fcxx-exceptions, -fno-cxx-exceptions
+
+Enable C++ exceptions
+
+.. program:: clang356
+.. option:: -fcxx-modules, -fno-cxx-modules
+
+.. program:: clang357
+.. option:: -fdata-sections, -fno-data-sections
+
+Place each data in its own section (ELF Only)
+
+.. program:: clang358
+.. option:: -fdebug-info-for-profiling, -fno-debug-info-for-profiling
+
+Emit extra debug info to make sample profile more accurate.
+
+.. program:: clang359
+.. option:: -fdebug-pass-arguments
+
+.. program:: clang360
+.. option:: -fdebug-pass-structure
+
+.. program:: clang361
+.. option:: -fdebug-prefix-map=<arg>
+
+remap file source paths in debug info
+
+.. program:: clang362
+.. option:: -fdebug-types-section, -fno-debug-types-section
+
+Place debug types in their own section (ELF Only)
+
+.. program:: clang363
+.. option:: -fdelayed-template-parsing, -fno-delayed-template-parsing
+
+Parse templated function definitions at the end of the translation unit
+
+.. program:: clang364
+.. option:: -fdenormal-fp-math=<arg>
+
+.. program:: clang365
+.. option:: -fdiagnostics-absolute-paths
+
+Print absolute paths in diagnostics
+
+.. program:: clang366
+.. option:: -fdiagnostics-color, -fno-diagnostics-color
+
+.. program:: clang367
+.. option:: -fdiagnostics-color=<arg>
+
+.. program:: clang368
+.. option:: -fdiagnostics-show-hotness, -fno-diagnostics-show-hotness
+
+Enable profile hotness information in diagnostic line
+
+.. program:: clang369
+.. option:: -fdiagnostics-show-note-include-stack, -fno-diagnostics-show-note-include-stack
+
+Display include stacks for diagnostic notes
+
+.. program:: clang370
+.. option:: -fdiagnostics-show-option, -fno-diagnostics-show-option
+
+Print option name with mappable diagnostics
+
+.. program:: clang371
+.. option:: -fdiagnostics-show-template-tree
+
+Print a template comparison tree for differing templates
+
+.. program:: clang372
+.. option:: -fdollars-in-identifiers, -fno-dollars-in-identifiers
+
+Allow '$' in identifiers
+
+.. program:: clang373
+.. option:: -fdwarf-directory-asm, -fno-dwarf-directory-asm
+
+.. program:: clang374
+.. option:: -felide-constructors, -fno-elide-constructors
+
+.. program:: clang375
+.. option:: -feliminate-unused-debug-symbols, -fno-eliminate-unused-debug-symbols
+
+.. program:: clang376
+.. option:: -fembed-bitcode=<option>, -fembed-bitcode (equivalent to -fembed-bitcode=all), -fembed-bitcode-marker (equivalent to -fembed-bitcode=marker)
+
+Embed LLVM bitcode (option: off, all, bitcode, marker)
+
+.. program:: clang377
+.. option:: -femit-all-decls
+
+Emit all declarations, even if unused
+
+.. program:: clang378
+.. option:: -femulated-tls, -fno-emulated-tls
+
+Use emutls functions to access thread\_local variables
+
+.. program:: clang379
+.. option:: -fencoding=<arg>, --encoding <arg>, --encoding=<arg>
+
+.. program:: clang380
+.. option:: -ferror-limit=<arg>
+
+.. program:: clang381
+.. option:: -fexceptions, -fno-exceptions
+
+Enable support for exception handling
+
+.. program:: clang382
+.. option:: -fexec-charset=<arg>
+
+.. program:: clang383
+.. option:: -fextdirs=<arg>, --extdirs <arg>, --extdirs=<arg>
+
+.. program:: clang384
+.. option:: -ffast-math, -fno-fast-math
+
+Allow aggressive, lossy floating-point optimizations
+
+.. program:: clang385
+.. option:: -ffinite-math-only, -fno-finite-math-only
+
+.. program:: clang386
+.. option:: -ffor-scope, -fno-for-scope
+
+.. program:: clang387
+.. option:: -ffp-contract=<arg>
+
+Form fused FP ops (e.g. FMAs): fast (everywhere) \| on (according to FP\_CONTRACT pragma, default) \| off (never fuse)
+
+.. program:: clang388
+.. option:: -ffreestanding
+
+Assert that the compilation takes place in a freestanding environment
+
+.. program:: clang389
+.. option:: -ffunction-sections, -fno-function-sections
+
+Place each function in its own section (ELF Only)
+
+.. program:: clang390
+.. option:: -fgnu-inline-asm, -fno-gnu-inline-asm
+
+.. program:: clang391
+.. option:: -fgnu-keywords, -fno-gnu-keywords
+
+Allow GNU-extension keywords regardless of language standard
+
+.. program:: clang392
+.. option:: -fgnu-runtime
+
+Generate output compatible with the standard GNU Objective-C runtime
+
+.. program:: clang393
+.. option:: -fgnu89-inline, -fno-gnu89-inline
+
+Use the gnu89 inline semantics
+
+.. program:: clang394
+.. option:: -fhonor-infinities, -fhonor-infinites, -fno-honor-infinities
+
+.. program:: clang395
+.. option:: -fhonor-nans, -fno-honor-nans
+
+.. program:: clang396
+.. option:: -fhosted
+
+.. program:: clang397
+.. option:: -fimplicit-module-maps, -fmodule-maps, -fno-implicit-module-maps
+
+Implicitly search the file system for module map files.
+
+.. program:: clang398
+.. option:: -fimplicit-modules, -fno-implicit-modules
+
+.. program:: clang399
+.. option:: -finput-charset=<arg>
+
+.. program:: clang400
+.. option:: -finstrument-functions
+
+Generate calls to instrument function entry and exit
+
+.. program:: clang401
+.. option:: -fintegrated-as, -fno-integrated-as, -integrated-as
+
+Enable the integrated assembler
+
+.. program:: clang402
+.. option:: -fjump-tables, -fno-jump-tables
+
+.. program:: clang403
+.. option:: -flax-vector-conversions, -fno-lax-vector-conversions
+
+.. program:: clang404
+.. option:: -flimited-precision=<arg>
+
+.. program:: clang405
+.. option:: -flto, -fno-lto
+
+Enable LTO in 'full' mode
+
+.. program:: clang406
+.. option:: -flto-jobs=<arg>
+
+Controls the backend parallelism of -flto=thin (default of 0 means the number of threads will be derived from the number of CPUs detected)
+
+.. program:: clang407
+.. option:: -flto=<arg>
+
+Set LTO mode to either 'full' or 'thin'
+
+.. program:: clang408
+.. option:: -fmacro-backtrace-limit=<arg>
+
+.. program:: clang409
+.. option:: -fmath-errno, -fno-math-errno
+
+Require math functions to indicate errors by setting errno
+
+.. program:: clang410
+.. option:: -fmax-type-align=<arg>
+
+Specify the maximum alignment to enforce on pointers lacking an explicit alignment
+
+.. program:: clang411
+.. option:: -fmerge-all-constants, -fno-merge-all-constants
+
+.. program:: clang412
+.. option:: -fmessage-length=<arg>
+
+.. program:: clang413
+.. option:: -fmodule-file-deps, -fno-module-file-deps
+
+.. program:: clang414
+.. option:: -fmodule-file=<file>
+
+Load this precompiled module file
+
+.. program:: clang415
+.. option:: -fmodule-map-file=<file>
+
+Load this module map file
+
+.. program:: clang416
+.. option:: -fmodule-name=<name>, -fmodule-implementation-of <arg>, -fmodule-name <arg>
+
+Specify the name of the module to build
+
+.. program:: clang417
+.. option:: -fmodules, -fno-modules
+
+Enable the 'modules' language feature
+
+.. program:: clang418
+.. option:: -fmodules-decluse, -fno-modules-decluse
+
+Require declaration of modules used within a module
+
+.. program:: clang419
+.. option:: -fmodules-ignore-macro=<arg>
+
+Ignore the definition of the given macro when building and loading modules
+
+.. program:: clang420
+.. option:: -fmodules-search-all, -fno-modules-search-all
+
+Search even non-imported modules to resolve references
+
+.. program:: clang421
+.. option:: -fmodules-strict-decluse
+
+Like -fmodules-decluse but requires all headers to be in modules
+
+.. program:: clang422
+.. option:: -fmodules-ts
+
+Enable support for the C++ Modules TS
+
+.. program:: clang423
+.. option:: -fms-compatibility, -fno-ms-compatibility
+
+Enable full Microsoft Visual C++ compatibility
+
+.. program:: clang424
+.. option:: -fms-compatibility-version=<arg>
+
+Dot-separated value representing the Microsoft compiler version number to report in \_MSC\_VER (0 = don't define it (default))
+
+.. program:: clang425
+.. option:: -fms-extensions, -fno-ms-extensions
+
+Accept some non-standard constructs supported by the Microsoft compiler
+
+.. program:: clang426
+.. option:: -fms-memptr-rep=<arg>
+
+.. program:: clang427
+.. option:: -fms-volatile<arg>
+
+.. program:: clang428
+.. option:: -fmsc-version=<arg>
+
+Microsoft compiler version number to report in \_MSC\_VER (0 = don't define it (default))
+
+.. program:: clang429
+.. option:: -fmudflap
+
+.. program:: clang430
+.. option:: -fmudflapth
+
+.. program:: clang431
+.. option:: -fnested-functions
+
+.. program:: clang432
+.. option:: -fnew-alignment=<align>, -fnew-alignment <arg>
+
+Specifies the largest alignment guaranteed by '::operator new(size\_t)'
+
+.. program:: clang433
+.. option:: -fnext-runtime
+
+.. program:: clang434
+.. option:: -fno-builtin-<arg>
+
+Disable implicit builtin knowledge of a specific function
+
+.. program:: clang435
+.. option:: -fno-elide-type
+
+Do not elide types when printing diagnostics
+
+.. program:: clang436
+.. option:: -fno-max-type-align
+
+.. program:: clang437
+.. option:: -fno-operator-names
+
+Do not treat C++ operator name keywords as synonyms for operators
+
+.. program:: clang438
+.. option:: -fno-strict-modules-decluse
+
+.. program:: clang439
+.. option:: -fno-working-directory
+
+.. program:: clang440
+.. option:: -fnoopenmp-use-tls
+
+.. program:: clang441
+.. option:: -fobjc-abi-version=<arg>
+
+.. program:: clang442
+.. option:: -fobjc-arc, -fno-objc-arc
+
+Synthesize retain and release calls for Objective-C pointers
+
+.. program:: clang443
+.. option:: -fobjc-arc-exceptions, -fno-objc-arc-exceptions
+
+Use EH-safe code when synthesizing retains and releases in -fobjc-arc
+
+.. program:: clang444
+.. option:: -fobjc-exceptions, -fno-objc-exceptions
+
+Enable Objective-C exceptions
+
+.. program:: clang445
+.. option:: -fobjc-infer-related-result-type, -fno-objc-infer-related-result-type
+
+.. program:: clang446
+.. option:: -fobjc-legacy-dispatch, -fno-objc-legacy-dispatch
+
+.. program:: clang447
+.. option:: -fobjc-link-runtime
+
+.. program:: clang448
+.. option:: -fobjc-nonfragile-abi, -fno-objc-nonfragile-abi
+
+.. program:: clang449
+.. option:: -fobjc-nonfragile-abi-version=<arg>
+
+.. program:: clang450
+.. option:: -fobjc-runtime=<arg>
+
+Specify the target Objective-C runtime kind and version
+
+.. program:: clang451
+.. option:: -fobjc-sender-dependent-dispatch
+
+.. program:: clang452
+.. option:: -fobjc-weak, -fno-objc-weak
+
+Enable ARC-style weak references in Objective-C
+
+.. program:: clang453
+.. option:: -fomit-frame-pointer, -fno-omit-frame-pointer
+
+.. program:: clang454
+.. option:: -fopenmp, -fno-openmp
+
+.. program:: clang455
+.. option:: -fopenmp-dump-offload-linker-script
+
+.. program:: clang456
+.. option:: -fopenmp-use-tls
+
+.. program:: clang457
+.. option:: -fopenmp-version=<arg>
+
+.. program:: clang458
+.. option:: -fopenmp=<arg>
+
+.. program:: clang459
+.. option:: -foperator-arrow-depth=<arg>
+
+.. program:: clang460
+.. option:: -foptimization-record-file=<arg>
+
+Specify the file name of any generated YAML optimization record
+
+.. program:: clang461
+.. option:: -foptimize-sibling-calls, -fno-optimize-sibling-calls
+
+.. program:: clang462
+.. option:: -foutput-class-dir=<arg>, --output-class-directory <arg>, --output-class-directory=<arg>
+
+.. program:: clang463
+.. option:: -fpack-struct, -fno-pack-struct
+
+.. program:: clang464
+.. option:: -fpack-struct=<arg>
+
+Specify the default maximum struct packing alignment
+
+.. program:: clang465
+.. option:: -fpascal-strings, -fno-pascal-strings, -mpascal-strings
+
+Recognize and construct Pascal-style string literals
+
+.. program:: clang466
+.. option:: -fpcc-struct-return
+
+Override the default ABI to return all structs on the stack
+
+.. program:: clang467
+.. option:: -fpch-preprocess
+
+.. program:: clang468
+.. option:: -fpic, -fno-pic
+
+.. program:: clang469
+.. option:: -fpie, -fno-pie
+
+.. program:: clang470
+.. option:: -fplugin=<dsopath>
+
+Load the named plugin (dynamic shared object)
+
+.. program:: clang471
+.. option:: -fpreserve-as-comments, -fno-preserve-as-comments
+
+.. program:: clang472
+.. option:: -fprofile-arcs, -fno-profile-arcs
+
+.. program:: clang473
+.. option:: -fprofile-dir=<arg>
+
+.. program:: clang474
+.. option:: -fprofile-generate, -fno-profile-generate
+
+Generate instrumented code to collect execution counts into default.profraw (overridden by LLVM\_PROFILE\_FILE env var)
+
+.. program:: clang475
+.. option:: -fprofile-generate=<directory>
+
+Generate instrumented code to collect execution counts into <directory>/default.profraw (overridden by LLVM\_PROFILE\_FILE env var)
+
+.. program:: clang476
+.. option:: -fprofile-instr-generate, -fno-profile-instr-generate
+
+Generate instrumented code to collect execution counts into default.profraw file (overridden by '=' form of option or LLVM\_PROFILE\_FILE env var)
+
+.. program:: clang477
+.. option:: -fprofile-instr-generate=<file>
+
+Generate instrumented code to collect execution counts into <file> (overridden by LLVM\_PROFILE\_FILE env var)
+
+.. program:: clang478
+.. option:: -fprofile-instr-use, -fno-profile-instr-use, -fprofile-use
+
+.. program:: clang479
+.. option:: -fprofile-instr-use=<arg>
+
+Use instrumentation data for profile-guided optimization
+
+.. program:: clang480
+.. option:: -fprofile-sample-use=<arg>, -fauto-profile=<arg>
+
+Enable sample-based profile guided optimizations
+
+.. program:: clang481
+.. option:: -fprofile-use=<pathname>
+
+Use instrumentation data for profile-guided optimization. If pathname is a directory, it reads from <pathname>/default.profdata. Otherwise, it reads from file <pathname>.
+
+.. program:: clang482
+.. option:: -freciprocal-math, -fno-reciprocal-math
+
+Allow division operations to be reassociated
+
+.. program:: clang483
+.. option:: -freg-struct-return
+
+Override the default ABI to return small structs in registers
+
+.. program:: clang484
+.. option:: -frelaxed-template-template-args, -fno-relaxed-template-template-args
+
+Enable C++17 relaxed template template argument matching
+
+.. program:: clang485
+.. option:: -freroll-loops, -fno-reroll-loops
+
+Turn on loop reroller
+
+.. program:: clang486
+.. option:: -fretain-comments-from-system-headers
+
+.. program:: clang487
+.. option:: -frewrite-includes, -fno-rewrite-includes
+
+.. program:: clang488
+.. option:: -frewrite-map-file <arg>
+
+.. program:: clang489
+.. option:: -frewrite-map-file=<arg>
+
+.. program:: clang490
+.. option:: -fropi, -fno-ropi
+
+.. program:: clang491
+.. option:: -frtti, -fno-rtti
+
+.. program:: clang492
+.. option:: -frwpi, -fno-rwpi
+
+.. program:: clang493
+.. option:: -fsave-optimization-record, -fno-save-optimization-record
+
+Generate a YAML optimization record file
+
+.. program:: clang494
+.. option:: -fshort-enums, -fno-short-enums
+
+Allocate to an enum type only as many bytes as it needs for the declared range of possible values
+
+.. program:: clang495
+.. option:: -fshort-wchar, -fno-short-wchar
+
+Force wchar\_t to be a short unsigned int
+
+.. program:: clang496
+.. option:: -fshow-column, -fno-show-column
+
+.. program:: clang497
+.. option:: -fshow-overloads=<arg>
+
+Which overload candidates to show when overload resolution fails: best\|all; defaults to all
+
+.. program:: clang498
+.. option:: -fshow-source-location, -fno-show-source-location
+
+.. program:: clang499
+.. option:: -fsignaling-math, -fno-signaling-math
+
+.. program:: clang500
+.. option:: -fsigned-bitfields
+
+.. program:: clang501
+.. option:: -fsigned-char, -fno-signed-char, --signed-char
+
+.. program:: clang502
+.. option:: -fsigned-zeros, -fno-signed-zeros
+
+.. program:: clang503
+.. option:: -fsized-deallocation, -fno-sized-deallocation
+
+Enable C++14 sized global deallocation functions
+
+.. program:: clang504
+.. option:: -fsjlj-exceptions
+
+Use SjLj style exceptions
+
+.. program:: clang505
+.. option:: -fslp-vectorize, -fno-slp-vectorize, -ftree-slp-vectorize
+
+Enable the superword-level parallelism vectorization passes
+
+.. program:: clang506
+.. option:: -fslp-vectorize-aggressive, -fno-slp-vectorize-aggressive
+
+Enable the BB vectorization passes
+
+.. program:: clang507
+.. option:: -fspell-checking, -fno-spell-checking
+
+.. program:: clang508
+.. option:: -fspell-checking-limit=<arg>
+
+.. program:: clang509
+.. option:: -fsplit-dwarf-inlining, -fno-split-dwarf-inlining
+
+Place debug types in their own section (ELF Only)
+
+.. program:: clang510
+.. option:: -fsplit-stack
+
+.. program:: clang511
+.. option:: -fstack-protector, -fno-stack-protector
+
+Enable stack protectors for functions potentially vulnerable to stack smashing
+
+.. program:: clang512
+.. option:: -fstack-protector-all
+
+Force the usage of stack protectors for all functions
+
+.. program:: clang513
+.. option:: -fstack-protector-strong
+
+Use a strong heuristic to apply stack protectors to functions
+
+.. program:: clang514
+.. option:: -fstandalone-debug, -fno-limit-debug-info, -fno-standalone-debug
+
+Emit full debug info for all types used by the program
+
+.. program:: clang515
+.. option:: -fstrict-aliasing, -fno-strict-aliasing
+
+.. program:: clang516
+.. option:: -fstrict-enums, -fno-strict-enums
+
+Enable optimizations based on the strict definition of an enum's value range
+
+.. program:: clang517
+.. option:: -fstrict-overflow, -fno-strict-overflow
+
+.. program:: clang518
+.. option:: -fstrict-return, -fno-strict-return
+
+Always treat control flow paths that fall off the end of a non-voidfunction as unreachable
+
+.. program:: clang519
+.. option:: -fstrict-vtable-pointers, -fno-strict-vtable-pointers
+
+Enable optimizations based on the strict rules for overwriting polymorphic C++ objects
+
+.. program:: clang520
+.. option:: -fstruct-path-tbaa, -fno-struct-path-tbaa
+
+.. program:: clang521
+.. option:: -ftabstop=<arg>
+
+.. program:: clang522
+.. option:: -ftemplate-backtrace-limit=<arg>
+
+.. program:: clang523
+.. option:: -ftemplate-depth-<arg>
+
+.. program:: clang524
+.. option:: -ftemplate-depth=<arg>
+
+.. program:: clang525
+.. option:: -ftest-coverage
+
+.. program:: clang526
+.. option:: -fthinlto-index=<arg>
+
+Perform ThinLTO importing using provided function summary index
+
+.. program:: clang527
+.. option:: -fthreadsafe-statics, -fno-threadsafe-statics
+
+.. program:: clang528
+.. option:: -ftime-report
+
+.. program:: clang529
+.. option:: -ftls-model=<arg>
+
+.. program:: clang530
+.. option:: -ftrap-function=<arg>
+
+Issue call to specified function rather than a trap instruction
+
+.. program:: clang531
+.. option:: -ftrapping-math, -fno-trapping-math
+
+.. program:: clang532
+.. option:: -ftrapv
+
+Trap on integer overflow
+
+.. program:: clang533
+.. option:: -ftrapv-handler <arg>
+
+.. program:: clang534
+.. option:: -ftrapv-handler=<function name>
+
+Specify the function to be called on overflow
+
+.. program:: clang535
+.. option:: -ftrigraphs, -fno-trigraphs, -trigraphs, --trigraphs
+
+Process trigraph sequences
+
+.. program:: clang536
+.. option:: -funique-section-names, -fno-unique-section-names
+
+Use unique names for text and data sections (ELF Only)
+
+.. program:: clang537
+.. option:: -funit-at-a-time, -fno-unit-at-a-time
+
+.. program:: clang538
+.. option:: -funroll-loops, -fno-unroll-loops
+
+Turn on loop unroller
+
+.. program:: clang539
+.. option:: -funsafe-math-optimizations, -fno-unsafe-math-optimizations
+
+.. program:: clang540
+.. option:: -funsigned-bitfields
+
+.. program:: clang541
+.. option:: -funsigned-char, -fno-unsigned-char, --unsigned-char
+
+.. program:: clang542
+.. option:: -funwind-tables, -fno-unwind-tables
+
+.. program:: clang543
+.. option:: -fuse-cxa-atexit, -fno-use-cxa-atexit
+
+.. program:: clang544
+.. option:: -fuse-init-array, -fno-use-init-array
+
+Use .init\_array instead of .ctors
+
+.. program:: clang545
+.. option:: -fuse-ld=<arg>
+
+.. program:: clang546
+.. option:: -fuse-line-directives, -fno-use-line-directives
+
+.. program:: clang547
+.. option:: -fveclib=<arg>
+
+Use the given vector functions library
+
+.. program:: clang548
+.. option:: -fvectorize, -fno-vectorize, -ftree-vectorize
+
+Enable the loop vectorization passes
+
+.. program:: clang549
+.. option:: -fverbose-asm, -fno-verbose-asm
+
+.. program:: clang550
+.. option:: -fvisibility-inlines-hidden
+
+Give inline C++ member functions default visibility by default
+
+.. program:: clang551
+.. option:: -fvisibility-ms-compat
+
+Give global types 'default' visibility and global functions and variables 'hidden' visibility by default
+
+.. program:: clang552
+.. option:: -fvisibility=<arg>
+
+Set the default symbol visibility for all global declarations
+
+.. program:: clang553
+.. option:: -fwhole-program-vtables, -fno-whole-program-vtables
+
+Enables whole-program vtable optimization. Requires -flto
+
+.. program:: clang554
+.. option:: -fwrapv, -fno-wrapv
+
+Treat signed integer overflow as two's complement
+
+.. program:: clang555
+.. option:: -fwritable-strings
+
+Store string literals as writable data
+
+.. program:: clang556
+.. option:: -fxray-instruction-threshold<arg>
+
+.. program:: clang557
+.. option:: -fxray-instruction-threshold=<arg>
+
+Sets the minimum function size to instrument with XRay
+
+.. program:: clang558
+.. option:: -fxray-instrument, -fno-xray-instrument
+
+Generate XRay instrumentation sleds on function entry and exit
+
+.. program:: clang559
+.. option:: -fzero-initialized-in-bss, -fno-zero-initialized-in-bss
+
+.. program:: clang560
+.. option:: -fzvector, -fno-zvector, -mzvector
+
+Enable System z vector language extension
+
+.. program:: clang561
+.. option:: -pedantic, --pedantic, -no-pedantic, --no-pedantic
+
+.. program:: clang562
+.. option:: -pedantic-errors, --pedantic-errors
+
+OpenCL flags
+------------
+.. program:: clang563
+.. option:: -cl-denorms-are-zero
+
+OpenCL only. Allow denormals to be flushed to zero.
+
+.. program:: clang564
+.. option:: -cl-fast-relaxed-math
+
+OpenCL only. Sets -cl-finite-math-only and -cl-unsafe-math-optimizations, and defines \_\_FAST\_RELAXED\_MATH\_\_.
+
+.. program:: clang565
+.. option:: -cl-finite-math-only
+
+OpenCL only. Allow floating-point optimizations that assume arguments and results are not NaNs or +-Inf.
+
+.. program:: clang566
+.. option:: -cl-fp32-correctly-rounded-divide-sqrt
+
+OpenCL only. Specify that single precision floating-point divide and sqrt used in the program source are correctly rounded.
+
+.. program:: clang567
+.. option:: -cl-kernel-arg-info
+
+OpenCL only. Generate kernel argument metadata.
+
+.. program:: clang568
+.. option:: -cl-mad-enable
+
+OpenCL only. Allow use of less precise MAD computations in the generated binary.
+
+.. program:: clang569
+.. option:: -cl-no-signed-zeros
+
+OpenCL only. Allow use of less precise no signed zeros computations in the generated binary.
+
+.. program:: clang570
+.. option:: -cl-opt-disable
+
+OpenCL only. This option disables all optimizations. By default optimizations are enabled.
+
+.. program:: clang571
+.. option:: -cl-single-precision-constant
+
+OpenCL only. Treat double precision floating-point constant as single precision constant.
+
+.. program:: clang572
+.. option:: -cl-std=<arg>
+
+OpenCL language standard to compile for.
+
+.. program:: clang573
+.. option:: -cl-strict-aliasing
+
+OpenCL only. This option is added for compatibility with OpenCL 1.0.
+
+.. program:: clang574
+.. option:: -cl-unsafe-math-optimizations
+
+OpenCL only. Allow unsafe floating-point optimizations.  Also implies -cl-no-signed-zeros and -cl-mad-enable.
+
+Target-dependent compilation options
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. program:: clang575
+.. option:: -m16
+
+.. program:: clang576
+.. option:: -m32
+
+.. program:: clang577
+.. option:: -m64
+
+.. program:: clang578
+.. option:: -mabi=<arg>
+
+.. program:: clang579
+.. option:: -mabicalls, -mno-abicalls
+
+Enable SVR4-style position-independent code (Mips only)
+
+.. program:: clang580
+.. option:: -malign-double
+
+Align doubles to two words in structs (x86 only)
+
+.. program:: clang581
+.. option:: -march=<arg>
+
+.. program:: clang582
+.. option:: -masm=<arg>
+
+.. program:: clang583
+.. option:: -mbackchain, -mno-backchain
+
+Link stack frames through backchain on System Z
+
+.. program:: clang584
+.. option:: -mcheck-zero-division, -mno-check-zero-division
+
+.. program:: clang585
+.. option:: -mcmodel=<arg>
+
+.. program:: clang586
+.. option:: -mcompact-branches=<arg>
+
+.. program:: clang587
+.. option:: -mconsole<arg>
+
+.. program:: clang588
+.. option:: -mcpu=<arg>, -mv4 (equivalent to -mcpu=hexagonv4), -mv5 (equivalent to -mcpu=hexagonv5), -mv55 (equivalent to -mcpu=hexagonv55), -mv60 (equivalent to -mcpu=hexagonv60)
+
+.. program:: clang589
+.. option:: -mdll<arg>
+
+.. program:: clang590
+.. option:: -mdouble-float
+
+.. program:: clang591
+.. option:: -mdsp, -mno-dsp
+
+.. program:: clang592
+.. option:: -mdspr2, -mno-dspr2
+
+.. program:: clang593
+.. option:: -mdynamic-no-pic<arg>
+
+.. program:: clang594
+.. option:: -meabi <arg>
+
+Set EABI type, e.g. 4, 5 or gnu (default depends on triple)
+
+.. program:: clang595
+.. option:: -mfloat-abi=<arg>
+
+.. program:: clang596
+.. option:: -mfp32
+
+Use 32-bit floating point registers (MIPS only)
+
+.. program:: clang597
+.. option:: -mfp64
+
+Use 64-bit floating point registers (MIPS only)
+
+.. program:: clang598
+.. option:: -mfpmath=<arg>
+
+.. program:: clang599
+.. option:: -mfpu=<arg>
+
+.. program:: clang600
+.. option:: -mglobal-merge, -mno-global-merge
+
+Enable merging of globals
+
+.. program:: clang601
+.. option:: -mhard-float
+
+.. program:: clang602
+.. option:: -mhwdiv=<arg>, --mhwdiv <arg>, --mhwdiv=<arg>
+
+.. program:: clang603
+.. option:: -miamcu, -mno-iamcu
+
+Use Intel MCU ABI
+
+.. program:: clang604
+.. option:: -mimplicit-float, -mno-implicit-float
+
+.. program:: clang605
+.. option:: -mimplicit-it=<arg>
+
+.. program:: clang606
+.. option:: -mincremental-linker-compatible, -mno-incremental-linker-compatible
+
+(integrated-as) Emit an object file which can be used with an incremental linker
+
+.. program:: clang607
+.. option:: -miphoneos-version-min=<arg>, -mios-simulator-version-min=<arg>, -mios-version-min=<arg>, -miphonesimulator-version-min=<arg>
+
+.. program:: clang608
+.. option:: -mips16
+
+.. program:: clang609
+.. option:: -mkernel
+
+.. program:: clang610
+.. option:: -mldc1-sdc1, -mno-ldc1-sdc1
+
+.. program:: clang611
+.. option:: -mlong-calls, -mno-long-calls
+
+Generate branches with extended addressability, usually via indirect jumps.
+
+.. program:: clang612
+.. option:: -mmacosx-version-min=<arg>
+
+Set Mac OS X deployment target
+
+.. program:: clang613
+.. option:: -mmicromips, -mno-micromips
+
+.. program:: clang614
+.. option:: -mms-bitfields, -mno-ms-bitfields
+
+Set the default structure layout to be compatible with the Microsoft compiler standard
+
+.. program:: clang615
+.. option:: -mmsa, -mno-msa
+
+Enable MSA ASE (MIPS only)
+
+.. program:: clang616
+.. option:: -mnan=<arg>
+
+.. program:: clang617
+.. option:: -mno-mips16
+
+.. program:: clang618
+.. option:: -momit-leaf-frame-pointer, -mno-omit-leaf-frame-pointer
+
+Omit frame pointer setup for leaf functions
+
+.. program:: clang619
+.. option:: -moslib=<arg>
+
+.. program:: clang620
+.. option:: -mpie-copy-relocations, -mno-pie-copy-relocations
+
+Use copy relocations support for PIE builds
+
+.. program:: clang621
+.. option:: -mqdsp6-compat
+
+Enable hexagon-qdsp6 backward compatibility
+
+.. program:: clang622
+.. option:: -mrecip
+
+.. program:: clang623
+.. option:: -mrecip=<arg1>,<arg2>...
+
+.. program:: clang624
+.. option:: -mred-zone, -mno-red-zone
+
+.. program:: clang625
+.. option:: -mregparm=<arg>
+
+.. program:: clang626
+.. option:: -mrelax-all, -mno-relax-all
+
+(integrated-as) Relax all machine instructions
+
+.. program:: clang627
+.. option:: -mrtd, -mno-rtd
+
+Make StdCall calling convention the default
+
+.. program:: clang628
+.. option:: -msingle-float
+
+.. program:: clang629
+.. option:: -msmall-data-threshold=<arg>
+
+.. program:: clang630
+.. option:: -msoft-float, -mno-soft-float
+
+Use software floating point
+
+.. program:: clang631
+.. option:: -mstack-alignment=<arg>
+
+Set the stack alignment
+
+.. program:: clang632
+.. option:: -mstack-probe-size=<arg>
+
+Set the stack probe size
+
+.. program:: clang633
+.. option:: -mstackrealign, -mno-stackrealign
+
+Force realign the stack at entry to every function
+
+.. program:: clang634
+.. option:: -mthread-model <arg>
+
+The thread model to use, e.g. posix, single (posix by default)
+
+.. program:: clang635
+.. option:: -mthreads<arg>
+
+.. program:: clang636
+.. option:: -mthumb, -mno-thumb
+
+.. program:: clang637
+.. option:: -mtune=<arg>
+
+.. program:: clang638
+.. option:: -mtvos-version-min=<arg>, -mappletvos-version-min=<arg>, -mappletvsimulator-version-min=<arg>, -mtvos-simulator-version-min=<arg>
+
+.. program:: clang639
+.. option:: -municode<arg>
+
+.. program:: clang640
+.. option:: -mvx, -mno-vx
+
+.. program:: clang641
+.. option:: -mwarn-nonportable-cfstrings, -mno-warn-nonportable-cfstrings
+
+.. program:: clang642
+.. option:: -mwatchos-version-min=<arg>, -mwatchos-simulator-version-min=<arg>, -mwatchsimulator-version-min=<arg>
+
+.. program:: clang643
+.. option:: -mwindows<arg>
+
+.. program:: clang644
+.. option:: -mx32
+
+.. program:: clang645
+.. option:: -mxgot, -mno-xgot
+
+AARCH64
+-------
+.. program:: clang646
+.. option:: -ffixed-x18
+
+Reserve the x18 register (AArch64 only)
+
+.. program:: clang647
+.. option:: -mfix-cortex-a53-835769, -mno-fix-cortex-a53-835769
+
+Workaround Cortex-A53 erratum 835769 (AArch64 only)
+
+.. program:: clang648
+.. option:: -mgeneral-regs-only
+
+Generate code which only uses the general purpose registers (AArch64 only)
+
+AMDGPU
+------
+ARM
+---
+.. program:: clang649
+.. option:: -ffixed-r9
+
+Reserve the r9 register (ARM only)
+
+.. program:: clang650
+.. option:: -mcrc
+
+Allow use of CRC instructions (ARM only)
+
+.. program:: clang651
+.. option:: -mexecute-only, -mno-execute-only, -mpure-code
+
+Disallow generation of data access to code sections (ARM only)
+
+.. program:: clang652
+.. option:: -mno-movt
+
+Disallow use of movt/movw pairs (ARM only)
+
+.. program:: clang653
+.. option:: -mnocrc
+
+Disallow use of CRC instructions (ARM only)
+
+.. program:: clang654
+.. option:: -mrestrict-it, -mno-restrict-it
+
+Disallow generation of deprecated IT blocks for ARMv8. It is on by default for ARMv8 Thumb mode.
+
+.. program:: clang655
+.. option:: -munaligned-access, -mno-unaligned-access
+
+Allow memory accesses to be unaligned (AArch32/AArch64 only)
+
+Hexagon
+-------
+.. program:: clang656
+.. option:: -mhvx, -mno-hvx
+
+Enable Hexagon Vector eXtensions
+
+.. program:: clang657
+.. option:: -mhvx-double, -mno-hvx-double
+
+Enable Hexagon Double Vector eXtensions
+
+.. program:: clang658
+.. option:: -mieee-rnd-near
+
+PowerPC
+-------
+.. program:: clang659
+.. option:: -mcmpb, -mno-cmpb
+
+.. program:: clang660
+.. option:: -mcrbits, -mno-crbits
+
+.. program:: clang661
+.. option:: -mcrypto, -mno-crypto
+
+.. program:: clang662
+.. option:: -mdirect-move, -mno-direct-move
+
+.. program:: clang663
+.. option:: -mfloat128, -mno-float128
+
+.. program:: clang664
+.. option:: -mfprnd, -mno-fprnd
+
+.. program:: clang665
+.. option:: -mhtm, -mno-htm
+
+.. program:: clang666
+.. option:: -minvariant-function-descriptors, -mno-invariant-function-descriptors
+
+.. program:: clang667
+.. option:: -misel, -mno-isel
+
+.. program:: clang668
+.. option:: -mlongcall, -mno-longcall
+
+.. program:: clang669
+.. option:: -mmfocrf, -mmfcrf, -mno-mfocrf
+
+.. program:: clang670
+.. option:: -mpopcntd, -mno-popcntd
+
+.. program:: clang671
+.. option:: -mpower8-vector, -mno-power8-vector
+
+.. program:: clang672
+.. option:: -mpower9-vector, -mno-power9-vector
+
+.. program:: clang673
+.. option:: -mqpx, -mno-qpx
+
+.. program:: clang674
+.. option:: -mvsx, -mno-vsx
+
+WebAssembly
+-----------
+.. program:: clang675
+.. option:: -msimd128, -mno-simd128
+
+X86
+---
+.. program:: clang676
+.. option:: -m3dnow, -mno-3dnow
+
+.. program:: clang677
+.. option:: -m3dnowa, -mno-3dnowa
+
+.. program:: clang678
+.. option:: -madx, -mno-adx
+
+.. program:: clang679
+.. option:: -maes, -mno-aes
+
+.. program:: clang680
+.. option:: -mavx, -mno-avx
+
+.. program:: clang681
+.. option:: -mavx2, -mno-avx2
+
+.. program:: clang682
+.. option:: -mavx512bw, -mno-avx512bw
+
+.. program:: clang683
+.. option:: -mavx512cd, -mno-avx512cd
+
+.. program:: clang684
+.. option:: -mavx512dq, -mno-avx512dq
+
+.. program:: clang685
+.. option:: -mavx512er, -mno-avx512er
+
+.. program:: clang686
+.. option:: -mavx512f, -mno-avx512f
+
+.. program:: clang687
+.. option:: -mavx512ifma, -mno-avx512ifma
+
+.. program:: clang688
+.. option:: -mavx512pf, -mno-avx512pf
+
+.. program:: clang689
+.. option:: -mavx512vbmi, -mno-avx512vbmi
+
+.. program:: clang690
+.. option:: -mavx512vl, -mno-avx512vl
+
+.. program:: clang691
+.. option:: -mbmi, -mno-bmi
+
+.. program:: clang692
+.. option:: -mbmi2, -mno-bmi2
+
+.. program:: clang693
+.. option:: -mcx16, -mno-cx16
+
+.. program:: clang694
+.. option:: -mf16c, -mno-f16c
+
+.. program:: clang695
+.. option:: -mfma, -mno-fma
+
+.. program:: clang696
+.. option:: -mfma4, -mno-fma4
+
+.. program:: clang697
+.. option:: -mfsgsbase, -mno-fsgsbase
+
+.. program:: clang698
+.. option:: -mfxsr, -mno-fxsr
+
+.. program:: clang699
+.. option:: -mlzcnt, -mno-lzcnt
+
+.. program:: clang700
+.. option:: -mmmx, -mno-mmx
+
+.. program:: clang701
+.. option:: -mmwaitx, -mno-mwaitx
+
+.. program:: clang702
+.. option:: -mpclmul, -mno-pclmul
+
+.. program:: clang703
+.. option:: -mpku, -mno-pku
+
+.. program:: clang704
+.. option:: -mpopcnt, -mno-popcnt
+
+.. program:: clang705
+.. option:: -mprfchw, -mno-prfchw
+
+.. program:: clang706
+.. option:: -mrdrnd, -mno-rdrnd
+
+.. program:: clang707
+.. option:: -mrdseed, -mno-rdseed
+
+.. program:: clang708
+.. option:: -mrtm, -mno-rtm
+
+.. program:: clang709
+.. option:: -msha, -mno-sha
+
+.. program:: clang710
+.. option:: -msse, -mno-sse
+
+.. program:: clang711
+.. option:: -msse2, -mno-sse2
+
+.. program:: clang712
+.. option:: -msse3, -mno-sse3
+
+.. program:: clang713
+.. option:: -msse4.1, -mno-sse4.1
+
+.. program:: clang714
+.. option:: -msse4.2, -mno-sse4.2, -msse4
+
+.. program:: clang715
+.. option:: -msse4a, -mno-sse4a
+
+.. program:: clang716
+.. option:: -mssse3, -mno-ssse3
+
+.. program:: clang717
+.. option:: -mtbm, -mno-tbm
+
+.. program:: clang718
+.. option:: -mx87, -m80387, -mno-x87
+
+.. program:: clang719
+.. option:: -mxop, -mno-xop
+
+.. program:: clang720
+.. option:: -mxsave, -mno-xsave
+
+.. program:: clang721
+.. option:: -mxsavec, -mno-xsavec
+
+.. program:: clang722
+.. option:: -mxsaveopt, -mno-xsaveopt
+
+.. program:: clang723
+.. option:: -mxsaves, -mno-xsaves
+
+Optimization level
+~~~~~~~~~~~~~~~~~~
+
+Flags controlling how much optimization should be performed.
+
+.. program:: clang724
+.. option:: -O<arg>, -O (equivalent to -O2), --optimize, --optimize=<arg>
+
+.. program:: clang725
+.. option:: -O0
+
+.. program:: clang726
+.. option:: -O4
+
+.. program:: clang727
+.. option:: -Ofast<arg>
+
+Debug information generation
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Flags controlling how much and what kind of debug information should be
+generated.
+
+Kind and level of debug information
+-----------------------------------
+.. program:: clang728
+.. option:: -g, --debug, --debug=<arg>
+
+Generate source-level debug information
+
+.. program:: clang729
+.. option:: -gdwarf-2
+
+Generate source-level debug information with dwarf version 2
+
+.. program:: clang730
+.. option:: -gdwarf-3
+
+Generate source-level debug information with dwarf version 3
+
+.. program:: clang731
+.. option:: -gdwarf-4, -gdwarf
+
+Generate source-level debug information with dwarf version 4
+
+.. program:: clang732
+.. option:: -gdwarf-5
+
+Generate source-level debug information with dwarf version 5
+
+.. program:: clang733
+.. option:: -gfull
+
+.. program:: clang734
+.. option:: -gused
+
+Debug level
+___________
+.. program:: clang735
+.. option:: -g0
+
+.. program:: clang736
+.. option:: -g2
+
+.. program:: clang737
+.. option:: -g3
+
+.. program:: clang738
+.. option:: -ggdb0
+
+.. program:: clang739
+.. option:: -ggdb1
+
+.. program:: clang740
+.. option:: -ggdb2
+
+.. program:: clang741
+.. option:: -ggdb3
+
+.. program:: clang742
+.. option:: -gline-tables-only, -g1, -gmlt
+
+Emit debug line number tables only
+
+.. program:: clang743
+.. option:: -gmodules
+
+Generate debug info with external references to clang modules or precompiled headers
+
+Debugger to tune debug information for
+______________________________________
+.. program:: clang744
+.. option:: -ggdb
+
+.. program:: clang745
+.. option:: -glldb
+
+.. program:: clang746
+.. option:: -gsce
+
+Debug information flags
+-----------------------
+.. program:: clang747
+.. option:: -gcolumn-info, -gno-column-info
+
+.. program:: clang748
+.. option:: -gdwarf-aranges
+
+.. program:: clang749
+.. option:: -ggnu-pubnames
+
+.. program:: clang750
+.. option:: -grecord-gcc-switches, -gno-record-gcc-switches
+
+.. program:: clang751
+.. option:: -gsplit-dwarf
+
+.. program:: clang752
+.. option:: -gstrict-dwarf, -gno-strict-dwarf
+
+Linker flags
+============
+Flags that are passed on to the linker
+
+.. program:: clang753
+.. option:: -L<arg>, --library-directory <arg>, --library-directory=<arg>
+
+.. program:: clang754
+.. option:: -T<arg>
+
+.. program:: clang755
+.. option:: -Tbss<arg>
+
+.. program:: clang756
+.. option:: -Tdata<arg>
+
+.. program:: clang757
+.. option:: -Ttext<arg>
+
+.. program:: clang758
+.. option:: -Wl,<arg>,<arg2>...
+
+Pass the comma separated arguments in <arg> to the linker
+
+.. program:: clang759
+.. option:: -Xlinker <arg>, --for-linker <arg>, --for-linker=<arg>
+
+Pass <arg> to the linker
+
+.. program:: clang760
+.. option:: -Z
+
+.. program:: clang761
+.. option:: -e<arg>, --entry
+
+.. program:: clang762
+.. option:: -filelist <arg>
+
+.. program:: clang763
+.. option:: -l<arg>
+
+.. program:: clang764
+.. option:: -r
+
+.. program:: clang765
+.. option:: -rpath <arg>
+
+.. program:: clang766
+.. option:: -s
+
+.. program:: clang767
+.. option:: -t
+
+.. program:: clang768
+.. option:: -u<arg>, --force-link <arg>, --force-link=<arg>
+
+.. program:: clang769
+.. option:: -undef
+
+undef all system defines
+
+.. program:: clang770
+.. option:: -undefined<arg>, --no-undefined
+
+.. program:: clang771
+.. option:: -z <arg>
+
+Pass -z <arg> to the linker
+
+Fortran compilation flags
+=========================
+
+Flags that will be passed onto the ``gfortran`` compiler when Clang is given
+a Fortran input.
+
+.. program:: clang772
+.. option:: -A-<arg>
+
+.. program:: clang773
+.. option:: -J<arg>
+
+.. program:: clang774
+.. option:: -cpp
+
+.. program:: clang775
+.. option:: -faggressive-function-elimination, -fno-aggressive-function-elimination
+
+.. program:: clang776
+.. option:: -falign-commons, -fno-align-commons
+
+.. program:: clang777
+.. option:: -fall-intrinsics, -fno-all-intrinsics
+
+.. program:: clang778
+.. option:: -fautomatic, -fno-automatic
+
+.. program:: clang779
+.. option:: -fbackslash, -fno-backslash
+
+.. program:: clang780
+.. option:: -fbacktrace, -fno-backtrace
+
+.. program:: clang781
+.. option:: -fblas-matmul-limit=<arg>
+
+.. program:: clang782
+.. option:: -fbounds-check, -fno-bounds-check
+
+.. program:: clang783
+.. option:: -fcheck-array-temporaries, -fno-check-array-temporaries
+
+.. program:: clang784
+.. option:: -fcheck=<arg>
+
+.. program:: clang785
+.. option:: -fcoarray=<arg>
+
+.. program:: clang786
+.. option:: -fconvert=<arg>
+
+.. program:: clang787
+.. option:: -fcray-pointer, -fno-cray-pointer
+
+.. program:: clang788
+.. option:: -fd-lines-as-code, -fno-d-lines-as-code
+
+.. program:: clang789
+.. option:: -fd-lines-as-comments, -fno-d-lines-as-comments
+
+.. program:: clang790
+.. option:: -fdefault-double-8, -fno-default-double-8
+
+.. program:: clang791
+.. option:: -fdefault-integer-8, -fno-default-integer-8
+
+.. program:: clang792
+.. option:: -fdefault-real-8, -fno-default-real-8
+
+.. program:: clang793
+.. option:: -fdollar-ok, -fno-dollar-ok
+
+.. program:: clang794
+.. option:: -fdump-fortran-optimized, -fno-dump-fortran-optimized
+
+.. program:: clang795
+.. option:: -fdump-fortran-original, -fno-dump-fortran-original
+
+.. program:: clang796
+.. option:: -fdump-parse-tree, -fno-dump-parse-tree
+
+.. program:: clang797
+.. option:: -fexternal-blas, -fno-external-blas
+
+.. program:: clang798
+.. option:: -ff2c, -fno-f2c
+
+.. program:: clang799
+.. option:: -ffixed-form, -fno-fixed-form
+
+.. program:: clang800
+.. option:: -ffixed-line-length-<arg>
+
+.. program:: clang801
+.. option:: -ffpe-trap=<arg>
+
+.. program:: clang802
+.. option:: -ffree-form, -fno-free-form
+
+.. program:: clang803
+.. option:: -ffree-line-length-<arg>
+
+.. program:: clang804
+.. option:: -ffrontend-optimize, -fno-frontend-optimize
+
+.. program:: clang805
+.. option:: -fimplicit-none, -fno-implicit-none
+
+.. program:: clang806
+.. option:: -finit-character=<arg>
+
+.. program:: clang807
+.. option:: -finit-integer=<arg>
+
+.. program:: clang808
+.. option:: -finit-local-zero, -fno-init-local-zero
+
+.. program:: clang809
+.. option:: -finit-logical=<arg>
+
+.. program:: clang810
+.. option:: -finit-real=<arg>
+
+.. program:: clang811
+.. option:: -finteger-4-integer-8, -fno-integer-4-integer-8
+
+.. program:: clang812
+.. option:: -fintrinsic-modules-path, -fno-intrinsic-modules-path
+
+.. program:: clang813
+.. option:: -fmax-array-constructor=<arg>
+
+.. program:: clang814
+.. option:: -fmax-errors=<arg>
+
+.. program:: clang815
+.. option:: -fmax-identifier-length, -fno-max-identifier-length
+
+.. program:: clang816
+.. option:: -fmax-stack-var-size=<arg>
+
+.. program:: clang817
+.. option:: -fmax-subrecord-length=<arg>
+
+.. program:: clang818
+.. option:: -fmodule-private, -fno-module-private
+
+.. program:: clang819
+.. option:: -fpack-derived, -fno-pack-derived
+
+.. program:: clang820
+.. option:: -fprotect-parens, -fno-protect-parens
+
+.. program:: clang821
+.. option:: -frange-check, -fno-range-check
+
+.. program:: clang822
+.. option:: -freal-4-real-10, -fno-real-4-real-10
+
+.. program:: clang823
+.. option:: -freal-4-real-16, -fno-real-4-real-16
+
+.. program:: clang824
+.. option:: -freal-4-real-8, -fno-real-4-real-8
+
+.. program:: clang825
+.. option:: -freal-8-real-10, -fno-real-8-real-10
+
+.. program:: clang826
+.. option:: -freal-8-real-16, -fno-real-8-real-16
+
+.. program:: clang827
+.. option:: -freal-8-real-4, -fno-real-8-real-4
+
+.. program:: clang828
+.. option:: -frealloc-lhs, -fno-realloc-lhs
+
+.. program:: clang829
+.. option:: -frecord-marker=<arg>
+
+.. program:: clang830
+.. option:: -frecursive, -fno-recursive
+
+.. program:: clang831
+.. option:: -frepack-arrays, -fno-repack-arrays
+
+.. program:: clang832
+.. option:: -fsecond-underscore, -fno-second-underscore
+
+.. program:: clang833
+.. option:: -fsign-zero, -fno-sign-zero
+
+.. program:: clang834
+.. option:: -fstack-arrays, -fno-stack-arrays
+
+.. program:: clang835
+.. option:: -funderscoring, -fno-underscoring
+
+.. program:: clang836
+.. option:: -fwhole-file, -fno-whole-file
+
+.. program:: clang837
+.. option:: -nocpp
+
+.. program:: clang838
+.. option:: -static-libgfortran
+

Modified: cfe/trunk/docs/index.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/index.rst?rev=292968&r1=292967&r2=292968&view=diff
==============================================================================
--- cfe/trunk/docs/index.rst (original)
+++ cfe/trunk/docs/index.rst Tue Jan 24 13:39:46 2017
@@ -19,6 +19,7 @@ Using Clang as a Compiler
    UsersManual
    Toolchain
    LanguageExtensions
+   ClangCommandLineReference
    AttributeReference
    DiagnosticsReference
    CrossCompilation

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=292968&r1=292967&r2=292968&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Tue Jan 24 13:39:46 2017
@@ -11,7 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-def cl_Group : OptionGroup<"<clang-cl options>">,
+def cl_Group : OptionGroup<"<clang-cl options>">, Flags<[CLOption]>,
   HelpText<"CL.EXE COMPATIBILITY OPTIONS">;
 
 def cl_compile_Group : OptionGroup<"<clang-cl compile-only options>">,

Added: cfe/trunk/include/clang/Driver/ClangOptionDocs.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ClangOptionDocs.td?rev=292968&view=auto
==============================================================================
--- cfe/trunk/include/clang/Driver/ClangOptionDocs.td (added)
+++ cfe/trunk/include/clang/Driver/ClangOptionDocs.td Tue Jan 24 13:39:46 2017
@@ -0,0 +1,36 @@
+//==--- ClangOptionDocs.td - Option documentation -------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+def GlobalDocumentation {
+  code Intro =[{..
+  -------------------------------------------------------------------
+  NOTE: This file is automatically generated by running clang-tblgen
+  -gen-opt-docs. Do not edit this file by hand!!
+  -------------------------------------------------------------------
+
+=====================================
+Clang command line argument reference
+=====================================
+.. contents::
+   :local:
+
+Introduction
+============
+
+This page lists the command line arguments currently supported by the
+GCC-compatible ``clang`` and ``clang++`` drivers.
+
+}];
+
+  string Program = "clang";
+  list<string> ExcludedFlags = ["HelpHidden", "NoDriverOption",
+                                "CLOption", "Unsupported", "Ignored"];
+}
+
+include "Options.td"

Modified: cfe/trunk/include/clang/Driver/Options.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.h?rev=292968&r1=292967&r2=292968&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.h (original)
+++ cfe/trunk/include/clang/Driver/Options.h Tue Jan 24 13:39:46 2017
@@ -33,7 +33,8 @@ enum ClangFlags {
   CLOption = (1 << 9),
   CC1Option = (1 << 10),
   CC1AsOption = (1 << 11),
-  NoDriverOption = (1 << 12)
+  NoDriverOption = (1 << 12),
+  Ignored = (1 << 13)
 };
 
 enum ID {

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=292968&r1=292967&r2=292968&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Jan 24 13:39:46 2017
@@ -33,6 +33,9 @@ def NoArgumentUnused : OptionFlag;
 // lines that use it.
 def Unsupported : OptionFlag;
 
+// Ignored - The option is unsupported, and the driver will silently ignore it.
+def Ignored : OptionFlag;
+
 // CoreOption - This is considered a "core" Clang option, available in both
 // clang and clang-cl modes.
 def CoreOption : OptionFlag;
@@ -50,72 +53,130 @@ def CC1AsOption : OptionFlag;
 // NoDriverOption - This option should not be accepted by the driver.
 def NoDriverOption : OptionFlag;
 
+// A short name to show in documentation. The name will be interpreted as rST.
+class DocName<string name> { string DocName = name; }
+
+// A brief description to show in documentation, interpreted as rST.
+class DocBrief<code descr> { code DocBrief = descr; }
+
+// Indicates that this group should be flattened into its parent when generating
+// documentation.
+class DocFlatten { bit DocFlatten = 1; }
+
 /////////
 // Groups
 
+def Action_Group : OptionGroup<"<action group>">, DocName<"Actions">,
+                   DocBrief<[{The action to perform on the input.}]>;
+
 // Meta-group for options which are only used for compilation,
 // and not linking etc.
-def CompileOnly_Group     : OptionGroup<"<CompileOnly group>">;
+def CompileOnly_Group : OptionGroup<"<CompileOnly group>">,
+                        DocName<"Compilation flags">, DocBrief<[{
+Flags controlling the behavior of Clang during compilation. These flags have
+no effect during actions that do not perform compilation.}]>;
+
+def IncludePath_Group : OptionGroup<"<I/i group>">, Group<CompileOnly_Group>,
+                        DocName<"Include path management">,
+                        DocBrief<[{
+Flags controlling how ``#include``\s are resolved to files.}]>;
+
+def I_Group : OptionGroup<"<I group>">, Group<IncludePath_Group>, DocFlatten;
+def i_Group : OptionGroup<"<i group>">, Group<IncludePath_Group>, DocFlatten;
+def clang_i_Group : OptionGroup<"<clang i group>">, Group<i_Group>, DocFlatten;
+
+def M_Group : OptionGroup<"<M group>">, Group<CompileOnly_Group>,
+              DocName<"Dependency file generation">, DocBrief<[{
+Flags controlling generation of a dependency file for ``make``-like build
+systems.}]>;
+
+def d_Group : OptionGroup<"<d group>">, Group<CompileOnly_Group>,
+              DocName<"Dumping preprocessor state">, DocBrief<[{
+Flags allowing the state of the preprocessor to be dumped in various ways.}]>;
+
+def Diag_Group : OptionGroup<"<W/R group>">, Group<CompileOnly_Group>,
+                 DocName<"Diagnostic flags">, DocBrief<[{
+Flags controlling which warnings, errors, and remarks Clang will generate.
+See the :doc:`full list of warning and remark flags <DiagnosticsReference>`.}]>;
+
+def R_Group : OptionGroup<"<R group>">, Group<Diag_Group>, DocFlatten;
+def R_value_Group : OptionGroup<"<R (with value) group>">, Group<R_Group>,
+                    DocFlatten;
+def W_Group : OptionGroup<"<W group>">, Group<Diag_Group>, DocFlatten;
+def W_value_Group : OptionGroup<"<W (with value) group>">, Group<W_Group>,
+                    DocFlatten;
+
+def f_Group : OptionGroup<"<f group>">, Group<CompileOnly_Group>,
+              DocName<"Target-independent compilation options">;
+
+def f_clang_Group : OptionGroup<"<f (clang-only) group>">,
+                    Group<CompileOnly_Group>, DocFlatten;
+def pedantic_Group : OptionGroup<"<pedantic group>">, Group<f_Group>,
+                     DocFlatten;
+def opencl_Group : OptionGroup<"<opencl group>">, Group<f_Group>,
+                   DocName<"OpenCL flags">;
 
-def Action_Group          : OptionGroup<"<action group>">;
-
-def I_Group               : OptionGroup<"<I group>">, Group<CompileOnly_Group>;
-def M_Group               : OptionGroup<"<M group>">, Group<CompileOnly_Group>;
-def T_Group               : OptionGroup<"<T group>">;
-def O_Group               : OptionGroup<"<O group>">, Group<CompileOnly_Group>;
-def R_Group               : OptionGroup<"<R group>">, Group<CompileOnly_Group>;
-def R_value_Group         : OptionGroup<"<R (with value) group>">, Group<R_Group>;
-def W_Group               : OptionGroup<"<W group>">, Group<CompileOnly_Group>;
-def W_value_Group         : OptionGroup<"<W (with value) group>">, Group<W_Group>;
-def d_Group               : OptionGroup<"<d group>">;
-def f_Group               : OptionGroup<"<f group>">, Group<CompileOnly_Group>;
-def f_clang_Group         : OptionGroup<"<f (clang-only) group>">, Group<CompileOnly_Group>;
-def g_Group               : OptionGroup<"<g group>">;
-def gN_Group              : OptionGroup<"<gN group>">, Group<g_Group>;
-def ggdbN_Group           : OptionGroup<"<ggdbN group>">, Group<gN_Group>;
-def gTune_Group           : OptionGroup<"<gTune group>">, Group<g_Group>;
-def g_flags_Group         : OptionGroup<"<g flags group>">;
-def i_Group               : OptionGroup<"<i group>">, Group<CompileOnly_Group>;
-def clang_i_Group         : OptionGroup<"<clang i group>">, Group<i_Group>;
-def m_Group               : OptionGroup<"<m group>">, Group<CompileOnly_Group>;
-def opencl_Group          : OptionGroup<"<opencl group>">, Group<CompileOnly_Group>;
+def m_Group : OptionGroup<"<m group>">, Group<CompileOnly_Group>,
+              DocName<"Target-dependent compilation options">;
 
 // Feature groups - these take command line options that correspond directly to
 // target specific features and can be translated directly from command line
 // options.
-def m_x86_Features_Group : OptionGroup<"<x86 features group>">,
-                           Group<m_Group>,
-                           Flags<[CoreOption]>;
-def m_hexagon_Features_Group : OptionGroup<"<hexagon features group>">,
-                               Group<m_Group>;
-def m_arm_Features_Group : OptionGroup<"<arm features group>">,
-                           Group<m_Group>;
 def m_aarch64_Features_Group : OptionGroup<"<aarch64 features group>">,
-                               Group<m_Group>;
+                               Group<m_Group>, DocName<"AARCH64">;
+def m_amdgpu_Features_Group : OptionGroup<"<amdgpu features group>">,
+                              Group<m_Group>, DocName<"AMDGPU">;
+def m_arm_Features_Group : OptionGroup<"<arm features group>">,
+                           Group<m_Group>, DocName<"ARM">;
+def m_hexagon_Features_Group : OptionGroup<"<hexagon features group>">,
+                               Group<m_Group>, DocName<"Hexagon">;
 def m_ppc_Features_Group : OptionGroup<"<ppc features group>">,
-                           Group<m_Group>;
+                           Group<m_Group>, DocName<"PowerPC">;
 def m_wasm_Features_Group : OptionGroup<"<wasm features group>">,
-                            Group<m_Group>;
-def m_amdgpu_Features_Group : OptionGroup<"<amdgpu features group>">,
-                              Group<m_Group>;
+                            Group<m_Group>, DocName<"WebAssembly">;
+def m_x86_Features_Group : OptionGroup<"<x86 features group>">,
+                           Group<m_Group>, Flags<[CoreOption]>, DocName<"X86">;
+
+def m_libc_Group : OptionGroup<"<m libc group>">, Group<m_Group>,
+                   Flags<[HelpHidden]>;
 
-def m_libc_Group          : OptionGroup<"<m libc group>">, Group<m_Group>;
-def u_Group               : OptionGroup<"<u group>">;
+def O_Group : OptionGroup<"<O group>">, Group<CompileOnly_Group>,
+              DocName<"Optimization level">, DocBrief<[{
+Flags controlling how much optimization should be performed.}]>;
+
+def DebugInfo_Group : OptionGroup<"<g group>">, Group<CompileOnly_Group>,
+                      DocName<"Debug information generation">, DocBrief<[{
+Flags controlling how much and what kind of debug information should be
+generated.}]>;
+
+def g_Group : OptionGroup<"<g group>">, Group<DebugInfo_Group>,
+              DocName<"Kind and level of debug information">;
+def gN_Group : OptionGroup<"<gN group>">, Group<g_Group>,
+               DocName<"Debug level">;
+def ggdbN_Group : OptionGroup<"<ggdbN group>">, Group<gN_Group>, DocFlatten;
+def gTune_Group : OptionGroup<"<gTune group>">, Group<g_Group>,
+                  DocName<"Debugger to tune debug information for">;
+def g_flags_Group : OptionGroup<"<g flags group>">, Group<DebugInfo_Group>,
+                    DocName<"Debug information flags">;
+
+def Link_Group : OptionGroup<"<T/e/s/t/u group>">, DocName<"Linker flags">,
+                 DocBrief<[{Flags that are passed on to the linker}]>;
+def T_Group : OptionGroup<"<T group>">, Group<Link_Group>, DocFlatten;
+def u_Group : OptionGroup<"<u group>">, Group<Link_Group>, DocFlatten;
 
-def pedantic_Group        : OptionGroup<"<pedantic group>">,
-  Group<CompileOnly_Group>;
-def reserved_lib_Group   : OptionGroup<"<reserved libs group>">;
+def reserved_lib_Group : OptionGroup<"<reserved libs group>">,
+                         Flags<[Unsupported]>;
 
 // Temporary groups for clang options which we know we don't support,
 // but don't want to verbosely warn the user about.
 def clang_ignored_f_Group : OptionGroup<"<clang ignored f group>">,
-  Group<f_Group>;
+  Group<f_Group>, Flags<[Ignored]>;
 def clang_ignored_m_Group : OptionGroup<"<clang ignored m group>">,
-  Group<m_Group>;
+  Group<m_Group>, Flags<[Ignored]>;
 
 // Group that ignores all gcc optimizations that won't be implemented
 def clang_ignored_gcc_optimization_f_Group : OptionGroup<
-  "<clang_ignored_gcc_optimization_f_Group>">, Group<f_Group>;
+  "<clang_ignored_gcc_optimization_f_Group>">, Group<f_Group>, Flags<[Ignored]>;
 
 /////////
 // Options
@@ -141,7 +202,7 @@ def clang_ignored_gcc_optimization_f_Gro
 
 // Developer Driver Options
 
-def internal_Group : OptionGroup<"<clang internal options>">;
+def internal_Group : OptionGroup<"<clang internal options>">, Flags<[HelpHidden]>;
 def internal_driver_Group : OptionGroup<"<clang driver internal options>">,
   Group<internal_Group>, HelpText<"DRIVER OPTIONS">;
 def internal_debug_Group :
@@ -252,7 +313,7 @@ def H : Flag<["-"], "H">, Flags<[CC1Opti
 def I_ : Flag<["-"], "I-">, Group<I_Group>;
 def I : JoinedOrSeparate<["-"], "I">, Group<I_Group>, Flags<[CC1Option,CC1AsOption]>,
     HelpText<"Add directory to include search path">;
-def L : JoinedOrSeparate<["-"], "L">, Flags<[RenderJoined]>;
+def L : JoinedOrSeparate<["-"], "L">, Flags<[RenderJoined]>, Group<Link_Group>;
 def MD : Flag<["-"], "MD">, Group<M_Group>,
     HelpText<"Write a depfile containing user and system headers">;
 def MMD : Flag<["-"], "MMD">, Group<M_Group>,
@@ -323,7 +384,7 @@ def Wno_deprecated : Flag<["-"], "Wno-de
 def Wextra : Flag<["-"], "Wextra">, Group<W_Group>, Flags<[CC1Option]>;
 def Wl_COMMA : CommaJoined<["-"], "Wl,">, Flags<[LinkerInput, RenderAsInput]>,
   HelpText<"Pass the comma separated arguments in <arg> to the linker">,
-  MetaVarName<"<arg>">;
+  MetaVarName<"<arg>">, Group<Link_Group>;
 // FIXME: This is broken; these should not be Joined arguments.
 def Wno_nonportable_cfstrings : Joined<["-"], "Wno-nonportable-cfstrings">, Group<W_Group>,
   Flags<[CC1Option]>;
@@ -349,14 +410,16 @@ def Xcuda_fatbinary : Separate<["-"], "X
 def Xcuda_ptxas : Separate<["-"], "Xcuda-ptxas">,
   HelpText<"Pass <arg> to the ptxas assembler">, MetaVarName<"<arg>">;
 def z : Separate<["-"], "z">, Flags<[LinkerInput, RenderAsInput]>,
-  HelpText<"Pass -z <arg> to the linker">, MetaVarName<"<arg>">;
+  HelpText<"Pass -z <arg> to the linker">, MetaVarName<"<arg>">,
+  Group<Link_Group>;
 def Xlinker : Separate<["-"], "Xlinker">, Flags<[LinkerInput, RenderAsInput]>,
-  HelpText<"Pass <arg> to the linker">, MetaVarName<"<arg>">;
+  HelpText<"Pass <arg> to the linker">, MetaVarName<"<arg>">,
+  Group<Link_Group>;
 def Xpreprocessor : Separate<["-"], "Xpreprocessor">,
   HelpText<"Pass <arg> to the preprocessor">, MetaVarName<"<arg>">;
 def X_Flag : Flag<["-"], "X">;
 def X_Joined : Joined<["-"], "X">;
-def Z_Flag : Flag<["-"], "Z">;
+def Z_Flag : Flag<["-"], "Z">, Group<Link_Group>;
 def Z_Joined : Joined<["-"], "Z">;
 def all__load : Flag<["-"], "all_load">;
 def allowable__client : Separate<["-"], "allowable_client">;
@@ -462,7 +525,7 @@ def emit_ast : Flag<["-"], "emit-ast">,
 def emit_llvm : Flag<["-"], "emit-llvm">, Flags<[CC1Option]>, Group<Action_Group>,
   HelpText<"Use the LLVM representation for assembler and object files">;
 def exported__symbols__list : Separate<["-"], "exported_symbols_list">;
-def e : JoinedOrSeparate<["-"], "e">;
+def e : JoinedOrSeparate<["-"], "e">, Group<Link_Group>;
 def fPIC : Flag<["-"], "fPIC">, Group<f_Group>;
 def fno_PIC : Flag<["-"], "fno-PIC">, Group<f_Group>;
 def fPIE : Flag<["-"], "fPIE">, Group<f_Group>;
@@ -822,7 +885,8 @@ def fno_gnu89_inline : Flag<["-"], "fno-
 def fgnu_runtime : Flag<["-"], "fgnu-runtime">, Group<f_Group>,
   HelpText<"Generate output compatible with the standard GNU Objective-C runtime">;
 def fheinous_gnu_extensions : Flag<["-"], "fheinous-gnu-extensions">, Flags<[CC1Option]>;
-def filelist : Separate<["-"], "filelist">, Flags<[LinkerInput]>;
+def filelist : Separate<["-"], "filelist">, Flags<[LinkerInput]>,
+               Group<Link_Group>;
 def : Flag<["-"], "findirect-virtual-calls">, Alias<fapple_kext>;
 def finline_functions : Flag<["-"], "finline-functions">, Group<f_clang_Group>, Flags<[CC1Option]>,
   HelpText<"Inline suitable functions">;
@@ -1455,7 +1519,8 @@ def ivfsoverlay : JoinedOrSeparate<["-"]
   HelpText<"Overlay the virtual filesystem described by file over the real file system">;
 def i : Joined<["-"], "i">, Group<i_Group>;
 def keep__private__externs : Flag<["-"], "keep_private_externs">;
-def l : JoinedOrSeparate<["-"], "l">, Flags<[LinkerInput, RenderJoined]>;
+def l : JoinedOrSeparate<["-"], "l">, Flags<[LinkerInput, RenderJoined]>,
+        Group<Link_Group>;
 def lazy__framework : Separate<["-"], "lazy_framework">, Flags<[LinkerInput]>;
 def lazy__library : Separate<["-"], "lazy_library">, Flags<[LinkerInput]>;
 def mlittle_endian : Flag<["-"], "mlittle-endian">, Flags<[DriverOption]>;
@@ -1965,10 +2030,11 @@ def resource_dir : Separate<["-"], "reso
   HelpText<"The directory which holds the compiler resource files">;
 def resource_dir_EQ : Joined<["-"], "resource-dir=">, Flags<[DriverOption, CoreOption]>,
   Alias<resource_dir>;
-def rpath : Separate<["-"], "rpath">, Flags<[LinkerInput]>;
+def rpath : Separate<["-"], "rpath">, Flags<[LinkerInput]>, Group<Link_Group>;
 def rtlib_EQ : Joined<["-", "--"], "rtlib=">,
   HelpText<"Compiler runtime library to use">;
-def r : Flag<["-"], "r">, Flags<[LinkerInput,NoArgumentUnused]>;
+def r : Flag<["-"], "r">, Flags<[LinkerInput,NoArgumentUnused]>,
+        Group<Link_Group>;
 def save_temps_EQ : Joined<["-", "--"], "save-temps=">, Flags<[DriverOption]>,
   HelpText<"Save intermediate compilation results.">;
 def save_temps : Flag<["-", "--"], "save-temps">, Flags<[DriverOption]>,
@@ -2020,7 +2086,7 @@ def no_system_header_prefix : Joined<["-
   HelpText<"Treat all #include paths starting with <prefix> as not including a "
            "system header.">;
 def : Separate<["--"], "no-system-header-prefix">, Alias<no_system_header_prefix>;
-def s : Flag<["-"], "s">;
+def s : Flag<["-"], "s">, Group<Link_Group>;
 def target : Joined<["--"], "target=">, Flags<[DriverOption, CoreOption]>,
   HelpText<"Generate code for the given target">;
 def gcc_toolchain : Joined<["--"], "gcc-toolchain=">, Flags<[DriverOption]>,
@@ -2034,7 +2100,7 @@ def trigraphs : Flag<["-", "--"], "trigr
   HelpText<"Process trigraph sequences">;
 def twolevel__namespace__hints : Flag<["-"], "twolevel_namespace_hints">;
 def twolevel__namespace : Flag<["-"], "twolevel_namespace">;
-def t : Flag<["-"], "t">;
+def t : Flag<["-"], "t">, Group<Link_Group>;
 def umbrella : Separate<["-"], "umbrella">;
 def undefined : JoinedOrSeparate<["-"], "undefined">, Group<u_Group>;
 def undef : Flag<["-"], "undef">, Group<u_Group>, Flags<[CC1Option]>,
@@ -2330,7 +2396,10 @@ defm devirtualize_speculatively : Boolea
 
 // gfortran options that we recognize in the driver and pass along when
 // invoking GCC to compile Fortran code.
-def gfortran_Group : OptionGroup<"gfortran Group">;
+def gfortran_Group : OptionGroup<"<gfortran group>">,
+                     DocName<"Fortran compilation flags">, DocBrief<[{
+Flags that will be passed onto the ``gfortran`` compiler when Clang is given
+a Fortran input.}]>;
 
 // Generic gfortran options.
 def A_DASH : Joined<["-"], "A-">, Group<gfortran_Group>;

Modified: cfe/trunk/utils/TableGen/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/CMakeLists.txt?rev=292968&r1=292967&r2=292968&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/CMakeLists.txt (original)
+++ cfe/trunk/utils/TableGen/CMakeLists.txt Tue Jan 24 13:39:46 2017
@@ -7,6 +7,7 @@ add_tablegen(clang-tblgen CLANG
   ClangCommentHTMLNamedCharacterReferenceEmitter.cpp
   ClangCommentHTMLTagsEmitter.cpp
   ClangDiagnosticsEmitter.cpp
+  ClangOptionDocEmitter.cpp
   ClangSACheckersEmitter.cpp
   NeonEmitter.cpp
   TableGen.cpp

Added: cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp?rev=292968&view=auto
==============================================================================
--- cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp (added)
+++ cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp Tue Jan 24 13:39:46 2017
@@ -0,0 +1,358 @@
+//===- ClangOptionDocEmitter.cpp - Documentation for command line flags ---===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// FIXME: Once this has stabilized, consider moving it to LLVM.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/TableGen/Error.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/TableGen/Record.h"
+#include "llvm/TableGen/TableGenBackend.h"
+#include <cctype>
+#include <cstring>
+#include <map>
+
+using namespace llvm;
+
+namespace clang {
+namespace docs {
+namespace {
+struct DocumentedOption {
+  Record *Option;
+  std::vector<Record*> Aliases;
+};
+struct DocumentedGroup;
+struct Documentation {
+  std::vector<DocumentedGroup> Groups;
+  std::vector<DocumentedOption> Options;
+};
+struct DocumentedGroup : Documentation {
+  Record *Group;
+};
+
+// Reorganize the records into a suitable form for emitting documentation.
+Documentation extractDocumentation(RecordKeeper &Records) {
+  Documentation Result;
+
+  // Build the tree of groups. The root in the tree is the fake option group
+  // (Record*)nullptr, which contains all top-level groups and options.
+  std::map<Record*, std::vector<Record*> > OptionsInGroup;
+  std::map<Record*, std::vector<Record*> > GroupsInGroup;
+  std::map<Record*, std::vector<Record*> > Aliases;
+
+  std::map<std::string, Record*> OptionsByName;
+  for (Record *R : Records.getAllDerivedDefinitions("Option"))
+    OptionsByName[R->getValueAsString("Name")] = R;
+
+  auto Flatten = [](Record *R) {
+    return R->getValue("DocFlatten") && R->getValueAsBit("DocFlatten");
+  };
+
+  auto SkipFlattened = [&](Record *R) -> Record* {
+    while (R && Flatten(R)) {
+      auto *G = dyn_cast<DefInit>(R->getValueInit("Group"));
+      if (!G)
+        return nullptr;
+      R = G->getDef();
+    }
+    return R;
+  };
+
+  for (Record *R : Records.getAllDerivedDefinitions("OptionGroup")) {
+    if (Flatten(R))
+      continue;
+
+    Record *Group = nullptr;
+    if (auto *G = dyn_cast<DefInit>(R->getValueInit("Group")))
+      Group = SkipFlattened(G->getDef());
+    GroupsInGroup[Group].push_back(R);
+  }
+
+  for (Record *R : Records.getAllDerivedDefinitions("Option")) {
+    if (auto *A = dyn_cast<DefInit>(R->getValueInit("Alias"))) {
+      Aliases[A->getDef()].push_back(R);
+      continue;
+    }
+
+    // Pretend no-X and Xno-Y options are aliases of X and XY.
+    auto Name = R->getValueAsString("Name");
+    if (Name.size() >= 4) {
+      if (Name.substr(0, 3) == "no-" && OptionsByName[Name.substr(3)]) {
+        Aliases[OptionsByName[Name.substr(3)]].push_back(R);
+        continue;
+      }
+      if (Name.substr(1, 3) == "no-" && OptionsByName[Name[0] + Name.substr(4)]) {
+        Aliases[OptionsByName[Name[0] + Name.substr(4)]].push_back(R);
+        continue;
+      }
+    }
+
+    Record *Group = nullptr;
+    if (auto *G = dyn_cast<DefInit>(R->getValueInit("Group")))
+      Group = SkipFlattened(G->getDef());
+    OptionsInGroup[Group].push_back(R);
+  }
+
+  auto CompareByName = [](Record *A, Record *B) {
+    return A->getValueAsString("Name") < B->getValueAsString("Name");
+  };
+
+  auto CompareByLocation = [](Record *A, Record *B) {
+    return A->getLoc()[0].getPointer() < B->getLoc()[0].getPointer();
+  };
+
+  auto DocumentationForOption = [&](Record *R) -> DocumentedOption {
+    auto &A = Aliases[R];
+    std::sort(A.begin(), A.end(), CompareByName);
+    return {R, std::move(A)};
+  };
+
+  std::function<Documentation(Record *)> DocumentationForGroup =
+      [&](Record *R) -> Documentation {
+    Documentation D;
+
+    auto &Groups = GroupsInGroup[R];
+    std::sort(Groups.begin(), Groups.end(), CompareByLocation);
+    for (Record *G : Groups) {
+      D.Groups.emplace_back();
+      D.Groups.back().Group = G;
+      Documentation &Base = D.Groups.back();
+      Base = DocumentationForGroup(G);
+    }
+
+    auto &Options = OptionsInGroup[R];
+    std::sort(Options.begin(), Options.end(), CompareByName);
+    for (Record *O : Options)
+      D.Options.push_back(DocumentationForOption(O));
+
+    return D;
+  };
+
+  return DocumentationForGroup(nullptr);
+}
+
+// Get the first and successive separators to use for an OptionKind.
+std::pair<StringRef,StringRef> getSeparatorsForKind(Record *OptionKind) {
+  return StringSwitch<std::pair<StringRef, StringRef>>(OptionKind->getName())
+    .Cases("KIND_JOINED", "KIND_JOINED_OR_SEPARATE",
+           "KIND_JOINED_AND_SEPARATE",
+           "KIND_REMAINING_ARGS_JOINED", {"", " "})
+    .Case("KIND_COMMAJOINED", {"", ","})
+    .Default({" ", " "});
+}
+
+const unsigned UnlimitedArgs = unsigned(-1);
+
+// Get the number of arguments expected for an option, or -1 if any number of
+// arguments are accepted.
+unsigned getNumArgsForKind(Record *OptionKind, Record *Option) {
+  return StringSwitch<unsigned>(OptionKind->getName())
+    .Cases("KIND_JOINED", "KIND_JOINED_OR_SEPARATE", "KIND_SEPARATE", 1)
+    .Cases("KIND_REMAINING_ARGS", "KIND_REMAINING_ARGS_JOINED",
+           "KIND_COMMAJOINED", UnlimitedArgs)
+    .Case("KIND_JOINED_AND_SEPARATE", 2)
+    .Case("KIND_MULTIARG", Option->getValueAsInt("NumArgs"))
+    .Default(0);
+}
+
+bool hasFlag(const Record *OptionOrGroup, StringRef OptionFlag) {
+  for (const Record *Flag : OptionOrGroup->getValueAsListOfDefs("Flags"))
+    if (Flag->getName() == OptionFlag)
+      return true;
+  return false;
+}
+
+bool isExcluded(const Record *OptionOrGroup, const Record *DocInfo) {
+  // FIXME: Provide a flag to specify the set of exclusions.
+  for (StringRef Exclusion : DocInfo->getValueAsListOfStrings("ExcludedFlags"))
+    if (hasFlag(OptionOrGroup, Exclusion))
+      return true;
+  return false;
+}
+
+std::string escapeRST(StringRef Str) {
+  std::string Out;
+  for (auto K : Str) {
+    if (StringRef("`*|_[]\\").count(K))
+      Out.push_back('\\');
+    Out.push_back(K);
+  }
+  return Out;
+}
+
+bool canSphinxCopeWithOption(const Record *Option) {
+  // HACK: Work arond sphinx's inability to cope with punctuation-only options
+  // such as /? by suppressing them from the option list.
+  for (char C : Option->getValueAsString("Name"))
+    if (isalnum(C))
+      return true;
+  return false;
+}
+
+void emitHeading(int Depth, std::string Heading, raw_ostream &OS) {
+  assert(Depth < 8 && "groups nested too deeply");
+  OS << Heading << '\n'
+     << std::string(Heading.size(), "=~-_'+<>"[Depth]) << "\n";
+}
+
+/// Get the value of field \p Primary, if possible. If \p Primary does not
+/// exist, get the value of \p Fallback and escape it for rST emission.
+std::string getRSTStringWithTextFallback(const Record *R, StringRef Primary,
+                                         StringRef Fallback) {
+  for (auto Field : {Primary, Fallback}) {
+    if (auto *V = R->getValue(Field)) {
+      StringRef Value;
+      if (auto *SV = dyn_cast_or_null<StringInit>(V->getValue()))
+        Value = SV->getValue();
+      else if (auto *CV = dyn_cast_or_null<CodeInit>(V->getValue()))
+        Value = CV->getValue();
+      if (!Value.empty())
+        return Field == Primary ? Value.str() : escapeRST(Value);
+    }
+  }
+  return StringRef();
+}
+
+void emitOptionWithArgs(StringRef Prefix, Record *Option,
+                               ArrayRef<std::string> Args, raw_ostream &OS) {
+  OS << Prefix << escapeRST(Option->getValueAsString("Name"));
+
+  std::pair<StringRef, StringRef> Separators =
+      getSeparatorsForKind(Option->getValueAsDef("Kind"));
+
+  StringRef Separator = Separators.first;
+  for (auto Arg : Args) {
+    OS << Separator << escapeRST(Arg);
+    Separator = Separators.second;
+  }
+}
+
+void emitOptionName(StringRef Prefix, Record *Option, raw_ostream &OS) {
+  // Find the arguments to list after the option.
+  unsigned NumArgs = getNumArgsForKind(Option->getValueAsDef("Kind"), Option);
+
+  std::vector<std::string> Args;
+  if (!Option->isValueUnset("MetaVarName"))
+    Args.push_back(Option->getValueAsString("MetaVarName"));
+  else if (NumArgs == 1)
+    Args.push_back("<arg>");
+
+  while (Args.size() < NumArgs) {
+    Args.push_back(("<arg" + Twine(Args.size() + 1) + ">").str());
+    // Use '--args <arg1> <arg2>...' if any number of args are allowed.
+    if (Args.size() == 2 && NumArgs == UnlimitedArgs) {
+      Args.back() += "...";
+      break;
+    }
+  }
+
+  emitOptionWithArgs(Prefix, Option, Args, OS);
+
+  auto AliasArgs = Option->getValueAsListOfStrings("AliasArgs");
+  if (!AliasArgs.empty()) {
+    Record *Alias = Option->getValueAsDef("Alias");
+    OS << " (equivalent to ";
+    emitOptionWithArgs(Alias->getValueAsListOfStrings("Prefixes").front(),
+                       Alias, Option->getValueAsListOfStrings("AliasArgs"), OS);
+    OS << ")";
+  }
+}
+
+bool emitOptionNames(Record *Option, raw_ostream &OS, bool EmittedAny) {
+  for (auto &Prefix : Option->getValueAsListOfStrings("Prefixes")) {
+    if (EmittedAny)
+      OS << ", ";
+    emitOptionName(Prefix, Option, OS);
+    EmittedAny = true;
+  }
+  return EmittedAny;
+}
+
+void emitOption(const DocumentedOption &Option, const Record *DocInfo,
+                raw_ostream &OS) {
+  if (isExcluded(Option.Option, DocInfo))
+    return;
+  if (Option.Option->getValueAsDef("Kind")->getName() == "KIND_UNKNOWN" ||
+      Option.Option->getValueAsDef("Kind")->getName() == "KIND_INPUT")
+    return;
+  if (!canSphinxCopeWithOption(Option.Option))
+    return;
+
+  // HACK: Emit a different program name with each option to work around
+  // sphinx's inability to cope with options that differ only by punctuation
+  // (eg -ObjC vs -ObjC++, -G vs -G=).
+  static int Emitted = 0;
+  OS << ".. program:: " << DocInfo->getValueAsString("Program") << Emitted++
+     << "\n";
+
+  // Emit the names of the option.
+  OS << ".. option:: ";
+  bool EmittedAny = emitOptionNames(Option.Option, OS, false);
+  for (auto *Alias : Option.Aliases)
+    if (!isExcluded(Alias, DocInfo) && canSphinxCopeWithOption(Option.Option))
+      EmittedAny = emitOptionNames(Alias, OS, EmittedAny);
+  assert(EmittedAny && "no flags for option");
+  OS << "\n\n";
+
+  // Emit the description, if we have one.
+  std::string Description =
+      getRSTStringWithTextFallback(Option.Option, "DocBrief", "HelpText");
+  if (!Description.empty())
+    OS << Description << "\n\n";
+}
+
+void emitDocumentation(int Depth, const Documentation &Doc,
+                       const Record *DocInfo, raw_ostream &OS);
+
+void emitGroup(int Depth, const DocumentedGroup &Group, const Record *DocInfo,
+               raw_ostream &OS) {
+  if (isExcluded(Group.Group, DocInfo))
+    return;
+
+  emitHeading(Depth,
+              getRSTStringWithTextFallback(Group.Group, "DocName", "Name"), OS);
+
+  // Emit the description, if we have one.
+  std::string Description =
+      getRSTStringWithTextFallback(Group.Group, "DocBrief", "HelpText");
+  if (!Description.empty())
+    OS << Description << "\n\n";
+
+  // Emit contained options and groups.
+  emitDocumentation(Depth + 1, Group, DocInfo, OS);
+}
+
+void emitDocumentation(int Depth, const Documentation &Doc,
+                       const Record *DocInfo, raw_ostream &OS) {
+  for (auto &O : Doc.Options)
+    emitOption(O, DocInfo, OS);
+  for (auto &G : Doc.Groups)
+    emitGroup(Depth, G, DocInfo, OS);
+}
+
+}  // namespace
+}  // namespace docs
+
+void EmitClangOptDocs(RecordKeeper &Records, raw_ostream &OS) {
+  using namespace docs;
+
+  const Record *DocInfo = Records.getDef("GlobalDocumentation");
+  if (!DocInfo) {
+    PrintFatalError("The GlobalDocumentation top-level definition is missing, "
+                    "no documentation will be generated.");
+    return;
+  }
+  OS << DocInfo->getValueAsString("Intro") << "\n";
+  OS << ".. program:: " << DocInfo->getValueAsString("Program") << "\n";
+
+  emitDocumentation(0, extractDocumentation(Records), DocInfo, OS);
+}
+} // end namespace clang

Modified: cfe/trunk/utils/TableGen/TableGen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/TableGen.cpp?rev=292968&r1=292967&r2=292968&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/TableGen.cpp (original)
+++ cfe/trunk/utils/TableGen/TableGen.cpp Tue Jan 24 13:39:46 2017
@@ -53,7 +53,8 @@ enum ActionType {
   GenArmNeonSema,
   GenArmNeonTest,
   GenAttrDocs,
-  GenDiagDocs
+  GenDiagDocs,
+  GenOptDocs
 };
 
 namespace {
@@ -135,7 +136,9 @@ cl::opt<ActionType> Action(
         clEnumValN(GenAttrDocs, "gen-attr-docs",
                    "Generate attribute documentation"),
         clEnumValN(GenDiagDocs, "gen-diag-docs",
-                   "Generate attribute documentation")));
+                   "Generate diagnostic documentation"),
+        clEnumValN(GenOptDocs, "gen-opt-docs",
+                   "Generate option documentation")));
 
 cl::opt<std::string>
 ClangComponent("clang-component",
@@ -238,6 +241,9 @@ bool ClangTableGenMain(raw_ostream &OS,
   case GenDiagDocs:
     EmitClangDiagDocs(Records, OS);
     break;
+  case GenOptDocs:
+    EmitClangOptDocs(Records, OS);
+    break;
   }
 
   return false;

Modified: cfe/trunk/utils/TableGen/TableGenBackends.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/TableGenBackends.h?rev=292968&r1=292967&r2=292968&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/TableGenBackends.h (original)
+++ cfe/trunk/utils/TableGen/TableGenBackends.h Tue Jan 24 13:39:46 2017
@@ -70,6 +70,7 @@ void EmitNeonTest2(RecordKeeper &Records
 
 void EmitClangAttrDocs(RecordKeeper &Records, raw_ostream &OS);
 void EmitClangDiagDocs(RecordKeeper &Records, raw_ostream &OS);
+void EmitClangOptDocs(RecordKeeper &Records, raw_ostream &OS);
 
 } // end namespace clang
 




More information about the cfe-commits mailing list