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
This commit is contained in:
Dimitry Andric 2012-12-22 15:00:54 +00:00
parent 13cc256e40
commit be7c9ec198
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/clang/dist/; revision=244592
svn path=/vendor/clang/clang-release_32-r170710/; revision=244593; tag=vendor/clang/clang-release_32-r170710
9 changed files with 107 additions and 62 deletions

View File

@ -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&lt;map&lt;int, double&gt;&gt;);
</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 &amp;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,39 +268,41 @@ attributes in Clang language extensions documentation.</p>
<h4 id="cxx11changes">C++11 Feature Support</h4>
<p>...</p>
<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>
<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="objcchanges">Objective-C Language Changes in Clang</h3>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<p>...</p>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<h3 id="apichanges">Internal API Changes</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>

View File

@ -84,11 +84,18 @@ class Scope {
/// 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

View File

@ -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"));

View File

@ -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;
}

View File

@ -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.

View File

@ -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.

View File

@ -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;
}

View File

@ -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
}
}

View File

@ -4,3 +4,6 @@ decltype(;
struct{
a
}
// PR14549. Must be at end of file.
decltype(