Home | History | Annotate | Download | only in docs

Lines Matching full:clang

3 <title>Clang Compiler User's Manual</title>
18 <h1>Clang Compiler User's Manual</h1>
37 <li><a href="#diagnostics_display">Controlling How Clang Displays Diagnostics</a></li>
52 <li><a href="#c_ext">Extensions supported by clang</a></li>
84 <p>The Clang Compiler is an open-source compiler for the C family of programming
86 Clang builds on the LLVM optimizer and code generator, allowing it to provide
88 more general information, please see the <a href="http://clang.llvm.org">Clang
91 <p>This document describes important notes about using Clang as a compiler for
93 you are interested in using Clang to build a tool that processes code, please
94 see <a href="InternalsManual.html">the Clang Internals Manual</a>. If you are
95 interested in the <a href="http://clang.llvm.org/StaticAnalysis.html">Clang
98 <p>Clang is designed to support the C family of programming languages, which
113 <p>In addition to these base languages and their dialects, Clang supports a
117 through Clang-specific features. The Clang driver and language features are
119 reasonably possible, easing migration from GCC to Clang. In most cases, code
122 <p>In addition to language specific features, Clang has a variety of features
129 and contains a basic <a href="#basicusage">introduction to using Clang</a>
196 <p>Clang aims to produce beautiful diagnostics by default, particularly for new
197 users that first come to Clang. However, different people have different
198 preferences, and sometimes Clang is driven by another program that wants to
199 parse simple and consistent output, not a person. For these cases, Clang
208 <dd>This option, which defaults to on, controls whether or not Clang prints the
209 column number of a diagnostic. For example, when this is enabled, Clang will
219 <p>When this is disabled, Clang will print "test.c:28: warning..." with no
226 <dd>This option, which defaults to on, controls whether or not Clang prints the
228 when this is enabled, Clang will print something like:
237 <p>When this is disabled, Clang will not print the "test.c:28:8: " part.</p>
243 <dd>This option, which defaults to on, controls whether or not Clang prints the
245 when this is enabled, Clang will print something like:
257 detected, controls whether or not Clang prints diagnostics in color.
258 When this option is enabled, Clang will use colors to highlight
267 <p>When this is disabled, Clang will just print:</p>
277 <dt id="opt_fdiagnostics-format"><b>-fdiagnostics-format=clang/msvc/vi</b>:
282 <dt><b>clang</b> (default)</dt>
303 Clang prints the associated name.</dd>
309 controls whether or not Clang prints the associated <A
320 <p>Passing <b>-fno-diagnostics-show-option</b> will prevent Clang from printing
330 controls whether or not Clang prints the category associated with a diagnostic
354 <dd>This option, which defaults to on, controls whether or not Clang prints the
365 <p>Passing <b>-fno-diagnostics-fixit-info</b> will prevent Clang from printing
375 <dd>This option, which defaults to off, controls whether or not Clang prints
394 <dd><p>This option makes Clang
464 because it's hard to work around, Clang downgrades it to a warning as
515 <p>Clang provides a number of ways to control which code constructs cause it to
518 <h4 id="diagnostics_display">Controlling How Clang Displays Diagnostics</h4>
520 <p>When Clang emits a diagnostic, it includes rich information in the output,
521 and gives you fine-grain control over which information is printed. Clang has
545 problem (when Clang is certain it knows) [<a
579 mapping of category names to category id's can be obtained by running '<tt>clang
590 <p>Clang can also control what diagnostics are enabled through the use of
592 in a section of source code. Clang supports GCC's pragma for compatibility
597 example code will tell Clang or GCC to ignore the -Wall warnings:</p>
603 <p>In addition to all of the functionality provided by GCC's pragma, Clang
613 #pragma clang diagnostic push
614 #pragma clang diagnostic ignored "-Wmultichar"
618 #pragma clang diagnostic pop
623 use push and pop around GCC compatible diagnostics and Clang will push and pop
625 pragmas. It should be noted that while Clang supports the GCC pragma, Clang and
642 <p>While not strictly part of the compiler, the diagnostics from Clang's <a
643 href="http://clang-analyzer.llvm.org">static analyzer</a> can also be influenced
652 attributes, additional ones have been added to Clang to specifically support the
654 <a href="http://clang-analyzer.llvm.org/annotations.html">analyzer's
657 <li><b><tt>__clang_analyzer__</tt></b>: When the static analyzer is using Clang
696 <p>To generate a PCH file using Clang, one invokes Clang with
702 $ clang -x c-header test.h -o test.h.pch
708 <b><tt>-include</tt></b> option is passed to <tt>clang</tt>:</p>
711 $ clang -include test.h test.c -o test
714 <p>The <tt>clang</tt> driver will first check if a PCH file for <tt>test.h</tt>
716 will be processed from the PCH file. Otherwise, Clang falls back to
720 <p><b>NOTE:</b> Clang does <em>not</em> automatically use PCH files
724 $ clang -x c-header test.h -o test.h.pch
727 $ clang test.c -o test
730 <p>In this example, <tt>clang</tt> will not automatically use the PCH file for
738 alongside the headers. Clang permits the creation of "relocatable" precompiled
758 # clang -x c-header --relocatable-pch -isysroot /path/to/build /path/to/build/mylib.h mylib.h.pch
783 <p>Clang
790 <dd>This option, which defaults to off, controls whether or not Clang
830 <p>The support for standard C in clang is feature-complete except for the C99
834 <h3 id="c_ext">Extensions supported by clang</h3>
837 <p>See <a href="LanguageExtensions.html">clang language extensions</a>.</p>
843 <p>clang supports the -std option, which changes what language mode clang uses.
845 for those modes. If no -std option is specified, clang defaults to gnu99 mode.
890 <p>clang tries to be compatible with gcc as much as possible, but some gcc
895 <li>clang does not support #pragma weak
900 <li>clang does not support decimal floating point types (_Decimal32 and
905 <li>clang does not support nested functions; this is a complex feature which
908 <li>clang does not support global register variables, this is unlikely
912 <li>clang does not support static initialization of flexible array
916 <li>clang does not support __builtin_va_arg_pack/__builtin_va_arg_pack_len.
919 because clang pretends to be like GCC 4.2, and this extension was introduced
920 in 4.3, the glibc headers will not try to use this extension with clang at
923 <li>clang does not support the gcc extension for forward-declaring function
943 <li>clang does not support the gcc extension that allows variable-length arrays
946 extension appears to be rarely used. Note that clang <em>does</em> support
950 <li>clang does not have an equivalent to gcc's "fold"; this means that
951 clang doesn't accept some constructs gcc might accept in contexts where a
954 <li>clang does not support multiple alternative constraints in inline asm; this
958 <li>clang does not support __builtin_apply and friends; this extension is
967 <p>clang has some experimental support for extensions from
975 <li>clang allows setting _MSC_VER with -fmsc-version=. It defaults to 1300 which
977 what Windows SDK and c++stdlib headers clang can compile. This option will be
978 removed when clang supports the full set of MS extensions required for these
981 <li>clang does not support the Microsoft extension where anonymous
984 <li>clang supports the Microsoft "#pragma pack" feature for
986 however where MSVC and GCC are incompatible clang follows the MSVC
1017 Objective-C, and Objective-C++ codebases. Clang only supports a limited number
1023 clang currently contains some support for PPC and Sparc; however, significant
1027 <p>clang contains limited support for the MSP430 embedded processor, but both
1028 the clang support and the LLVM backend support are highly experimental.
1032 is quite easy; see lib/Basic/Targets.cpp in the clang source tree. This level
1056 <p>Clang works on Cygwin-1.7.</p>
1060 <p>Clang works on some mingw32 distributions.
1061 Clang assumes directories as below;</p>
1073 <p>For 32-bit (i686-w64-mingw32), and 64-bit (x86_64-w64-mingw32), Clang assumes as below;<p>
1078 <li><tt>some_directory/bin/clang.exe</tt></li>
1079 <li><tt>some_directory/bin/clang++.exe</tt></li>
1091 <p>Clang expects the GCC executable &quot;gcc.exe&quot; compiled for i686-w64-mingw32 (or x86_64-w64-mingw32) to be present on PATH.</p>