<commit_before><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
          "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Clang Compiler User's Manual</title>
<link type="text/css" rel="stylesheet" href="../menu.css">
<link type="text/css" rel="stylesheet" href="../content.css">
<style type="text/css">
td {
	vertical-align: top;
}
</style>
</head>
<body>

<!--#include virtual="../menu.html.incl"-->

<div id="content">

<h1>Clang Compiler User's Manual</h1>

<ul>
<li><a href="#intro">Introduction</a>
  <ul>
  <li><a href="#terminology">Terminology</a></li>
  <li><a href="#basicusage">Basic Usage</a></li>
  </ul>
</li>
<li><a href="#commandline">Command Line Options</a>
  <ul>
  <li><a href="#cl_diagnostics">Options to Control Error and Warning
      Messages</a></li>
  </ul>
</li>
<li><a href="#general_features">Language and Target-Independent Features</a>
 <ul>
  <li><a href="#diagnostics">Controlling Errors and Warnings</a>
   <ul>
   <li><a href="#diagnostics_display">Controlling How Clang Displays Diagnostics</a></li>
   <li><a href="#diagnostics_mappings">Diagnostic Mappings</a></li>
   <li><a href="#diagnostics_categories">Diagnostic Categories</a></li>
   <li><a href="#diagnostics_commandline">Controlling Diagnostics via Command Line Flags</a></li>
   <li><a href="#diagnostics_pragmas">Controlling Diagnostics via Pragmas</a></li>
   <li><a href="#diagnostics_enable_everything">Enabling All Warnings</a></li>
   <li><a href="#analyzer_diagnositics">Controlling Static Analyzer Diagnostics</a></li>
   </ul>
  </li>
  <li><a href="#precompiledheaders">Precompiled Headers</a></li>
  <li><a href="#codegen">Controlling Code Generation</a></li>
 </ul>
</li>
<li><a href="#c">C Language Features</a>
  <ul>
  <li><a href="#c_ext">Extensions supported by clang</a></li>
  <li><a href="#c_modes">Differences between various standard modes</a></li>
  <li><a href="#c_unimpl_gcc">GCC extensions not implemented yet</a></li>
  <li><a href="#c_unsupp_gcc">Intentionally unsupported GCC extensions</a></li>
  <li><a href="#c_ms">Microsoft extensions</a></li>
  </ul>
</li>
<li><a href="#cxx">C++ Language Features</a>
  <ul>
  <li><a href="#cxx_implimits">Controlling implementation limits</a></li>
  </ul>
</li>
<li><a href="#target_features">Target-Specific Features and Limitations</a>
  <ul>
  <li><a href="#target_arch">CPU Architectures Features and Limitations</a>
    <ul>
    <li><a href="#target_arch_x86">X86</a></li>
    <li><a href="#target_arch_arm">ARM</a></li>
    <li><a href="#target_arch_other">Other platforms</a></li>
    </ul>
  </li>
  <li><a href="#target_os">Operating System Features and Limitations</a>
    <ul>
    <li><a href="#target_os_darwin">Darwin (Mac OS/X)</a></li>
    <li>Linux, etc.</li>
    <li><a href="#target_os_win32">Windows</a></li>
    </ul>
  </li>
  </ul>
</li>
</ul>


<!-- ======================================================================= -->
<h2 id="intro">Introduction</h2>
<!-- ======================================================================= -->

<p>The Clang Compiler is an open-source compiler for the C family of programming
languages, aiming to be the best in class implementation of these languages.
Clang builds on the LLVM optimizer and code generator, allowing it to provide
high-quality optimization and code generation support for many targets.  For
more general information, please see the <a href="http://clang.llvm.org">Clang
Web Site</a> or the <a href="http://llvm.org">LLVM Web Site</a>.</p>

<p>This document describes important notes about using Clang as a compiler for
an end-user, documenting the supported features, command line options, etc.  If
you are interested in using Clang to build a tool that processes code, please
see <a href="InternalsManual.html">the Clang Internals Manual</a>.  If you are
interested in the <a href="http://clang-analyzer.llvm.org">Clang
Static Analyzer</a>, please see its web page.</p>

<p>Clang is designed to support the C family of programming languages, which
includes <a href="#c">C</a>, <a href="#objc">Objective-C</a>, <a
href="#cxx">C++</a>, and <a href="#objcxx">Objective-C++</a> as well as many
dialects of those.  For language-specific information, please see the
corresponding language specific section:</p>

<ul>
<li><a href="#c">C Language</a>: K&amp;R C, ANSI C89, ISO C90, ISO C94
    (C89+AMD1), ISO C99 (+TC1, TC2, TC3). </li>
<li><a href="#objc">Objective-C Language</a>: ObjC 1, ObjC 2, ObjC 2.1, plus
    variants depending on base language.</li>
<li><a href="#cxx">C++ Language</a></li>
<li><a href="#objcxx">Objective C++ Language</a></li>
</ul>

<p>In addition to these base languages and their dialects, Clang supports a
broad variety of language extensions, which are documented in the corresponding
language section.  These extensions are provided to be compatible with the GCC,
Microsoft, and other popular compilers as well as to improve functionality
through Clang-specific features.  The Clang driver and language features are
intentionally designed to be as compatible with the GNU GCC compiler as
reasonably possible, easing migration from GCC to Clang.  In most cases, code
"just works".</p>

<p>In addition to language specific features, Clang has a variety of features
that depend on what CPU architecture or operating system is being compiled for.
Please see the <a href="#target_features">Target-Specific Features and
Limitations</a> section for more details.</p>

<p>The rest of the introduction introduces some basic <a
href="#terminology">compiler terminology</a> that is used throughout this manual
and contains a basic <a href="#basicusage">introduction to using Clang</a>
as a command line compiler.</p>

<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<h3 id="terminology">Terminology</h3>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->

<p>Front end, parser, backend, preprocessor, undefined behavior, diagnostic,
 optimizer</p>

<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<h3 id="basicusage">Basic Usage</h3>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->

<p>Intro to how to use a C compiler for newbies.</p>
<p>
compile + link

compile then link

debug info

enabling optimizations

picking a language to use, defaults to C99 by default.  Autosenses based on
extension.

using a makefile
</p>


<!-- ======================================================================= -->
<h2 id="commandline">Command Line Options</h2>
<!-- ======================================================================= -->

<p>
This section is generally an index into other sections.  It does not go into
depth on the ones that are covered by other sections.  However, the first part
introduces the language selection and other high level options like -c, -g, etc.
</p>


<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<h3 id="cl_diagnostics">Options to Control Error and Warning Messages</h3>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->

<p><b>-Werror</b>: Turn warnings into errors.</p>
<p><b>-Werror=foo</b>: Turn warning "foo" into an error.</p>
<p><b>-Wno-error=foo</b>: Turn warning "foo" into an warning even if -Werror is
   specified.</p>
<p><b>-Wfoo</b>: Enable warning foo</p>
<p><b>-Wno-foo</b>: Disable warning foo</p>
<p><b>-w</b>: Disable all warnings.</p>
<p><b>-pedantic</b>: Warn on language extensions.</p>
<p><b>-pedantic-errors</b>: Error on language extensions.</p>
<p><b>-Wsystem-headers</b>: Enable warnings from system headers.</p>

<p><b>-ferror-limit=123</b>: Stop emitting diagnostics after 123 errors have
   been produced.  The default is 20, and the error limit can be disabled with
   -ferror-limit=0.</p>

<p><b>-ftemplate-backtrace-limit=123</b>: Only emit up to 123 template instantiation notes within the template instantiation backtrace for a single warning or error. The default is 10, and the limit can be disabled with -ftemplate-backtrace-limit=0.</p>

<!-- ================================================= -->
<h4 id="cl_diag_formatting">Formatting of Diagnostics</h4>
<!-- ================================================= -->

<p>Clang aims to produce beautiful diagnostics by default, particularly for new
users that first come to Clang.  However, different people have different
preferences, and sometimes Clang is driven by another program that wants to
parse simple and consistent output, not a person. For these cases, Clang
provides a wide range of options to control the exact output format of the
diagnostics that it generates.</p>

<dl>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<dt id="opt_fshow-column"><b>-f[no-]show-column</b>: Print column number in
diagnostic.</dt>
<dd>This option, which defaults to on, controls whether or not Clang prints the<commit_msg>Add clang crash diagnostic info and associated flags to Clang user manual.<commit_after><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
          "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Clang Compiler User's Manual</title>
<link type="text/css" rel="stylesheet" href="../menu.css">
<link type="text/css" rel="stylesheet" href="../content.css">
<style type="text/css">
td {
	vertical-align: top;
}
</style>
</head>
<body>

<!--#include virtual="../menu.html.incl"-->

<div id="content">

<h1>Clang Compiler User's Manual</h1>

<ul>
<li><a href="#intro">Introduction</a>
  <ul>
  <li><a href="#terminology">Terminology</a></li>
  <li><a href="#basicusage">Basic Usage</a></li>
  </ul>
</li>
<li><a href="#commandline">Command Line Options</a>
  <ul>
  <li><a href="#cl_diagnostics">Options to Control Error and Warning
      Messages</a></li>
  <li><a href="#cl_crash_diagnostics">Options to Control Clang Crash
      Diagnostics</a></li>
  </ul>
</li>
<li><a href="#general_features">Language and Target-Independent Features</a>
 <ul>
  <li><a href="#diagnostics">Controlling Errors and Warnings</a>
   <ul>
   <li><a href="#diagnostics_display">Controlling How Clang Displays Diagnostics</a></li>
   <li><a href="#diagnostics_mappings">Diagnostic Mappings</a></li>
   <li><a href="#diagnostics_categories">Diagnostic Categories</a></li>
   <li><a href="#diagnostics_commandline">Controlling Diagnostics via Command Line Flags</a></li>
   <li><a href="#diagnostics_pragmas">Controlling Diagnostics via Pragmas</a></li>
   <li><a href="#diagnostics_enable_everything">Enabling All Warnings</a></li>
   <li><a href="#analyzer_diagnositics">Controlling Static Analyzer Diagnostics</a></li>
   </ul>
  </li>
  <li><a href="#precompiledheaders">Precompiled Headers</a></li>
  <li><a href="#codegen">Controlling Code Generation</a></li>
 </ul>
</li>
<li><a href="#c">C Language Features</a>
  <ul>
  <li><a href="#c_ext">Extensions supported by clang</a></li>
  <li><a href="#c_modes">Differences between various standard modes</a></li>
  <li><a href="#c_unimpl_gcc">GCC extensions not implemented yet</a></li>
  <li><a href="#c_unsupp_gcc">Intentionally unsupported GCC extensions</a></li>
  <li><a href="#c_ms">Microsoft extensions</a></li>
  </ul>
</li>
<li><a href="#cxx">C++ Language Features</a>
  <ul>
  <li><a href="#cxx_implimits">Controlling implementation limits</a></li>
  </ul>
</li>
<li><a href="#target_features">Target-Specific Features and Limitations</a>
  <ul>
  <li><a href="#target_arch">CPU Architectures Features and Limitations</a>
    <ul>
    <li><a href="#target_arch_x86">X86</a></li>
    <li><a href="#target_arch_arm">ARM</a></li>
    <li><a href="#target_arch_other">Other platforms</a></li>
    </ul>
  </li>
  <li><a href="#target_os">Operating System Features and Limitations</a>
    <ul>
    <li><a href="#target_os_darwin">Darwin (Mac OS/X)</a></li>
    <li>Linux, etc.</li>
    <li><a href="#target_os_win32">Windows</a></li>
    </ul>
  </li>
  </ul>
</li>
</ul>


<!-- ======================================================================= -->
<h2 id="intro">Introduction</h2>
<!-- ======================================================================= -->

<p>The Clang Compiler is an open-source compiler for the C family of programming
languages, aiming to be the best in class implementation of these languages.
Clang builds on the LLVM optimizer and code generator, allowing it to provide
high-quality optimization and code generation support for many targets.  For
more general information, please see the <a href="http://clang.llvm.org">Clang
Web Site</a> or the <a href="http://llvm.org">LLVM Web Site</a>.</p>

<p>This document describes important notes about using Clang as a compiler for
an end-user, documenting the supported features, command line options, etc.  If
you are interested in using Clang to build a tool that processes code, please
see <a href="InternalsManual.html">the Clang Internals Manual</a>.  If you are
interested in the <a href="http://clang-analyzer.llvm.org">Clang
Static Analyzer</a>, please see its web page.</p>

<p>Clang is designed to support the C family of programming languages, which
includes <a href="#c">C</a>, <a href="#objc">Objective-C</a>, <a
href="#cxx">C++</a>, and <a href="#objcxx">Objective-C++</a> as well as many
dialects of those.  For language-specific information, please see the
corresponding language specific section:</p>

<ul>
<li><a href="#c">C Language</a>: K&amp;R C, ANSI C89, ISO C90, ISO C94
    (C89+AMD1), ISO C99 (+TC1, TC2, TC3). </li>
<li><a href="#objc">Objective-C Language</a>: ObjC 1, ObjC 2, ObjC 2.1, plus
    variants depending on base language.</li>
<li><a href="#cxx">C++ Language</a></li>
<li><a href="#objcxx">Objective C++ Language</a></li>
</ul>

<p>In addition to these base languages and their dialects, Clang supports a
broad variety of language extensions, which are documented in the corresponding
language section.  These extensions are provided to be compatible with the GCC,
Microsoft, and other popular compilers as well as to improve functionality
through Clang-specific features.  The Clang driver and language features are
intentionally designed to be as compatible with the GNU GCC compiler as
reasonably possible, easing migration from GCC to Clang.  In most cases, code
"just works".</p>

<p>In addition to language specific features, Clang has a variety of features
that depend on what CPU architecture or operating system is being compiled for.
Please see the <a href="#target_features">Target-Specific Features and
Limitations</a> section for more details.</p>

<p>The rest of the introduction introduces some basic <a
href="#terminology">compiler terminology</a> that is used throughout this manual
and contains a basic <a href="#basicusage">introduction to using Clang</a>
as a command line compiler.</p>

<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<h3 id="terminology">Terminology</h3>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->

<p>Front end, parser, backend, preprocessor, undefined behavior, diagnostic,
 optimizer</p>

<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<h3 id="basicusage">Basic Usage</h3>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->

<p>Intro to how to use a C compiler for newbies.</p>
<p>
compile + link

compile then link

debug info

enabling optimizations

picking a language to use, defaults to C99 by default.  Autosenses based on
extension.

using a makefile
</p>


<!-- ======================================================================= -->
<h2 id="commandline">Command Line Options</h2>
<!-- ======================================================================= -->

<p>
This section is generally an index into other sections.  It does not go into
depth on the ones that are covered by other sections.  However, the first part
introduces the language selection and other high level options like -c, -g, etc.
</p>


<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<h3 id="cl_diagnostics">Options to Control Error and Warning Messages</h3>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->

<p><b>-Werror</b>: Turn warnings into errors.</p>
<p><b>-Werror=foo</b>: Turn warning "foo" into an error.</p>
<p><b>-Wno-error=foo</b>: Turn warning "foo" into an warning even if -Werror is
   specified.</p>
<p><b>-Wfoo</b>: Enable warning foo</p>
<p><b>-Wno-foo</b>: Disable warning foo</p>
<p><b>-w</b>: Disable all warnings.</p>
<p><b>-pedantic</b>: Warn on language extensions.</p>
<p><b>-pedantic-errors</b>: Error on language extensions.</p>
<p><b>-Wsystem-headers</b>: Enable warnings from system headers.</p>

<p><b>-ferror-limit=123</b>: Stop emitting diagnostics after 123 errors have
   been produced.  The default is 20, and the error limit can be disabled with
   -ferror-limit=0.</p>

<p><b>-ftemplate-backtrace-limit=123</b>: Only emit up to 123 template instantiation notes within the template instantiation backtrace for a single warning or error. The default is 10, and the limit can be disabled with -ftemplate-backtrace-limit=0.</p>

<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<h3 id="cl_crash_diagnostics">Options to Control Clang Crash Diagnostics</h3>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->

<p>As unbelievable as it may sound, Clang does crash from time to time.  
Generally, this only occurs to those living on the 
<a href="http://llvm.org/releases/download.html#svn">bleeding edge</a>.  Clang
goes to great lengths to assist you in filing a bug report.  Specifically, Clang
generates preprocessed source file(s) and associated run script(s) upon a
crash.  These files should be attached to a bug report to ease reproducibility
of the failure.  Below are the command line options to control the crash
diagnostics.
</p>

<p><b>-fno-crash-diagnostics</b>: Disable auto-generation of preprocessed 
source files during a clang crash.</p>

<p>The -fno-crash-diagnostics flag can be helpful for speeding the process of
generating a delta reduced test case.</p>

<!-- ================================================= -->
<h4 id="cl_diag_formatting">Formatting of Diagnostics</h4>
<!-- ================================================= -->

<p>Clang aims to produce beautiful diagnostics by default, particularly for new
users that first come to Clang.  However, different people have different
preferences, and sometimes Clang is driven by another program that wants to
parse simple and consistent output, not a person. For these cases, Clang
provides a wide range of options to control the exact output format of the
diagnostics that it generates.</p>

<dl>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<dt id="opt_fshow-column"><b>-f[no-]show-column</b>: Print column number in
diagnostic.</dt>
<dd>This option, which defaults to on, controls whether or not Clang prints the
{'fraction_non_alphanumeric': 0.2107084797315014, 'fraction_numerical': 0.006817347527400493, 'mean_word_length': 4.170824295010846, 'pattern_counts': {'":': 0, '<': 625, '<?xml version=': 0, '>': 625, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 97, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6499875', 'n_tokens_mistral': 6287, 'n_tokens_neox': 6018, 'n_words': 1854}