Bill Wendling | ad0116e | 2013-12-16 19:53:36 +0000 | [diff] [blame^] | 1 | ======================= |
| 2 | Clang 3.4 Release Notes |
| 3 | ======================= |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 4 | |
| 5 | .. contents:: |
| 6 | :local: |
| 7 | :depth: 2 |
| 8 | |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 9 | Introduction |
| 10 | ============ |
| 11 | |
| 12 | This document contains the release notes for the Clang C/C++/Objective-C |
Bill Wendling | a03209e | 2013-06-04 06:17:46 +0000 | [diff] [blame] | 13 | frontend, part of the LLVM Compiler Infrastructure, release 3.4. Here we |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 14 | describe the status of Clang in some detail, including major |
| 15 | improvements from the previous release and new feature work. For the |
| 16 | general LLVM release notes, see `the LLVM |
| 17 | documentation <http://llvm.org/docs/ReleaseNotes.html>`_. All LLVM |
| 18 | releases may be downloaded from the `LLVM releases web |
| 19 | site <http://llvm.org/releases/>`_. |
| 20 | |
| 21 | For more information about Clang or LLVM, including information about |
Gabor Greif | 3cb8e31 | 2013-12-16 11:18:18 +0000 | [diff] [blame] | 22 | the latest release, please check out the main `Clang Web |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 23 | Site <http://clang.llvm.org>`_ or the `LLVM Web |
| 24 | Site <http://llvm.org>`_. |
| 25 | |
| 26 | Note that if you are reading this file from a Subversion checkout or the |
| 27 | main Clang web page, this document applies to the *next* release, not |
| 28 | the current one. To see the release notes for a specific release, please |
| 29 | see the `releases page <http://llvm.org/releases/>`_. |
| 30 | |
Bill Wendling | a03209e | 2013-06-04 06:17:46 +0000 | [diff] [blame] | 31 | What's New in Clang 3.4? |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 32 | ======================== |
| 33 | |
| 34 | Some of the major new features and improvements to Clang are listed |
| 35 | here. Generic improvements to Clang as a whole or to its underlying |
| 36 | infrastructure are described first, followed by language-specific |
| 37 | sections with improvements to Clang's support for those languages. |
| 38 | |
Chandler Carruth | fe1088d | 2013-11-07 00:26:32 +0000 | [diff] [blame] | 39 | Last release which will build as C++98 |
| 40 | -------------------------------------- |
| 41 | |
| 42 | This is expected to be the last release of Clang which compiles using a C++98 |
| 43 | toolchain. We expect to start using some C++11 features in Clang starting after |
| 44 | this release. That said, we are committed to supporting a reasonable set of |
| 45 | modern C++ toolchains as the host compiler on all of the platforms. This will |
| 46 | at least include Visual Studio 2012 on Windows, and Clang 3.1 or GCC 4.7.x on |
| 47 | Mac and Linux. The final set of compilers (and the C++11 features they support) |
| 48 | is not set in stone, but we wanted users of Clang to have a heads up that the |
| 49 | next release will involve a substantial change in the host toolchain |
| 50 | requirements. |
| 51 | |
| 52 | Note that this change is part of a change for the entire LLVM project, not just |
| 53 | Clang. |
| 54 | |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 55 | Major New Features |
| 56 | ------------------ |
| 57 | |
| 58 | Improvements to Clang's diagnostics |
| 59 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 60 | |
| 61 | Clang's diagnostics are constantly being improved to catch more issues, |
| 62 | explain them more clearly, and provide more accurate source information |
Bill Wendling | a03209e | 2013-06-04 06:17:46 +0000 | [diff] [blame] | 63 | about them. The improvements since the 3.3 release include: |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 64 | |
Richard Trieu | 06907e1 | 2013-12-03 01:35:18 +0000 | [diff] [blame] | 65 | - -Wheader-guard warns on mismatches between the #ifndef and #define lines |
| 66 | in a header guard. |
| 67 | - -Wlogical-not-parentheses warns when a logical not ('!') only applies to the |
| 68 | left-hand side of a comparison. This warning is part of -Wparentheses. |
| 69 | - Boolean increment, a deprecated feature, has own warning flag |
| 70 | -Wdeprecated-increment-bool, and is still part of -Wdeprecated. |
| 71 | - Clang errors on builtin enum increments and decrements. |
Sylvestre Ledru | aa7fc19 | 2013-12-13 11:30:23 +0000 | [diff] [blame] | 72 | - -Wloop-analysis now warns on for-loops which have the same increment or |
Richard Trieu | 06907e1 | 2013-12-03 01:35:18 +0000 | [diff] [blame] | 73 | decrement in the loop header as the last statement in the loop. |
| 74 | - -Wuninitialized now performs checking across field initializers to detect |
| 75 | when one field in used uninitialized in another field initialization. |
| 76 | - Clang can detect initializer list use inside a macro and suggest parentheses |
| 77 | if possible to fix. |
Kaelyn Uhrain | b4ec8b1 | 2013-12-04 02:25:41 +0000 | [diff] [blame] | 78 | - Many improvements to Clang's typo correction facilities, such as: |
Richard Smith | f1a2837 | 2013-12-12 02:26:06 +0000 | [diff] [blame] | 79 | |
Kaelyn Uhrain | b4ec8b1 | 2013-12-04 02:25:41 +0000 | [diff] [blame] | 80 | + Adding global namespace qualifiers so that corrections can refer to shadowed |
| 81 | or otherwise ambiguous or unreachable namespaces. |
| 82 | + Including accessible class members in the set of typo correction candidates, |
| 83 | so that corrections requiring a class name in the name specifier are now |
| 84 | possible. |
| 85 | + Allowing typo corrections that involve removing a name specifier. |
| 86 | + In some situations, correcting function names when a function was given the |
| 87 | wrong number of arguments, including situations where the original function |
| 88 | name was correct but was shadowed by a lexically closer function with the |
| 89 | same name yet took a different number of arguments. |
| 90 | + Offering typo suggestions for 'using' declarations. |
| 91 | + Providing better diagnostics and fixit suggestions in more situations when |
| 92 | a '->' was used instead of '.' or vice versa. |
| 93 | + Providing more relevant suggestions for typos followed by '.' or '='. |
| 94 | + Various performance improvements when searching for typo correction |
| 95 | candidates. |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 96 | |
Bill Wendling | ad0116e | 2013-12-16 19:53:36 +0000 | [diff] [blame^] | 97 | - `LeakSanitizer <LeakSanitizer.rst>`_ is an experimental memory leak detector |
| 98 | which can be combined with AddressSanitizer. |
| 99 | |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 100 | New Compiler Flags |
| 101 | ------------------ |
| 102 | |
Rafael Espindola | 3b0f62b | 2013-08-23 21:49:00 +0000 | [diff] [blame] | 103 | - Clang no longer special cases -O4 to enable lto. Explicitly pass -flto to |
| 104 | enable it. |
Richard Smith | 22540da | 2013-12-12 02:20:54 +0000 | [diff] [blame] | 105 | - Clang no longer fails on >= -O5. These flags are mapped to -O3 instead. |
Sylvestre Ledru | 762e567 | 2013-11-18 13:23:07 +0000 | [diff] [blame] | 106 | - Command line "clang -O3 -flto a.c -c" and "clang -emit-llvm a.c -c" |
Shuxin Yang | 8b49854 | 2013-08-23 22:01:03 +0000 | [diff] [blame] | 107 | are no longer equivalent. |
Rafael Espindola | 3dd4dd6 | 2013-10-16 16:32:17 +0000 | [diff] [blame] | 108 | - Clang now errors on unknown -m flags (``-munknown-to-clang``), |
| 109 | unknown -f flags (``-funknown-to-clang``) and unknown |
| 110 | options (``-what-is-this``). |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 111 | |
| 112 | C Language Changes in Clang |
| 113 | --------------------------- |
| 114 | |
Michael Gottesman | 98d1ec1 | 2013-06-20 23:28:10 +0000 | [diff] [blame] | 115 | - Added new checked arithmetic builtins for security critical applications. |
| 116 | |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 117 | C11 Feature Support |
| 118 | ^^^^^^^^^^^^^^^^^^^ |
| 119 | |
| 120 | ... |
| 121 | |
| 122 | C++ Language Changes in Clang |
| 123 | ----------------------------- |
| 124 | |
Eli Friedman | 6540052 | 2013-07-20 01:06:31 +0000 | [diff] [blame] | 125 | - Fixed an ABI regression, introduced in Clang 3.2, which affected |
| 126 | member offsets for classes inheriting from certain classes with tail padding. |
| 127 | See PR16537. |
| 128 | |
Richard Smith | 22540da | 2013-12-12 02:20:54 +0000 | [diff] [blame] | 129 | - Clang 3.4 supports the 2013-08-28 draft of the ISO WG21 SG10 feature test |
| 130 | macro recommendations. These aim to provide a portable method to determine |
| 131 | whether a compiler supports a language feature, much like Clang's |
Richard Smith | f1a2837 | 2013-12-12 02:26:06 +0000 | [diff] [blame] | 132 | |has_feature macro|_. |
Rafael Espindola | 40db515 | 2013-04-09 12:51:24 +0000 | [diff] [blame] | 133 | |
Richard Smith | f1a2837 | 2013-12-12 02:26:06 +0000 | [diff] [blame] | 134 | .. |has_feature macro| replace:: ``__has_feature`` macro |
| 135 | .. _has_feature macro: LanguageExtensions.html#has-feature-and-has-extension |
Richard Smith | 22540da | 2013-12-12 02:20:54 +0000 | [diff] [blame] | 136 | |
| 137 | C++1y Feature Support |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 138 | ^^^^^^^^^^^^^^^^^^^^^ |
| 139 | |
Richard Smith | 22540da | 2013-12-12 02:20:54 +0000 | [diff] [blame] | 140 | Clang 3.4 supports all the features in the current working draft of the |
| 141 | upcoming C++ standard, provisionally named C++1y. Support for the following |
| 142 | major new features has been added since Clang 3.3: |
| 143 | |
| 144 | - Generic lambdas and initialized lambda captures. |
| 145 | - Deduced function return types (``auto f() { return 0; }``). |
| 146 | - Generalized ``constexpr`` support (variable mutation and loops). |
| 147 | - Variable templates and static data member templates. |
| 148 | - Use of ``'`` as a digit separator in numeric literals. |
| 149 | - Support for sized ``::operator delete`` functions. |
| 150 | |
| 151 | In addition, ``[[deprecated]]`` is now accepted as a synonym for Clang's |
| 152 | existing ``deprecated`` attribute. |
| 153 | |
| 154 | Use ``-std=c++1y`` to enable C++1y mode. |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 155 | |
| 156 | Objective-C Language Changes in Clang |
| 157 | ------------------------------------- |
| 158 | |
| 159 | ... |
| 160 | |
Erik Schnetter | a87219b | 2013-11-11 06:36:33 +0000 | [diff] [blame] | 161 | OpenCL C Language Changes in Clang |
| 162 | ---------------------------------- |
| 163 | |
| 164 | - OpenCL C "long" now always has a size of 64 bit, and all OpenCL C |
| 165 | types are aligned as specified in the OpenCL C standard. Also, |
| 166 | "char" is now always signed. |
| 167 | |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 168 | Internal API Changes |
| 169 | -------------------- |
| 170 | |
Bill Wendling | a03209e | 2013-06-04 06:17:46 +0000 | [diff] [blame] | 171 | These are major API changes that have happened since the 3.3 release of |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 172 | Clang. If upgrading an external codebase that uses Clang as a library, |
| 173 | this section should help get you past the largest hurdles of upgrading. |
| 174 | |
Hans Wennborg | 0437e0d | 2013-05-20 14:53:06 +0000 | [diff] [blame] | 175 | Wide Character Types |
| 176 | ^^^^^^^^^^^^^^^^^^^^ |
| 177 | |
| 178 | The ASTContext class now keeps track of two different types for wide character |
| 179 | types: WCharTy and WideCharTy. WCharTy represents the built-in wchar_t type |
| 180 | available in C++. WideCharTy is the type used for wide character literals; in |
| 181 | C++ it is the same as WCharTy, but in C99, where wchar_t is a typedef, it is an |
| 182 | integer type. |
| 183 | |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 184 | ... |
| 185 | |
Ted Kremenek | 230fc37 | 2013-04-24 07:33:52 +0000 | [diff] [blame] | 186 | libclang |
| 187 | -------- |
| 188 | |
Bill Wendling | a03209e | 2013-06-04 06:17:46 +0000 | [diff] [blame] | 189 | ... |
Ted Kremenek | 230fc37 | 2013-04-24 07:33:52 +0000 | [diff] [blame] | 190 | |
Anna Zaks | 08741a0 | 2013-04-25 23:14:38 +0000 | [diff] [blame] | 191 | Static Analyzer |
Ted Kremenek | 1377a46 | 2013-04-26 00:01:34 +0000 | [diff] [blame] | 192 | --------------- |
Anna Zaks | 08741a0 | 2013-04-25 23:14:38 +0000 | [diff] [blame] | 193 | |
Sylvestre Ledru | 309dd09 | 2013-12-16 10:43:55 +0000 | [diff] [blame] | 194 | The static analyzer has been greatly improved. This impacts the overall analyzer quality and reduces a number of false positives. |
| 195 | In particular, this release provides enhanced C++ support, reasoning about initializer lists, zeroing constructors, noreturn destructors and modeling of destructor calls on calls to delete. |
Sylvestre Ledru | aa7fc19 | 2013-12-13 11:30:23 +0000 | [diff] [blame] | 196 | |
Daniel Jasper | 87ddfdd | 2013-12-11 14:41:33 +0000 | [diff] [blame] | 197 | Clang Format |
| 198 | ------------ |
| 199 | |
| 200 | Clang now includes a new tool ``clang-format`` which can be used to |
| 201 | automatically format C, C++ and Objective-C source code. ``clang-format`` |
| 202 | automatically chooses linebreaks and indentation and can be easily integrated |
| 203 | into editors, IDEs and version control systems. It supports several pre-defined |
| 204 | styles as well as precise style control using a multitude of formatting |
| 205 | options. ``clang-format`` itself is just a thin wrapper around a library which |
| 206 | can also be used directly from code refactoring and code translation tools. |
| 207 | More information can be found on `Clang Format's |
| 208 | site <http://clang.llvm.org/docs/ClangFormat.html>`_. |
| 209 | |
Hans Wennborg | a6c1850 | 2013-12-02 22:38:55 +0000 | [diff] [blame] | 210 | Windows Support |
| 211 | --------------- |
| 212 | |
Richard Smith | 94aaee2 | 2013-12-12 02:30:46 +0000 | [diff] [blame] | 213 | - `clang-cl <UsersManual.html#clang-cl>`_ provides a new driver mode that is |
Hans Wennborg | a6c1850 | 2013-12-02 22:38:55 +0000 | [diff] [blame] | 214 | designed for compatibility with Visual Studio's compiler, cl.exe. This driver |
Hans Wennborg | 70cb838 | 2013-12-09 20:00:25 +0000 | [diff] [blame] | 215 | mode makes Clang accept the same kind of command-line options as cl.exe. The |
| 216 | installer will attempt to expose clang-cl in any Visual Studio installations |
| 217 | on the system as a Platform Toolset, e.g. "LLVM-vs2012". clang-cl targets the |
| 218 | Microsoft ABI by default. Please note that this driver mode and compatibility |
| 219 | with the MS ABI is highly experimental. |
Hans Wennborg | a6c1850 | 2013-12-02 22:38:55 +0000 | [diff] [blame] | 220 | |
Ted Kremenek | 1377a46 | 2013-04-26 00:01:34 +0000 | [diff] [blame] | 221 | Core Analysis Improvements |
| 222 | ========================== |
| 223 | |
Bill Wendling | a03209e | 2013-06-04 06:17:46 +0000 | [diff] [blame] | 224 | - ... |
Ted Kremenek | 1377a46 | 2013-04-26 00:01:34 +0000 | [diff] [blame] | 225 | |
| 226 | New Issues Found |
| 227 | ================ |
| 228 | |
Bill Wendling | a03209e | 2013-06-04 06:17:46 +0000 | [diff] [blame] | 229 | - ... |
Anna Zaks | 08741a0 | 2013-04-25 23:14:38 +0000 | [diff] [blame] | 230 | |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 231 | Python Binding Changes |
| 232 | ---------------------- |
| 233 | |
| 234 | The following methods have been added: |
| 235 | |
| 236 | - ... |
| 237 | |
| 238 | Significant Known Problems |
| 239 | ========================== |
| 240 | |
| 241 | Additional Information |
| 242 | ====================== |
| 243 | |
| 244 | A wide variety of additional information is available on the `Clang web |
| 245 | page <http://clang.llvm.org/>`_. The web page contains versions of the |
Gabor Greif | 3cb8e31 | 2013-12-16 11:18:18 +0000 | [diff] [blame] | 246 | API documentation which are up-to-date with the Subversion revision of |
Sean Silva | debc018 | 2012-12-23 01:19:35 +0000 | [diff] [blame] | 247 | the source code. You can access versions of these documents specific to |
| 248 | this release by going into the "``clang/docs/``" directory in the Clang |
| 249 | tree. |
| 250 | |
| 251 | If you have any questions or comments about Clang, please feel free to |
| 252 | contact us via the `mailing |
| 253 | list <http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev>`_. |