summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/ClangFormat.rst34
-rw-r--r--docs/ClangTools.rst41
-rw-r--r--docs/LanguageExtensions.rst107
-rw-r--r--docs/LibASTMatchersReference.html28
-rw-r--r--docs/LibASTMatchersTutorial.rst84
-rw-r--r--docs/MemorySanitizer.rst9
-rw-r--r--docs/Modules.rst4
-rw-r--r--docs/ReleaseNotes.rst124
-rw-r--r--docs/ThreadSanitizer.rst13
-rw-r--r--docs/UsersManual.rst38
-rw-r--r--docs/tools/clang.pod8
11 files changed, 376 insertions, 114 deletions
diff --git a/docs/ClangFormat.rst b/docs/ClangFormat.rst
index 92d7fc3..964fc84 100644
--- a/docs/ClangFormat.rst
+++ b/docs/ClangFormat.rst
@@ -18,7 +18,6 @@ to format C/C++/Obj-C code.
$ clang-format --help
OVERVIEW: A tool to format C/C++/Obj-C code.
- Currently supports LLVM and Google style guides.
If no arguments are specified, it formats the code from standard input
and writes the result to the standard output.
If <file> is given, it reformats the file. If -i is specified together
@@ -66,6 +65,37 @@ It operates on the current, potentially unsaved buffer and does not create
or save any files. To revert a formatting, just undo.
+Emacs Integration
+=================
+
+Similar to the integration for :program:`vim`, there is an integration for
+:program:`emacs`. It can be found at `clang/tools/clang-format/clang-format.el`
+and used by adding this to your `.emacs`:
+
+.. code-block:: common-lisp
+
+ (load "<path-to-clang>/tools/clang-format/clang-format.el")
+ (global-set-key [C-M-tab] 'clang-format-region)
+
+This binds the function `clang-format-region` to C-M-tab, which then formats the
+current line or selected region.
+
+
+BBEdit Integration
+==================
+
+:program:`clang-format` cannot be used as a text filter with BBEdit, but works
+well via a script. The AppleScript to do this integration can be found at
+`clang/tools/clang-format/clang-format-bbedit.applescript`; place a copy in
+`~/Library/Application Support/BBEdit/Scripts`, and edit the path within it to
+point to your local copy of :program:`clang-format`.
+
+With this integration you can select the script from the Script menu and
+:program:`clang-format` will format the selection. Note that you can rename the
+menu item by renaming the script, and can assign the menu item a keyboard
+shortcut in the BBEdit preferences, under Menus & Shortcuts.
+
+
Script for patch reformatting
=============================
@@ -81,7 +111,7 @@ a unified diff and reformats all contained lines with :program:`clang-format`.
optional arguments:
-h, --help show this help message and exit
-p P strip the smallest prefix containing P slashes
- -style STYLE formatting style to apply (LLVM, Google)
+ -style STYLE formatting style to apply (LLVM, Google, Chromium)
So to reformat all the lines in the latest :program:`git` commit, just do:
diff --git a/docs/ClangTools.rst b/docs/ClangTools.rst
index b7f7c7b..9312e6b 100644
--- a/docs/ClangTools.rst
+++ b/docs/ClangTools.rst
@@ -100,7 +100,11 @@ Currently it can:
* convert loops to range-based for loops;
-* convert null pointer constants (like ``NULL`` or ``0``) to C++11 ``nullptr``.
+* convert null pointer constants (like ``NULL`` or ``0``) to C++11 ``nullptr``;
+
+* replace the type specifier in variable declarations with the ``auto`` type specifier;
+
+* add the ``override`` specifier to applicable member functions.
Extra Clang Tools
=================
@@ -120,6 +124,27 @@ Ideas for new Tools
``foo.begin()`` into ``begin(foo)`` and similarly for ``end()``, where
``foo`` is a standard container. We could also detect similar patterns for
arrays.
+* ``make_shared`` / ``make_unique`` conversion. Part of this transformation
+can be incorporated into the ``auto`` transformation. Will convert
+
+ .. code-block:: c++
+
+ std::shared_ptr<Foo> sp(new Foo);
+ std::unique_ptr<Foo> up(new Foo);
+
+ func(std::shared_ptr<Foo>(new Foo), bar());
+
+ into:
+
+ .. code-block:: c++
+
+ auto sp = std::make_shared<Foo>();
+ auto up = std::make_unique<Foo>(); // In C++14 mode.
+
+ // This also affects correctness. For the cases where bar() throws,
+ // make_shared() is safe and the original code may leak.
+ func(std::make_shared<Foo>(), bar());
+
* ``tr1`` removal tool. Will migrate source code from using TR1 library
features to C++11 library. For example:
@@ -150,3 +175,17 @@ Ideas for new Tools
that don't want to use ``auto`` because they are afraid that they might lose
control over their code.
+* C++14: less verbose operator function objects (`N3421
+ <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3421.htm>`_).
+ For example:
+
+ .. code-block:: c++
+
+ sort(v.begin(), v.end(), greater<ValueType>());
+
+ should be rewritten to:
+
+ .. code-block:: c++
+
+ sort(v.begin(), v.end(), greater<>());
+
diff --git a/docs/LanguageExtensions.rst b/docs/LanguageExtensions.rst
index c870d20..324feaf 100644
--- a/docs/LanguageExtensions.rst
+++ b/docs/LanguageExtensions.rst
@@ -645,8 +645,7 @@ C++11 inheriting constructors
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Use ``__has_feature(cxx_inheriting_constructors)`` to determine if support for
-inheriting constructors is enabled. Clang does not currently implement this
-feature.
+inheriting constructors is enabled.
C++11 inline namespaces
^^^^^^^^^^^^^^^^^^^^^^^
@@ -727,6 +726,12 @@ Use ``__has_feature(cxx_static_assert)`` or
``__has_extension(cxx_static_assert)`` to determine if support for compile-time
assertions using ``static_assert`` is enabled.
+C++11 ``thread_local``
+^^^^^^^^^^^^^^^^^^^^^^
+
+Use ``__has_feature(cxx_thread_local)`` to determine if support for
+``thread_local`` variables is enabled.
+
C++11 type inference
^^^^^^^^^^^^^^^^^^^^
@@ -774,6 +779,98 @@ Use ``__has_feature(cxx_variadic_templates)`` or
``__has_extension(cxx_variadic_templates)`` to determine if support for
variadic templates is enabled.
+C++1y
+-----
+
+The features listed below are part of the committee draft for the C++1y
+standard. As a result, all these features are enabled with the ``-std=c++1y``
+or ``-std=gnu++1y`` option when compiling C++ code.
+
+C++1y binary literals
+^^^^^^^^^^^^^^^^^^^^^
+
+Use ``__has_feature(cxx_binary_literals)`` or
+``__has_extension(cxx_binary_literals)`` to determine whether
+binary literals (for instance, ``0b10010``) are recognized. Clang supports this
+feature as an extension in all language modes.
+
+C++1y contextual conversions
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Use ``__has_feature(cxx_contextual_conversions)`` or
+``__has_extension(cxx_contextual_conversions)`` to determine if the C++1y rules
+are used when performing an implicit conversion for an array bound in a
+*new-expression*, the operand of a *delete-expression*, an integral constant
+expression, or a condition in a ``switch`` statement. Clang does not yet
+support this feature.
+
+C++1y decltype(auto)
+^^^^^^^^^^^^^^^^^^^^
+
+Use ``__has_feature(cxx_decltype_auto)`` or
+``__has_extension(cxx_decltype_auto)`` to determine if support
+for the ``decltype(auto)`` placeholder type is enabled.
+
+C++1y default initializers for aggregates
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Use ``__has_feature(cxx_aggregate_nsdmi)`` or
+``__has_extension(cxx_aggregate_nsdmi)`` to determine if support
+for default initializers in aggregate members is enabled.
+
+C++1y generalized lambda capture
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Use ``__has_feature(cxx_generalized_capture)`` or
+``__has_extension(cxx_generalized_capture`` to determine if support for
+generalized lambda captures is enabled
+(for instance, ``[n(0)] { return ++n; }``).
+Clang does not yet support this feature.
+
+C++1y generic lambdas
+^^^^^^^^^^^^^^^^^^^^^
+
+Use ``__has_feature(cxx_generic_lambda)`` or
+``__has_extension(cxx_generic_lambda)`` to determine if support for generic
+(polymorphic) lambdas is enabled
+(for instance, ``[] (auto x) { return x + 1; }``).
+Clang does not yet support this feature.
+
+C++1y relaxed constexpr
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Use ``__has_feature(cxx_relaxed_constexpr)`` or
+``__has_extension(cxx_relaxed_constexpr)`` to determine if variable
+declarations, local variable modification, and control flow constructs
+are permitted in ``constexpr`` functions.
+Clang's implementation of this feature is incomplete.
+
+C++1y return type deduction
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Use ``__has_feature(cxx_return_type_deduction)`` or
+``__has_extension(cxx_return_type_deduction)`` to determine if support
+for return type deduction for functions (using ``auto`` as a return type)
+is enabled.
+Clang's implementation of this feature is incomplete.
+
+C++1y runtime-sized arrays
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Use ``__has_feature(cxx_runtime_array)`` or
+``__has_extension(cxx_runtime_array)`` to determine if support
+for arrays of runtime bound (a restricted form of variable-length arrays)
+is enabled.
+Clang's implementation of this feature is incomplete.
+
+C++1y variable templates
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Use ``__has_feature(cxx_variable_templates)`` or
+``__has_extension(cxx_variable_templates)`` to determine if support for
+templated variable declarations is enabled.
+Clang does not yet support this feature.
+
C11
---
@@ -818,6 +915,12 @@ Use ``__has_feature(c_static_assert)`` or ``__has_extension(c_static_assert)``
to determine if support for compile-time assertions using ``_Static_assert`` is
enabled.
+C11 ``_Thread_local``
+^^^^^^^^^^^^^^^^^^^^^
+
+Use ``__has_feature(c_thread_local)`` to determine if support for
+``_Thread_local`` variables is enabled.
+
Checks for Type Traits
======================
diff --git a/docs/LibASTMatchersReference.html b/docs/LibASTMatchersReference.html
index b476065..e80e442 100644
--- a/docs/LibASTMatchersReference.html
+++ b/docs/LibASTMatchersReference.html
@@ -1513,6 +1513,34 @@ Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOpe
</pre></td></tr>
+<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isOverride0')"><a name="isOverride0Anchor">isOverride</a></td><td></td></tr>
+<tr><td colspan="4" class="doc" id="isOverride0"><pre>Matches if the given method declaration overrides another method.
+
+Given
+ class A {
+ public:
+ virtual void x();
+ };
+ class B : public A {
+ public:
+ virtual void x();
+ };
+ matches B::x
+</pre></td></tr>
+
+
+<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isVirtual0')"><a name="isVirtual0Anchor">isVirtual</a></td><td></td></tr>
+<tr><td colspan="4" class="doc" id="isVirtual0"><pre>Matches if the given method declaration is virtual.
+
+Given
+ class A {
+ public:
+ virtual void x();
+ };
+ matches A::x
+</pre></td></tr>
+
+
<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;</td><td class="name" onclick="toggle('hasOverloadedOperatorName1')"><a name="hasOverloadedOperatorName1Anchor">hasOverloadedOperatorName</a></td><td>StringRef Name</td></tr>
<tr><td colspan="4" class="doc" id="hasOverloadedOperatorName1"><pre>Matches overloaded operator names.
diff --git a/docs/LibASTMatchersTutorial.rst b/docs/LibASTMatchersTutorial.rst
index ba568e3..5bd62a1 100644
--- a/docs/LibASTMatchersTutorial.rst
+++ b/docs/LibASTMatchersTutorial.rst
@@ -27,6 +27,8 @@ guide <http://llvm.org/docs/GettingStarted.html>`_.
git clone http://llvm.org/git/llvm.git
cd llvm/tools
git clone http://llvm.org/git/clang.git
+ cd clang/tools
+ git clone http://llvm.org/git/clang-tools-extra.git extra
Next you need to obtain the CMake build system and Ninja build tool. You
may already have CMake installed, but current binary versions of CMake
@@ -163,7 +165,7 @@ You should now be able to run the syntax checker, which is located in
.. code-block:: console
- cat "void main() {}" > test.cpp
+ cat "int main() { return 0; }" > test.cpp
bin/loop-convert test.cpp --
Note the two dashes after we specify the source file. The additional
@@ -275,8 +277,9 @@ Add the following to ``LoopConvert.cpp``:
class LoopPrinter : public MatchFinder::MatchCallback {
public :
virtual void run(const MatchFinder::MatchResult &Result) {
- if (const ForStmt *FS = Result.Nodes.getNodeAs<clang::ForStmt>("forLoop"))
- FS->dump();
+ if (const ForStmt *FS = Result.Nodes.getNodeAs<clang::ForStmt>("forLoop"))
+ FS->dump();
+ }
};
And change ``main()`` to:
@@ -411,13 +414,13 @@ previous iteration of loop-convert, shows us the answer:
(IntegerLiteral 0x173afa8 'int' 0)")
<<>>
(BinaryOperator 0x173b060 '_Bool' '<'
- (ImplicitCastExpr 0x173b030 'int'
+ (ImplicitCastExpr 0x173b030 'int'
(DeclRefExpr 0x173afe0 'int' lvalue Var 0x173af50 'i' 'int'))
- (ImplicitCastExpr 0x173b048 'int'
+ (ImplicitCastExpr 0x173b048 'int'
(DeclRefExpr 0x173b008 'const int' lvalue Var 0x170fa80 'N' 'const int')))
(UnaryOperator 0x173b0b0 'int' lvalue prefix '++'
(DeclRefExpr 0x173b088 'int' lvalue Var 0x173af50 'i' 'int'))
- (CompoundStatement …
+ (CompoundStatement ...
We already know that the declaration and increments both match, or this
loop wouldn't have been dumped. The culprit lies in the implicit cast
@@ -460,32 +463,60 @@ Since we bind three variables (identified by ConditionVarName,
InitVarName, and IncrementVarName), we can obtain the matched nodes by
using the ``getNodeAs()`` member function.
-In ``LoopActions.cpp``:
+In ``LoopConvert.cpp`` add
.. code-block:: c++
#include "clang/AST/ASTContext.h"
+Change ``LoopMatcher`` to
+
+.. code-block:: c++
+
+ StatementMatcher LoopMatcher =
+ forStmt(hasLoopInit(declStmt(
+ hasSingleDecl(varDecl(hasInitializer(integerLiteral(equals(0))))
+ .bind("initVarName")))),
+ hasIncrement(unaryOperator(
+ hasOperatorName("++"),
+ hasUnaryOperand(declRefExpr(
+ to(varDecl(hasType(isInteger())).bind("incVarName")))))),
+ hasCondition(binaryOperator(
+ hasOperatorName("<"),
+ hasLHS(ignoringParenImpCasts(declRefExpr(
+ to(varDecl(hasType(isInteger())).bind("condVarName"))))),
+ hasRHS(expr(hasType(isInteger())))))).bind("forLoop");
+
+And change ``LoopPrinter::run`` to
+
+.. code-block:: c++
+
void LoopPrinter::run(const MatchFinder::MatchResult &Result) {
ASTContext *Context = Result.Context;
- const ForStmt *FS = Result.Nodes.getStmtAs<ForStmt>(LoopName);
+ const ForStmt *FS = Result.Nodes.getStmtAs<ForStmt>("forLoop");
// We do not want to convert header files!
if (!FS || !Context->getSourceManager().isFromMainFile(FS->getForLoc()))
return;
- const VarDecl *IncVar = Result.Nodes.getNodeAs<VarDecl>(IncrementVarName);
- const VarDecl *CondVar = Result.Nodes.getNodeAs<VarDecl>(ConditionVarName);
- const VarDecl *InitVar = Result.Nodes.getNodeAs<VarDecl>(InitVarName);
+ const VarDecl *IncVar = Result.Nodes.getNodeAs<VarDecl>("incVarName");
+ const VarDecl *CondVar = Result.Nodes.getNodeAs<VarDecl>("condVarName");
+ const VarDecl *InitVar = Result.Nodes.getNodeAs<VarDecl>("initVarName");
+
+ if (!areSameVariable(IncVar, CondVar) || !areSameVariable(IncVar, InitVar))
+ return;
+ llvm::outs() << "Potential array-based loop discovered.\n";
+ }
-Now that we have the three variables, represented by their respective
-declarations, let's make sure that they're all the same, using a helper
-function I call ``areSameVariable()``.
+Clang associates a ``VarDecl`` with each variable to represent the variable's
+declaration. Since the "canonical" form of each declaration is unique by
+address, all we need to do is make sure neither ``ValueDecl`` (base class of
+``VarDecl``) is ``NULL`` and compare the canonical Decls.
.. code-block:: c++
- if (!areSameVariable(IncVar, CondVar) || !areSameVariable(IncVar, InitVar))
- return;
- llvm::outs() << "Potential array-based loop discovered.\n";
- }
+ static bool areSameVariable(const ValueDecl *First, const ValueDecl *Second) {
+ return First && Second &&
+ First->getCanonicalDecl() == Second->getCanonicalDecl();
+ }
If execution reaches the end of ``LoopPrinter::run()``, we know that the
loop shell that looks like
@@ -498,21 +529,8 @@ For now, we will just print a message explaining that we found a loop.
The next section will deal with recursively traversing the AST to
discover all changes needed.
-As a side note, here is the implementation of ``areSameVariable``. Clang
-associates a ``VarDecl`` with each variable to represent the variable's
-declaration. Since the "canonical" form of each declaration is unique by
-address, all we need to do is make sure neither ``ValueDecl`` (base
-class of ``VarDecl``) is ``NULL`` and compare the canonical Decls.
-
-.. code-block:: c++
-
- static bool areSameVariable(const ValueDecl *First, const ValueDecl *Second) {
- return First && Second &&
- First->getCanonicalDecl() == Second->getCanonicalDecl();
- }
-
-It's not as trivial to test if two expressions are the same, though
-Clang has already done the hard work for us by providing a way to
+As a side note, it's not as trivial to test if two expressions are the same,
+though Clang has already done the hard work for us by providing a way to
canonicalize expressions:
.. code-block:: c++
diff --git a/docs/MemorySanitizer.rst b/docs/MemorySanitizer.rst
index fdb8a81..439acc4 100644
--- a/docs/MemorySanitizer.rst
+++ b/docs/MemorySanitizer.rst
@@ -46,7 +46,7 @@ to disable inlining (just use ``-O1``) and tail call elimination
return 0;
}
- % clang -fsanitize=memory -fPIE -pie -fno-omit-frame-pointer -g -O2 umr.cc
+ % clang -fsanitize=memory -fno-omit-frame-pointer -g -O2 umr.cc
If a bug is detected, the program will print an error message to
stderr and exit with a non-zero exit code. Currently, MemorySanitizer
@@ -103,7 +103,7 @@ the example above,
.. code-block:: console
- % clang -fsanitize=memory -fsanitize-memory-track-origins -fPIE -pie -fno-omit-frame-pointer -g -O2 umr.cc
+ % clang -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -g -O2 umr.cc
% ./a.out 2>log
% projects/compiler-rt/lib/asan/scripts/asan_symbolize.py / < log | c++filt
==14425== WARNING: MemorySanitizer: UMR (uninitialized-memory-read)
@@ -160,7 +160,10 @@ Limitations
address space. This means that tools like ``ulimit`` may not work as
usually expected.
* Static linking is not supported.
-* Non-position-independent executables are not supported.
+* Non-position-independent executables are not supported. Therefore, the
+ ``fsanitize=memory`` flag will cause Clang to act as though the ``-fPIE``
+ flag had been supplied if compiling without ``-fPIC``, and as though the
+ ``-pie`` flag had been supplied if linking an executable.
* Depending on the version of Linux kernel, running without ASLR may
be not supported. Note that GDB disables ASLR by default. To debug
instrumented programs, use "set disable-randomization off".
diff --git a/docs/Modules.rst b/docs/Modules.rst
index 8a6b8b6..fdf597a 100644
--- a/docs/Modules.rst
+++ b/docs/Modules.rst
@@ -168,8 +168,8 @@ Command-line parameters
``-fmodules-cache-path=<directory>``
Specify the path to the modules cache. If not provided, Clang will select a system-appropriate default.
-``-f[no-]modules-autolink``
- Enable of disable automatic linking against the libraries associated with imported modules.
+``-fno-autolink``
+ Disable automatic linking against the libraries associated with imported modules.
``-fmodules-ignore-macro=macroname``
Instruct modules to ignore the named macro when selecting an appropriate module variant. Use this for macros defined on the command line that don't affect how modules are built, to improve sharing of compiled module files.
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index d9a3364..e764a09 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -1,6 +1,6 @@
-=====================================
-Clang 3.3 (In-Progress) Release Notes
-=====================================
+=======================
+Clang 3.3 Release Notes
+=======================
.. contents::
:local:
@@ -8,41 +8,33 @@ Clang 3.3 (In-Progress) Release Notes
Written by the `LLVM Team <http://llvm.org/>`_
-.. warning::
-
- These are in-progress notes for the upcoming Clang 3.3 release. You may
- prefer the `Clang 3.2 Release Notes
- <http://llvm.org/releases/3.2/docs/ClangReleaseNotes.html>`_.
-
Introduction
============
This document contains the release notes for the Clang C/C++/Objective-C
frontend, part of the LLVM Compiler Infrastructure, release 3.3. Here we
-describe the status of Clang in some detail, including major
-improvements from the previous release and new feature work. For the
-general LLVM release notes, see `the LLVM
-documentation <http://llvm.org/docs/ReleaseNotes.html>`_. All LLVM
-releases may be downloaded from the `LLVM releases web
-site <http://llvm.org/releases/>`_.
-
-For more information about Clang or LLVM, including information about
-the latest release, please check out the main please see the `Clang Web
-Site <http://clang.llvm.org>`_ or the `LLVM Web
-Site <http://llvm.org>`_.
-
-Note that if you are reading this file from a Subversion checkout or the
-main Clang web page, this document applies to the *next* release, not
-the current one. To see the release notes for a specific release, please
-see the `releases page <http://llvm.org/releases/>`_.
+describe the status of Clang in some detail, including major improvements from
+the previous release and new feature work. For the general LLVM release notes,
+see `the LLVM documentation <http://llvm.org/docs/ReleaseNotes.html>`_. All LLVM
+releases may be downloaded from the `LLVM releases web site
+<http://llvm.org/releases/>`_.
+
+For more information about Clang or LLVM, including information about the latest
+release, please check out the main please see the `Clang Web Site
+<http://clang.llvm.org>`_ or the `LLVM Web Site <http://llvm.org>`_.
+
+Note that if you are reading this file from a Subversion checkout or the main
+Clang web page, this document applies to the *next* release, not the current
+one. To see the release notes for a specific release, please see the `releases
+page <http://llvm.org/releases/>`_.
What's New in Clang 3.3?
========================
Some of the major new features and improvements to Clang are listed
here. Generic improvements to Clang as a whole or to its underlying
-infrastructure are described first, followed by language-specific
-sections with improvements to Clang's support for those languages.
+infrastructure are described first, followed by language-specific sections with
+improvements to Clang's support for those languages.
Major New Features
------------------
@@ -54,8 +46,6 @@ Clang's diagnostics are constantly being improved to catch more issues,
explain them more clearly, and provide more accurate source information
about them. The improvements since the 3.2 release include:
-- ...
-
Extended Identifiers: Unicode Support and Universal Character Names
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -65,31 +55,17 @@ specified by the active language standard; these characters can be written
directly in the source file using the UTF-8 encoding, or referred to using
*universal character names* (``\u00E0``, ``\U000000E0``).
-New Compiler Flags
-------------------
-
-- ...
-
C Language Changes in Clang
---------------------------
-C11 Feature Support
-^^^^^^^^^^^^^^^^^^^
-
-...
-
C++ Language Changes in Clang
-----------------------------
-C++11 Feature Support
-^^^^^^^^^^^^^^^^^^^^^
-
-...
-
-Objective-C Language Changes in Clang
--------------------------------------
-
-...
+- Clang now correctly implements language linkage for functions and variables.
+ This means that, for example, it is now possible to overload static functions
+ declared in an ``extern "C"`` context. For backwards compatibility, an alias
+ with the unmangled name is still emitted if it is the only one and has the
+ ``used`` attribute.
Internal API Changes
--------------------
@@ -118,16 +94,40 @@ Storage Class
For each variable and function Clang used to keep the storage class as written
in the source, the linkage and a semantic storage class. This was a bit
redundant and the semantic storage class has been removed. The method
-getStorageClass now returns what is written it the source code for that decl.
+getStorageClass now returns what is written in the source code for that decl.
+
+libclang
+--------
-...
+The clang_CXCursorSet_contains() function previously incorrectly returned 0
+if it contained a CXCursor, contrary to what the documentation stated. This
+has been fixed so that the function returns a non-zero value if the set
+contains a cursor. This is API breaking change, but matches the intended
+original behavior. Moreover, this also fixes the issue of an invalid CXCursorSet
+appearing to contain any CXCursor.
+
+Static Analyzer
+---------------
+
+The static analyzer (which contains additional code checking beyond compiler
+warnings) has improved significantly in both in the core analysis engine and
+also in the kinds of issues it can find.
+
+Core Analysis Improvements
+==========================
-Python Binding Changes
-----------------------
+- Support for interprocedural reasoning about constructors and destructors.
+- New false positive suppression mechanisms that reduced the number of false
+ null pointer dereference warnings due to interprocedural analysis.
+- Major performance enhancements to speed up interprocedural analysis
-The following methods have been added:
+New Issues Found
+================
-- ...
+- New memory error checks such as use-after-free with C++ 'delete'.
+- Detection of mismatched allocators and deallocators (e.g., using 'new' with
+ 'free()', 'malloc()' with 'delete').
+- Additional checks for misuses of Apple Foundation framework collection APIs.
Significant Known Problems
==========================
@@ -135,13 +135,11 @@ Significant Known Problems
Additional Information
======================
-A wide variety of additional information is available on the `Clang web
-page <http://clang.llvm.org/>`_. The web page contains versions of the
-API documentation which are up-to-date with the Subversion version of
-the source code. You can access versions of these documents specific to
-this release by going into the "``clang/docs/``" directory in the Clang
-tree.
+A wide variety of additional information is available on the `Clang web page
+<http://clang.llvm.org/>`_. The web page contains versions of the API
+documentation which are up-to-date with the Subversion version of the source
+code. You can access versions of these documents specific to this release by
+going into the "``clang/docs/``" directory in the Clang tree.
-If you have any questions or comments about Clang, please feel free to
-contact us via the `mailing
-list <http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev>`_.
+If you have any questions or comments about Clang, please feel free to contact
+us via the `mailing list <http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev>`_.
diff --git a/docs/ThreadSanitizer.rst b/docs/ThreadSanitizer.rst
index c0c576b..5e5ee48 100644
--- a/docs/ThreadSanitizer.rst
+++ b/docs/ThreadSanitizer.rst
@@ -25,9 +25,9 @@ platforms is problematic and not yet planned.
Usage
-----
-Simply compile your program with ``-fsanitize=thread -fPIE`` and link it with
-``-fsanitize=thread -pie``. To get a reasonable performance add ``-O1`` or
-higher. Use ``-g`` to get file names and line numbers in the warning messages.
+Simply compile and link your program with ``-fsanitize=thread``. To get a
+reasonable performance add ``-O1`` or higher. Use ``-g`` to get file names
+and line numbers in the warning messages.
Example:
@@ -48,7 +48,7 @@ Example:
return Global;
}
- $ clang -fsanitize=thread -g -O1 tiny_race.c -fPIE -pie
+ $ clang -fsanitize=thread -g -O1 tiny_race.c
If a bug is detected, the program will print an error message to stderr.
Currently, ThreadSanitizer symbolizes its output using an external
@@ -107,7 +107,10 @@ Limitations
* ThreadSanitizer maps (but does not reserve) a lot of virtual address space.
This means that tools like ``ulimit`` may not work as usually expected.
* Libc/libstdc++ static linking is not supported.
-* ThreadSanitizer requires ``-fPIE -pie`` compiler flags.
+* Non-position-independent executables are not supported. Therefore, the
+ ``fsanitize=thread`` flag will cause Clang to act as though the ``-fPIE``
+ flag had been supplied if compiling without ``-fPIC``, and as though the
+ ``-pie`` flag had been supplied if linking an executable.
Current Status
--------------
diff --git a/docs/UsersManual.rst b/docs/UsersManual.rst
index 6cc8361..3dc07ab 100644
--- a/docs/UsersManual.rst
+++ b/docs/UsersManual.rst
@@ -652,6 +652,31 @@ supports the GCC pragma, Clang and GCC do not support the exact same set
of warnings, so even when using GCC compatible #pragmas there is no
guarantee that they will have identical behaviour on both compilers.
+In addition to controlling warnings and errors generated by the compiler, it is
+possible to generate custom warning and error messages through the following
+pragmas:
+
+.. code-block:: c
+
+ // The following will produce warning messages
+ #pragma message "some diagnostic message"
+ #pragma GCC warning "TODO: replace deprecated feature"
+
+ // The following will produce an error message
+ #pragma GCC error "Not supported"
+
+These pragmas operate similarly to the ``#warning`` and ``#error`` preprocessor
+directives, except that they may also be embedded into preprocessor macros via
+the C99 ``_Pragma`` operator, for example:
+
+.. code-block:: c
+
+ #define STR(X) #X
+ #define DEFER(M,...) M(__VA_ARGS__)
+ #define CUSTOM_ERROR(X) _Pragma(STR(GCC error(X " at line " DEFER(STR,__LINE__))))
+
+ CUSTOM_ERROR("Feature not available");
+
Controlling Diagnostics in System Headers
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1005,6 +1030,19 @@ below. If multiple flags are present, the last one is used.
Generate complete debug info.
+Comment Parsing Options
+--------------------------
+
+Clang parses Doxygen and non-Doxygen style documentation comments and attaches
+them to the appropriate declaration nodes. By default, it only parses
+Doxygen-style comments and ignores ordinary comments starting with ``//`` and
+``/*``.
+
+.. option:: -fparse-all-comments
+
+ Parse all comments as documentation comments (including ordinary comments
+ starting with ``//`` and ``/*``).
+
.. _c:
C Language Features
diff --git a/docs/tools/clang.pod b/docs/tools/clang.pod
index 9628d47..d2394a8 100644
--- a/docs/tools/clang.pod
+++ b/docs/tools/clang.pod
@@ -7,7 +7,7 @@ clang - the Clang C, C++, and Objective-C compiler
=head1 SYNOPSIS
B<clang> [B<-c>|B<-S>|B<-E>] B<-std=>I<standard> B<-g>
- [B<-O0>|B<-O1>|B<-O2>|B<-Os>|B<-Oz>|B<-O3>|B<-O4>]
+ [B<-O0>|B<-O1>|B<-O2>|B<-Os>|B<-Oz>|B<-O3>|B<-Ofast>|B<-O4>]
B<-W>I<warnings...> B<-pedantic>
B<-I>I<dir...> B<-L>I<dir...>
B<-D>I<macro[=defn]>
@@ -263,7 +263,7 @@ may not exist on earlier ones.
=over
-=item B<-O0> B<-O1> B<-O2> B<-Os> B<-Oz> B<-O3> B<-O4>
+=item B<-O0> B<-O1> B<-O2> B<-Os> B<-Oz> B<-O3> B<-Ofast> B<-O4>
Specify which optimization level to use. B<-O0> means "no optimization": this
level compiles the fastest and generates the most debuggable code. B<-O2> is a
@@ -271,7 +271,9 @@ moderate level of optimization which enables most optimizations. B<-Os> is like
B<-O2> with extra optimizations to reduce code size. B<-Oz> is like B<-Os>
(and thus B<-O2>), but reduces code size further. B<-O3> is like B<-O2>,
except that it enables optimizations that take longer to perform or that may
-generate larger code (in an attempt to make the program run faster). On
+generate larger code (in an attempt to make the program run faster).
+B<-Ofast> enables all the optimizations from B<-O3> along with other aggressive
+optimizations that may violate strict compliance with language standards. On
supported platforms, B<-O4> enables link-time optimization; object files are
stored in the LLVM bitcode file format and whole program optimization is done at
link time. B<-O1> is somewhere between B<-O0> and B<-O2>.
OpenPOWER on IntegriCloud