diff options
author | dim <dim@FreeBSD.org> | 2012-12-22 15:00:54 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-12-22 15:00:54 +0000 |
commit | 5b20025c30d23d521e12c1f33ec8fa6b821952cd (patch) | |
tree | d97cbb4c3a7d0c7da83f0baa1fa220f188e9c6df | |
parent | 056abd2059c65a3e908193aeae16fad98017437c (diff) | |
download | FreeBSD-src-5b20025c30d23d521e12c1f33ec8fa6b821952cd.zip FreeBSD-src-5b20025c30d23d521e12c1f33ec8fa6b821952cd.tar.gz |
Vendor import of clang tags/RELEASE_32/final r170710 (effectively, 3.2
release):
http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_32/final@170710
-rw-r--r-- | docs/ReleaseNotes.html | 106 | ||||
-rw-r--r-- | include/clang/Sema/Scope.h | 11 | ||||
-rw-r--r-- | lib/Basic/Version.cpp | 2 | ||||
-rw-r--r-- | lib/Driver/ToolChains.cpp | 6 | ||||
-rw-r--r-- | lib/Parse/ParseDeclCXX.cpp | 3 | ||||
-rw-r--r-- | lib/Parse/ParseStmt.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/IdentifierResolver.cpp | 13 | ||||
-rw-r--r-- | test/CXX/basic/basic.scope/basic.scope.local/p2.cpp | 23 | ||||
-rw-r--r-- | test/Parser/bracket-crash.cpp | 3 |
9 files changed, 107 insertions, 62 deletions
diff --git a/docs/ReleaseNotes.html b/docs/ReleaseNotes.html index 8a195f0..a1ba15c 100644 --- a/docs/ReleaseNotes.html +++ b/docs/ReleaseNotes.html @@ -43,12 +43,6 @@ td { <p>Written by the <a href="http://llvm.org/">LLVM Team</a></p> </div> -<h1 style="color:red">These are in-progress notes for the upcoming Clang 3.2 -release.<br> -You may prefer the -<a href="http://llvm.org/releases/3.1/docs/ClangReleaseNotes.html">Clang 3.1 -Release Notes</a>.</h1> - <!-- ======================================================================= --> <h2 id="intro">Introduction</h2> <!-- ======================================================================= --> @@ -91,7 +85,7 @@ explain them more clearly, and provide more accurate source information about them. The improvements since the 3.1 release include:</p> <ul> - <li><tt>-Wuninitialized</tt> has been taught to recognise uninitialized uses + <li><tt>-Wuninitialized</tt> has been taught to recognize uninitialized uses which always occur when an explicitly-written non-constant condition is either <tt>true</tt> or <tt>false</tt>. For example: @@ -170,14 +164,11 @@ int f(vector<map<int, double>>); </li> - <li>Clang's <tt>-fcatch-undefined-behavior</tt> option has been renamed to - <tt>-fsanitize=undefined</tt> and has grown the ability to check for several - new types of undefined behavior. See the Users Manual for more information. - - <!-- Flesh this out prior to release. --> - - <!-- Document renaming of -faddress-sanitizer and -fthread-sanitizer. --> - + <li>The Address Sanitizer feature and Clang's <tt>-fcatch-undefined-behavior</tt> option have been moved to a unified flag set: + <tt>-fsanitize</tt>. This flag can be used to enable the different dynamic checking tools when building. For example, + <tt>-faddress-sanitizer</tt> is now <tt>-fsanitize=address</tt>, and <tt>-fcatch-undefined-behavior</tt> is now + <tt>-fsanitize=undefined</tt>. With this release the set of checks available continues to grow, see the Clang + documentation and specific sanitizer notes below for details. </li> </ul> @@ -215,6 +206,35 @@ function call.</p> <code>pointer_with_type_tag</code> and <code>type_tag_for_datatype</code> attributes in Clang language extensions documentation.</p> +<h4>Documentation comment support</h4> +<p>Clang now supports documentation comments written in a Doxygen-like syntax. +Clang parses the comments and can detect syntactic and semantic errors in +comments. These warnings are off by default. Pass <tt>-Wdocumentation</tt> +flag to enable warnings about documentation comments.</p> + +<p>For example, given:</p> + +<pre>/// \param [in] Str the string. +/// \returns a modified string. +void do_something(const std::string &str);</pre> + +<p><tt>clang -Wdocumentation</tt> will emit two warnings:</p> + +<pre><b>doc-test.cc:3:6: <span class="warning">warning:</span></b> '\returns' command used in a comment that is attached to a function returning void [-Wdocumentation] +/// \returns a modified string. + <span class="caret">~^~~~~~~~~~~~~~~~~~~~~~~~~~</span> +<b>doc-test.cc:2:17: <span class="warning">warning:</span></b> parameter 'Str' not found in the function declaration [-Wdocumentation] +/// \param [in] Str the string. + <span class="caret">^~~</span> +<b>doc-test.cc:2:17: <span class="note">note:</span></b> did you mean 'str'? +/// \param [in] Str the string. + <span class="caret">^~~</span> + <span class="caret">str</span></pre> + +<p>libclang includes a new API, <tt>clang_FullComment_getAsXML</tt>, to convert +comments to XML documents. This API can be used to build documentation +extraction tools.</p> + <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = --> <h3 id="newflags">New Compiler Flags</h3> <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = --> @@ -239,7 +259,8 @@ attributes in Clang language extensions documentation.</p> <h4 id="c11changes">C11 Feature Support</h4> -<p>...</p> +<p>Clang 3.2 adds support for the C11 <code>_Alignof</code> keyword, pedantic warning through option + <code>-Wempty-translation-unit</code> (C11 6.9p1) </p> <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = --> <h3 id="cxxchanges">C++ Language Changes in Clang</h3> @@ -247,40 +268,42 @@ attributes in Clang language extensions documentation.</p> <h4 id="cxx11changes">C++11 Feature Support</h4> -<p>...</p> - -<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = --> -<h3 id="objcchanges">Objective-C Language Changes in Clang</h3> -<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = --> +<p>Clang 3.2 supports <a href="http://clang.llvm.org/cxx_status.html#cxx11">most of the language features</a> + added in the latest ISO C++ standard,<a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=50372">C++ 2011</a>. + Use <code>-std=c++11</code> or <code>-std=gnu++11</code> to enable support for these features. In addition to the features supported by Clang 3.1, the + following features have been added:</p> -<p>...</p> +<ul> + <li>Implemented the C++11 discarded value expression rules for volatile lvalues.</li> + <li>Support for the C++11 enum forward declarations.</li> + <li>Handling of C++11 attribute namespaces (automatically).</li> + <li>Implemented C++11 [conv.prom]p4: an enumeration with a fixed underlying type has integral promotions + to both its underlying type and to its underlying type's promoted type.</li> +</ul> <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = --> -<h3 id="apichanges">Internal API Changes</h3> +<h3 id="objcchanges">Objective-C Language Changes in Clang</h3> <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = --> -<p>These are major API changes that have happened since the 3.1 release of - Clang. If upgrading an external codebase that uses Clang as a library, this - section should help get you past the largest hurdles of upgrading.</p> - -<h4 id="api1">API change 1</h4> - -<p>...</p> +<p>Bug-fixes, no functionality changes.</p> <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = --> <h3 id="pythonchanges">Python Binding Changes</h3> <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = --> -The following methods have been added: +The following classes and methods have been added: <ul> - <li>...</li> + <li>class CompilationDatabaseError(Exception)</li> + <li>class CompileCommand(object)</li> + <li>class CompileCommands(object)</li> + <li>class CompilationDatabase(ClangObject)</li> + <li>Cursor.is_static_method</li> + <li>Cursor.is_static_method</li> + <li>SourceLocation.from_offset</li> + <li>Cursor.is_static_method</li> </ul> <!-- ======================================================================= --> -<h2 id="knownproblems">Significant Known Problems</h2> -<!-- ======================================================================= --> - -<!-- ======================================================================= --> <h2 id="additionalinfo">Additional Information</h2> <!-- ======================================================================= --> @@ -296,17 +319,6 @@ The following methods have been added: the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev"> mailing list</a>.</p> -<!-- ======================================================================= --> -<!-- Likely 3.1 release notes --> -<!-- ======================================================================= --> -<!-- -This is just a section to hold things that have already gotten started and -should likely pick up proper release notes in 3.1. - -- C1X and C++11 atomics infrastructure and support -- CUDA support? - ---> </div> </body> diff --git a/include/clang/Sema/Scope.h b/include/clang/Sema/Scope.h index fa508cf..1329f97 100644 --- a/include/clang/Sema/Scope.h +++ b/include/clang/Sema/Scope.h @@ -84,11 +84,18 @@ public: /// TryScope - This is the scope of a C++ try statement. TryScope = 0x1000, + /// CatchScope - This is the scope of a C++ catch statement. + CatchScope = 0x2000, + + /// FnTryCatchScope - This is the scope for a function-level C++ try or + /// catch scope. + FnTryCatchScope = 0x4000, + /// FnTryScope - This is the scope of a function-level C++ try scope. - FnTryScope = 0x3000, + FnTryScope = TryScope | FnTryCatchScope, /// FnCatchScope - This is the scope of a function-level C++ catch scope. - FnCatchScope = 0x4000 + FnCatchScope = CatchScope | FnTryCatchScope }; private: /// The parent scope for this scope. This is null for the translation-unit diff --git a/lib/Basic/Version.cpp b/lib/Basic/Version.cpp index 286e96e..dc7d8d1 100644 --- a/lib/Basic/Version.cpp +++ b/lib/Basic/Version.cpp @@ -32,7 +32,7 @@ std::string getClangRepositoryPath() { // If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us // pick up a tag in an SVN export, for example. - static StringRef SVNRepository("$URL: http://llvm.org/svn/llvm-project/cfe/branches/release_32/lib/Basic/Version.cpp $"); + static StringRef SVNRepository("$URL: http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_32/final/lib/Basic/Version.cpp $"); if (URL.empty()) { URL = SVNRepository.slice(SVNRepository.find(':'), SVNRepository.find("/lib/Basic")); diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index a2ccb35..7d70cd5 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -1855,6 +1855,8 @@ enum LinuxDistro { UbuntuNatty, UbuntuOneiric, UbuntuPrecise, + UbuntuQuantal, + UbuntuRaring, UnknownDistro }; @@ -1872,7 +1874,7 @@ static bool IsDebian(enum LinuxDistro Distro) { } static bool IsUbuntu(enum LinuxDistro Distro) { - return Distro >= UbuntuHardy && Distro <= UbuntuPrecise; + return Distro >= UbuntuHardy && Distro <= UbuntuRaring; } static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) { @@ -1894,6 +1896,8 @@ static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) { .Case("natty", UbuntuNatty) .Case("oneiric", UbuntuOneiric) .Case("precise", UbuntuPrecise) + .Case("quantal", UbuntuQuantal) + .Case("raring", UbuntuRaring) .Default(UnknownDistro); return Version; } diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 4cb14e2..f11a9d1 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -706,8 +706,7 @@ SourceLocation Parser::ParseDecltypeSpecifier(DeclSpec &DS) { if (SkipUntil(tok::r_paren, /*StopAtSemi=*/true, /*DontConsume=*/true)) { EndLoc = ConsumeParen(); } else { - assert(Tok.is(tok::semi)); - if (PP.isBacktrackEnabled()) { + if (PP.isBacktrackEnabled() && Tok.is(tok::semi)) { // Backtrack to get the location of the last token before the semi. PP.RevertCachedTokens(2); ConsumeToken(); // the semi. diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index f604e03..5883115 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -2197,7 +2197,7 @@ StmtResult Parser::ParseCXXCatchBlock(bool FnCatch) { // The name in a catch exception-declaration is local to the handler and // shall not be redeclared in the outermost block of the handler. ParseScope CatchScope(this, Scope::DeclScope | Scope::ControlScope | - (FnCatch ? Scope::FnCatchScope : 0)); + (FnCatch ? Scope::FnCatchScope : Scope::CatchScope)); // exception-declaration is equivalent to '...' or a parameter-declaration // without default arguments. diff --git a/lib/Sema/IdentifierResolver.cpp b/lib/Sema/IdentifierResolver.cpp index 0093915..7d55304 100644 --- a/lib/Sema/IdentifierResolver.cpp +++ b/lib/Sema/IdentifierResolver.cpp @@ -135,16 +135,13 @@ bool IdentifierResolver::isDeclInScope(Decl *D, DeclContext *Ctx, // of the controlled statement. // assert(S->getParent() && "No TUScope?"); - if (S->getFlags() & Scope::FnTryScope) - return S->getParent()->isDeclScope(D); if (S->getParent()->getFlags() & Scope::ControlScope) { - if (S->getParent()->getFlags() & Scope::FnCatchScope) { - S = S->getParent(); - if (S->isDeclScope(D)) - return true; - } - return S->getParent()->isDeclScope(D); + S = S->getParent(); + if (S->isDeclScope(D)) + return true; } + if (S->getFlags() & Scope::FnTryCatchScope) + return S->getParent()->isDeclScope(D); } return false; } diff --git a/test/CXX/basic/basic.scope/basic.scope.local/p2.cpp b/test/CXX/basic/basic.scope/basic.scope.local/p2.cpp index 91e96b6..7c7b84d 100644 --- a/test/CXX/basic/basic.scope/basic.scope.local/p2.cpp +++ b/test/CXX/basic/basic.scope/basic.scope.local/p2.cpp @@ -35,3 +35,26 @@ void func7() { int i; // expected-error{{redefinition of 'i'}} } } + +void func8() { + int i; + try { + int i; + } catch (...) { + } +} + +void func9() { + if (bool b = true) + try { + int b; // FIXME: this probably should be invalid, maybe + } catch (...) { + } +} + +void func10() { + if (bool b = true) + if (true) { + int b; // FIXME: decide whether this is valid + } +} diff --git a/test/Parser/bracket-crash.cpp b/test/Parser/bracket-crash.cpp index bcc6eab..93b5294 100644 --- a/test/Parser/bracket-crash.cpp +++ b/test/Parser/bracket-crash.cpp @@ -4,3 +4,6 @@ decltype(; struct{ a } + +// PR14549. Must be at end of file. +decltype( |