CLANG(1)

NAME
clang - the Clang C and Objective-C compiler

SYNOPSIS
clang [-c|-S|-E] -std=standard -g
  [-O0|-O1|-O2|-Os|-O3|-O4]
  -Wwarnings... -pedantic
  -Idir... -Ldir...
  -Dmacro[=defn]
  -ffeature-option...
  -mmachine-option...
  -o output-file
  input-filenames

DESCRIPTION
clang is a C and Objective-C compiler which encompasses preprocessing, parsing, optimization, code generation, assembly, and linking. Depending on which high-level mode setting is passed, Clang will stop before doing a full link. While Clang is highly integrated, it is important to understand the stages of compilation, to understand how to invoke it. These stages are:

Driver
    The clang executable is actually a small driver which controls the overall execution of other tools such as the compiler, assembler and linker. Typically you do not need to interact with the driver, but you transparently use it to run the other tools.

Preprocessing
    This stage handles tokenization of the input source file, macro expansion, #include expansion and handling of other preprocessor directives. The output of this stage is typically called a ".i" (for C) or ".mi" (for Objective-C) file.

Parsing and Semantic Analysis
    This stage parses the input file, translating preprocessor tokens into a parse tree. Once in the form of a parser tree, it applies semantic analysis to compute types for expressions as well and determine whether the code is well formed. This stage is responsible for generating most of the compiler warnings as well as parse errors. The output of this stage is an "Abstract Syntax Tree" (AST).

Code Generation and Optimization
    This stage translates an AST into low-level intermediate code or machine code (depending on the optimization level). This phase is responsible for optimizing the generated code and handling target-specfic code generation. The output of this stage is typically called a ".s" file.

Assembly
    This stage runs the target assembler to translate the output of the compiler into a target object file. The output of this stage is typically called a ".o" file.

Linking
    This stage runs the target linker to merge multiple object files into an executable or dynamic library. The output of this stage is typically called an "a.out", ".dylib" or ".so" file.

The Clang compiler supports a large number of options to control each of these stages.

OPTIONS

  Stage Selection Options

--help
    Display available options.

-###
    Print the commands to run for this compilation.

-E  Only run the preprocessor.

-S  Only run preprocess and compilation steps.

-c  Only run preprocess, compile, and assemble steps.

-emit-llvm
    Use the LLVM representation for assembler and object files.

--analyze
    Run the static analyzer. =item -ObjC++

    Treat source input files as Objective-C++ inputs.

-ObjC
    Treat source input files as Objective-C inputs.

-Qunused-arguments
    Don't emit warning for unused driver arguments.

-Wa,args
    Pass the comma separated arguments in args to the assembler.

-Wl,args
    Pass the comma separated arguments in args to the linker.

-Wp,args
    Pass the comma separated arguments in args to the preprocessor.

-Xanalyzer arg
    Pass arg to the static analyzer.

-Xassembler arg
    Pass arg to the assembler.

-Xclang arg
    Pass arg to the clang compiler.

-Xlinker arg
    Pass arg to the linker.

-Xpreprocessor arg
    Pass arg to the preprocessor.

-o file
    Write output to file.

-pipe
    Use pipes between commands, when possible.

-print-file-name=file
    Print the full library path of file.

-print-libgcc-file-name
    Print the library path for "libgcc.a".

-print-prog-name=name
    Print the full program path of name.

-print-search-dirs
    Print the paths used for finding libraries and programs.

-save-temps
    Save intermediate compilation results.

-time
    Time individual commands.

-v  Show commands to run and use verbose output.

-x language
    Treat subsequent input files as having type language.

ENVIRONMENT
FIXME: Fill in environment.

BUGS
It is inconceivable that Clang may have a bug.

SEE ALSO
FIXME: See also?

AUTHOR
Maintained by the Clang / LLVM Team (<http://clang.llvm.org>).