• Home
  • Raw
  • Download

Lines Matching +full:- +full:wno +full:- +full:invalid +full:- +full:source +full:- +full:encoding

11 The Clang Compiler is an open-source compiler for the C family of
14 allowing it to provide high-quality optimization and code generation
20 for an end-user, documenting the supported features, command line
23 `Clang Static Analyzer <http://clang-analyzer.llvm.org>`_, please see its web
27 which includes :ref:`C <c>`, :ref:`Objective-C <objc>`, :ref:`C++ <cxx>`, and
28 :ref:`Objective-C++ <objcxx>` as well as many dialects of those. For
29 language-specific information, please see the corresponding language
32 - :ref:`C Language <c>`: K&R C, ANSI C89, ISO C90, ISO C94 (C89+AMD1), ISO
34 - :ref:`Objective-C Language <objc>`: ObjC 1, ObjC 2, ObjC 2.1, plus
36 - :ref:`C++ Language <cxx>`
37 - :ref:`Objective C++ Language <objcxx>`
43 as to improve functionality through Clang-specific features. The Clang
47 Clang also provides an alternative driver, :ref:`clang-cl`, that is designed
52 being compiled for. Please see the :ref:`Target-Specific Features and
63 -----------
71 -----------
85 options like :option:`-c`, :option:`-g`, etc.
88 ---------------------------------------------
90 .. option:: -Werror
95 .. -Werror, and Sphinx complains.
97 ``-Werror=foo``
101 .. option:: -Wno-error=foo
103 Turn warning "foo" into an warning even if :option:`-Werror` is specified.
105 .. option:: -Wfoo
109 .. option:: -Wno-foo
113 .. option:: -w
117 .. option:: -Weverything
121 .. option:: -pedantic
125 .. option:: -pedantic-errors
129 .. option:: -Wsystem-headers
133 .. option:: -ferror-limit=123
136 20, and the error limit can be disabled with `-ferror-limit=0`.
138 .. option:: -ftemplate-backtrace-limit=123
142 the limit can be disabled with `-ftemplate-backtrace-limit=0`.
156 .. _opt_fshow-column:
158 **-f[no-]show-column**
167 test.c:28:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
176 line; take care if your source contains multibyte characters.
178 .. _opt_fshow-source-location:
180 **-f[no-]show-source-location**
181 Print source file/line/column information in diagnostic.
189 test.c:28:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
197 .. _opt_fcaret-diagnostics:
199 **-f[no-]caret-diagnostics**
200 Print source line and ranges from source code in diagnostic.
202 prints the source line, source ranges, and caret when emitting a
208 test.c:28:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
213 **-f[no-]color-diagnostics**
214 This option, which defaults to on when a color-capable terminal is
225 …"color:magenta">warning</span>: extra tokens at end of #endif directive [-Wextra-tokens]</span></b>
235 test.c:2:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
240 **-fansi-escape-codes**
245 .. option:: -fdiagnostics-format=clang/msvc/vi
268 .. _opt_fdiagnostics-show-option:
270 **-f[no-]diagnostics-show-option**
271 Enable ``[-Woption]`` information in diagnostic line.
280 test.c:28:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
285 Passing **-fno-diagnostics-show-option** will prevent Clang from
286 printing the [:ref:`-Wextra-tokens <opt_Wextra-tokens>`] information in
291 .. _opt_fdiagnostics-show-category:
293 .. option:: -fdiagnostics-show-category=none/id/name
308 … t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat]
309 … t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,1]
310 …t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,Fo…
316 .. _opt_fdiagnostics-fixit-info:
318 **-f[no-]diagnostics-fixit-info**
327 test.c:28:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
332 Passing **-fno-diagnostics-fixit-info** will prevent Clang from
337 .. _opt_fdiagnostics-print-source-range-info:
339 **-fdiagnostics-print-source-range-info**
340 Print machine parsable information about source ranges.
341 This option makes Clang print information about source ranges in a machine
348 …exprs.c:47:15:{47:8-47:14}{47:17-47:24}: error: invalid operands to binary expression ('int *' and…
349 P = (P-42) + Gamma*4;
352 The {}'s are generated by -fdiagnostics-print-source-range-info.
355 line; take care if your source contains multibyte characters.
357 .. option:: -fdiagnostics-parseable-fixits
359 Print Fix-Its in a machine parseable form.
361 This option makes Clang print available Fix-Its in a machine
367 fix-it:"t.cpp":{7:25-7:29}:"Gamma"
369 The range printed is a half-open range, so in this example the
376 non-printable characters (as octal "\\xxx").
379 line; take care if your source contains multibyte characters.
381 .. option:: -fno-elide-type
397 -fno-elide-type:
403 .. option:: -fdiagnostics-show-template-tree
410 -fno-elide-type.
418 With :option:`-fdiagnostics-show-template-tree`:
437 .. _opt_wextra-tokens:
439 .. option:: -Wextra-tokens
448 test.c:28:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
455 .. option:: -Wambiguous-member-template
479 .. option:: -Wbind-to-temporary-copy
516 ------------------------------------------
522 generates preprocessed source file(s) and associated run script(s) upon
527 .. option:: -fno-crash-diagnostics
529 Disable auto-generation of preprocessed source files during a clang crash.
531 The -fno-crash-diagnostics flag can be helpful for speeding the process
535 ------------------------------------
537 Optimization reports trace, at a high-level, all the major decisions
546 1. When the pass makes a transformation (:option:`-Rpass`).
548 2. When the pass fails to make a transformation (:option:`-Rpass-missed`).
551 (:option:`-Rpass-analysis`).
553 NOTE: Although the discussion below focuses on :option:`-Rpass`, the exact
554 same options apply to :option:`-Rpass-missed` and :option:`-Rpass-analysis`.
561 .. code-block:: console
563 $ clang -O2 -Rpass=inline code.cc -o code
564 code.cc:4:25: remark: foo inlined into bar [-Rpass=inline]
565 int bar(int j) { return foo(j, j - 2); }
568 Note that remarks from the inliner are identified with `[-Rpass=inline]`.
570 :option:`-Rpass=.*` (in fact, you can use any valid POSIX regular
585 2. Some source locations are not displayed correctly. The front end has
586 a more detailed source location tracking than the locations included
588 expansions). However, the locations used by :option:`-Rpass` are
593 -------------
596 .. option:: -MV
602 When Clang emits a dependency file (e.g., you supplied the -M option)
607 a special character, which is the convention used by GNU Make. The -MV
608 option tells Clang to put double-quotes around the entire filename, which
612 Language and Target-Independent Features
616 -------------------------------
626 output, and gives you fine-grain control over which information is
631 occurs in your code [:ref:`-fshow-column <opt_fshow-column>`,
632 :ref:`-fshow-source-location <opt_fshow-source-location>`].
638 [:ref:`-fdiagnostics-show-option <opt_fdiagnostics-show-option>`].
639 #. A :ref:`high-level category <diagnostics_categories>` for the diagnostic
642 [:ref:`-fdiagnostics-show-category <opt_fdiagnostics-show-category>`].
643 #. The line of source code that the issue occurs on, along with a caret
645 [:ref:`-fcaret-diagnostics <opt_fcaret-diagnostics>`].
648 [:ref:`-fdiagnostics-fixit-info <opt_fdiagnostics-fixit-info>`].
649 #. A machine-parsable representation of the ranges involved (off by
651 [:ref:`-fdiagnostics-print-source-range-info <opt_fdiagnostics-print-source-range-info>`].
661 - Ignored
662 - Note
663 - Remark
664 - Warning
665 - Error
666 - Fatal
674 high-level category. This category is intended to make it possible to
679 :ref:`-fdiagnostics-show-category <opt_fdiagnostics-show-category>` option.
683 by running '``clang --print-diagnostic-categories``'.
688 TODO: -W flags, -pedantic, etc
696 pragmas in the source code. This is useful for turning off specific
697 warnings in a section of source code. Clang supports GCC's pragma for
698 compatibility with existing source code, as well as several extensions.
702 following example code will tell Clang or GCC to ignore the -Wall
705 .. code-block:: c
707 #pragma GCC diagnostic ignored "-Wall"
714 In the below example :option:`-Wextra-tokens` is ignored for only a single line
718 .. code-block:: c
723 #pragma clang diagnostic ignored "-Wextra-tokens"
743 .. code-block:: c
756 .. code-block:: c
769 include path specified by ``-isystem``, but this can be overridden in
776 .. code-block:: c
786 The :option:`--system-header-prefix=` and :option:`--no-system-header-prefix=`
787 command-line arguments can be used to override whether subsets of an include
791 command-line which matches the specified header name takes precedence.
794 .. code-block:: console
796 $ clang -Ifoo -isystem bar --system-header-prefix=x/ \
797 --no-system-header-prefix=x/y/
813 In addition to the traditional ``-W`` flags, one can enable **all**
814 diagnostics by passing :option:`-Weverything`. This works as expected
816 :option:`-Werror`, and also includes the warnings from :option:`-pedantic`.
818 Note that when combined with :option:`-w` (which disables all warnings), that
825 `static analyzer <http://clang-analyzer.llvm.org>`_ can also be
826 influenced by the user via changes to the source code. See the available
827 `annotations <http://clang-analyzer.llvm.org/annotations.html>`_ and the
829 page <http://clang-analyzer.llvm.org/faq.html#exclude_code>`_ for more
832 .. _usersmanual-precompiled-headers:
835 -------------------
841 source files. Consequently, compile times can often be greatly improved
845 on-disk cache that contains the vital information necessary to reduce
855 :option:`-x <language>-header` option. This mirrors the interface in GCC
858 .. code-block:: console
860 $ gcc -x c-header test.h -o test.h.gch
861 $ clang -x c-header test.h -o test.h.pch
866 A PCH file can then be used as a prefix header when a :option:`-include`
869 .. code-block:: console
871 $ clang -include test.h test.c -o test
882 included within a source file. For example:
884 .. code-block:: console
886 $ clang -x c-header test.h -o test.h.pch
889 $ clang test.c -o test
892 ``test.h`` since ``test.h`` was included directly in the source file and not
893 specified on the command line using :option:`-include`.
916 arguments. First, pass the ``--relocatable-pch`` flag to indicate that
918 :option:`-isysroot /path/to/build`, which makes all includes for your library
921 .. code-block:: console
923 # clang -x c-header --relocatable-pch -isysroot /path/to/build /path/to/build/mylib.h mylib.h.pch
928 in some other system root, the :option:`-isysroot` option can be used provide
930 example, :option:`-isysroot /Developer/SDKs/MacOSX10.4u.sdk` will look for
938 .. _controlling-code-generation:
941 ---------------------------
946 **-f[no-]sanitize=check1,check2,...**
955 - .. _opt_fsanitize_address:
957 ``-fsanitize=address``:
960 - .. _opt_fsanitize_thread:
962 ``-fsanitize=thread``: :doc:`ThreadSanitizer`, a data race detector.
963 - .. _opt_fsanitize_memory:
965 ``-fsanitize=memory``: :doc:`MemorySanitizer`,
968 - .. _opt_fsanitize_undefined:
970 ``-fsanitize=undefined``: :doc:`UndefinedBehaviorSanitizer`,
973 - ``-fsanitize=dataflow``: :doc:`DataFlowSanitizer`, a general data
975 - ``-fsanitize=cfi``: :doc:`control flow integrity <ControlFlowIntegrity>`
976 checks. Requires ``-flto``.
977 - ``-fsanitize=safe-stack``: :doc:`safe stack <SafeStack>`
978 protection against stack-based memory corruption errors.
980 There are more fine-grained checks available: see
981 the :ref:`list <ubsan-checks>` of specific kinds of
982 undefined behavior that can be detected and the :ref:`list <cfi-schemes>`
985 The ``-fsanitize=`` argument must also be provided when linking, in
988 It is not possible to combine more than one of the ``-fsanitize=address``,
989 ``-fsanitize=thread``, and ``-fsanitize=memory`` checkers in the same
992 **-f[no-]sanitize-recover=check1,check2,...**
994 **-f[no-]sanitize-recover=all**
996 Controls which checks enabled by ``-fsanitize=`` flag are non-fatal.
1000 By default, non-fatal checks are those enabled by
1002 except for ``-fsanitize=return`` and ``-fsanitize=unreachable``. Some
1007 Note that the ``-fsanitize-trap`` flag has precedence over this flag.
1011 ``-fno-sanitize-trap``.
1013 For example, if a command line contains the flags ``-fsanitize=undefined
1014 -fsanitize-trap=undefined``, the flag ``-fsanitize-recover=alignment``
1016 ``-fno-sanitize-trap=alignment``.
1018 **-f[no-]sanitize-trap=check1,check2,...**
1020 Controls which checks enabled by the ``-fsanitize=`` flag trap. This
1028 is supplied together with ``-fsanitize=undefined``, the ``vptr`` sanitizer
1033 .. option:: -fsanitize-blacklist=/path/to/blacklist/file
1035 Disable or modify sanitizer checks for objects (source files, functions,
1039 .. option:: -fno-sanitize-blacklist
1043 **-f[no-]sanitize-coverage=[type,features,...]**
1048 **-f[no-]sanitize-stats**
1053 .. option:: -fsanitize-undefined-trap-on-error
1055 Deprecated alias for ``-fsanitize-trap=undefined``.
1057 .. option:: -fsanitize-cfi-cross-dso
1059 Enable cross-DSO control flow integrity checks. This flag modifies
1061 of cross-DSO virtual and indirect calls.
1063 .. option:: -ffast-math
1065 Enable fast-math mode. This defines the ``__FAST_MATH__`` preprocessor
1066 macro, and lets the compiler make aggressive, potentially-lossy assumptions
1067 about floating-point math. These include:
1069 * Floating-point math obeys regular algebraic rules for real numbers (e.g.
1072 * operands to floating-point operations are not equal to ``NaN`` and
1074 * ``+0`` and ``-0`` are interchangeable.
1076 .. option:: -fwhole-program-vtables
1078 Enable whole-program vtable optimizations, such as single-implementation
1080 :doc:`hidden LTO visibility <LTOVisibility>`. Requires ``-flto``.
1082 .. option:: -fno-assume-sane-operator-new
1090 .. option:: -ftrap-function=[name]
1104 .. option:: -ftls-model=[model]
1108 Valid values are: ``global-dynamic``, ``local-dynamic``,
1109 ``initial-exec`` and ``local-exec``. The default value is
1110 ``global-dynamic``. The compiler may use a different model if the
1115 .. option:: -femulated-tls
1117 Select emulated TLS model, which overrides all -ftls-model choices.
1122 .. option:: -mhwdiv=[values]
1132 .. option:: -m[no-]crc
1141 .. option:: -mgeneral-regs-only
1148 .. option:: -mcompact-branches=[values]
1158 **-f[no-]max-type-align=[number]**
1168 not promise to return memory that is more than 8-byte or 16-byte-aligned. Use
1175 This option can be overridden on a case-by-case basis by putting an explicit
1178 .. code-block:: console
1181 // Make an aligned typedef of the AVX-512 16-int vector type.
1185 // The compiler may assume that ‘v’ is 64-byte aligned, regardless of the
1186 // value of -fmax-type-align.
1191 ---------------------------
1219 via ``-fprofile-instr-generate`` must be used with ``-fprofile-instr-use``.
1221 converted and used with ``-fprofile-sample-use``.
1228 sampling profiles for code coverage, sample-based profiles are too
1229 coarse-grained for code coverage purposes; it would yield poor results.
1251 1. Build the code with source line table information. You can use all the
1253 requirement is that you add ``-gline-tables-only`` or ``-g`` to the
1255 instructions back to source line locations.
1257 .. code-block:: console
1259 $ clang++ -O2 -gline-tables-only code.cc -o code
1268 .. code-block:: console
1270 $ perf record -b ./code
1272 Note the use of the ``-b`` flag. This tells Perf to use the Last Branch
1283 .. code-block:: console
1285 $ create_llvm_prof --binary=./code --out=code.prof
1289 without the ``-b`` flag, you need to use ``--use_lbr=false`` when
1297 with ``-gline-tables-only`` and ``-fprofile-sample-use``.
1299 .. code-block:: console
1301 $ clang++ -O2 -gline-tables-only -fprofile-sample-use=code.prof code.cc -o code
1314 the binary or gcov formats using the ``llvm-profdata`` tool.
1316 2. Binary encoding. This uses a more efficient encoding that yields smaller
1320 3. GCC encoding. This is based on the gcov format, which is accepted by GCC. It
1321 is only interesting in environments where GCC and Clang co-exist. This
1322 encoding is only generated by the ``create_gcov`` tool in
1324 ``llvm-profdata``, but it cannot be generated by either.
1337 of the other two, consult the ``ProfileData`` library in in LLVM's source tree
1340 .. code-block:: console
1361 stack of source locations in which the top of the stack represents the
1374 - Sampled line represents the profile information of a source location.
1377 - Callsite line represents the profile information of an inlined callsite.
1383 a. Source line offset. This number represents the line number
1402 same source line location.
1407 time. But both calls to ``foo`` and ``bar`` are at the same source
1418 number of samples collected by the profiler at this source
1425 .. code-block:: console
1433 As an example, consider a program with the call chain ``main -> foo -> bar``.
1438 .. code-block:: console
1465 ``-fprofile-instr-generate`` option.
1467 .. code-block:: console
1469 $ clang++ -O2 -fprofile-instr-generate code.cc -o code
1479 .. code-block:: console
1481 $ LLVM_PROFILE_FILE="code-%p.profraw" ./code
1485 ``llvm-profdata`` tool to do this.
1487 .. code-block:: console
1489 $ llvm-profdata merge -output=code.profdata code-*.profraw
1494 4. Build the code again using the ``-fprofile-instr-use`` option to specify the
1497 .. code-block:: console
1499 $ clang++ -O2 -fprofile-instr-use=code.profdata code.cc -o code
1505 Profile generation and use can also be controlled by the GCC-compatible flags
1506 ``-fprofile-generate`` and ``-fprofile-use``. Although these flags are
1508 GCC-compatible profiles. They are only meant to implement GCC's semantics
1511 .. option:: -fprofile-generate[=<dirname>]
1513 Without any other arguments, ``-fprofile-generate`` behaves identically to
1514 ``-fprofile-instr-generate``. When given a directory name, it generates the
1520 .. code-block:: console
1522 $ clang++ -O2 -fprofile-generate=yyy/zzz code.cc -o code
1528 .. code-block:: console
1537 .. option:: -fprofile-use[=<pathname>]
1539 Without any other arguments, ``-fprofile-use`` behaves identically to
1540 ``-fprofile-instr-use``. Otherwise, if ``pathname`` is the full path to a
1551 In these cases, you can use the flag ``-fno-profile-instr-generate`` (or
1552 ``-fno-profile-generate``) to disable profile generation, and
1553 ``-fno-profile-instr-use`` (or ``-fno-profile-use``) to disable profile use.
1559 -----------------------------
1567 .. option:: -g0
1571 .. option:: -gline-tables-only
1580 .. option:: -fstandalone-debug
1591 The **-fstandalone-debug** option turns off these optimizations.
1592 This is useful when working with 3rd-party libraries that don't come
1596 .. option:: -fno-standalone-debug
1598 On Darwin **-fstandalone-debug** is enabled by default. The
1599 **-fno-standalone-debug** option can be used to get to turn on the
1600 vtable-based optimization described above.
1602 .. option:: -g
1613 .. option:: -ggdb, -glldb, -gsce
1616 debugger, respectively. Each of these options implies **-g**. (Therefore, if
1617 you want both **-gline-tables-only** and debugger tuning, the tuning option
1622 -----------------------
1624 Clang parses Doxygen and non-Doxygen style documentation comments and attaches
1626 Doxygen-style comments and ignores ordinary comments starting with ``//`` and
1629 .. option:: -Wdocumentation
1638 .. option:: -Wno-documentation-unknown-command
1642 .. option:: -fparse-all-comments
1647 .. option:: -fcomment-block-commands=[commands]
1652 *without trailing space*; e.g. ``-fcomment-block-commands=foo,bar`` defines
1655 It is also possible to use ``-fcomment-block-commands`` several times; e.g.
1656 ``-fcomment-block-commands=foo -fcomment-block-commands=bar`` does the same
1664 The support for standard C in clang is feature-complete except for the
1665 C99 floating-point pragmas.
1668 -----------------------------
1673 ------------------------------------------
1675 clang supports the -std option, which changes what language mode clang
1677 gnu11, and various aliases for those modes. If no -std option is
1680 ``-pedantic-errors`` to request an error if a feature from a later standard
1685 - ``c*`` modes define "``__STRICT_ANSI__``".
1686 - Target-specific defines not prefixed by underscores, like "linux",
1688 - Trigraphs default to being off in ``gnu*`` modes; they can be enabled by
1689 the -trigraphs option.
1690 - The parser recognizes "asm" and "typeof" as keywords in ``gnu*`` modes;
1693 - The Apple "blocks" extension is recognized by default in ``gnu*`` modes
1694 on some platforms; it can be enabled in any mode with the "-fblocks"
1696 - Arrays that are VLA's according to the standard, but which can be
1703 - The ``*99`` modes default to implementing "inline" as specified in C99,
1707 - Digraphs are not recognized in c89 mode.
1708 - The scope of names defined inside a "for", "if", "switch", "while",
1711 - ``__STDC_VERSION__`` is not defined in ``*89`` modes.
1712 - "inline" is not recognized as a keyword in c89 mode.
1713 - "restrict" is not recognized as a keyword in ``*89`` modes.
1714 - Commas are allowed in integer constant expressions in ``*99`` modes.
1715 - Arrays which are not lvalues are not implicitly promoted to pointers
1717 - Some warnings are different.
1721 - Warnings for use of C11 features are disabled.
1722 - ``__STDC_VERSION__`` is defined to ``201112L`` rather than ``199901L``.
1728 ----------------------------------
1733 - clang does not support decimal floating point types (``_Decimal32`` and
1734 friends) or fixed-point types (``_Fract`` and friends); nobody has
1737 - clang does not support nested functions; this is a complex feature
1742 .. code-block:: cpp
1750 - clang does not support static initialization of flexible array
1753 - clang does not support
1760 - clang does not support the gcc extension for forward-declaring
1761 function parameters; this has not shown up in any real-world code
1765 missing from this list, please send an e-mail to cfe-dev. This list
1767 list does not include bugs in mostly-implemented features; please see
1769 tracker <http://llvm.org/bugs/buglist.cgi?quicksearch=product%3Aclang+component%3A-New%2BBugs%2CAST…
1770 for known existing bugs (FIXME: Is there a section for bug-reporting
1774 ----------------------------------------
1776 - clang does not support the gcc extension that allows variable-length
1782 - clang does not have an equivalent to gcc's "fold"; this means that
1784 where a constant expression is required, like "x-x" where x is a
1786 - clang does not support ``__builtin_apply`` and friends; this extension
1792 --------------------
1795 extensions, use the ``-fms-extensions`` command-line option. This is the default
1800 clang has a ``-fms-compatibility`` flag that makes clang accept enough
1801 invalid C++ to be able to parse most Microsoft headers. For example, it
1807 ``-fdelayed-template-parsing`` lets clang delay parsing of function template
1814 C++ 2013. The ``-fms-compatibility-version=`` flag overrides these values. It
1817 example, ``-fms-compatibility-version=19`` will enable C++14 features and define
1830 ---------------------------------
1832 .. option:: -fbracket-depth=N
1837 .. option:: -fconstexpr-depth=N
1842 .. option:: -ftemplate-depth=N
1847 .. option:: -foperator-arrow-depth=N
1849 Sets the limit for iterative calls to 'operator->' functions to N. The
1854 Objective-C Language Features
1859 Objective-C++ Language Features
1870 set of atomic constructs, ``proc_bind`` clause for all parallel-based
1875 Use :option:`-fopenmp` to enable OpenMP. Support for OpenMP can be disabled with
1876 :option:`-fno-openmp`.
1879 ---------------------------------
1881 .. option:: -fopenmp-use-tls
1885 local variables, using TLS support. If :option:`-fno-openmp-use-tls`
1891 Target-Specific Features and Limitations
1895 ------------------------------------------
1900 The support for X86 (both 32-bit and 64-bit) is considered stable on
1902 to correctly compile many large C, C++, Objective-C, and Objective-C++
1905 On ``x86_64-mingw32``, passing i128(by value) is incompatible with the
1909 For the X86 target, clang supports the :option:`-m16` command line
1910 argument which enables 16-bit code output. This is broadly similar to
1912 and the ABI remains 32-bit but the assembler emits instructions
1913 appropriate for a CPU running in 16-bit mode, with address-size and
1914 operand-size prefixes to enable 32-bit addressing and operations.
1921 C++, Objective-C, and Objective-C++ codebases. Clang only supports a
1946 platform is quite easy; see ``lib/Basic/Targets.cpp`` in the clang source
1954 -----------------------------------------
1972 Clang works on Cygwin-1.7.
1980 - ``C:/mingw/include``
1981 - ``C:/mingw/lib``
1982 - ``C:/mingw/lib/gcc/mingw32/4.[3-5].0/include/c++``
1986 MinGW-w64
1989 For 32-bit (i686-w64-mingw32), and 64-bit (x86\_64-w64-mingw32), Clang
1992 - ``GCC versions 4.5.0 to 4.5.3, 4.6.0 to 4.6.2, or 4.7.0 (for the C++ header search path)``
1993 - ``some_directory/bin/gcc.exe``
1994 - ``some_directory/bin/clang.exe``
1995 - ``some_directory/bin/clang++.exe``
1996 - ``some_directory/bin/../include/c++/GCC_version``
1997 - ``some_directory/bin/../include/c++/GCC_version/x86_64-w64-mingw32``
1998 - ``some_directory/bin/../include/c++/GCC_version/i686-w64-mingw32``
1999 - ``some_directory/bin/../include/c++/GCC_version/backward``
2000 - ``some_directory/bin/../x86_64-w64-mingw32/include``
2001 - ``some_directory/bin/../i686-w64-mingw32/include``
2002 - ``some_directory/bin/../include``
2005 official `MinGW-w64 website <http://mingw-w64.sourceforge.net>`_.
2008 ``i686-w64-mingw32`` (or ``x86_64-w64-mingw32``) to be present on PATH.
2011 ``x86_64-w64-mingw32``.
2013 .. _clang-cl:
2015 clang-cl
2018 clang-cl is an alternative command-line interface to Clang driver, designed for
2021 To enable clang-cl to find system headers, libraries, and the linker when run
2022 from the command-line, it should be executed inside a Visual Studio Native Tools
2024 up using e.g. `vcvars32.bat <http://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx>`_.
2026 clang-cl can also be used from inside Visual Studio by using an LLVM Platform
2029 Command-Line Options
2030 --------------------
2032 To be compatible with cl.exe, clang-cl supports most of the same command-line
2033 options. Those options can start with either ``/`` or ``-``. It also supports
2034 some of Clang's core options, such as the ``-W`` options.
2036 Options that are known to clang-cl, but not currently supported, are ignored
2041 clang-cl.exe: warning: argument unused during compilation: '/AI'
2043 To suppress warnings about unused arguments, use the ``-Qunused-arguments`` option.
2045 Options that are not known to clang-cl will be ignored by default. Use the
2046 ``-Werror=unknown-argument`` option in order to treat them as errors. If these
2051 clang-cl.exe: error: no such file or directory: '/foobar'
2054 for any valid cl.exe flags that clang-cl does not understand.
2056 Execute ``clang-cl /?`` to see a list of supported options:
2063 /Brepro- Emit an object file which cannot be reproduced over time
2071 /fallback Fall back to cl.exe if clang-cl fails to compile
2078 /fp:except-
2083 /GA Assume thread-local variables are defined in the executable
2084 /GF- Disable string pooling
2085 /GR- Disable emission of RTTI data
2088 /Gw- Don't put each data item in its own section
2090 /Gy- Don't put each function in its own section
2098 /MDd Use DLL debug run-time
2099 /MD Use DLL run-time
2100 /MTd Use static debug run-time
2101 /MT Use static run-time
2104 /Oi- Disable use of builtin functions
2111 /Qvec- Disable the loop vectorization passes
2114 /TC Treat all source files as C
2115 /Tc <filename> Specify a C source file
2116 /TP Treat all source files as C++
2117 /Tp <filename> Specify a C++ source file
2120 /vmb Use a best-case representation method for member pointers
2121 /vmg Use a most-general representation for member pointers
2122 /vmm Set the default most-general representation to multiple inheritance
2123 /vms Set the default most-general representation to single inheritance
2124 /vmv Set the default most-general representation to virtual inheritance
2128 /W1 Enable -Wall
2129 /W2 Enable -Wall
2130 /W3 Enable -Wall
2131 /W4 Enable -Wall and -Wextra
2132 /Wall Enable -Wall and -Wextra
2133 /WX- Do not treat warnings as errors
2137 /Zc:sizedDealloc- Disable C++14 sized global deallocation functions
2140 /Zc:threadSafeInit- Disable thread-safe initialization of static variables
2141 /Zc:threadSafeInit Enable thread-safe initialization of static variables
2142 /Zc:trigraphs- Disable trigraphs (default)
2148 /Zs Syntax-check only
2151 -### Print (but do not run) the commands to run for this compilation
2152 --analyze Run the static analyzer
2153 -fansi-escape-codes Use ANSI escape codes for diagnostics
2154 -fcolor-diagnostics Use colors in diagnostics
2155 -fdiagnostics-parseable-fixits
2156 Print fix-its in machine parseable form
2157 -fms-compatibility-version=<value>
2158 Dot-separated value representing the Microsoft compiler version
2160 -fms-compatibility Enable full Microsoft Visual C++ compatibility
2161-fms-extensions Accept some non-standard constructs supported by the Microsoft compiler
2162 -fmsc-version=<value> Microsoft compiler version number to report in _MSC_VER
2164 -fno-sanitize-coverage=<value>
2166 -fno-sanitize-recover=<value>
2168 -fno-sanitize-trap=<value>
2170 -fsanitize-blacklist=<value>
2172 -fsanitize-coverage=<value>
2174 -fsanitize-recover=<value>
2176 -fsanitize-trap=<value> Enable trapping for specified sanitizers
2177 -fsanitize=<check> Turn on runtime checks for various forms of undefined or suspicious
2179 -gcodeview Generate CodeView debug information
2180 -mllvm <value> Additional arguments to forward to LLVM's option processing
2181 -Qunused-arguments Don't emit warning for unused driver arguments
2182 -R<remark> Enable the specified remark
2183 --target=<value> Generate code for the given target
2184 -v Show commands to run and use verbose output
2185 -W<warning> Enable the specified warning
2186 -Xclang <arg> Pass <arg> to the clang compiler
2191 When clang-cl is run with the ``/fallback`` option, it will first try to
2196 clang-cl cannot successfully compile all the files. clang-cl may fail to compile