Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 1 | =pod |
| 2 | |
| 3 | =head1 NAME |
| 4 | |
Douglas Gregor | 51c7a78 | 2010-09-24 17:26:14 +0000 | [diff] [blame] | 5 | clang - the Clang C, C++, and Objective-C compiler |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 6 | |
| 7 | =head1 SYNOPSIS |
| 8 | |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 9 | B<clang> [B<-c>|B<-S>|B<-E>] B<-std=>I<standard> B<-g> |
| 10 | [B<-O0>|B<-O1>|B<-O2>|B<-Os>|B<-O3>|B<-O4>] |
| 11 | B<-W>I<warnings...> B<-pedantic> |
| 12 | B<-I>I<dir...> B<-L>I<dir...> |
| 13 | B<-D>I<macro[=defn]> |
| 14 | B<-f>I<feature-option...> |
| 15 | B<-m>I<machine-option...> |
| 16 | B<-o> I<output-file> |
Daniel Dunbar | 3f16c95 | 2010-09-14 23:12:40 +0000 | [diff] [blame] | 17 | B<-stdlib=>I<library> |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 18 | I<input-filenames> |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 19 | |
| 20 | =head1 DESCRIPTION |
| 21 | |
Douglas Gregor | 51c7a78 | 2010-09-24 17:26:14 +0000 | [diff] [blame] | 22 | B<clang> is a C, C++, and Objective-C compiler which encompasses preprocessing, |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 23 | parsing, optimization, code generation, assembly, and linking. Depending on |
| 24 | which high-level mode setting is passed, Clang will stop before doing a full |
| 25 | link. While Clang is highly integrated, it is important to understand the |
| 26 | stages of compilation, to understand how to invoke it. These stages are: |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 27 | |
| 28 | =over |
| 29 | |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 30 | =item B<Driver> |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 31 | |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 32 | The B<clang> executable is actually a small driver which controls the overall |
| 33 | execution of other tools such as the compiler, assembler and linker. Typically |
| 34 | you do not need to interact with the driver, but you transparently use it to run |
| 35 | the other tools. |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 36 | |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 37 | =item B<Preprocessing> |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 38 | |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 39 | This stage handles tokenization of the input source file, macro expansion, |
| 40 | #include expansion and handling of other preprocessor directives. The output of |
Douglas Gregor | 51c7a78 | 2010-09-24 17:26:14 +0000 | [diff] [blame] | 41 | this stage is typically called a ".i" (for C), ".ii" (for C++), ".mi" (for |
| 42 | Objective-C) , or ".mii" (for Objective-C++) file. |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 43 | |
| 44 | =item B<Parsing and Semantic Analysis> |
| 45 | |
| 46 | This stage parses the input file, translating preprocessor tokens into a parse |
| 47 | tree. Once in the form of a parser tree, it applies semantic analysis to compute |
| 48 | types for expressions as well and determine whether the code is well formed. This |
| 49 | stage is responsible for generating most of the compiler warnings as well as |
| 50 | parse errors. The output of this stage is an "Abstract Syntax Tree" (AST). |
| 51 | |
| 52 | =item B<Code Generation and Optimization> |
| 53 | |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 54 | This stage translates an AST into low-level intermediate code (known as "LLVM |
Daniel Dunbar | 073190d | 2010-05-21 00:28:14 +0000 | [diff] [blame] | 55 | IR") and ultimately to machine code. This phase is responsible for optimizing |
| 56 | the generated code and handling target-specfic code generation. The output of |
| 57 | this stage is typically called a ".s" file or "assembly" file. |
| 58 | |
| 59 | Clang also supports the use of an integrated assembler, in which the code |
| 60 | generator produces object files directly. This avoids the overhead of generating |
| 61 | the ".s" file and of calling the target assembler. |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 62 | |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 63 | =item B<Assembler> |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 64 | |
| 65 | This stage runs the target assembler to translate the output of the compiler |
| 66 | into a target object file. The output of this stage is typically called a ".o" |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 67 | file or "object" file. |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 68 | |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 69 | =item B<Linker> |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 70 | |
| 71 | This stage runs the target linker to merge multiple object files into an |
| 72 | executable or dynamic library. The output of this stage is typically called an |
| 73 | "a.out", ".dylib" or ".so" file. |
| 74 | |
| 75 | =back |
| 76 | |
| 77 | The Clang compiler supports a large number of options to control each of these |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 78 | stages. In addition to compilation of code, Clang also supports other tools: |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 79 | |
| 80 | B<Clang Static Analyzer> |
| 81 | |
| 82 | The Clang Static Analyzer is a tool that scans source code to try to find bugs |
Douglas Gregor | 7780981 | 2010-10-08 21:03:07 +0000 | [diff] [blame] | 83 | through code analysis. This tool uses many parts of Clang and is built into the |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 84 | same driver. |
| 85 | |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 86 | |
| 87 | =head1 OPTIONS |
| 88 | |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 89 | =head2 Stage Selection Options |
| 90 | |
| 91 | =over |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 92 | |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 93 | =item B<-E> |
| 94 | |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 95 | Run the preprocessor stage. |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 96 | |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 97 | =item B<-fsyntax-only> |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 98 | |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 99 | Run the preprocessor, parser and type checking stages. |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 100 | |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 101 | =item B<-S> |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 102 | |
Daniel Dunbar | 94f497b | 2009-05-18 21:34:46 +0000 | [diff] [blame] | 103 | Run the previous stages as well as LLVM generation and optimization stages and |
| 104 | target-specific code generation, producing an assembly file. |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 105 | |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 106 | =item B<-c> |
| 107 | |
| 108 | Run all of the above, plus the assembler, generating a target ".o" object file. |
| 109 | |
| 110 | =item B<no stage selection option> |
| 111 | |
| 112 | If no stage selection option is specified, all stages above are run, and the |
| 113 | linker is run to combine the results into an executable or shared library. |
| 114 | |
| 115 | =item B<--analyze> |
| 116 | |
| 117 | Run the Clang Static Analyzer. |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 118 | |
| 119 | =back |
| 120 | |
| 121 | |
| 122 | |
Chris Lattner | 04005dd | 2009-05-12 00:01:32 +0000 | [diff] [blame] | 123 | =head2 Language Selection and Mode Options |
| 124 | |
| 125 | =over |
| 126 | |
| 127 | =item B<-x> I<language> |
| 128 | |
| 129 | Treat subsequent input files as having type I<language>. |
| 130 | |
| 131 | =item B<-std>=I<language> |
| 132 | |
| 133 | Specify the language standard to compile for. |
| 134 | |
Daniel Dunbar | 3f16c95 | 2010-09-14 23:12:40 +0000 | [diff] [blame] | 135 | =item B<-stdlib>=I<language> |
| 136 | |
| 137 | Specify the C++ standard library to use; supported options are libstdc++ and |
| 138 | libc++. |
| 139 | |
Chris Lattner | 04005dd | 2009-05-12 00:01:32 +0000 | [diff] [blame] | 140 | =item B<-ansi> |
| 141 | |
| 142 | Same as B<-std=c89>. |
| 143 | |
| 144 | =item B<-ObjC++> |
| 145 | |
Daniel Dunbar | 94f497b | 2009-05-18 21:34:46 +0000 | [diff] [blame] | 146 | Treat source input files as Objective-C++ inputs. |
Chris Lattner | 04005dd | 2009-05-12 00:01:32 +0000 | [diff] [blame] | 147 | |
| 148 | =item B<-ObjC> |
| 149 | |
Daniel Dunbar | 94f497b | 2009-05-18 21:34:46 +0000 | [diff] [blame] | 150 | Treat source input files as Objective-C inputs. |
Chris Lattner | 04005dd | 2009-05-12 00:01:32 +0000 | [diff] [blame] | 151 | |
| 152 | =item B<-trigraphs> |
| 153 | |
| 154 | Enable trigraphs. |
| 155 | |
| 156 | =item B<-ffreestanding> |
| 157 | |
| 158 | Indicate that the file should be compiled for a freestanding, not a hosted, |
| 159 | environment. |
| 160 | |
| 161 | =item B<-fno-builtin> |
| 162 | |
| 163 | Disable special handling and optimizations of builtin functions like strlen and |
| 164 | malloc. |
| 165 | |
| 166 | =item B<-fmath-errno> |
| 167 | |
| 168 | Indicate that math functions should be treated as updating errno. |
| 169 | |
| 170 | =item B<-fpascal-strings> |
| 171 | |
| 172 | Enable support for Pascal-style strings with "\pfoo". |
| 173 | |
| 174 | =item B<-fms-extensions> |
| 175 | |
| 176 | Enable support for Microsoft extensions. |
| 177 | |
Dawn Perchik | 400b607 | 2010-09-02 23:59:25 +0000 | [diff] [blame] | 178 | =item B<-fborland-extensions> |
| 179 | |
| 180 | Enable support for Borland extensions. |
| 181 | |
Chris Lattner | 04005dd | 2009-05-12 00:01:32 +0000 | [diff] [blame] | 182 | =item B<-fwritable-strings> |
| 183 | |
| 184 | Make all string literals default to writable. This disables uniquing of |
| 185 | strings and other optimizations. |
| 186 | |
| 187 | =item B<-flax-vector-conversions> |
| 188 | |
| 189 | Allow loose type checking rules for implicit vector conversions. |
| 190 | |
| 191 | =item B<-fblocks> |
| 192 | |
| 193 | Enable the "Blocks" language feature. |
| 194 | |
Chris Lattner | 04005dd | 2009-05-12 00:01:32 +0000 | [diff] [blame] | 195 | =item B<-fobjc-gc-only> |
| 196 | |
| 197 | Indicate that Objective-C code should be compiled in GC-only mode, which only |
| 198 | works when Objective-C Garbage Collection is enabled. |
| 199 | |
| 200 | =item B<-fobjc-gc> |
| 201 | |
| 202 | Indicate that Objective-C code should be compiled in hybrid-GC mode, which works |
| 203 | with both GC and non-GC mode. |
| 204 | |
Daniel Dunbar | dea6313 | 2010-09-20 18:19:55 +0000 | [diff] [blame] | 205 | =item B<-fobjc-abi-version>=I<version> |
| 206 | |
| 207 | Select the Objective-C ABI version to use. Available versions are 1 (legacy |
| 208 | "fragile" ABI), 2 (non-fragile ABI 1), and 3 (non-fragile ABI 2). |
| 209 | |
| 210 | =item B<-fobjc-nonfragile-abi-version>=I<version> |
| 211 | |
| 212 | Select the Objective-C non-fragile ABI version to use by default. This will only |
| 213 | be used as the Objective-C ABI when the non-fragile ABI is enabled (either via |
| 214 | -fobjc-nonfragile-abi, or because it is the platform default). |
| 215 | |
| 216 | =item B<-fobjc-nonfragile-abi> |
| 217 | |
| 218 | Enable use of the Objective-C non-fragile ABI. On platforms for which this is |
| 219 | the default ABI, it can be disabled with B<-fno-objc-nonfragile-abi>. |
| 220 | |
Chris Lattner | 04005dd | 2009-05-12 00:01:32 +0000 | [diff] [blame] | 221 | =back |
| 222 | |
| 223 | |
| 224 | |
| 225 | =head2 Target Selection Options |
| 226 | |
Daniel Dunbar | 94f497b | 2009-05-18 21:34:46 +0000 | [diff] [blame] | 227 | Clang fully supports cross compilation as an inherent part of its design. |
Chris Lattner | 04005dd | 2009-05-12 00:01:32 +0000 | [diff] [blame] | 228 | Depending on how your version of Clang is configured, it may have support for |
Daniel Dunbar | 94f497b | 2009-05-18 21:34:46 +0000 | [diff] [blame] | 229 | a number of cross compilers, or may only support a native target. |
Chris Lattner | 04005dd | 2009-05-12 00:01:32 +0000 | [diff] [blame] | 230 | |
| 231 | =over |
| 232 | |
Chris Lattner | 04005dd | 2009-05-12 00:01:32 +0000 | [diff] [blame] | 233 | =item B<-arch> I<architecture> |
| 234 | |
| 235 | Specify the architecture to build for. |
| 236 | |
| 237 | =item B<-mmacosx-version-min>=I<version> |
| 238 | |
| 239 | When building for Mac OS/X, specify the minimum version supported by your |
| 240 | application. |
| 241 | |
| 242 | =item B<-miphoneos-version-min> |
| 243 | |
| 244 | When building for iPhone OS, specify the minimum version supported by your |
| 245 | application. |
| 246 | |
| 247 | |
| 248 | =item B<-march>=I<cpu> |
| 249 | |
| 250 | Specify that Clang should generate code for a specific processor family member |
| 251 | and later. For example, if you specify -march=i486, the compiler is allowed to |
| 252 | generate instructions that are valid on i486 and later processors, but which |
| 253 | may not exist on earlier ones. |
| 254 | |
| 255 | =back |
| 256 | |
| 257 | |
| 258 | =head2 Code Generation Options |
| 259 | |
| 260 | =over |
| 261 | |
| 262 | =item B<-O0> B<-O1> B<-O2> B<-Os> B<-O3> B<-O4> |
| 263 | |
| 264 | Specify which optimization level to use. B<-O0> means "no optimization": this |
Daniel Dunbar | 94f497b | 2009-05-18 21:34:46 +0000 | [diff] [blame] | 265 | level compiles the fastest and generates the most debuggable code. B<-O2> is a |
| 266 | moderate level of optimization which enables most optimizations. B<-Os> is like |
| 267 | B<-O2> with extra optimizations to reduce code size. B<-O3> is like B<-O2>, |
| 268 | except that it enables optimizations that take longer to perform or that may |
| 269 | generate larger code (in an attempt to make the program run faster). On |
| 270 | supported platforms, B<-O4> enables link-time optimization; object files are |
| 271 | stored in the LLVM bitcode file format and whole program optimization is done at |
| 272 | link time. B<-O1> is somewhere between B<-O0> and B<-O2>. |
Chris Lattner | 04005dd | 2009-05-12 00:01:32 +0000 | [diff] [blame] | 273 | |
| 274 | =item B<-g> |
| 275 | |
| 276 | Generate debug information. Note that Clang debug information works best at |
| 277 | B<-O0>. At higher optimization levels, only line number information is |
| 278 | currently available. |
| 279 | |
| 280 | =item B<-fexceptions> |
| 281 | |
| 282 | Enable generation of unwind information, this allows exceptions to be thrown |
| 283 | through Clang compiled stack frames. This is on by default in x86-64. |
| 284 | |
| 285 | =item B<-ftrapv> |
| 286 | |
| 287 | Generate code to catch integer overflow errors. Signed integer overflow is |
| 288 | undefined in C, with this flag, extra code is generated to detect this and abort |
| 289 | when it happens. |
| 290 | |
| 291 | |
| 292 | =item B<-fvisibility> |
| 293 | |
| 294 | This flag sets the default visibility level. |
| 295 | |
| 296 | =item B<-fcommon> |
| 297 | |
| 298 | This flag specifies that variables without initializers get common linkage. It |
| 299 | can be disabled with B<-fno-common>. |
| 300 | |
Daniel Dunbar | 94f497b | 2009-05-18 21:34:46 +0000 | [diff] [blame] | 301 | =item B<-flto> B<-emit-llvm> |
| 302 | |
| 303 | Generate output files in LLVM formats, suitable for link time optimization. When |
| 304 | used with B<-S> this generates LLVM intermediate language assembly files, |
| 305 | otherwise this generates LLVM bitcode format object files (which may be passed |
| 306 | to the linker depending on the stage selection options). |
| 307 | |
Chris Lattner | 04005dd | 2009-05-12 00:01:32 +0000 | [diff] [blame] | 308 | =cut |
| 309 | |
| 310 | ##=item B<-fnext-runtime> B<-fobjc-nonfragile-abi> B<-fgnu-runtime> |
| 311 | ##These options specify which Objective-C runtime the code generator should |
| 312 | ##target. FIXME: we don't want people poking these generally. |
| 313 | |
| 314 | =pod |
| 315 | |
| 316 | =back |
| 317 | |
| 318 | |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 319 | =head2 Driver Options |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 320 | |
| 321 | =over |
| 322 | |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 323 | =item B<-###> |
Chris Lattner | b5f6e80 | 2009-05-06 02:47:51 +0000 | [diff] [blame] | 324 | |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 325 | Print the commands to run for this compilation. |
| 326 | |
| 327 | =item B<--help> |
| 328 | |
| 329 | Display available options. |
| 330 | |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 331 | =item B<-Qunused-arguments> |
| 332 | |
| 333 | Don't emit warning for unused driver arguments. |
| 334 | |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 335 | =item B<-Wa,>I<args> |
| 336 | |
| 337 | Pass the comma separated arguments in I<args> to the assembler. |
| 338 | |
| 339 | =item B<-Wl,>I<args> |
| 340 | |
| 341 | Pass the comma separated arguments in I<args> to the linker. |
| 342 | |
| 343 | =item B<-Wp,>I<args> |
| 344 | |
| 345 | Pass the comma separated arguments in I<args> to the preprocessor. |
| 346 | |
| 347 | =item B<-Xanalyzer> I<arg> |
| 348 | |
| 349 | Pass I<arg> to the static analyzer. |
| 350 | |
| 351 | =item B<-Xassembler> I<arg> |
| 352 | |
| 353 | Pass I<arg> to the assembler. |
| 354 | |
| 355 | =item B<-Xclang> I<arg> |
| 356 | |
Daniel Dunbar | 073190d | 2010-05-21 00:28:14 +0000 | [diff] [blame] | 357 | Pass I<arg> to the clang compiler frontend. |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 358 | |
| 359 | =item B<-Xlinker> I<arg> |
| 360 | |
| 361 | Pass I<arg> to the linker. |
| 362 | |
Daniel Dunbar | 073190d | 2010-05-21 00:28:14 +0000 | [diff] [blame] | 363 | =item B<-mllvm> I<arg> |
| 364 | |
| 365 | Pass I<arg> to the LLVM backend. |
| 366 | |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 367 | =item B<-Xpreprocessor> I<arg> |
| 368 | |
| 369 | Pass I<arg> to the preprocessor. |
| 370 | |
Daniel Dunbar | 073190d | 2010-05-21 00:28:14 +0000 | [diff] [blame] | 371 | =item B<-o> I<file> |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 372 | |
| 373 | Write output to I<file>. |
| 374 | |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 375 | =item B<-print-file-name>=I<file> |
| 376 | |
| 377 | Print the full library path of I<file>. |
| 378 | |
| 379 | =item B<-print-libgcc-file-name> |
| 380 | |
| 381 | Print the library path for "libgcc.a". |
| 382 | |
| 383 | =item B<-print-prog-name>=I<name> |
| 384 | |
| 385 | Print the full program path of I<name>. |
| 386 | |
| 387 | =item B<-print-search-dirs> |
| 388 | |
| 389 | Print the paths used for finding libraries and programs. |
| 390 | |
| 391 | =item B<-save-temps> |
| 392 | |
| 393 | Save intermediate compilation results. |
| 394 | |
Daniel Dunbar | 073190d | 2010-05-21 00:28:14 +0000 | [diff] [blame] | 395 | =item B<-integrated-as> B<-no-integrated-as> |
| 396 | |
| 397 | Used to enable and disable, respectively, the use of the integrated |
| 398 | assembler. Whether the integrated assembler is on by default is target |
| 399 | dependent. |
| 400 | |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 401 | =item B<-time> |
| 402 | |
| 403 | Time individual commands. |
| 404 | |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 405 | =item B<-ftime-report> |
| 406 | |
| 407 | Print timing summary of each stage of compilation. |
| 408 | |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 409 | =item B<-v> |
| 410 | |
| 411 | Show commands to run and use verbose output. |
| 412 | |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 413 | =back |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 414 | |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 415 | |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 416 | =head2 Diagnostics Options |
| 417 | |
| 418 | =over |
| 419 | |
Daniel Dunbar | 0a2329a | 2009-09-13 02:21:55 +0000 | [diff] [blame] | 420 | =item B<-fshow-column> |
Chris Lattner | 04005dd | 2009-05-12 00:01:32 +0000 | [diff] [blame] | 421 | B<-fshow-source-location> |
| 422 | B<-fcaret-diagnostics> |
| 423 | B<-fdiagnostics-fixit-info> |
Douglas Gregor | 4786c15 | 2010-08-19 20:24:43 +0000 | [diff] [blame] | 424 | B<-fdiagnostics-parseable-fixits> |
Chris Lattner | 04005dd | 2009-05-12 00:01:32 +0000 | [diff] [blame] | 425 | B<-fdiagnostics-print-source-range-info> |
| 426 | B<-fprint-source-range-info> |
| 427 | B<-fdiagnostics-show-option> |
| 428 | B<-fmessage-length> |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 429 | |
Chris Lattner | 04005dd | 2009-05-12 00:01:32 +0000 | [diff] [blame] | 430 | These options control how Clang prints out information about diagnostics (errors |
| 431 | and warnings). Please see the Clang User's Manual for more information. |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 432 | |
| 433 | =back |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 434 | |
| 435 | |
| 436 | =head2 Preprocessor Options |
| 437 | |
| 438 | =over |
| 439 | |
Chris Lattner | 06ab044 | 2009-05-12 00:47:40 +0000 | [diff] [blame] | 440 | =item B<-D>I<macroname=value> |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 441 | |
Chris Lattner | 06ab044 | 2009-05-12 00:47:40 +0000 | [diff] [blame] | 442 | Adds an implicit #define into the predefines buffer which is read before the |
| 443 | source file is preprocessed. |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 444 | |
Chris Lattner | 06ab044 | 2009-05-12 00:47:40 +0000 | [diff] [blame] | 445 | =item B<-U>I<macroname> |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 446 | |
Chris Lattner | 06ab044 | 2009-05-12 00:47:40 +0000 | [diff] [blame] | 447 | Adds an implicit #undef into the predefines buffer which is read before the |
| 448 | source file is preprocessed. |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 449 | |
Chris Lattner | 06ab044 | 2009-05-12 00:47:40 +0000 | [diff] [blame] | 450 | =item B<-include> I<filename> |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 451 | |
Chris Lattner | 06ab044 | 2009-05-12 00:47:40 +0000 | [diff] [blame] | 452 | Adds an implicit #include into the predefines buffer which is read before the |
| 453 | source file is preprocessed. |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 454 | |
Chris Lattner | 06ab044 | 2009-05-12 00:47:40 +0000 | [diff] [blame] | 455 | =item B<-I>I<directory> |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 456 | |
Chris Lattner | 06ab044 | 2009-05-12 00:47:40 +0000 | [diff] [blame] | 457 | Add the specified directory to the search path for include files. |
| 458 | |
| 459 | =item B<-F>I<directory> |
| 460 | |
| 461 | Add the specified directory to the search path for framework include files. |
| 462 | |
| 463 | =item B<-nostdinc> |
| 464 | |
| 465 | Do not search the standard system directories for include files. |
| 466 | |
Rafael Espindola | 4c8e611 | 2009-10-27 00:29:40 +0000 | [diff] [blame] | 467 | =item B<-nobuiltininc> |
| 468 | |
| 469 | Do not search clang's builtin directory for include files. |
| 470 | |
Chris Lattner | 06ab044 | 2009-05-12 00:47:40 +0000 | [diff] [blame] | 471 | =cut |
| 472 | |
| 473 | ## TODO, but do we really want people using this stuff? |
Daniel Dunbar | 0a2329a | 2009-09-13 02:21:55 +0000 | [diff] [blame] | 474 | #=item B<-idirafter>I<directory> |
| 475 | #=item B<-iquote>I<directory> |
| 476 | #=item B<-isystem>I<directory> |
| 477 | #=item B<-iprefix>I<directory> |
| 478 | #=item B<-iwithprefix>I<directory> |
| 479 | #=item B<-iwithprefixbefore>I<directory> |
| 480 | #=item B<-isysroot> |
| 481 | |
Chris Lattner | 06ab044 | 2009-05-12 00:47:40 +0000 | [diff] [blame] | 482 | =pod |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 483 | |
| 484 | |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 485 | =back |
| 486 | |
| 487 | |
| 488 | |
Chris Lattner | 06ab044 | 2009-05-12 00:47:40 +0000 | [diff] [blame] | 489 | =cut |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 490 | |
Chris Lattner | 06ab044 | 2009-05-12 00:47:40 +0000 | [diff] [blame] | 491 | ### TODO someday. |
Daniel Dunbar | 0a2329a | 2009-09-13 02:21:55 +0000 | [diff] [blame] | 492 | #=head2 Warning Control Options |
| 493 | #=over |
| 494 | #=back |
| 495 | #=head2 Code Generation and Optimization Options |
| 496 | #=over |
| 497 | #=back |
| 498 | #=head2 Assembler Options |
| 499 | #=over |
| 500 | #=back |
| 501 | #=head2 Linker Options |
| 502 | #=over |
| 503 | #=back |
| 504 | #=head2 Static Analyzer Options |
| 505 | #=over |
| 506 | #=back |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 507 | |
Chris Lattner | 06ab044 | 2009-05-12 00:47:40 +0000 | [diff] [blame] | 508 | =pod |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 509 | |
| 510 | |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 511 | =head1 ENVIRONMENT |
| 512 | |
Daniel Dunbar | e58c943 | 2009-05-06 19:18:09 +0000 | [diff] [blame] | 513 | =over |
| 514 | |
| 515 | =item B<TMPDIR>, B<TEMP>, B<TMP> |
| 516 | |
| 517 | These environment variables are checked, in order, for the location to |
| 518 | write temporary files used during the compilation process. |
| 519 | |
| 520 | =item B<CPATH> |
| 521 | |
| 522 | If this environment variable is present, it is treated as a delimited |
| 523 | list of paths to be added to the default system include path list. The |
| 524 | delimiter is the platform dependent delimitor, as used in the I<PATH> |
| 525 | environment variable. |
| 526 | |
| 527 | Empty components in the environment variable are ignored. |
| 528 | |
| 529 | =item B<C_INCLUDE_PATH>, B<OBJC_INCLUDE_PATH>, B<CPLUS_INCLUDE_PATH>, |
| 530 | B<OBJCPLUS_INCLUDE_PATH> |
| 531 | |
| 532 | These environment variables specify additional paths, as for CPATH, |
| 533 | which are only used when processing the appropriate language. |
| 534 | |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 535 | =item B<MACOSX_DEPLOYMENT_TARGET> |
Daniel Dunbar | e58c943 | 2009-05-06 19:18:09 +0000 | [diff] [blame] | 536 | |
| 537 | If -mmacosx-version-min is unspecified, the default deployment target |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 538 | is read from this environment variable. This option only affects darwin |
| 539 | targets. |
Daniel Dunbar | e58c943 | 2009-05-06 19:18:09 +0000 | [diff] [blame] | 540 | |
| 541 | =back |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 542 | |
| 543 | =head1 BUGS |
| 544 | |
Chris Lattner | 9b081c6 | 2009-05-06 17:22:08 +0000 | [diff] [blame] | 545 | To report bugs, please visit L<http://llvm.org/bugs/>. Most bug reports should |
Daniel Dunbar | e58c943 | 2009-05-06 19:18:09 +0000 | [diff] [blame] | 546 | include preprocessed source files (use the B<-E> option) and the full output of |
| 547 | the compiler, along with information to reproduce. |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 548 | |
| 549 | =head1 SEE ALSO |
| 550 | |
Chris Lattner | 482c682 | 2009-05-11 22:45:37 +0000 | [diff] [blame] | 551 | as(1), ld(1) |
Daniel Dunbar | dbec033 | 2009-04-29 01:00:32 +0000 | [diff] [blame] | 552 | |
| 553 | =head1 AUTHOR |
| 554 | |
| 555 | Maintained by the Clang / LLVM Team (L<http://clang.llvm.org>). |
| 556 | |
| 557 | =cut |