swiftswift-compiler

What does "-c" option do for Swift compiler (swiftc)?


I noticed there is "-c" option in swiftc, what does this option do?

swiftc ... -c ....

Is there an official document about this? I couldn't find it from man, --help or online :(


Solution

  • The -c is -emit-object:

    $ swiftc --help
    OVERVIEW: Swift compiler
    
    USAGE: swiftc [options] 
    
    MODES:
      -dump-ast              Parse and type-check input file(s) and dump AST(s)
      -dump-parse            Parse input file(s) and dump AST(s)
      -dump-scope-maps 
                             Parse and type-check input file(s) and dump the scope map(s)
      -dump-type-info        Output YAML dump of fixed-size types from all imported modules
      -dump-type-refinement-contexts
                             Type-check input file(s) and dump type refinement contexts(s)
      -emit-assembly         Emit assembly file(s) (-S)
      -emit-bc               Emit LLVM BC file(s)
      -emit-executable       Emit a linked executable
      -emit-imported-modules Emit a list of the imported modules
      -emit-ir               Emit LLVM IR file(s)
      -emit-library          Emit a linked library
      -emit-object           Emit object file(s) (-c)
      -emit-sibgen           Emit serialized AST + raw SIL file(s)
      -emit-sib              Emit serialized AST + canonical SIL file(s)
      -emit-silgen           Emit raw SIL file(s)
      -emit-sil              Emit canonical SIL file(s)
      -index-file            Produce index data for a source file
      -parse                 Parse input file(s)
      -print-ast             Parse and type-check input file(s) and pretty print AST(s)
      -resolve-imports       Parse and resolve imports in input file(s)
      -typecheck             Parse and type-check input file(s)