[llvm-branch-commits] [cfe-branch] r157610 - in /cfe/branches/tooling: ./ docs/ include/clang/AST/ include/clang/Analysis/Analyses/ include/clang/Basic/ include/clang/Sema/ include/clang/StaticAnalyzer/Core/PathSensitive/ lib/ARCMigrate/ lib/AST/ lib/Analysis/ lib/Basic/ lib/CodeGen/ lib/Driver/ lib/Edit/ lib/Frontend/ lib/Rewrite/ lib/Sema/ lib/Serialization/ lib/StaticAnalyzer/Checkers/ lib/StaticAnalyzer/Core/ lib/Tooling/ test/ARCMT/ test/Analysis/ test/CXX/expr/ test/CXX/stmt.stmt/stmt.iter/stmt.ranged/ test/CodeGen/ tes...
Manuel Klimek
klimek at google.com
Tue May 29 05:04:38 PDT 2012
Author: klimek
Date: Tue May 29 07:04:37 2012
New Revision: 157610
URL: http://llvm.org/viewvc/llvm-project?rev=157610&view=rev
Log:
Merging mainline.
Added:
cfe/branches/tooling/docs/ClangPlugins.html
- copied unchanged from r157609, cfe/trunk/docs/ClangPlugins.html
cfe/branches/tooling/include/clang/Basic/BuiltinsNVPTX.def
- copied unchanged from r157609, cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
cfe/branches/tooling/test/Analysis/uninit-sometimes.cpp
- copied unchanged from r157609, cfe/trunk/test/Analysis/uninit-sometimes.cpp
cfe/branches/tooling/test/CXX/expr/p10-0x.cpp
- copied unchanged from r157609, cfe/trunk/test/CXX/expr/p10-0x.cpp
cfe/branches/tooling/test/CodeGen/alloc_size.c
- copied unchanged from r157609, cfe/trunk/test/CodeGen/alloc_size.c
cfe/branches/tooling/test/CodeGen/builtins-nvptx.c
- copied unchanged from r157609, cfe/trunk/test/CodeGen/builtins-nvptx.c
cfe/branches/tooling/test/CodeGen/nvptx-cc.c
- copied unchanged from r157609, cfe/trunk/test/CodeGen/nvptx-cc.c
cfe/branches/tooling/test/CodeGenCXX/alloc_size.cpp
- copied unchanged from r157609, cfe/trunk/test/CodeGenCXX/alloc_size.cpp
cfe/branches/tooling/test/CodeGenCXX/mangle-ms-templates.cpp
- copied unchanged from r157609, cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp
cfe/branches/tooling/test/Index/index-refs.m
- copied unchanged from r157609, cfe/trunk/test/Index/index-refs.m
cfe/branches/tooling/test/Rewriter/rewrite-modern-atautoreleasepool.mm
- copied unchanged from r157609, cfe/trunk/test/Rewriter/rewrite-modern-atautoreleasepool.mm
cfe/branches/tooling/test/Sema/alloc_size.c
- copied unchanged from r157609, cfe/trunk/test/Sema/alloc_size.c
cfe/branches/tooling/test/SemaCXX/long-virtual-inheritance-chain.cpp
- copied unchanged from r157609, cfe/trunk/test/SemaCXX/long-virtual-inheritance-chain.cpp
Removed:
cfe/branches/tooling/include/clang/Basic/BuiltinsPTX.def
cfe/branches/tooling/test/CodeGen/builtins-ptx.c
cfe/branches/tooling/test/CodeGen/ptx-cc.c
Modified:
cfe/branches/tooling/ (props changed)
cfe/branches/tooling/docs/LanguageExtensions.html
cfe/branches/tooling/docs/LibTooling.html
cfe/branches/tooling/docs/RAVFrontendAction.html
cfe/branches/tooling/docs/ReleaseNotes.html
cfe/branches/tooling/docs/Tooling.html
cfe/branches/tooling/include/clang/AST/BaseSubobject.h
cfe/branches/tooling/include/clang/AST/Expr.h
cfe/branches/tooling/include/clang/AST/Redeclarable.h
cfe/branches/tooling/include/clang/Analysis/Analyses/UninitializedValues.h
cfe/branches/tooling/include/clang/Basic/Attr.td
cfe/branches/tooling/include/clang/Basic/DiagnosticGroups.td
cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td
cfe/branches/tooling/include/clang/Basic/TargetBuiltins.h
cfe/branches/tooling/include/clang/Sema/Sema.h
cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
cfe/branches/tooling/lib/ARCMigrate/ObjCMT.cpp
cfe/branches/tooling/lib/ARCMigrate/TransProperties.cpp
cfe/branches/tooling/lib/ARCMigrate/TransRetainReleaseDealloc.cpp
cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp
cfe/branches/tooling/lib/ARCMigrate/Transforms.h
cfe/branches/tooling/lib/AST/CXXInheritance.cpp
cfe/branches/tooling/lib/AST/Decl.cpp
cfe/branches/tooling/lib/AST/Expr.cpp
cfe/branches/tooling/lib/AST/MicrosoftMangle.cpp
cfe/branches/tooling/lib/Analysis/UninitializedValues.cpp
cfe/branches/tooling/lib/Basic/Targets.cpp
cfe/branches/tooling/lib/Basic/Version.cpp
cfe/branches/tooling/lib/CodeGen/CGCall.cpp
cfe/branches/tooling/lib/CodeGen/CGExprScalar.cpp
cfe/branches/tooling/lib/CodeGen/CodeGenModule.cpp
cfe/branches/tooling/lib/CodeGen/TargetInfo.cpp
cfe/branches/tooling/lib/Driver/Driver.cpp
cfe/branches/tooling/lib/Driver/Tools.cpp
cfe/branches/tooling/lib/Edit/RewriteObjCFoundationAPI.cpp
cfe/branches/tooling/lib/Frontend/TextDiagnostic.cpp
cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp
cfe/branches/tooling/lib/Rewrite/Rewriter.cpp
cfe/branches/tooling/lib/Sema/AnalysisBasedWarnings.cpp
cfe/branches/tooling/lib/Sema/SemaDecl.cpp
cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp
cfe/branches/tooling/lib/Sema/SemaDeclObjC.cpp
cfe/branches/tooling/lib/Sema/SemaExpr.cpp
cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp
cfe/branches/tooling/lib/Sema/SemaExprObjC.cpp
cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp
cfe/branches/tooling/lib/Sema/SemaOverload.cpp
cfe/branches/tooling/lib/Sema/SemaPseudoObject.cpp
cfe/branches/tooling/lib/Sema/SemaStmt.cpp
cfe/branches/tooling/lib/Serialization/ASTReaderDecl.cpp
cfe/branches/tooling/lib/StaticAnalyzer/Checkers/Checkers.td
cfe/branches/tooling/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineC.cpp
cfe/branches/tooling/lib/StaticAnalyzer/Core/SValBuilder.cpp
cfe/branches/tooling/lib/Tooling/CompilationDatabase.cpp
cfe/branches/tooling/lib/Tooling/Tooling.cpp
cfe/branches/tooling/test/ARCMT/Common.h
cfe/branches/tooling/test/ARCMT/autoreleases.m
cfe/branches/tooling/test/ARCMT/autoreleases.m.result
cfe/branches/tooling/test/ARCMT/checking.m
cfe/branches/tooling/test/ARCMT/dispatch.m
cfe/branches/tooling/test/ARCMT/dispatch.m.result
cfe/branches/tooling/test/ARCMT/objcmt-boxing.m
cfe/branches/tooling/test/ARCMT/objcmt-boxing.m.result
cfe/branches/tooling/test/Analysis/cxx11-crashes.cpp
cfe/branches/tooling/test/Analysis/retain-release.m
cfe/branches/tooling/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
cfe/branches/tooling/test/CodeGenCUDA/address-spaces.cu
cfe/branches/tooling/test/CodeGenCUDA/ptx-kernels.cu
cfe/branches/tooling/test/CodeGenCXX/visibility.cpp
cfe/branches/tooling/test/CodeGenOpenCL/ptx-calls.cl
cfe/branches/tooling/test/CodeGenOpenCL/ptx-kernels.cl
cfe/branches/tooling/test/Driver/debug-options.c
cfe/branches/tooling/test/Index/print-typekind.m
cfe/branches/tooling/test/Sema/attr-deprecated.c
cfe/branches/tooling/test/Sema/attr-unavailable-message.c
cfe/branches/tooling/test/Sema/uninit-variables.c
cfe/branches/tooling/test/Sema/unused-expr.c
cfe/branches/tooling/test/SemaCXX/attr-deprecated.cpp
cfe/branches/tooling/test/SemaCXX/overload-call.cpp
cfe/branches/tooling/test/SemaCXX/reinterpret-cast.cpp
cfe/branches/tooling/test/SemaCXX/switch-implicit-fallthrough.cpp
cfe/branches/tooling/test/SemaCXX/unused.cpp
cfe/branches/tooling/test/SemaCXX/warn-unreachable.cpp (props changed)
cfe/branches/tooling/test/SemaCXX/warn-unused-value.cpp
cfe/branches/tooling/test/SemaObjC/attr-deprecated.m
cfe/branches/tooling/test/SemaObjC/no-ivar-in-interface-block.m
cfe/branches/tooling/test/SemaObjC/property-user-setter.m
cfe/branches/tooling/test/SemaObjC/protocol-attribute.m
cfe/branches/tooling/test/SemaObjC/special-dep-unavail-warning.m
cfe/branches/tooling/test/SemaObjC/warn-deprecated-implementations.m
cfe/branches/tooling/test/Tooling/clang-check-args.cpp
cfe/branches/tooling/test/Tooling/clang-check-builtin-headers.cpp
cfe/branches/tooling/test/Tooling/clang-check-chdir.cpp
cfe/branches/tooling/test/Tooling/clang-check-pwd.cpp
cfe/branches/tooling/test/Tooling/clang-check.cpp
cfe/branches/tooling/test/Tooling/multi-jobs.cpp
cfe/branches/tooling/tools/libclang/CXType.cpp
cfe/branches/tooling/tools/libclang/IndexingContext.h
cfe/branches/tooling/tools/scan-build/ccc-analyzer
cfe/branches/tooling/tools/scan-build/scan-build (contents, props changed)
cfe/branches/tooling/tools/scan-build/scan-build.1 (contents, props changed)
cfe/branches/tooling/unittests/Tooling/RewriterTestContext.h
cfe/branches/tooling/www/analyzer/latest_checker.html.incl
cfe/branches/tooling/www/analyzer/release_notes.html
cfe/branches/tooling/www/content.css
cfe/branches/tooling/www/menu.html.incl
Propchange: cfe/branches/tooling/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 29 07:04:37 2012
@@ -1,3 +1,3 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:146581-157321
+/cfe/trunk:146581-157609
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/tooling/docs/LanguageExtensions.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/docs/LanguageExtensions.html?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/docs/LanguageExtensions.html (original)
+++ cfe/branches/tooling/docs/LanguageExtensions.html Tue May 29 07:04:37 2012
@@ -660,7 +660,7 @@
included in installed versions of the framework.</p>
<!-- ======================================================================= -->
-<h2 id="availability">Availability attribute</h2
+<h2 id="availability">Availability attribute</h2>
<!-- ======================================================================= -->
<p>Clang introduces the <code>availability</code> attribute, which can
Modified: cfe/branches/tooling/docs/LibTooling.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/docs/LibTooling.html?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/docs/LibTooling.html (original)
+++ cfe/branches/tooling/docs/LibTooling.html Tue May 29 07:04:37 2012
@@ -7,6 +7,9 @@
<link type="text/css" rel="stylesheet" href="../content.css">
</head>
<body>
+
+<!--#include virtual="../menu.html.incl"-->
+
<div id="content">
<h1>LibTooling</h1>
Modified: cfe/branches/tooling/docs/RAVFrontendAction.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/docs/RAVFrontendAction.html?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/docs/RAVFrontendAction.html (original)
+++ cfe/branches/tooling/docs/RAVFrontendAction.html Tue May 29 07:04:37 2012
@@ -7,6 +7,9 @@
<link type="text/css" rel="stylesheet" href="../content.css">
</head>
<body>
+
+<!--#include virtual="../menu.html.incl"-->
+
<div id="content">
<h1>How to write RecursiveASTVisitor based ASTFrontendActions.</h1>
Modified: cfe/branches/tooling/docs/ReleaseNotes.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/docs/ReleaseNotes.html?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/docs/ReleaseNotes.html (original)
+++ cfe/branches/tooling/docs/ReleaseNotes.html Tue May 29 07:04:37 2012
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
-<title>Clang 3.1 Release Notes</title>
+<title>Clang 3.2 Release Notes</title>
<link type="text/css" rel="stylesheet" href="../menu.css">
<link type="text/css" rel="stylesheet" href="../content.css">
<style type="text/css">
@@ -17,14 +17,14 @@
<div id="content">
-<h1>Clang 3.1 Release Notes</h1>
+<h1>Clang 3.2 Release Notes</h1>
<img style="float:right" src="http://llvm.org/img/DragonSmall.png"
width="136" height="136" alt="LLVM Dragon Logo">
<ul>
<li><a href="#intro">Introduction</a></li>
- <li><a href="#whatsnew">What's New in Clang 3.1?</a>
+ <li><a href="#whatsnew">What's New in Clang 3.2?</a>
<ul>
<li><a href="#majorfeatures">Major New Features</a></li>
<li><a href="#cchanges">C Language Changes</a></li>
@@ -42,10 +42,10 @@
<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.1
+<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.0/docs/ClangReleaseNotes.html">Clang 3.0
+<a href="http://llvm.org/releases/3.1/docs/ClangReleaseNotes.html">Clang 3.1
Release Notes</a>.</h1>
<!-- ======================================================================= -->
@@ -53,50 +53,75 @@
<!-- ======================================================================= -->
<p>This document contains the release notes for the Clang C/C++/Objective-C
-frontend, part of the LLVM Compiler Infrastructure, release 3.1. 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 <a href="http://llvm.org/docs/ReleaseNotes.html">the LLVM
- documentation</a>. All LLVM releases may be downloaded from the
-<a href="http://llvm.org/releases/">LLVM releases web site</a>.</p>
+ frontend, part of the LLVM Compiler Infrastructure, release 3.2. 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 <a href="http://llvm.org/docs/ReleaseNotes.html">the LLVM
+ documentation</a>. All LLVM releases may be downloaded from the
+ <a href="http://llvm.org/releases/">LLVM releases web site</a>.</p>
<p>For more information about Clang or LLVM, including information about the
-latest release, please check out the main please see the
-<a href="http://clang.llvm.org">Clang Web Site</a> or the
-<a href="http://llvm.org">LLVM Web Site</a>.
+ latest release, please check out the main 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>Note that if you are reading this file from a Subversion checkout or the main
-Clang web page, this document applies to the <i>next</i> release, not the
-current one. To see the release notes for a specific release, please see the
-<a href="http://llvm.org/releases/">releases page</a>.</p>
+ Clang web page, this document applies to the <i>next</i> release, not the
+ current one. To see the release notes for a specific release, please see the
+ <a href="http://llvm.org/releases/">releases page</a>.</p>
<!-- ======================================================================= -->
-<h2 id="whatsnew">What's New in Clang 3.1?</h2>
+<h2 id="whatsnew">What's New in Clang 3.2?</h2>
<!-- ======================================================================= -->
<p>Some of the major new features and improvements to Clang are listed here.
-Generic improvements to Clang as a whole or two its underlying infrastructure
-are described first, followed by language-specific sections with improvements to
-Clang's support for those languages.</p>
+ 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.</p>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<h3 id="majorfeatures">Major New Features</h3>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
-<h4 id="majorfeature1">Feature 1</h4>
-...
+<h4 id="diagnostics">Improvements to Clang's diagnostics</h4>
-<h4 id="diagnostics">New and better diagnostics</h4>
+<p>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.1 release include:</p>
-<p>New: <code>-Wdangling-else</code>, <code>-Wstrncat-size</code>, ...</p>
+<ul>
+ <li><tt>-Wuninitialized</tt> has been taught to recognise uninitialized uses
+ which always occur when an explicitly-written non-constant condition is either
+ <tt>true</tt> or <tt>false</tt>. For example:
+
+<pre>
+int f(bool b) {
+ int n;
+ if (b)
+ n = 1;
+ return n;
+}
-<p>Improved: <code>-Wformat</code>, <code>-Wempty-body</code>,
-<code>-Wliteral-conversion</code>, ...</p>
+<b>sometimes-uninit.cpp:3:7: <span class="warning">warning:</span> variable 'n' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]</b>
+ if (b)
+ <span class="caret">^</span>
+<b>sometimes-uninit.cpp:5:10: <span class="note">note:</span></b> uninitialized use occurs here
+ return n;
+ <span class="caret">^</span>
+<b>sometimes-uninit.cpp:3:3: <span class="note">note:</span></b> remove the 'if' if its condition is always true
+ if (b)
+ <span class="caret">^~~~~~</span>
+<b>sometimes-uninit.cpp:2:8: <span class="note">note:</span></b> initialize the variable 'n' to silence this warning
+ int n;
+ <span class="caret">^</span>
+ <span class="caret"> = 0</span>
+</pre>
+
+ This functionality can be enabled or disabled separately from
+ <tt>-Wuninitialized</tt> with the <tt>-Wsometimes-uninitialized</tt> warning
+ flag.</li>
+</ul>
-<h4 id="tooling">Tooling</h4>
-<!-- FIXME: add a link to the tooling documentation once that's written. -->
-<p>Added an API to enable clang-based standalone tools, including initial build
-system integration.</p>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<h3 id="cchanges">C Language Changes in Clang</h3>
@@ -104,63 +129,33 @@
<h4 id="c11changes">C11 Feature Support</h4>
-<p>Clang 3.1 adds support for anonymous structs and anonymous unions, added in
-the latest ISO C standard. Use <code>-std=c11</code> or <code>-std=gnu11</code>
-to enable support for the new language standard. The new C11 features are
-backwards-compatible and are available as an extension in all language
-modes.</p>
-
-<p>All warning and language selection flags which previously accepted
-<code>c1x</code> have been updated to accept <code>c11</code>. The old
-<code>c1x</code> forms have been removed.</p>
-
-<p>Clang 3.1 adds a family of <code>__c11_atomic</code> builtins corresponding
- directly to the <code>_explict</code> versions of the C11 atomic functions.
- This means that C11's <code><stdatomic.h></code> can be implemented in
- a small set of trivial macros. </p>
+<p>...</p>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<h3 id="cxxchanges">C++ Language Changes in Clang</h3>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<h4 id="cxx11changes">C++11 Feature Support</h4>
-<p>Clang 3.1 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.0, the
-following are now considered to be of production quality:
-<ul>
- <li>Generalized constant expressions</li>
- <li>Lambda expressions</li>
- <li>Generalized initializers</li>
- <li>Unrestricted unions</li>
- <li>User-defined literals</li>
- <li>Forward-declared enumerations</li>
- <li>Atomics (both libc++'s and libstdc++4.7's <tt><atomic></tt> are
- supported)</li>
-</ul>
+
+<p>...</p>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<h3 id="objcchanges">Objective-C Language Changes in Clang</h3>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
-Clang 3.1 introduces several new Objective-C language features and improvements.
-
-<h4 id="objcwformat">Format string checking for NSString literals</h4>
-<code>-Wformat</code> now checks <code>@"nsstring literals"</code>.
+<p>...</p>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<h3 id="apichanges">Internal API Changes</h3>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
-These are major API changes that have happened since the 3.0 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>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>
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
<h3 id="pythonchanges">Python Binding Changes</h3>
@@ -168,32 +163,7 @@
The following methods have been added:
<ul>
- <li>SourceLocation.from_position (static)</li>
- <li>SourceLocation.__eq__ and SourceLocation.__ne__</li>
- <li>SourceRange.__eq__ and SourceRange.__ne__</li>
- <li>Diagnostic.category_number (property)</li>
- <li>Diagnostic.category_name (property)</li>
- <li>Diagnostic.option (property)</li>
- <li>Diagnostic.disable_option (property)</li>
- <li>CursorKind.is_translation_unit</li>
- <li>CursorKind.is_preprocessing</li>
- <li>CursorKind.is_unexposed</li>
- <li>Cursor.from_location (static)</li>
- <li>Cursor.underlying_typedef_type (property)</li>
- <li>Cursor.enum_type (property)</li>
- <li>Cursor.objc_type_encoding (property)</li>
- <li>Cursor.hash</li>
- <li>TypeKind.spelling</li>
- <li>Type.argument_types</li>
- <li>Type.element_type (property)</li>
- <li>Type.element_count (property)</li>
- <li>Type.is_function_variadic</li>
- <li>Type.is_pod</li>
- <li>Type.get_array_element_type</li>
- <li>Type.get_array_size</li>
- <li>Type.__eq__ and Type.__ne__</li>
- <li>File.from_name (static)</li>
- <li>File.__str__ and File.__repr__</li>
+ <li>...</li>
</ul>
<!-- ======================================================================= -->
@@ -205,16 +175,16 @@
<!-- ======================================================================= -->
<p>A wide variety of additional information is available on the
-<a href="http://clang.llvm.org/">Clang web page</a>. 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 "<tt>clang/doc/</tt>" directory in the Clang
-tree.</p>
+ <a href="http://clang.llvm.org/">Clang web page</a>. 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 "<tt>clang/doc/</tt>" directory in
+ the Clang tree.</p>
<p>If you have any questions or comments about Clang, please feel free to
-contact us via the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">
-mailing list</a>.</p>
-
+ contact us via
+ the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev"> mailing
+ list</a>.</p>
<!-- ======================================================================= -->
<!-- Likely 3.1 release notes -->
Modified: cfe/branches/tooling/docs/Tooling.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/docs/Tooling.html?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/docs/Tooling.html (original)
+++ cfe/branches/tooling/docs/Tooling.html Tue May 29 07:04:37 2012
@@ -7,6 +7,9 @@
<link type="text/css" rel="stylesheet" href="../content.css">
</head>
<body>
+
+<!--#include virtual="../menu.html.incl"-->
+
<div id="content">
<h1>Writing Clang Tools</h1>
@@ -40,7 +43,7 @@
</ul>
<!-- ======================================================================= -->
-<h2 id="clang-plugins"><a href="http://clang.llvm.org/doxygen/classclang_1_1PluginASTAction.html">Clang Plugins</a></h2>
+<h2 id="clang-plugins"><a href="ClangPlugins.html">Clang Plugins</a></h2>
<!-- ======================================================================= -->
<p>Clang Plugins allow you to run additional actions on the AST as part of
@@ -67,7 +70,7 @@
</ul>
<!-- ======================================================================= -->
-<h2 id="libtooling"><a href="http://clang.llvm.org/doxygen/namespaceclang_1_1tooling.html">LibTooling</a></h2>
+<h2 id="libtooling"><a href="LibTooling.html">LibTooling</a></h2>
<!-- ======================================================================= -->
<p>LibTooling is a C++ interface aimed at writing standalone tools, as well as
Modified: cfe/branches/tooling/include/clang/AST/BaseSubobject.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/BaseSubobject.h?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/BaseSubobject.h (original)
+++ cfe/branches/tooling/include/clang/AST/BaseSubobject.h Tue May 29 07:04:37 2012
@@ -66,9 +66,9 @@
}
static unsigned getHashValue(const clang::BaseSubobject &Base) {
- return
- DenseMapInfo<const clang::CXXRecordDecl *>::getHashValue(Base.getBase()) ^
- DenseMapInfo<int64_t>::getHashValue(Base.getBaseOffset().getQuantity());
+ typedef std::pair<const clang::CXXRecordDecl *, clang::CharUnits> PairTy;
+ return DenseMapInfo<PairTy>::getHashValue(PairTy(Base.getBase(),
+ Base.getBaseOffset()));
}
static bool isEqual(const clang::BaseSubobject &LHS,
Modified: cfe/branches/tooling/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/Expr.h?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/Expr.h (original)
+++ cfe/branches/tooling/include/clang/AST/Expr.h Tue May 29 07:04:37 2012
@@ -179,11 +179,12 @@
SourceLocation getExprLoc() const LLVM_READONLY;
/// isUnusedResultAWarning - Return true if this immediate expression should
- /// be warned about if the result is unused. If so, fill in Loc and Ranges
- /// with location to warn on and the source range[s] to report with the
- /// warning.
- bool isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1,
- SourceRange &R2, ASTContext &Ctx) const;
+ /// be warned about if the result is unused. If so, fill in expr, location,
+ /// and ranges with expr to warn on and source locations/ranges appropriate
+ /// for a warning.
+ bool isUnusedResultAWarning(const Expr *&WarnExpr, SourceLocation &Loc,
+ SourceRange &R1, SourceRange &R2,
+ ASTContext &Ctx) const;
/// isLValue - True if this expression is an "l-value" according to
/// the rules of the current language. C and C++ give somewhat
Modified: cfe/branches/tooling/include/clang/AST/Redeclarable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/Redeclarable.h?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/Redeclarable.h (original)
+++ cfe/branches/tooling/include/clang/AST/Redeclarable.h Tue May 29 07:04:37 2012
@@ -25,26 +25,25 @@
class Redeclarable {
protected:
- // FIXME: PointerIntPair is a value class that should not be inherited from.
- // This should change to using containment.
- struct DeclLink : public llvm::PointerIntPair<decl_type *, 1, bool> {
+ class DeclLink {
+ llvm::PointerIntPair<decl_type *, 1, bool> NextAndIsPrevious;
+ public:
DeclLink(decl_type *D, bool isLatest)
- : llvm::PointerIntPair<decl_type *, 1, bool>(D, isLatest) { }
-
- typedef llvm::PointerIntPair<decl_type *, 1, bool> base_type;
+ : NextAndIsPrevious(D, isLatest) { }
- bool NextIsPrevious() const { return base_type::getInt() == false; }
- bool NextIsLatest() const { return base_type::getInt() == true; }
- decl_type *getNext() const { return base_type::getPointer(); }
+ bool NextIsPrevious() const { return !NextAndIsPrevious.getInt(); }
+ bool NextIsLatest() const { return NextAndIsPrevious.getInt(); }
+ decl_type *getNext() const { return NextAndIsPrevious.getPointer(); }
+ void setNext(decl_type *D) { NextAndIsPrevious.setPointer(D); }
};
- struct PreviousDeclLink : public DeclLink {
- PreviousDeclLink(decl_type *D) : DeclLink(D, false) { }
- };
+ static DeclLink PreviousDeclLink(decl_type *D) {
+ return DeclLink(D, false);
+ }
- struct LatestDeclLink : public DeclLink {
- LatestDeclLink(decl_type *D) : DeclLink(D, true) { }
- };
+ static DeclLink LatestDeclLink(decl_type *D) {
+ return DeclLink(D, true);
+ }
/// \brief Points to the next redeclaration in the chain.
///
Modified: cfe/branches/tooling/include/clang/Analysis/Analyses/UninitializedValues.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Analysis/Analyses/UninitializedValues.h?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Analysis/Analyses/UninitializedValues.h (original)
+++ cfe/branches/tooling/include/clang/Analysis/Analyses/UninitializedValues.h Tue May 29 07:04:37 2012
@@ -15,6 +15,8 @@
#ifndef LLVM_CLANG_UNINIT_VALS_H
#define LLVM_CLANG_UNINIT_VALS_H
+#include "llvm/ADT/SmallVector.h"
+
namespace clang {
class AnalysisDeclContext;
@@ -23,15 +25,67 @@
class Expr;
class VarDecl;
+/// A use of a variable, which might be uninitialized.
+class UninitUse {
+public:
+ struct Branch {
+ const Stmt *Terminator;
+ unsigned Output;
+ };
+
+private:
+ /// The expression which uses this variable.
+ const Expr *User;
+
+ /// Does this use always see an uninitialized value?
+ bool AlwaysUninit;
+
+ /// This use is always uninitialized if it occurs after any of these branches
+ /// is taken.
+ llvm::SmallVector<Branch, 2> UninitBranches;
+
+public:
+ UninitUse(const Expr *User, bool AlwaysUninit) :
+ User(User), AlwaysUninit(AlwaysUninit) {}
+
+ void addUninitBranch(Branch B) {
+ UninitBranches.push_back(B);
+ }
+
+ /// Get the expression containing the uninitialized use.
+ const Expr *getUser() const { return User; }
+
+ /// The kind of uninitialized use.
+ enum Kind {
+ /// The use might be uninitialized.
+ Maybe,
+ /// The use is uninitialized whenever a certain branch is taken.
+ Sometimes,
+ /// The use is always uninitialized.
+ Always
+ };
+
+ /// Get the kind of uninitialized use.
+ Kind getKind() const {
+ return AlwaysUninit ? Always :
+ !branch_empty() ? Sometimes : Maybe;
+ }
+
+ typedef llvm::SmallVectorImpl<Branch>::const_iterator branch_iterator;
+ /// Branches which inevitably result in the variable being used uninitialized.
+ branch_iterator branch_begin() const { return UninitBranches.begin(); }
+ branch_iterator branch_end() const { return UninitBranches.end(); }
+ bool branch_empty() const { return UninitBranches.empty(); }
+};
+
class UninitVariablesHandler {
public:
UninitVariablesHandler() {}
virtual ~UninitVariablesHandler();
/// Called when the uninitialized variable is used at the given expression.
- virtual void handleUseOfUninitVariable(const Expr *ex,
- const VarDecl *vd,
- bool isAlwaysUninit) {}
+ virtual void handleUseOfUninitVariable(const VarDecl *vd,
+ const UninitUse &use) {}
/// Called when the uninitialized variable analysis detects the
/// idiom 'int x = x'. All other uses of 'x' within the initializer
Modified: cfe/branches/tooling/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/Attr.td?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/Attr.td (original)
+++ cfe/branches/tooling/include/clang/Basic/Attr.td Tue May 29 07:04:37 2012
@@ -144,6 +144,11 @@
let SemaHandler = 0;
}
+def AllocSize : Attr {
+ let Spellings = ["alloc_size"];
+ let Args = [VariadicUnsignedArgument<"Args">];
+}
+
def AlwaysInline : InheritableAttr {
let Spellings = ["always_inline"];
}
Removed: cfe/branches/tooling/include/clang/Basic/BuiltinsPTX.def
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/BuiltinsPTX.def?rev=157609&view=auto
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/BuiltinsPTX.def (original)
+++ cfe/branches/tooling/include/clang/Basic/BuiltinsPTX.def (removed)
@@ -1,62 +0,0 @@
-//===--- BuiltinsPTX.def - PTX Builtin function database ----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the PTX-specific builtin function database. Users of
-// this file must define the BUILTIN macro to make use of this information.
-//
-//===----------------------------------------------------------------------===//
-
-// The format of this database matches clang/Basic/Builtins.def.
-
-BUILTIN(__builtin_ptx_read_tid_x, "i", "nc")
-BUILTIN(__builtin_ptx_read_tid_y, "i", "nc")
-BUILTIN(__builtin_ptx_read_tid_z, "i", "nc")
-BUILTIN(__builtin_ptx_read_tid_w, "i", "nc")
-
-BUILTIN(__builtin_ptx_read_ntid_x, "i", "nc")
-BUILTIN(__builtin_ptx_read_ntid_y, "i", "nc")
-BUILTIN(__builtin_ptx_read_ntid_z, "i", "nc")
-BUILTIN(__builtin_ptx_read_ntid_w, "i", "nc")
-
-BUILTIN(__builtin_ptx_read_ctaid_x, "i", "nc")
-BUILTIN(__builtin_ptx_read_ctaid_y, "i", "nc")
-BUILTIN(__builtin_ptx_read_ctaid_z, "i", "nc")
-BUILTIN(__builtin_ptx_read_ctaid_w, "i", "nc")
-
-BUILTIN(__builtin_ptx_read_nctaid_x, "i", "nc")
-BUILTIN(__builtin_ptx_read_nctaid_y, "i", "nc")
-BUILTIN(__builtin_ptx_read_nctaid_z, "i", "nc")
-BUILTIN(__builtin_ptx_read_nctaid_w, "i", "nc")
-
-BUILTIN(__builtin_ptx_read_laneid, "i", "nc")
-BUILTIN(__builtin_ptx_read_warpid, "i", "nc")
-BUILTIN(__builtin_ptx_read_nwarpid, "i", "nc")
-
-BUILTIN(__builtin_ptx_read_smid, "i", "nc")
-BUILTIN(__builtin_ptx_read_nsmid, "i", "nc")
-BUILTIN(__builtin_ptx_read_gridid, "i", "nc")
-
-BUILTIN(__builtin_ptx_read_lanemask_eq, "i", "nc")
-BUILTIN(__builtin_ptx_read_lanemask_le, "i", "nc")
-BUILTIN(__builtin_ptx_read_lanemask_lt, "i", "nc")
-BUILTIN(__builtin_ptx_read_lanemask_ge, "i", "nc")
-BUILTIN(__builtin_ptx_read_lanemask_gt, "i", "nc")
-
-BUILTIN(__builtin_ptx_read_clock, "i", "n")
-BUILTIN(__builtin_ptx_read_clock64, "Li", "n")
-
-BUILTIN(__builtin_ptx_read_pm0, "i", "n")
-BUILTIN(__builtin_ptx_read_pm1, "i", "n")
-BUILTIN(__builtin_ptx_read_pm2, "i", "n")
-BUILTIN(__builtin_ptx_read_pm3, "i", "n")
-
-BUILTIN(__builtin_ptx_bar_sync, "vi", "n")
-
-
-#undef BUILTIN
Modified: cfe/branches/tooling/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/DiagnosticGroups.td?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticGroups.td Tue May 29 07:04:37 2012
@@ -214,8 +214,9 @@
def : DiagGroup<"type-limits">;
def Unicode : DiagGroup<"unicode">;
-def Uninitialized : DiagGroup<"uninitialized">;
def UninitializedMaybe : DiagGroup<"conditional-uninitialized">;
+def UninitializedSometimes : DiagGroup<"sometimes-uninitialized">;
+def Uninitialized : DiagGroup<"uninitialized", [UninitializedSometimes]>;
def UnknownPragmas : DiagGroup<"unknown-pragmas">;
def NSobjectAttribute : DiagGroup<"NSObject-attribute">;
def UnknownAttributes : DiagGroup<"attributes">;
Modified: cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/branches/tooling/include/clang/Basic/DiagnosticSemaKinds.td Tue May 29 07:04:37 2012
@@ -626,6 +626,9 @@
def warn_property_getter_owning_mismatch : Warning<
"property declared as returning non-retained objects"
"; getter returning retained objects">;
+def error_property_setter_ambiguous_use : Error<
+ "synthesized properties '%0' and '%1' both claim setter %2 -"
+ " use of this setter will cause unexpected behavior">;
def err_ownin_getter_rule : Error<
"property's synthesized getter follows Cocoa naming"
" convention for returning 'owned' objects">;
@@ -1174,19 +1177,21 @@
"variable %0 is uninitialized when used within its own initialization">,
InGroup<Uninitialized>;
def warn_uninit_var : Warning<
- "variable %0 is uninitialized when used here">,
+ "variable %0 is uninitialized when %select{used here|captured by block}1">,
InGroup<Uninitialized>, DefaultIgnore;
-def warn_maybe_uninit_var :
- Warning<"variable %0 may be uninitialized when used here">,
- InGroup<UninitializedMaybe>, DefaultIgnore;
-def note_uninit_var_def : Note<
- "variable %0 is declared here">;
-def warn_uninit_var_captured_by_block : Warning<
- "variable %0 is uninitialized when captured by block">,
- InGroup<Uninitialized>, DefaultIgnore;
-def warn_maybe_uninit_var_captured_by_block : Warning<
- "variable %0 may be uninitialized when captured by block">,
+def warn_sometimes_uninit_var : Warning<
+ "variable %0 is %select{used|captured}1 uninitialized whenever "
+ "%select{'%3' condition is %select{true|false}4|"
+ "'%3' loop %select{is entered|exits because its condition is false}4|"
+ "'%3' loop %select{condition is true|exits because its condition is false}4|"
+ "switch %3 is taken}2">, InGroup<UninitializedSometimes>, DefaultIgnore;
+def warn_maybe_uninit_var : Warning<
+ "variable %0 may be uninitialized when "
+ "%select{used here|captured by block}1">,
InGroup<UninitializedMaybe>, DefaultIgnore;
+def note_uninit_var_def : Note<"variable %0 is declared here">;
+def note_uninit_var_use : Note<
+ "%select{uninitialized use occurs|variable is captured by block}0 here">;
def warn_uninit_byref_blockvar_captured_by_block : Warning<
"block pointer variable %0 is uninitialized when captured by block">,
InGroup<Uninitialized>, DefaultIgnore;
@@ -1194,6 +1199,9 @@
"maybe you meant to use __block %0">;
def note_var_fixit_add_initialization : Note<
"initialize the variable %0 to silence this warning">;
+def note_uninit_fixit_remove_cond : Note<
+ "remove the %select{'%1' if its condition|condition if it}0 "
+ "is always %select{false|true}2">;
def err_init_incomplete_type : Error<"initialization of incomplete type %0">;
def err_temp_copy_no_viable : Error<
@@ -1483,6 +1491,8 @@
def err_init_priority_object_attr : Error<
"can only use 'init_priority' attribute on file-scope definitions "
"of objects of class type">;
+def err_attribute_argument_duplicate: Error<
+ "'%0' attribute parameter %1 is duplicated">;
def err_attribute_argument_n_not_int : Error<
"'%0' attribute requires parameter %1 to be an integer constant">;
def err_attribute_argument_n_not_string : Error<
@@ -3038,7 +3048,7 @@
"ivars may not be placed in %select{categories|class extension}0">;
def warn_ivars_in_interface : Warning<
"declaration of ivars in the interface is deprecated">,
- InGroup<DiagGroup<"interface-ivars">>, DefaultIgnore;
+ InGroup<DiagGroup<"objc-interface-ivars">>, DefaultIgnore;
def ext_enum_value_not_int : Extension<
"ISO C restricts enumerator values to range of 'int' (%0 is too "
"%select{small|large}1)">;
@@ -4726,6 +4736,10 @@
def warn_unused_result : Warning<
"ignoring return value of function declared with warn_unused_result "
"attribute">, InGroup<DiagGroup<"unused-result">>;
+def warn_unused_volatile : Warning<
+ "expression result unused; assign into a variable to force a volatile load">,
+ InGroup<DiagGroup<"unused-volatile-lvalue">>;
+
def warn_unused_comparison : Warning<
"%select{equality|inequality}0 comparison result unused">,
InGroup<UnusedComparison>;
Modified: cfe/branches/tooling/include/clang/Basic/TargetBuiltins.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/TargetBuiltins.h?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/TargetBuiltins.h (original)
+++ cfe/branches/tooling/include/clang/Basic/TargetBuiltins.h Tue May 29 07:04:37 2012
@@ -35,12 +35,12 @@
};
}
- /// PTX builtins
- namespace PTX {
+ /// NVPTX builtins
+ namespace NVPTX {
enum {
LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
-#include "clang/Basic/BuiltinsPTX.def"
+#include "clang/Basic/BuiltinsNVPTX.def"
LastTSBuiltin
};
}
Modified: cfe/branches/tooling/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Sema/Sema.h?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Sema/Sema.h (original)
+++ cfe/branches/tooling/include/clang/Sema/Sema.h Tue May 29 07:04:37 2012
@@ -2189,7 +2189,7 @@
bool isPropertyReadonly(ObjCPropertyDecl *PropertyDecl,
ObjCInterfaceDecl *IDecl);
- typedef llvm::DenseSet<Selector, llvm::DenseMapInfo<Selector> > SelectorSet;
+ typedef llvm::SmallPtrSet<Selector, 8> SelectorSet;
typedef llvm::DenseMap<Selector, ObjCMethodDecl*> ProtocolsMethodsMap;
/// CheckProtocolMethodDefs - This routine checks unimplemented
Modified: cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h (original)
+++ cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h Tue May 29 07:04:37 2012
@@ -151,7 +151,7 @@
static void Profile(llvm::FoldingSetNodeID &ID,
const ProgramPoint &Loc,
- ProgramStateRef state,
+ const ProgramStateRef &state,
bool IsSink) {
ID.Add(Loc);
ID.AddPointer(state.getPtr());
Modified: cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h (original)
+++ cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h Tue May 29 07:04:37 2012
@@ -78,7 +78,7 @@
// FIXME: Remove the second disjunct when we support symbolic
// truncation/extension.
return (Context.getCanonicalType(Ty1) == Context.getCanonicalType(Ty2) ||
- (Ty2->isIntegerType() && Ty2->isIntegerType()));
+ (Ty1->isIntegerType() && Ty2->isIntegerType()));
}
SVal evalCast(SVal val, QualType castTy, QualType originalType);
Modified: cfe/branches/tooling/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/ObjCMT.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/ObjCMT.cpp Tue May 29 07:04:37 2012
@@ -209,6 +209,7 @@
}
bool MigrateSourceAction::BeginInvocation(CompilerInstance &CI) {
+ CI.getDiagnostics().setIgnoreAllWarnings(true);
CI.getPreprocessorOpts().DetailedRecord = true;
CI.getPreprocessorOpts().DetailedRecordConditionalDirectives = true;
return true;
Modified: cfe/branches/tooling/lib/ARCMigrate/TransProperties.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransProperties.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransProperties.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransProperties.cpp Tue May 29 07:04:37 2012
@@ -309,17 +309,8 @@
if (RE->getDecl() != Ivar)
return true;
- if (ObjCMessageExpr *
- ME = dyn_cast<ObjCMessageExpr>(E->getRHS()->IgnoreParenCasts()))
- if (ME->getMethodFamily() == OMF_retain)
+ if (isPlusOneAssign(E))
return false;
-
- ImplicitCastExpr *implCE = dyn_cast<ImplicitCastExpr>(E->getRHS());
- while (implCE && implCE->getCastKind() == CK_BitCast)
- implCE = dyn_cast<ImplicitCastExpr>(implCE->getSubExpr());
-
- if (implCE && implCE->getCastKind() == CK_ARCConsumeObject)
- return false;
}
return true;
Modified: cfe/branches/tooling/lib/ARCMigrate/TransRetainReleaseDealloc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransRetainReleaseDealloc.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransRetainReleaseDealloc.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransRetainReleaseDealloc.cpp Tue May 29 07:04:37 2012
@@ -64,14 +64,16 @@
return true;
case OMF_autorelease:
if (isRemovable(E)) {
- // An unused autorelease is badness. If we remove it the receiver
- // will likely die immediately while previously it was kept alive
- // by the autorelease pool. This is bad practice in general, leave it
- // and emit an error to force the user to restructure his code.
- Pass.TA.reportError("it is not safe to remove an unused 'autorelease' "
- "message; its receiver may be destroyed immediately",
- E->getLocStart(), E->getSourceRange());
- return true;
+ if (!isCommonUnusedAutorelease(E)) {
+ // An unused autorelease is badness. If we remove it the receiver
+ // will likely die immediately while previously it was kept alive
+ // by the autorelease pool. This is bad practice in general, leave it
+ // and emit an error to force the user to restructure his code.
+ Pass.TA.reportError("it is not safe to remove an unused 'autorelease' "
+ "message; its receiver may be destroyed immediately",
+ E->getLocStart(), E->getSourceRange());
+ return true;
+ }
}
// Pass through.
case OMF_retain:
@@ -156,6 +158,80 @@
}
private:
+ /// \brief Checks for idioms where an unused -autorelease is common.
+ ///
+ /// Currently only returns true for this idiom which is common in property
+ /// setters:
+ ///
+ /// [backingValue autorelease];
+ /// backingValue = [newValue retain]; // in general a +1 assign
+ ///
+ bool isCommonUnusedAutorelease(ObjCMessageExpr *E) {
+ Expr *Rec = E->getInstanceReceiver();
+ if (!Rec)
+ return false;
+
+ Decl *RefD = getReferencedDecl(Rec);
+ if (!RefD)
+ return false;
+
+ Stmt *OuterS = E, *InnerS;
+ do {
+ InnerS = OuterS;
+ OuterS = StmtMap->getParent(InnerS);
+ }
+ while (OuterS && (isa<ParenExpr>(OuterS) ||
+ isa<CastExpr>(OuterS) ||
+ isa<ExprWithCleanups>(OuterS)));
+
+ if (!OuterS)
+ return false;
+
+ // Find next statement after the -autorelease.
+
+ Stmt::child_iterator currChildS = OuterS->child_begin();
+ Stmt::child_iterator childE = OuterS->child_end();
+ for (; currChildS != childE; ++currChildS) {
+ if (*currChildS == InnerS)
+ break;
+ }
+ if (currChildS == childE)
+ return false;
+ ++currChildS;
+ if (currChildS == childE)
+ return false;
+
+ Stmt *nextStmt = *currChildS;
+ if (!nextStmt)
+ return false;
+ nextStmt = nextStmt->IgnoreImplicit();
+
+ // Check for "RefD = [+1 retained object];".
+
+ if (BinaryOperator *Bop = dyn_cast<BinaryOperator>(nextStmt)) {
+ if (RefD != getReferencedDecl(Bop->getLHS()))
+ return false;
+ if (isPlusOneAssign(Bop))
+ return true;
+ }
+ return false;
+ }
+
+ Decl *getReferencedDecl(Expr *E) {
+ if (!E)
+ return 0;
+
+ E = E->IgnoreParenCasts();
+ if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
+ return DRE->getDecl();
+ if (MemberExpr *ME = dyn_cast<MemberExpr>(E))
+ return ME->getMemberDecl();
+ if (ObjCIvarRefExpr *IRE = dyn_cast<ObjCIvarRefExpr>(E))
+ return IRE->getDecl();
+
+ return 0;
+ }
+
/// \brief Check if the retain/release is due to a GCD/XPC macro that are
/// defined as:
///
Modified: cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp Tue May 29 07:04:37 2012
@@ -14,6 +14,7 @@
#include "clang/AST/StmtVisitor.h"
#include "clang/Lex/Lexer.h"
#include "clang/Basic/SourceManager.h"
+#include "clang/Analysis/DomainSpecific/CocoaConventions.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/DenseSet.h"
#include <map>
@@ -56,6 +57,47 @@
return true;
}
+bool trans::isPlusOneAssign(const BinaryOperator *E) {
+ if (E->getOpcode() != BO_Assign)
+ return false;
+
+ if (const ObjCMessageExpr *
+ ME = dyn_cast<ObjCMessageExpr>(E->getRHS()->IgnoreParenCasts()))
+ if (ME->getMethodFamily() == OMF_retain)
+ return true;
+
+ if (const CallExpr *
+ callE = dyn_cast<CallExpr>(E->getRHS()->IgnoreParenCasts())) {
+ if (const FunctionDecl *FD = callE->getDirectCallee()) {
+ if (FD->getAttr<CFReturnsRetainedAttr>())
+ return true;
+
+ if (FD->isGlobal() &&
+ FD->getIdentifier() &&
+ FD->getParent()->isTranslationUnit() &&
+ FD->getLinkage() == ExternalLinkage &&
+ ento::cocoa::isRefType(callE->getType(), "CF",
+ FD->getIdentifier()->getName())) {
+ StringRef fname = FD->getIdentifier()->getName();
+ if (fname.endswith("Retain") ||
+ fname.find("Create") != StringRef::npos ||
+ fname.find("Copy") != StringRef::npos) {
+ return true;
+ }
+ }
+ }
+ }
+
+ const ImplicitCastExpr *implCE = dyn_cast<ImplicitCastExpr>(E->getRHS());
+ while (implCE && implCE->getCastKind() == CK_BitCast)
+ implCE = dyn_cast<ImplicitCastExpr>(implCE->getSubExpr());
+
+ if (implCE && implCE->getCastKind() == CK_ARCConsumeObject)
+ return true;
+
+ return false;
+}
+
/// \brief 'Loc' is the end of a statement range. This returns the location
/// immediately after the semicolon following the statement.
/// If no semicolon is found or the location is inside a macro, the returned
Modified: cfe/branches/tooling/lib/ARCMigrate/Transforms.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/Transforms.h?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/Transforms.h (original)
+++ cfe/branches/tooling/lib/ARCMigrate/Transforms.h Tue May 29 07:04:37 2012
@@ -154,6 +154,8 @@
bool canApplyWeak(ASTContext &Ctx, QualType type,
bool AllowOnUnknownClass = false);
+bool isPlusOneAssign(const BinaryOperator *E);
+
/// \brief 'Loc' is the end of a statement range. This returns the location
/// immediately after the semicolon following the statement.
/// If no semicolon is found or the location is inside a macro, the returned
Modified: cfe/branches/tooling/lib/AST/CXXInheritance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/CXXInheritance.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/CXXInheritance.cpp (original)
+++ cfe/branches/tooling/lib/AST/CXXInheritance.cpp Tue May 29 07:04:37 2012
@@ -505,12 +505,17 @@
CXXFinalOverriderMap *BaseOverriders = &ComputedBaseOverriders;
if (Base->isVirtual()) {
CXXFinalOverriderMap *&MyVirtualOverriders = VirtualOverriders[BaseDecl];
+ BaseOverriders = MyVirtualOverriders;
if (!MyVirtualOverriders) {
MyVirtualOverriders = new CXXFinalOverriderMap;
+
+ // Collect may cause VirtualOverriders to reallocate, invalidating the
+ // MyVirtualOverriders reference. Set BaseOverriders to the right
+ // value now.
+ BaseOverriders = MyVirtualOverriders;
+
Collect(BaseDecl, true, BaseDecl, *MyVirtualOverriders);
}
-
- BaseOverriders = MyVirtualOverriders;
} else
Collect(BaseDecl, false, InVirtualSubobject, ComputedBaseOverriders);
Modified: cfe/branches/tooling/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/Decl.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/Decl.cpp (original)
+++ cfe/branches/tooling/lib/AST/Decl.cpp Tue May 29 07:04:37 2012
@@ -158,12 +158,13 @@
return getLVForTemplateArgumentList(TArgs.data(), TArgs.size(), OnlyTemplate);
}
-static bool shouldConsiderTemplateLV(const FunctionDecl *fn,
+static bool shouldConsiderTemplateVis(const FunctionDecl *fn,
const FunctionTemplateSpecializationInfo *spec) {
return !fn->hasAttr<VisibilityAttr>() || spec->isExplicitSpecialization();
}
-static bool shouldConsiderTemplateLV(const ClassTemplateSpecializationDecl *d) {
+static bool
+shouldConsiderTemplateVis(const ClassTemplateSpecializationDecl *d) {
return !d->hasAttr<VisibilityAttr>() || d->isExplicitSpecialization();
}
@@ -375,12 +376,16 @@
// this is an explicit specialization with a visibility attribute.
if (FunctionTemplateSpecializationInfo *specInfo
= Function->getTemplateSpecializationInfo()) {
- if (shouldConsiderTemplateLV(Function, specInfo)) {
- LV.merge(getLVForDecl(specInfo->getTemplate(),
- true));
- const TemplateArgumentList &templateArgs = *specInfo->TemplateArguments;
- LV.mergeWithMin(getLVForTemplateArgumentList(templateArgs,
- OnlyTemplate));
+ LinkageInfo TempLV = getLVForDecl(specInfo->getTemplate(), true);
+ const TemplateArgumentList &templateArgs = *specInfo->TemplateArguments;
+ LinkageInfo ArgsLV = getLVForTemplateArgumentList(templateArgs,
+ OnlyTemplate);
+ if (shouldConsiderTemplateVis(Function, specInfo)) {
+ LV.merge(TempLV);
+ LV.mergeWithMin(ArgsLV);
+ } else {
+ LV.mergeLinkage(TempLV);
+ LV.mergeLinkage(ArgsLV);
}
}
@@ -399,15 +404,19 @@
// linkage of the template and template arguments.
if (const ClassTemplateSpecializationDecl *spec
= dyn_cast<ClassTemplateSpecializationDecl>(Tag)) {
- if (shouldConsiderTemplateLV(spec)) {
- // From the template.
- LV.merge(getLVForDecl(spec->getSpecializedTemplate(),
- true));
-
- // The arguments at which the template was instantiated.
- const TemplateArgumentList &TemplateArgs = spec->getTemplateArgs();
- LV.mergeWithMin(getLVForTemplateArgumentList(TemplateArgs,
- OnlyTemplate));
+ // From the template.
+ LinkageInfo TempLV = getLVForDecl(spec->getSpecializedTemplate(), true);
+
+ // The arguments at which the template was instantiated.
+ const TemplateArgumentList &TemplateArgs = spec->getTemplateArgs();
+ LinkageInfo ArgsLV = getLVForTemplateArgumentList(TemplateArgs,
+ OnlyTemplate);
+ if (shouldConsiderTemplateVis(spec)) {
+ LV.merge(TempLV);
+ LV.mergeWithMin(ArgsLV);
+ } else {
+ LV.mergeLinkage(TempLV);
+ LV.mergeLinkage(ArgsLV);
}
}
@@ -526,12 +535,20 @@
// the template parameters and arguments.
if (FunctionTemplateSpecializationInfo *spec
= MD->getTemplateSpecializationInfo()) {
- if (shouldConsiderTemplateLV(MD, spec)) {
- LV.mergeWithMin(getLVForTemplateArgumentList(*spec->TemplateArguments,
- OnlyTemplate));
+ const TemplateArgumentList &TemplateArgs = *spec->TemplateArguments;
+ LinkageInfo ArgsLV = getLVForTemplateArgumentList(TemplateArgs,
+ OnlyTemplate);
+ TemplateParameterList *TemplateParams =
+ spec->getTemplate()->getTemplateParameters();
+ LinkageInfo ParamsLV = getLVForTemplateParameterList(TemplateParams);
+ if (shouldConsiderTemplateVis(MD, spec)) {
+ LV.mergeWithMin(ArgsLV);
+ if (!OnlyTemplate)
+ LV.merge(ParamsLV);
+ } else {
+ LV.mergeLinkage(ArgsLV);
if (!OnlyTemplate)
- LV.merge(getLVForTemplateParameterList(
- spec->getTemplate()->getTemplateParameters()));
+ LV.mergeLinkage(ParamsLV);
}
}
@@ -541,14 +558,22 @@
} else if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) {
if (const ClassTemplateSpecializationDecl *spec
= dyn_cast<ClassTemplateSpecializationDecl>(RD)) {
- if (shouldConsiderTemplateLV(spec)) {
- // Merge template argument/parameter information for member
- // class template specializations.
- LV.mergeWithMin(getLVForTemplateArgumentList(spec->getTemplateArgs(),
- OnlyTemplate));
- if (!OnlyTemplate)
- LV.merge(getLVForTemplateParameterList(
- spec->getSpecializedTemplate()->getTemplateParameters()));
+ // Merge template argument/parameter information for member
+ // class template specializations.
+ const TemplateArgumentList &TemplateArgs = spec->getTemplateArgs();
+ LinkageInfo ArgsLV = getLVForTemplateArgumentList(TemplateArgs,
+ OnlyTemplate);
+ TemplateParameterList *TemplateParams =
+ spec->getSpecializedTemplate()->getTemplateParameters();
+ LinkageInfo ParamsLV = getLVForTemplateParameterList(TemplateParams);
+ if (shouldConsiderTemplateVis(spec)) {
+ LV.mergeWithMin(ArgsLV);
+ if (!OnlyTemplate)
+ LV.merge(ParamsLV);
+ } else {
+ LV.mergeLinkage(ArgsLV);
+ if (!OnlyTemplate)
+ LV.mergeLinkage(ParamsLV);
}
}
Modified: cfe/branches/tooling/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/Expr.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/Expr.cpp (original)
+++ cfe/branches/tooling/lib/AST/Expr.cpp Tue May 29 07:04:37 2012
@@ -1654,8 +1654,9 @@
/// be warned about if the result is unused. If so, fill in Loc and Ranges
/// with location to warn on and the source range[s] to report with the
/// warning.
-bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1,
- SourceRange &R2, ASTContext &Ctx) const {
+bool Expr::isUnusedResultAWarning(const Expr *&WarnE, SourceLocation &Loc,
+ SourceRange &R1, SourceRange &R2,
+ ASTContext &Ctx) const {
// Don't warn if the expr is type dependent. The type could end up
// instantiating to void.
if (isTypeDependent())
@@ -1665,30 +1666,32 @@
default:
if (getType()->isVoidType())
return false;
+ WarnE = this;
Loc = getExprLoc();
R1 = getSourceRange();
return true;
case ParenExprClass:
return cast<ParenExpr>(this)->getSubExpr()->
- isUnusedResultAWarning(Loc, R1, R2, Ctx);
+ isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx);
case GenericSelectionExprClass:
return cast<GenericSelectionExpr>(this)->getResultExpr()->
- isUnusedResultAWarning(Loc, R1, R2, Ctx);
+ isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx);
case UnaryOperatorClass: {
const UnaryOperator *UO = cast<UnaryOperator>(this);
switch (UO->getOpcode()) {
- default: break;
+ case UO_Plus:
+ case UO_Minus:
+ case UO_AddrOf:
+ case UO_Not:
+ case UO_LNot:
+ case UO_Deref:
+ break;
case UO_PostInc:
case UO_PostDec:
case UO_PreInc:
case UO_PreDec: // ++/--
return false; // Not a warning.
- case UO_Deref:
- // Dereferencing a volatile pointer is a side-effect.
- if (Ctx.getCanonicalType(getType()).isVolatileQualified())
- return false;
- break;
case UO_Real:
case UO_Imag:
// accessing a piece of a volatile complex is a side-effect.
@@ -1697,8 +1700,9 @@
return false;
break;
case UO_Extension:
- return UO->getSubExpr()->isUnusedResultAWarning(Loc, R1, R2, Ctx);
+ return UO->getSubExpr()->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx);
}
+ WarnE = this;
Loc = UO->getOperatorLoc();
R1 = UO->getSubExpr()->getSourceRange();
return true;
@@ -1717,17 +1721,18 @@
dyn_cast<IntegerLiteral>(BO->getRHS()->IgnoreParens()))
if (IE->getValue() == 0)
return false;
- return BO->getRHS()->isUnusedResultAWarning(Loc, R1, R2, Ctx);
+ return BO->getRHS()->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx);
// Consider '||', '&&' to have side effects if the LHS or RHS does.
case BO_LAnd:
case BO_LOr:
- if (!BO->getLHS()->isUnusedResultAWarning(Loc, R1, R2, Ctx) ||
- !BO->getRHS()->isUnusedResultAWarning(Loc, R1, R2, Ctx))
+ if (!BO->getLHS()->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx) ||
+ !BO->getRHS()->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx))
return false;
break;
}
if (BO->isAssignmentOp())
return false;
+ WarnE = this;
Loc = BO->getOperatorLoc();
R1 = BO->getLHS()->getSourceRange();
R2 = BO->getRHS()->getSourceRange();
@@ -1743,28 +1748,22 @@
// be being used for control flow. Only warn if both the LHS and
// RHS are warnings.
const ConditionalOperator *Exp = cast<ConditionalOperator>(this);
- if (!Exp->getRHS()->isUnusedResultAWarning(Loc, R1, R2, Ctx))
+ if (!Exp->getRHS()->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx))
return false;
if (!Exp->getLHS())
return true;
- return Exp->getLHS()->isUnusedResultAWarning(Loc, R1, R2, Ctx);
+ return Exp->getLHS()->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx);
}
case MemberExprClass:
- // If the base pointer or element is to a volatile pointer/field, accessing
- // it is a side effect.
- if (Ctx.getCanonicalType(getType()).isVolatileQualified())
- return false;
+ WarnE = this;
Loc = cast<MemberExpr>(this)->getMemberLoc();
R1 = SourceRange(Loc, Loc);
R2 = cast<MemberExpr>(this)->getBase()->getSourceRange();
return true;
case ArraySubscriptExprClass:
- // If the base pointer or element is to a volatile pointer/field, accessing
- // it is a side effect.
- if (Ctx.getCanonicalType(getType()).isVolatileQualified())
- return false;
+ WarnE = this;
Loc = cast<ArraySubscriptExpr>(this)->getRBracketLoc();
R1 = cast<ArraySubscriptExpr>(this)->getLHS()->getSourceRange();
R2 = cast<ArraySubscriptExpr>(this)->getRHS()->getSourceRange();
@@ -1780,6 +1779,7 @@
const CXXOperatorCallExpr *Op = cast<CXXOperatorCallExpr>(this);
if (Op->getOperator() == OO_EqualEqual ||
Op->getOperator() == OO_ExclaimEqual) {
+ WarnE = this;
Loc = Op->getOperatorLoc();
R1 = Op->getSourceRange();
return true;
@@ -1800,6 +1800,7 @@
// updated to match for QoI.
if (FD->getAttr<WarnUnusedResultAttr>() ||
FD->getAttr<PureAttr>() || FD->getAttr<ConstAttr>()) {
+ WarnE = this;
Loc = CE->getCallee()->getLocStart();
R1 = CE->getCallee()->getSourceRange();
@@ -1824,6 +1825,7 @@
ME->getSelector().getIdentifierInfoForSlot(0) &&
ME->getSelector().getIdentifierInfoForSlot(0)
->getName().startswith("init")) {
+ WarnE = this;
Loc = getExprLoc();
R1 = ME->getSourceRange();
return true;
@@ -1831,6 +1833,7 @@
const ObjCMethodDecl *MD = ME->getMethodDecl();
if (MD && MD->getAttr<WarnUnusedResultAttr>()) {
+ WarnE = this;
Loc = getExprLoc();
return true;
}
@@ -1838,6 +1841,7 @@
}
case ObjCPropertyRefExprClass:
+ WarnE = this;
Loc = getExprLoc();
R1 = getSourceRange();
return true;
@@ -1850,6 +1854,7 @@
isa<BinaryOperator>(PO->getSyntacticForm()))
return false;
+ WarnE = this;
Loc = getExprLoc();
R1 = getSourceRange();
return true;
@@ -1864,50 +1869,67 @@
const CompoundStmt *CS = cast<StmtExpr>(this)->getSubStmt();
if (!CS->body_empty()) {
if (const Expr *E = dyn_cast<Expr>(CS->body_back()))
- return E->isUnusedResultAWarning(Loc, R1, R2, Ctx);
+ return E->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx);
if (const LabelStmt *Label = dyn_cast<LabelStmt>(CS->body_back()))
if (const Expr *E = dyn_cast<Expr>(Label->getSubStmt()))
- return E->isUnusedResultAWarning(Loc, R1, R2, Ctx);
+ return E->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx);
}
if (getType()->isVoidType())
return false;
+ WarnE = this;
Loc = cast<StmtExpr>(this)->getLParenLoc();
R1 = getSourceRange();
return true;
}
- case CStyleCastExprClass:
- // If this is an explicit cast to void, allow it. People do this when they
- // think they know what they're doing :).
- if (getType()->isVoidType())
- return false;
- Loc = cast<CStyleCastExpr>(this)->getLParenLoc();
- R1 = cast<CStyleCastExpr>(this)->getSubExpr()->getSourceRange();
- return true;
- case CXXFunctionalCastExprClass: {
- if (getType()->isVoidType())
- return false;
+ case CStyleCastExprClass: {
+ // Ignore an explicit cast to void unless the operand is a non-trivial
+ // volatile lvalue.
const CastExpr *CE = cast<CastExpr>(this);
-
- // If this is a cast to void or a constructor conversion, check the operand.
+ if (CE->getCastKind() == CK_ToVoid) {
+ if (CE->getSubExpr()->isGLValue() &&
+ CE->getSubExpr()->getType().isVolatileQualified()) {
+ const DeclRefExpr *DRE =
+ dyn_cast<DeclRefExpr>(CE->getSubExpr()->IgnoreParens());
+ if (!(DRE && isa<VarDecl>(DRE->getDecl()) &&
+ cast<VarDecl>(DRE->getDecl())->hasLocalStorage())) {
+ return CE->getSubExpr()->isUnusedResultAWarning(WarnE, Loc,
+ R1, R2, Ctx);
+ }
+ }
+ return false;
+ }
+
+ // If this is a cast to a constructor conversion, check the operand.
// Otherwise, the result of the cast is unused.
- if (CE->getCastKind() == CK_ToVoid ||
- CE->getCastKind() == CK_ConstructorConversion)
- return (cast<CastExpr>(this)->getSubExpr()
- ->isUnusedResultAWarning(Loc, R1, R2, Ctx));
- Loc = cast<CXXFunctionalCastExpr>(this)->getTypeBeginLoc();
- R1 = cast<CXXFunctionalCastExpr>(this)->getSubExpr()->getSourceRange();
+ if (CE->getCastKind() == CK_ConstructorConversion)
+ return CE->getSubExpr()->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx);
+
+ WarnE = this;
+ if (const CXXFunctionalCastExpr *CXXCE =
+ dyn_cast<CXXFunctionalCastExpr>(this)) {
+ Loc = CXXCE->getTypeBeginLoc();
+ R1 = CXXCE->getSubExpr()->getSourceRange();
+ } else {
+ const CStyleCastExpr *CStyleCE = cast<CStyleCastExpr>(this);
+ Loc = CStyleCE->getLParenLoc();
+ R1 = CStyleCE->getSubExpr()->getSourceRange();
+ }
return true;
}
+ case ImplicitCastExprClass: {
+ const CastExpr *ICE = cast<ImplicitCastExpr>(this);
- case ImplicitCastExprClass:
- // Check the operand, since implicit casts are inserted by Sema
- return (cast<ImplicitCastExpr>(this)
- ->getSubExpr()->isUnusedResultAWarning(Loc, R1, R2, Ctx));
+ // lvalue-to-rvalue conversion on a volatile lvalue is a side-effect.
+ if (ICE->getCastKind() == CK_LValueToRValue &&
+ ICE->getSubExpr()->getType().isVolatileQualified())
+ return false;
+ return ICE->getSubExpr()->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx);
+ }
case CXXDefaultArgExprClass:
return (cast<CXXDefaultArgExpr>(this)
- ->getExpr()->isUnusedResultAWarning(Loc, R1, R2, Ctx));
+ ->getExpr()->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx));
case CXXNewExprClass:
// FIXME: In theory, there might be new expressions that don't have side
@@ -1916,10 +1938,10 @@
return false;
case CXXBindTemporaryExprClass:
return (cast<CXXBindTemporaryExpr>(this)
- ->getSubExpr()->isUnusedResultAWarning(Loc, R1, R2, Ctx));
+ ->getSubExpr()->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx));
case ExprWithCleanupsClass:
return (cast<ExprWithCleanups>(this)
- ->getSubExpr()->isUnusedResultAWarning(Loc, R1, R2, Ctx));
+ ->getSubExpr()->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx));
}
}
Modified: cfe/branches/tooling/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/MicrosoftMangle.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/branches/tooling/lib/AST/MicrosoftMangle.cpp Tue May 29 07:04:37 2012
@@ -42,6 +42,7 @@
void mangleFunctionEncoding(const FunctionDecl *FD);
void mangleVariableEncoding(const VarDecl *VD);
void mangleNumber(int64_t Number);
+ void mangleNumber(const llvm::APSInt &Value);
void mangleType(QualType T);
private:
@@ -54,6 +55,11 @@
void mangleOperatorName(OverloadedOperatorKind OO);
void mangleQualifiers(Qualifiers Quals, bool IsMember);
+ void mangleUnscopedTemplateName(const TemplateDecl *ND);
+ void mangleTemplateInstantiationName(const TemplateDecl *TD,
+ const TemplateArgument *TemplateArgs,
+ unsigned NumTemplateArgs,
+ SourceLocation InstantiationLoc);
void mangleObjCMethodName(const ObjCMethodDecl *MD);
// Declare manglers for every type class.
@@ -69,8 +75,12 @@
void mangleExtraDimensions(QualType T);
void mangleFunctionClass(const FunctionDecl *FD);
void mangleCallingConvention(const FunctionType *T, bool IsInstMethod = false);
+ void mangleIntegerLiteral(QualType T, const llvm::APSInt &Number);
void mangleThrowSpecification(const FunctionProtoType *T);
+ void mangleTemplateArgs(const TemplateArgument *TemplateArgs, unsigned NumTemplateArgs,
+ SourceLocation InstantiationLoc);
+
};
/// MicrosoftMangleContext - Overrides the default MangleContext for the
@@ -266,35 +276,94 @@
}
void MicrosoftCXXNameMangler::mangleNumber(int64_t Number) {
- // <number> ::= [?] <decimal digit> # <= 9
- // ::= [?] <hex digit>+ @ # > 9; A = 0, B = 1, etc...
+ // <number> ::= [?] <decimal digit> # 1 <= Number <= 10
+ // ::= [?] <hex digit>+ @ # 0 or > 9; A = 0, B = 1, etc...
+ // ::= [?] @ # 0 (alternate mangling, not emitted by VC)
if (Number < 0) {
Out << '?';
Number = -Number;
}
- if (Number >= 1 && Number <= 10) {
+ // Oddly enough, there's a special shorter mangling for 0, but Microsoft chose not
+ // to use it. Instead, 0 gets mangled as "A@". Oh well...
+ if (Number >= 1 && Number <= 10)
Out << Number-1;
- } else {
+ else {
// We have to build up the encoding in reverse order, so it will come
// out right when we write it out.
char Encoding[16];
char *EndPtr = Encoding+sizeof(Encoding);
char *CurPtr = EndPtr;
- while (Number) {
+ do {
*--CurPtr = 'A' + (Number % 16);
Number /= 16;
- }
+ } while (Number);
Out.write(CurPtr, EndPtr-CurPtr);
Out << '@';
}
}
+void MicrosoftCXXNameMangler::mangleNumber(const llvm::APSInt &Value) {
+ if (Value.isSigned() && Value.isNegative()) {
+ Out << '?';
+ mangleNumber(llvm::APSInt(Value.abs()));
+ return;
+ }
+ llvm::APSInt Temp(Value);
+ if (Value.uge(1) && Value.ule(10)) {
+ --Temp;
+ Temp.print(Out, false);
+ } else {
+ // We have to build up the encoding in reverse order, so it will come
+ // out right when we write it out.
+ char Encoding[64];
+ char *EndPtr = Encoding+sizeof(Encoding);
+ char *CurPtr = EndPtr;
+ llvm::APSInt NibbleMask(Value.getBitWidth(), Value.isUnsigned());
+ NibbleMask = 0xf;
+ for (int i = 0, e = Value.getActiveBits() / 4; i != e; ++i) {
+ *--CurPtr = 'A' + Temp.And(NibbleMask).getLimitedValue(0xf);
+ Temp = Temp.lshr(4);
+ };
+ Out.write(CurPtr, EndPtr-CurPtr);
+ Out << '@';
+ }
+}
+
+static const TemplateDecl *
+isTemplate(const NamedDecl *ND, const TemplateArgumentList *&TemplateArgs) {
+ // Check if we have a function template.
+ if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)){
+ if (const TemplateDecl *TD = FD->getPrimaryTemplate()) {
+ TemplateArgs = FD->getTemplateSpecializationArgs();
+ return TD;
+ }
+ }
+
+ // Check if we have a class template.
+ if (const ClassTemplateSpecializationDecl *Spec =
+ dyn_cast<ClassTemplateSpecializationDecl>(ND)) {
+ TemplateArgs = &Spec->getTemplateArgs();
+ return Spec->getSpecializedTemplate();
+ }
+
+ return 0;
+}
+
void
MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
DeclarationName Name) {
// <unqualified-name> ::= <operator-name>
// ::= <ctor-dtor-name>
// ::= <source-name>
+ // ::= <template-name>
+ const TemplateArgumentList *TemplateArgs;
+ // Check if we have a template.
+ if (const TemplateDecl *TD = isTemplate(ND, TemplateArgs)) {
+ mangleTemplateInstantiationName(TD, TemplateArgs->data(), TemplateArgs->size(),
+ ND->getLocation());
+ return;
+ }
+
switch (Name.getNameKind()) {
case DeclarationName::Identifier: {
if (const IdentifierInfo *II = Name.getAsIdentifierInfo()) {
@@ -364,7 +433,6 @@
void MicrosoftCXXNameMangler::manglePostfix(const DeclContext *DC,
bool NoFunction) {
// <postfix> ::= <unqualified-name> [<postfix>]
- // ::= <template-postfix> <template-args> [<postfix>]
// ::= <template-param>
// ::= <substitution> [<postfix>]
@@ -523,10 +591,69 @@
Out << II->getName() << '@';
}
+void MicrosoftCXXNameMangler::mangleTemplateInstantiationName(const TemplateDecl *TD,
+ const TemplateArgument *TemplateArgs,
+ unsigned NumTemplateArgs,
+ SourceLocation InstantiationLoc) {
+ // <template-name> ::= <unscoped-template-name> <template-args>
+ // ::= <substitution>
+ // Always start with the unqualified name.
+ mangleUnscopedTemplateName(TD);
+ mangleTemplateArgs(TemplateArgs, NumTemplateArgs, InstantiationLoc);
+}
+
void MicrosoftCXXNameMangler::mangleObjCMethodName(const ObjCMethodDecl *MD) {
Context.mangleObjCMethodName(MD, Out);
}
+void
+MicrosoftCXXNameMangler::mangleUnscopedTemplateName(const TemplateDecl *TD) {
+ // <unscoped-template-name> ::= ?$ <unqualified-name>
+ Out << "?$";
+ mangleUnqualifiedName(TD);
+}
+
+void
+MicrosoftCXXNameMangler::mangleIntegerLiteral(QualType T, const llvm::APSInt &Value) {
+ // <integer-literal> ::= $0 <number>
+ Out << "$0";
+ // Make sure booleans are encoded as 0/1.
+ if (T->isBooleanType())
+ Out << (Value.getBoolValue() ? "0" : "A@");
+ else
+ mangleNumber(Value);
+}
+
+void
+MicrosoftCXXNameMangler::mangleTemplateArgs(const TemplateArgument *TemplateArgs,
+ unsigned NumTemplateArgs,
+ SourceLocation InstantiationLoc) {
+ // <template-args> ::= {<type> | <integer-literal>}+ @
+ for (unsigned int i = 0; i < NumTemplateArgs; ++i) {
+ const TemplateArgument &TA = TemplateArgs[i];
+ switch (TA.getKind()) {
+ case TemplateArgument::Null:
+ llvm_unreachable("Can't mangle null template arguments!");
+ case TemplateArgument::Type:
+ mangleType(TA.getAsType());
+ break;
+ case TemplateArgument::Integral:
+ mangleIntegerLiteral(TA.getIntegralType(), *TA.getAsIntegral());
+ break;
+ default: {
+ // Issue a diagnostic.
+ DiagnosticsEngine &Diags = Context.getDiags();
+ unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
+ "cannot yet mangle this %select{null|type|pointer/reference|integral|template|"
+ "template pack expansion|expression|parameter pack}0 template argument");
+ Diags.Report(InstantiationLoc, DiagID)
+ << TA.getKind();
+ }
+ }
+ }
+ Out << '@';
+}
+
void MicrosoftCXXNameMangler::mangleQualifiers(Qualifiers Quals,
bool IsMember) {
// <cvr-qualifiers> ::= [E] [F] [I] <base-cvr-qualifiers>
Modified: cfe/branches/tooling/lib/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Analysis/UninitializedValues.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Analysis/UninitializedValues.cpp (original)
+++ cfe/branches/tooling/lib/Analysis/UninitializedValues.cpp Tue May 29 07:04:37 2012
@@ -112,7 +112,7 @@
void computeSetOfDeclarations(const DeclContext &dc);
ValueVector &getValueVector(const CFGBlock *block,
- const CFGBlock *dstBlock);
+ const CFGBlock *dstBlock);
BVPair &getValueVectors(const CFGBlock *block, bool shouldLazyCreate);
@@ -128,6 +128,13 @@
ValueVector &getScratch() { return scratch; }
ValueVector::reference operator[](const VarDecl *vd);
+
+ Value getValue(const CFGBlock *block, const CFGBlock *dstBlock,
+ const VarDecl *vd) {
+ const llvm::Optional<unsigned> &idx = declToIndex.getValueIndex(vd);
+ assert(idx.hasValue());
+ return getValueVector(block, dstBlock)[idx.getValue()];
+ }
};
} // end anonymous namespace
@@ -338,6 +345,7 @@
class TransferFunctions : public StmtVisitor<TransferFunctions> {
CFGBlockValues &vals;
const CFG &cfg;
+ const CFGBlock *block;
AnalysisDeclContext ∾
UninitVariablesHandler *handler;
@@ -357,14 +365,13 @@
public:
TransferFunctions(CFGBlockValues &vals, const CFG &cfg,
- AnalysisDeclContext &ac,
+ const CFGBlock *block, AnalysisDeclContext &ac,
UninitVariablesHandler *handler)
- : vals(vals), cfg(cfg), ac(ac), handler(handler),
+ : vals(vals), cfg(cfg), block(block), ac(ac), handler(handler),
lastDR(0), lastLoad(0),
skipProcessUses(false) {}
- void reportUninit(const DeclRefExpr *ex, const VarDecl *vd,
- bool isAlwaysUninit);
+ void reportUse(const Expr *ex, const VarDecl *vd);
void VisitBlockExpr(BlockExpr *be);
void VisitDeclStmt(DeclStmt *ds);
@@ -374,11 +381,131 @@
void VisitCastExpr(CastExpr *ce);
void VisitObjCForCollectionStmt(ObjCForCollectionStmt *fs);
void Visit(Stmt *s);
-
+
bool isTrackedVar(const VarDecl *vd) {
return ::isTrackedVar(vd, cast<DeclContext>(ac.getDecl()));
}
-
+
+ UninitUse getUninitUse(const Expr *ex, const VarDecl *vd, Value v) {
+ UninitUse Use(ex, isAlwaysUninit(v));
+
+ assert(isUninitialized(v));
+ if (Use.getKind() == UninitUse::Always)
+ return Use;
+
+ // If an edge which leads unconditionally to this use did not initialize
+ // the variable, we can say something stronger than 'may be uninitialized':
+ // we can say 'either it's used uninitialized or you have dead code'.
+ //
+ // We track the number of successors of a node which have been visited, and
+ // visit a node once we have visited all of its successors. Only edges where
+ // the variable might still be uninitialized are followed. Since a variable
+ // can't transfer from being initialized to being uninitialized, this will
+ // trace out the subgraph which inevitably leads to the use and does not
+ // initialize the variable. We do not want to skip past loops, since their
+ // non-termination might be correlated with the initialization condition.
+ //
+ // For example:
+ //
+ // void f(bool a, bool b) {
+ // block1: int n;
+ // if (a) {
+ // block2: if (b)
+ // block3: n = 1;
+ // block4: } else if (b) {
+ // block5: while (!a) {
+ // block6: do_work(&a);
+ // n = 2;
+ // }
+ // }
+ // block7: if (a)
+ // block8: g();
+ // block9: return n;
+ // }
+ //
+ // Starting from the maybe-uninitialized use in block 9:
+ // * Block 7 is not visited because we have only visited one of its two
+ // successors.
+ // * Block 8 is visited because we've visited its only successor.
+ // From block 8:
+ // * Block 7 is visited because we've now visited both of its successors.
+ // From block 7:
+ // * Blocks 1, 2, 4, 5, and 6 are not visited because we didn't visit all
+ // of their successors (we didn't visit 4, 3, 5, 6, and 5, respectively).
+ // * Block 3 is not visited because it initializes 'n'.
+ // Now the algorithm terminates, having visited blocks 7 and 8, and having
+ // found the frontier is blocks 2, 4, and 5.
+ //
+ // 'n' is definitely uninitialized for two edges into block 7 (from blocks 2
+ // and 4), so we report that any time either of those edges is taken (in
+ // each case when 'b == false'), 'n' is used uninitialized.
+ llvm::SmallVector<const CFGBlock*, 32> Queue;
+ llvm::SmallVector<unsigned, 32> SuccsVisited(cfg.getNumBlockIDs(), 0);
+ Queue.push_back(block);
+ // Specify that we've already visited all successors of the starting block.
+ // This has the dual purpose of ensuring we never add it to the queue, and
+ // of marking it as not being a candidate element of the frontier.
+ SuccsVisited[block->getBlockID()] = block->succ_size();
+ while (!Queue.empty()) {
+ const CFGBlock *B = Queue.back();
+ Queue.pop_back();
+ for (CFGBlock::const_pred_iterator I = B->pred_begin(), E = B->pred_end();
+ I != E; ++I) {
+ const CFGBlock *Pred = *I;
+ if (vals.getValue(Pred, B, vd) == Initialized)
+ // This block initializes the variable.
+ continue;
+
+ if (++SuccsVisited[Pred->getBlockID()] == Pred->succ_size())
+ // All paths from this block lead to the use and don't initialize the
+ // variable.
+ Queue.push_back(Pred);
+ }
+ }
+
+ // Scan the frontier, looking for blocks where the variable was
+ // uninitialized.
+ for (CFG::const_iterator BI = cfg.begin(), BE = cfg.end(); BI != BE; ++BI) {
+ const CFGBlock *Block = *BI;
+ unsigned BlockID = Block->getBlockID();
+ const Stmt *Term = Block->getTerminator();
+ if (SuccsVisited[BlockID] && SuccsVisited[BlockID] < Block->succ_size() &&
+ Term) {
+ // This block inevitably leads to the use. If we have an edge from here
+ // to a post-dominator block, and the variable is uninitialized on that
+ // edge, we have found a bug.
+ for (CFGBlock::const_succ_iterator I = Block->succ_begin(),
+ E = Block->succ_end(); I != E; ++I) {
+ const CFGBlock *Succ = *I;
+ if (Succ && SuccsVisited[Succ->getBlockID()] >= Succ->succ_size() &&
+ vals.getValue(Block, Succ, vd) == Uninitialized) {
+ // Switch cases are a special case: report the label to the caller
+ // as the 'terminator', not the switch statement itself. Suppress
+ // situations where no label matched: we can't be sure that's
+ // possible.
+ if (isa<SwitchStmt>(Term)) {
+ const Stmt *Label = Succ->getLabel();
+ if (!Label || !isa<SwitchCase>(Label))
+ // Might not be possible.
+ continue;
+ UninitUse::Branch Branch;
+ Branch.Terminator = Label;
+ Branch.Output = 0; // Ignored.
+ Use.addUninitBranch(Branch);
+ } else {
+ UninitUse::Branch Branch;
+ Branch.Terminator = Term;
+ Branch.Output = I - Block->succ_begin();
+ Use.addUninitBranch(Branch);
+ }
+ }
+ }
+ }
+ }
+
+ return Use;
+ }
+
FindVarResult findBlockVarDecl(Expr *ex);
void ProcessUses(Stmt *s = 0);
@@ -399,9 +526,12 @@
return Ex;
}
-void TransferFunctions::reportUninit(const DeclRefExpr *ex,
- const VarDecl *vd, bool isAlwaysUnit) {
- if (handler) handler->handleUseOfUninitVariable(ex, vd, isAlwaysUnit);
+void TransferFunctions::reportUse(const Expr *ex, const VarDecl *vd) {
+ if (!handler)
+ return;
+ Value v = vals[vd];
+ if (isUninitialized(v))
+ handler->handleUseOfUninitVariable(vd, getUninitUse(ex, vd, v));
}
FindVarResult TransferFunctions::findBlockVarDecl(Expr *ex) {
@@ -442,9 +572,7 @@
vals[vd] = Initialized;
continue;
}
- Value v = vals[vd];
- if (handler && isUninitialized(v))
- handler->handleUseOfUninitVariable(be, vd, isAlwaysUninit(v));
+ reportUse(be, vd);
}
}
@@ -507,13 +635,10 @@
if (bo->isAssignmentOp()) {
const FindVarResult &res = findBlockVarDecl(bo->getLHS());
if (const VarDecl *vd = res.getDecl()) {
- ValueVector::reference val = vals[vd];
- if (isUninitialized(val)) {
- if (bo->getOpcode() != BO_Assign)
- reportUninit(res.getDeclRefExpr(), vd, isAlwaysUninit(val));
- else
- val = Initialized;
- }
+ if (bo->getOpcode() != BO_Assign)
+ reportUse(res.getDeclRefExpr(), vd);
+ else
+ vals[vd] = Initialized;
}
}
}
@@ -530,10 +655,7 @@
// We null out lastDR to indicate we have fully processed it
// and we don't want the auto-value setting in Visit().
lastDR = 0;
-
- ValueVector::reference val = vals[vd];
- if (isUninitialized(val))
- reportUninit(res.getDeclRefExpr(), vd, isAlwaysUninit(val));
+ reportUse(res.getDeclRefExpr(), vd);
}
break;
}
@@ -592,8 +714,7 @@
// If we reach here, we may have seen a load of an uninitialized value
// and it hasn't been casted to void or otherwise handled. In this
// situation, report the incident.
- if (isUninitialized(vals[VD]))
- reportUninit(DR, VD, isAlwaysUninit(vals[VD]));
+ reportUse(DR, VD);
lastLoad = 0;
@@ -659,7 +780,7 @@
}
}
// Apply the transfer function.
- TransferFunctions tf(vals, cfg, ac, handler);
+ TransferFunctions tf(vals, cfg, block, ac, handler);
for (CFGBlock::const_iterator I = block->begin(), E = block->end();
I != E; ++I) {
if (const CFGStmt *cs = dyn_cast<CFGStmt>(&*I)) {
@@ -680,6 +801,9 @@
vals.computeSetOfDeclarations(dc);
if (vals.hasNoDeclarations())
return;
+#if 0
+ cfg.dump(dc.getParentASTContext().getLangOpts(), true);
+#endif
stats.NumVariablesAnalyzed = vals.getNumEntries();
Modified: cfe/branches/tooling/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Basic/Targets.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Basic/Targets.cpp (original)
+++ cfe/branches/tooling/lib/Basic/Targets.cpp Tue May 29 07:04:37 2012
@@ -946,57 +946,39 @@
} // end anonymous namespace.
namespace {
- static const unsigned PTXAddrSpaceMap[] = {
- 0, // opencl_global
- 4, // opencl_local
- 1, // opencl_constant
- 0, // cuda_device
- 1, // cuda_constant
- 4, // cuda_shared
+ static const unsigned NVPTXAddrSpaceMap[] = {
+ 1, // opencl_global
+ 3, // opencl_local
+ 4, // opencl_constant
+ 1, // cuda_device
+ 4, // cuda_constant
+ 3, // cuda_shared
};
- class PTXTargetInfo : public TargetInfo {
+ class NVPTXTargetInfo : public TargetInfo {
static const char * const GCCRegNames[];
static const Builtin::Info BuiltinInfo[];
std::vector<llvm::StringRef> AvailableFeatures;
public:
- PTXTargetInfo(const std::string& triple) : TargetInfo(triple) {
+ NVPTXTargetInfo(const std::string& triple) : TargetInfo(triple) {
BigEndian = false;
TLSSupported = false;
LongWidth = LongAlign = 64;
- AddrSpaceMap = &PTXAddrSpaceMap;
+ AddrSpaceMap = &NVPTXAddrSpaceMap;
// Define available target features
- // These must be defined in sorted order!
- AvailableFeatures.push_back("compute10");
- AvailableFeatures.push_back("compute11");
- AvailableFeatures.push_back("compute12");
- AvailableFeatures.push_back("compute13");
- AvailableFeatures.push_back("compute20");
- AvailableFeatures.push_back("double");
- AvailableFeatures.push_back("no-fma");
- AvailableFeatures.push_back("ptx20");
- AvailableFeatures.push_back("ptx21");
- AvailableFeatures.push_back("ptx22");
- AvailableFeatures.push_back("ptx23");
- AvailableFeatures.push_back("sm10");
- AvailableFeatures.push_back("sm11");
- AvailableFeatures.push_back("sm12");
- AvailableFeatures.push_back("sm13");
- AvailableFeatures.push_back("sm20");
- AvailableFeatures.push_back("sm21");
- AvailableFeatures.push_back("sm22");
- AvailableFeatures.push_back("sm23");
+ // These must be defined in sorted order!
}
virtual void getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const {
Builder.defineMacro("__PTX__");
+ Builder.defineMacro("__NVPTX__");
}
virtual void getTargetBuiltins(const Builtin::Info *&Records,
unsigned &NumRecords) const {
Records = BuiltinInfo;
- NumRecords = clang::PTX::LastTSBuiltin-Builtin::FirstTSBuiltin;
+ NumRecords = clang::NVPTX::LastTSBuiltin-Builtin::FirstTSBuiltin;
}
virtual bool hasFeature(StringRef Feature) const {
- return Feature == "ptx";
+ return Feature == "ptx" || Feature == "nvptx";
}
virtual void getGCCRegNames(const char * const *&Names,
@@ -1020,32 +1002,34 @@
// FIXME: implement
return "typedef char* __builtin_va_list;";
}
-
+ virtual bool setCPU(const std::string &Name) {
+ return Name == "sm_10" || Name == "sm_13" || Name == "sm_20";
+ }
virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
StringRef Name,
bool Enabled) const;
};
- const Builtin::Info PTXTargetInfo::BuiltinInfo[] = {
+ const Builtin::Info NVPTXTargetInfo::BuiltinInfo[] = {
#define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES },
#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) { #ID, TYPE, ATTRS, HEADER,\
ALL_LANGUAGES },
-#include "clang/Basic/BuiltinsPTX.def"
+#include "clang/Basic/BuiltinsNVPTX.def"
};
- const char * const PTXTargetInfo::GCCRegNames[] = {
+ const char * const NVPTXTargetInfo::GCCRegNames[] = {
"r0"
};
- void PTXTargetInfo::getGCCRegNames(const char * const *&Names,
+ void NVPTXTargetInfo::getGCCRegNames(const char * const *&Names,
unsigned &NumNames) const {
Names = GCCRegNames;
NumNames = llvm::array_lengthof(GCCRegNames);
}
- bool PTXTargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
- StringRef Name,
- bool Enabled) const {
+ bool NVPTXTargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
+ StringRef Name,
+ bool Enabled) const {
if(std::binary_search(AvailableFeatures.begin(), AvailableFeatures.end(),
Name)) {
Features[Name] = Enabled;
@@ -1055,117 +1039,28 @@
}
}
- class PTX32TargetInfo : public PTXTargetInfo {
- public:
- PTX32TargetInfo(const std::string& triple) : PTXTargetInfo(triple) {
- PointerWidth = PointerAlign = 32;
- SizeType = PtrDiffType = IntPtrType = TargetInfo::UnsignedInt;
- DescriptionString
- = "e-p:32:32-i64:64:64-f64:64:64-n1:8:16:32:64";
- }
- };
-
- class PTX64TargetInfo : public PTXTargetInfo {
- public:
- PTX64TargetInfo(const std::string& triple) : PTXTargetInfo(triple) {
- PointerWidth = PointerAlign = 64;
- SizeType = PtrDiffType = IntPtrType = TargetInfo::UnsignedLongLong;
- DescriptionString
- = "e-p:64:64-i64:64:64-f64:64:64-n1:8:16:32:64";
- }
- };
-}
-
-namespace {
- static const unsigned NVPTXAddrSpaceMap[] = {
- 1, // opencl_global
- 3, // opencl_local
- 4, // opencl_constant
- 1, // cuda_device
- 4, // cuda_constant
- 3, // cuda_shared
- };
- class NVPTXTargetInfo : public TargetInfo {
- static const char * const GCCRegNames[];
- public:
- NVPTXTargetInfo(const std::string& triple) : TargetInfo(triple) {
- BigEndian = false;
- TLSSupported = false;
- LongWidth = LongAlign = 64;
- AddrSpaceMap = &NVPTXAddrSpaceMap;
- }
- virtual void getTargetDefines(const LangOptions &Opts,
- MacroBuilder &Builder) const {
- Builder.defineMacro("__PTX__");
- }
- virtual void getTargetBuiltins(const Builtin::Info *&Records,
- unsigned &NumRecords) const {
- // FIXME: implement.
- Records = 0;
- NumRecords = 0;
- }
- virtual bool hasFeature(StringRef Feature) const {
- return Feature == "nvptx";
- }
-
- virtual void getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const;
- virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
- unsigned &NumAliases) const {
- // No aliases.
- Aliases = 0;
- NumAliases = 0;
- }
- virtual bool validateAsmConstraint(const char *&Name,
- TargetInfo::ConstraintInfo &info) const {
- // FIXME: implement
- return true;
- }
- virtual const char *getClobbers() const {
- // FIXME: Is this really right?
- return "";
- }
- virtual const char *getVAListDeclaration() const {
- // FIXME: implement
- return "typedef char* __builtin_va_list;";
- }
- virtual bool setCPU(const std::string &Name) {
- return Name == "sm_10";
- }
- };
-
- const char * const NVPTXTargetInfo::GCCRegNames[] = {
- "r0"
- };
-
- void NVPTXTargetInfo::getGCCRegNames(const char * const *&Names,
- unsigned &NumNames) const {
- Names = GCCRegNames;
- NumNames = llvm::array_lengthof(GCCRegNames);
- }
-
class NVPTX32TargetInfo : public NVPTXTargetInfo {
public:
- NVPTX32TargetInfo(const std::string& triple) : NVPTXTargetInfo(triple) {
+ NVPTX32TargetInfo(const std::string& triple) : NVPTXTargetInfo(triple) {
PointerWidth = PointerAlign = 32;
- SizeType = PtrDiffType = IntPtrType = TargetInfo::UnsignedInt;
+ SizeType = PtrDiffType = IntPtrType = TargetInfo::UnsignedInt;
DescriptionString
= "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"
"f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-"
"n16:32:64";
- }
+ }
};
class NVPTX64TargetInfo : public NVPTXTargetInfo {
public:
- NVPTX64TargetInfo(const std::string& triple) : NVPTXTargetInfo(triple) {
+ NVPTX64TargetInfo(const std::string& triple) : NVPTXTargetInfo(triple) {
PointerWidth = PointerAlign = 64;
- SizeType = PtrDiffType = IntPtrType = TargetInfo::UnsignedLongLong;
+ SizeType = PtrDiffType = IntPtrType = TargetInfo::UnsignedLongLong;
DescriptionString
= "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"
"f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-"
"n16:32:64";
- }
+ }
};
}
@@ -4139,11 +4034,6 @@
return new PPC64TargetInfo(T);
}
- case llvm::Triple::ptx32:
- return new PTX32TargetInfo(T);
- case llvm::Triple::ptx64:
- return new PTX64TargetInfo(T);
-
case llvm::Triple::nvptx:
return new NVPTX32TargetInfo(T);
case llvm::Triple::nvptx64:
Modified: cfe/branches/tooling/lib/Basic/Version.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Basic/Version.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Basic/Version.cpp (original)
+++ cfe/branches/tooling/lib/Basic/Version.cpp Tue May 29 07:04:37 2012
@@ -136,8 +136,7 @@
#ifdef CLANG_VENDOR
OS << CLANG_VENDOR;
#endif
- OS << "Clang " CLANG_VERSION_STRING " ("
- << getClangFullRepositoryVersion() << ')';
+ OS << "Clang " CLANG_VERSION_STRING " " << getClangFullRepositoryVersion();
return OS.str();
}
Modified: cfe/branches/tooling/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGCall.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGCall.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGCall.cpp Tue May 29 07:04:37 2012
@@ -2066,8 +2066,7 @@
unsigned CallingConv;
CodeGen::AttributeListType AttributeList;
CGM.ConstructAttributeList(CallInfo, TargetDecl, AttributeList, CallingConv);
- llvm::AttrListPtr Attrs = llvm::AttrListPtr::get(AttributeList.begin(),
- AttributeList.end());
+ llvm::AttrListPtr Attrs = llvm::AttrListPtr::get(AttributeList);
llvm::BasicBlock *InvokeDest = 0;
if (!(Attrs.getFnAttributes() & llvm::Attribute::NoUnwind))
@@ -2087,6 +2086,25 @@
CS.setAttributes(Attrs);
CS.setCallingConv(static_cast<llvm::CallingConv::ID>(CallingConv));
+ // add metadata for __attribute__((alloc_size(foo)))
+ if (TargetDecl) {
+ if (const AllocSizeAttr* Attr = TargetDecl->getAttr<AllocSizeAttr>()) {
+ SmallVector<llvm::Value*, 4> Args;
+ llvm::IntegerType *Ty = llvm::IntegerType::getInt32Ty(getLLVMContext());
+ bool isMethod = false;
+ if (const CXXMethodDecl *MDecl = dyn_cast<CXXMethodDecl>(TargetDecl))
+ isMethod = MDecl->isInstance();
+
+ for (AllocSizeAttr::args_iterator I = Attr->args_begin(),
+ E = Attr->args_end(); I != E; ++I) {
+ Args.push_back(llvm::ConstantInt::get(Ty, *I + isMethod));
+ }
+
+ llvm::MDNode *MD = llvm::MDNode::get(getLLVMContext(), Args);
+ CS.getInstruction()->setMetadata("alloc_size", MD);
+ }
+ }
+
// In ObjC ARC mode with no ObjC ARC exception safety, tell the ARC
// optimizer it can aggressively ignore unwind edges.
if (CGM.getLangOpts().ObjCAutoRefCount)
Modified: cfe/branches/tooling/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGExprScalar.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGExprScalar.cpp Tue May 29 07:04:37 2012
@@ -2593,7 +2593,7 @@
llvm::Value *LHSTmp = LHS;
bool wasCast = false;
llvm::VectorType *rhsVTy = cast<llvm::VectorType>(RHS->getType());
- if (rhsVTy->getElementType()->isFloatTy()) {
+ if (rhsVTy->getElementType()->isFloatingPointTy()) {
RHSTmp = Builder.CreateBitCast(RHS, tmp2->getType());
LHSTmp = Builder.CreateBitCast(LHS, tmp->getType());
wasCast = true;
Modified: cfe/branches/tooling/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CodeGenModule.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CodeGenModule.cpp Tue May 29 07:04:37 2012
@@ -476,8 +476,7 @@
unsigned CallingConv;
AttributeListType AttributeList;
ConstructAttributeList(Info, D, AttributeList, CallingConv);
- F->setAttributes(llvm::AttrListPtr::get(AttributeList.begin(),
- AttributeList.size()));
+ F->setAttributes(llvm::AttrListPtr::get(AttributeList));
F->setCallingConv(static_cast<llvm::CallingConv::ID>(CallingConv));
}
@@ -1735,8 +1734,7 @@
ArgList.clear();
if (!NewCall->getType()->isVoidTy())
NewCall->takeName(CI);
- NewCall->setAttributes(llvm::AttrListPtr::get(AttrVec.begin(),
- AttrVec.end()));
+ NewCall->setAttributes(llvm::AttrListPtr::get(AttrVec));
NewCall->setCallingConv(CI->getCallingConv());
// Finally, remove the old call, replacing any uses with the new one.
Modified: cfe/branches/tooling/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/TargetInfo.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/TargetInfo.cpp Tue May 29 07:04:37 2012
@@ -2891,14 +2891,14 @@
}
//===----------------------------------------------------------------------===//
-// PTX ABI Implementation
+// NVPTX ABI Implementation
//===----------------------------------------------------------------------===//
namespace {
-class PTXABIInfo : public ABIInfo {
+class NVPTXABIInfo : public ABIInfo {
public:
- PTXABIInfo(CodeGenTypes &CGT) : ABIInfo(CGT) {}
+ NVPTXABIInfo(CodeGenTypes &CGT) : ABIInfo(CGT) {}
ABIArgInfo classifyReturnType(QualType RetTy) const;
ABIArgInfo classifyArgumentType(QualType Ty) const;
@@ -2908,16 +2908,16 @@
CodeGenFunction &CFG) const;
};
-class PTXTargetCodeGenInfo : public TargetCodeGenInfo {
+class NVPTXTargetCodeGenInfo : public TargetCodeGenInfo {
public:
- PTXTargetCodeGenInfo(CodeGenTypes &CGT)
- : TargetCodeGenInfo(new PTXABIInfo(CGT)) {}
+ NVPTXTargetCodeGenInfo(CodeGenTypes &CGT)
+ : TargetCodeGenInfo(new NVPTXABIInfo(CGT)) {}
virtual void SetTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
CodeGen::CodeGenModule &M) const;
};
-ABIArgInfo PTXABIInfo::classifyReturnType(QualType RetTy) const {
+ABIArgInfo NVPTXABIInfo::classifyReturnType(QualType RetTy) const {
if (RetTy->isVoidType())
return ABIArgInfo::getIgnore();
if (isAggregateTypeForABI(RetTy))
@@ -2925,14 +2925,14 @@
return ABIArgInfo::getDirect();
}
-ABIArgInfo PTXABIInfo::classifyArgumentType(QualType Ty) const {
+ABIArgInfo NVPTXABIInfo::classifyArgumentType(QualType Ty) const {
if (isAggregateTypeForABI(Ty))
return ABIArgInfo::getIndirect(0);
return ABIArgInfo::getDirect();
}
-void PTXABIInfo::computeInfo(CGFunctionInfo &FI) const {
+void NVPTXABIInfo::computeInfo(CGFunctionInfo &FI) const {
FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
for (CGFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end();
it != ie; ++it)
@@ -2943,6 +2943,8 @@
return;
// Calling convention as default by an ABI.
+ // We're still using the PTX_Kernel/PTX_Device calling conventions here,
+ // but we should switch to NVVM metadata later on.
llvm::CallingConv::ID DefaultCC;
const LangOptions &LangOpts = getContext().getLangOpts();
if (LangOpts.OpenCL || LangOpts.CUDA) {
@@ -2961,14 +2963,14 @@
}
-llvm::Value *PTXABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
- CodeGenFunction &CFG) const {
- llvm_unreachable("PTX does not support varargs");
+llvm::Value *NVPTXABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
+ CodeGenFunction &CFG) const {
+ llvm_unreachable("NVPTX does not support varargs");
}
-void PTXTargetCodeGenInfo::SetTargetAttributes(const Decl *D,
- llvm::GlobalValue *GV,
- CodeGen::CodeGenModule &M) const{
+void NVPTXTargetCodeGenInfo::
+SetTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
+ CodeGen::CodeGenModule &M) const{
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D);
if (!FD) return;
@@ -3704,11 +3706,9 @@
case llvm::Triple::ppc64:
return *(TheTargetCodeGenInfo = new PPC64TargetCodeGenInfo(Types));
- case llvm::Triple::ptx32:
- case llvm::Triple::ptx64:
case llvm::Triple::nvptx:
case llvm::Triple::nvptx64:
- return *(TheTargetCodeGenInfo = new PTXTargetCodeGenInfo(Types));
+ return *(TheTargetCodeGenInfo = new NVPTXTargetCodeGenInfo(Types));
case llvm::Triple::mblaze:
return *(TheTargetCodeGenInfo = new MBlazeTargetCodeGenInfo(Types));
Modified: cfe/branches/tooling/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Driver/Driver.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Driver/Driver.cpp (original)
+++ cfe/branches/tooling/lib/Driver/Driver.cpp Tue May 29 07:04:37 2012
@@ -386,6 +386,9 @@
<< "Please submit a bug report to " BUG_REPORT_URL " and include command"
" line arguments and all diagnostic information.";
+ // Print the version of the compiler.
+ PrintVersion(C, llvm::errs());
+
// Suppress driver output and emit preprocessor output to temp file.
CCCIsCPP = true;
CCGenDiagnostics = true;
Modified: cfe/branches/tooling/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Driver/Tools.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Driver/Tools.cpp (original)
+++ cfe/branches/tooling/lib/Driver/Tools.cpp Tue May 29 07:04:37 2012
@@ -1839,15 +1839,22 @@
D.CCLogDiagnosticsFilename : "-");
}
- // Special case debug options to only pass -g to clang. This is
- // wrong.
+ // Use the last option from "-g" group. "-gline-tables-only" is
+ // preserved, all other debug options are substituted with "-g".
+ // FIXME: We should eventually do the following:
+ // 1) collapse gdb and dwarf variations to -g (as we do now);
+ // 2) support things like -gtoggle;
+ // 3) ignore flag options like -gstrict-dwarf or -grecord-gcc-switches;
+ // 4) produce a driver error on unsupported formats
+ // (-gstabs, -gcoff, -gvms etc.)
Args.ClaimAllArgs(options::OPT_g_Group);
- if (Arg *A = Args.getLastArg(options::OPT_g_Group))
- if (!A->getOption().matches(options::OPT_g0)) {
+ if (Arg *A = Args.getLastArg(options::OPT_g_Group)) {
+ if (A->getOption().matches(options::OPT_gline_tables_only)) {
+ CmdArgs.push_back("-gline-tables-only");
+ } else if (!A->getOption().matches(options::OPT_g0)) {
CmdArgs.push_back("-g");
}
- if (Args.hasArg(options::OPT_gline_tables_only))
- CmdArgs.push_back("-gline-tables-only");
+ }
Args.AddAllArgs(CmdArgs, options::OPT_ffunction_sections);
Args.AddAllArgs(CmdArgs, options::OPT_fdata_sections);
Modified: cfe/branches/tooling/lib/Edit/RewriteObjCFoundationAPI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Edit/RewriteObjCFoundationAPI.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Edit/RewriteObjCFoundationAPI.cpp (original)
+++ cfe/branches/tooling/lib/Edit/RewriteObjCFoundationAPI.cpp Tue May 29 07:04:37 2012
@@ -801,8 +801,14 @@
}
}
- if (needsCast)
+ if (needsCast) {
+ DiagnosticsEngine &Diags = Ctx.getDiagnostics();
+ // FIXME: Use a custom category name to distinguish migration diagnostics.
+ unsigned diagID = Diags.getCustomDiagID(DiagnosticsEngine::Warning,
+ "converting to boxing syntax requires a cast");
+ Diags.Report(Msg->getExprLoc(), diagID) << Msg->getSourceRange();
return false;
+ }
SourceRange ArgRange = OrigArg->getSourceRange();
commit.replaceWithInner(Msg->getSourceRange(), ArgRange);
Modified: cfe/branches/tooling/lib/Frontend/TextDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/TextDiagnostic.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/TextDiagnostic.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/TextDiagnostic.cpp Tue May 29 07:04:37 2012
@@ -307,11 +307,11 @@
// correctly.
unsigned CaretStart = 0, CaretEnd = CaretLine.size();
for (; CaretStart != CaretEnd; ++CaretStart)
- if (!isspace(CaretLine[CaretStart]))
+ if (!isspace(static_cast<unsigned char>(CaretLine[CaretStart])))
break;
for (; CaretEnd != CaretStart; --CaretEnd)
- if (!isspace(CaretLine[CaretEnd - 1]))
+ if (!isspace(static_cast<unsigned char>(CaretLine[CaretEnd - 1])))
break;
// caret has already been inserted into CaretLine so the above whitespace
@@ -322,17 +322,33 @@
if (!FixItInsertionLine.empty()) {
unsigned FixItStart = 0, FixItEnd = FixItInsertionLine.size();
for (; FixItStart != FixItEnd; ++FixItStart)
- if (!isspace(FixItInsertionLine[FixItStart]))
+ if (!isspace(static_cast<unsigned char>(FixItInsertionLine[FixItStart])))
break;
for (; FixItEnd != FixItStart; --FixItEnd)
- if (!isspace(FixItInsertionLine[FixItEnd - 1]))
+ if (!isspace(static_cast<unsigned char>(FixItInsertionLine[FixItEnd - 1])))
break;
CaretStart = std::min(FixItStart, CaretStart);
CaretEnd = std::max(FixItEnd, CaretEnd);
}
+ // CaretEnd may have been set at the middle of a character
+ // If it's not at a character's first column then advance it past the current
+ // character.
+ while (static_cast<int>(CaretEnd) < map.columns() &&
+ -1 == map.columnToByte(CaretEnd))
+ ++CaretEnd;
+
+ assert((static_cast<int>(CaretStart) > map.columns() ||
+ -1!=map.columnToByte(CaretStart)) &&
+ "CaretStart must not point to a column in the middle of a source"
+ " line character");
+ assert((static_cast<int>(CaretEnd) > map.columns() ||
+ -1!=map.columnToByte(CaretEnd)) &&
+ "CaretEnd must not point to a column in the middle of a source line"
+ " character");
+
// CaretLine[CaretStart, CaretEnd) contains all of the interesting
// parts of the caret line. While this slice is smaller than the
// number of columns we have, try to grow the slice to encompass
@@ -366,12 +382,14 @@
// Skip over any whitespace we see here; we're looking for
// another bit of interesting text.
while (NewStart &&
- (map.byteToColumn(NewStart)==-1 || isspace(SourceLine[NewStart])))
+ (map.byteToColumn(NewStart)==-1 ||
+ isspace(static_cast<unsigned char>(SourceLine[NewStart]))))
--NewStart;
// Skip over this bit of "interesting" text.
while (NewStart &&
- (map.byteToColumn(NewStart)!=-1 && !isspace(SourceLine[NewStart])))
+ (map.byteToColumn(NewStart)!=-1 &&
+ !isspace(static_cast<unsigned char>(SourceLine[NewStart]))))
--NewStart;
// Move up to the non-whitespace character we just saw.
@@ -392,12 +410,14 @@
// Skip over any whitespace we see here; we're looking for
// another bit of interesting text.
while (NewEnd<SourceLine.size() &&
- (map.byteToColumn(NewEnd)==-1 || isspace(SourceLine[NewEnd])))
+ (map.byteToColumn(NewEnd)==-1 ||
+ isspace(static_cast<unsigned char>(SourceLine[NewEnd]))))
++NewEnd;
// Skip over this bit of "interesting" text.
while (NewEnd<SourceLine.size() &&
- (map.byteToColumn(NewEnd)!=-1 && !isspace(SourceLine[NewEnd])))
+ (map.byteToColumn(NewEnd)!=-1 &&
+ !isspace(static_cast<unsigned char>(SourceLine[NewEnd]))))
++NewEnd;
unsigned NewColumns = map.byteToColumn(NewEnd) -
Modified: cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp (original)
+++ cfe/branches/tooling/lib/Rewrite/RewriteModernObjC.cpp Tue May 29 07:04:37 2012
@@ -324,6 +324,7 @@
Stmt *RewriteObjCDictionaryLiteralExpr(ObjCDictionaryLiteral *Exp);
Stmt *RewriteObjCProtocolExpr(ObjCProtocolExpr *Exp);
Stmt *RewriteObjCTryStmt(ObjCAtTryStmt *S);
+ Stmt *RewriteObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S);
Stmt *RewriteObjCSynchronizedStmt(ObjCAtSynchronizedStmt *S);
Stmt *RewriteObjCThrowStmt(ObjCAtThrowStmt *S);
Stmt *RewriteObjCForCollectionStmt(ObjCForCollectionStmt *S,
@@ -1881,6 +1882,15 @@
return;
}
+Stmt *RewriteModernObjC::RewriteObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
+ SourceLocation startLoc = S->getAtLoc();
+ ReplaceText(startLoc, strlen("@autoreleasepool"), "/* @autoreleasepool */");
+ ReplaceText(S->getSubStmt()->getLocStart(), 1,
+ "{ __AtAutoreleasePool __autoreleasepool; ");
+
+ return 0;
+}
+
Stmt *RewriteModernObjC::RewriteObjCTryStmt(ObjCAtTryStmt *S) {
ObjCAtFinallyStmt *finalStmt = S->getFinallyStmt();
bool noCatch = S->getNumCatchStmts() == 0;
@@ -5408,6 +5418,11 @@
return RewriteMessageExpr(MessExpr);
}
+ if (ObjCAutoreleasePoolStmt *StmtAutoRelease =
+ dyn_cast<ObjCAutoreleasePoolStmt>(S)) {
+ return RewriteObjCAutoreleasePoolStmt(StmtAutoRelease);
+ }
+
if (ObjCAtTryStmt *StmtTry = dyn_cast<ObjCAtTryStmt>(S))
return RewriteObjCTryStmt(StmtTry);
@@ -5887,6 +5902,15 @@
Preamble += " }\n";
Preamble += "};\n";
+ // Declaration required for implementation of @autoreleasepool statement.
+ Preamble += "extern \"C\" __declspec(dllimport) void * objc_autoreleasePoolPush(void);\n";
+ Preamble += "extern \"C\" __declspec(dllimport) void objc_autoreleasePoolPop(void *);\n\n";
+ Preamble += "struct __AtAutoreleasePool {\n";
+ Preamble += " __AtAutoreleasePool() {atautoreleasepoolobj = objc_autoreleasePoolPush();}\n";
+ Preamble += " ~__AtAutoreleasePool() {objc_autoreleasePoolPop(atautoreleasepoolobj);}\n";
+ Preamble += " void * atautoreleasepoolobj;\n";
+ Preamble += "};\n";
+
// NOTE! Windows uses LLP64 for 64bit mode. So, cast pointer to long long
// as this avoids warning in any 64bit/32bit compilation model.
Preamble += "\n#define __OFFSETOFIVAR__(TYPE, MEMBER) ((long long) &((TYPE *)0)->MEMBER)\n";
Modified: cfe/branches/tooling/lib/Rewrite/Rewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Rewrite/Rewriter.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Rewrite/Rewriter.cpp (original)
+++ cfe/branches/tooling/lib/Rewrite/Rewriter.cpp Tue May 29 07:04:37 2012
@@ -444,6 +444,10 @@
if (!ok()) return;
FileStream->flush();
+#ifdef _WIN32
+ // Win32 does not allow rename/removing opened files.
+ FileStream.reset();
+#endif
if (llvm::error_code ec =
llvm::sys::fs::rename(TempFilename.str(), Filename)) {
AllWritten = false;
Modified: cfe/branches/tooling/lib/Sema/AnalysisBasedWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/AnalysisBasedWarnings.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/AnalysisBasedWarnings.cpp (original)
+++ cfe/branches/tooling/lib/Sema/AnalysisBasedWarnings.cpp Tue May 29 07:04:37 2012
@@ -19,6 +19,7 @@
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Lex/Preprocessor.h"
+#include "clang/Lex/Lexer.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/ExprObjC.h"
@@ -456,16 +457,182 @@
return true;
}
+/// Create a fixit to remove an if-like statement, on the assumption that its
+/// condition is CondVal.
+static void CreateIfFixit(Sema &S, const Stmt *If, const Stmt *Then,
+ const Stmt *Else, bool CondVal,
+ FixItHint &Fixit1, FixItHint &Fixit2) {
+ if (CondVal) {
+ // If condition is always true, remove all but the 'then'.
+ Fixit1 = FixItHint::CreateRemoval(
+ CharSourceRange::getCharRange(If->getLocStart(),
+ Then->getLocStart()));
+ if (Else) {
+ SourceLocation ElseKwLoc = Lexer::getLocForEndOfToken(
+ Then->getLocEnd(), 0, S.getSourceManager(), S.getLangOpts());
+ Fixit2 = FixItHint::CreateRemoval(
+ SourceRange(ElseKwLoc, Else->getLocEnd()));
+ }
+ } else {
+ // If condition is always false, remove all but the 'else'.
+ if (Else)
+ Fixit1 = FixItHint::CreateRemoval(
+ CharSourceRange::getCharRange(If->getLocStart(),
+ Else->getLocStart()));
+ else
+ Fixit1 = FixItHint::CreateRemoval(If->getSourceRange());
+ }
+}
+
+/// DiagUninitUse -- Helper function to produce a diagnostic for an
+/// uninitialized use of a variable.
+static void DiagUninitUse(Sema &S, const VarDecl *VD, const UninitUse &Use,
+ bool IsCapturedByBlock) {
+ bool Diagnosed = false;
+
+ // Diagnose each branch which leads to a sometimes-uninitialized use.
+ for (UninitUse::branch_iterator I = Use.branch_begin(), E = Use.branch_end();
+ I != E; ++I) {
+ assert(Use.getKind() == UninitUse::Sometimes);
+
+ const Expr *User = Use.getUser();
+ const Stmt *Term = I->Terminator;
+
+ // Information used when building the diagnostic.
+ unsigned DiagKind;
+ const char *Str;
+ SourceRange Range;
+
+ // FixIts to suppress the diagnosic by removing the dead condition.
+ // For all binary terminators, branch 0 is taken if the condition is true,
+ // and branch 1 is taken if the condition is false.
+ int RemoveDiagKind = -1;
+ const char *FixitStr =
+ S.getLangOpts().CPlusPlus ? (I->Output ? "true" : "false")
+ : (I->Output ? "1" : "0");
+ FixItHint Fixit1, Fixit2;
+
+ switch (Term->getStmtClass()) {
+ default:
+ // Don't know how to report this. Just fall back to 'may be used
+ // uninitialized'. This happens for range-based for, which the user
+ // can't explicitly fix.
+ // FIXME: This also happens if the first use of a variable is always
+ // uninitialized, eg "for (int n; n < 10; ++n)". We should report that
+ // with the 'is uninitialized' diagnostic.
+ continue;
+
+ // "condition is true / condition is false".
+ case Stmt::IfStmtClass: {
+ const IfStmt *IS = cast<IfStmt>(Term);
+ DiagKind = 0;
+ Str = "if";
+ Range = IS->getCond()->getSourceRange();
+ RemoveDiagKind = 0;
+ CreateIfFixit(S, IS, IS->getThen(), IS->getElse(),
+ I->Output, Fixit1, Fixit2);
+ break;
+ }
+ case Stmt::ConditionalOperatorClass: {
+ const ConditionalOperator *CO = cast<ConditionalOperator>(Term);
+ DiagKind = 0;
+ Str = "?:";
+ Range = CO->getCond()->getSourceRange();
+ RemoveDiagKind = 0;
+ CreateIfFixit(S, CO, CO->getTrueExpr(), CO->getFalseExpr(),
+ I->Output, Fixit1, Fixit2);
+ break;
+ }
+ case Stmt::BinaryOperatorClass: {
+ const BinaryOperator *BO = cast<BinaryOperator>(Term);
+ if (!BO->isLogicalOp())
+ continue;
+ DiagKind = 0;
+ Str = BO->getOpcodeStr();
+ Range = BO->getLHS()->getSourceRange();
+ RemoveDiagKind = 0;
+ if ((BO->getOpcode() == BO_LAnd && I->Output) ||
+ (BO->getOpcode() == BO_LOr && !I->Output))
+ // true && y -> y, false || y -> y.
+ Fixit1 = FixItHint::CreateRemoval(SourceRange(BO->getLocStart(),
+ BO->getOperatorLoc()));
+ else
+ // false && y -> false, true || y -> true.
+ Fixit1 = FixItHint::CreateReplacement(BO->getSourceRange(), FixitStr);
+ break;
+ }
+
+ // "loop is entered / loop is exited".
+ case Stmt::WhileStmtClass:
+ DiagKind = 1;
+ Str = "while";
+ Range = cast<WhileStmt>(Term)->getCond()->getSourceRange();
+ RemoveDiagKind = 1;
+ Fixit1 = FixItHint::CreateReplacement(Range, FixitStr);
+ break;
+ case Stmt::ForStmtClass:
+ DiagKind = 1;
+ Str = "for";
+ Range = cast<ForStmt>(Term)->getCond()->getSourceRange();
+ RemoveDiagKind = 1;
+ if (I->Output)
+ Fixit1 = FixItHint::CreateRemoval(Range);
+ else
+ Fixit1 = FixItHint::CreateReplacement(Range, FixitStr);
+ break;
+
+ // "condition is true / loop is exited".
+ case Stmt::DoStmtClass:
+ DiagKind = 2;
+ Str = "do";
+ Range = cast<DoStmt>(Term)->getCond()->getSourceRange();
+ RemoveDiagKind = 1;
+ Fixit1 = FixItHint::CreateReplacement(Range, FixitStr);
+ break;
+
+ // "switch case is taken".
+ case Stmt::CaseStmtClass:
+ DiagKind = 3;
+ Str = "case";
+ Range = cast<CaseStmt>(Term)->getLHS()->getSourceRange();
+ break;
+ case Stmt::DefaultStmtClass:
+ DiagKind = 3;
+ Str = "default";
+ Range = cast<DefaultStmt>(Term)->getDefaultLoc();
+ break;
+ }
+
+ S.Diag(Range.getBegin(), diag::warn_sometimes_uninit_var)
+ << VD->getDeclName() << IsCapturedByBlock << DiagKind
+ << Str << I->Output << Range;
+ S.Diag(User->getLocStart(), diag::note_uninit_var_use)
+ << IsCapturedByBlock << User->getSourceRange();
+ if (RemoveDiagKind != -1)
+ S.Diag(Fixit1.RemoveRange.getBegin(), diag::note_uninit_fixit_remove_cond)
+ << RemoveDiagKind << Str << I->Output << Fixit1 << Fixit2;
+
+ Diagnosed = true;
+ }
+
+ if (!Diagnosed)
+ S.Diag(Use.getUser()->getLocStart(),
+ Use.getKind() == UninitUse::Always ? diag::warn_uninit_var
+ : diag::warn_maybe_uninit_var)
+ << VD->getDeclName() << IsCapturedByBlock
+ << Use.getUser()->getSourceRange();
+}
+
/// DiagnoseUninitializedUse -- Helper function for diagnosing uses of an
/// uninitialized variable. This manages the different forms of diagnostic
/// emitted for particular types of uses. Returns true if the use was diagnosed
-/// as a warning. If a pariticular use is one we omit warnings for, returns
+/// as a warning. If a particular use is one we omit warnings for, returns
/// false.
static bool DiagnoseUninitializedUse(Sema &S, const VarDecl *VD,
- const Expr *E, bool isAlwaysUninit,
+ const UninitUse &Use,
bool alwaysReportSelfInit = false) {
- if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) {
+ if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Use.getUser())) {
// Inspect the initializer of the variable declaration which is
// being referenced prior to its initialization. We emit
// specialized diagnostics for self-initialization, and we
@@ -491,20 +658,15 @@
}
}
- S.Diag(DRE->getLocStart(), isAlwaysUninit ? diag::warn_uninit_var
- : diag::warn_maybe_uninit_var)
- << VD->getDeclName() << DRE->getSourceRange();
+ DiagUninitUse(S, VD, Use, false);
} else {
- const BlockExpr *BE = cast<BlockExpr>(E);
- if (VD->getType()->isBlockPointerType() &&
- !VD->hasAttr<BlocksAttr>())
- S.Diag(BE->getLocStart(), diag::warn_uninit_byref_blockvar_captured_by_block)
- << VD->getDeclName();
- else
+ const BlockExpr *BE = cast<BlockExpr>(Use.getUser());
+ if (VD->getType()->isBlockPointerType() && !VD->hasAttr<BlocksAttr>())
S.Diag(BE->getLocStart(),
- isAlwaysUninit ? diag::warn_uninit_var_captured_by_block
- : diag::warn_maybe_uninit_var_captured_by_block)
+ diag::warn_uninit_byref_blockvar_captured_by_block)
<< VD->getDeclName();
+ else
+ DiagUninitUse(S, VD, Use, true);
}
// Report where the variable was declared when the use wasn't within
@@ -683,8 +845,11 @@
if (L.isMacroID())
continue;
if (S.getLangOpts().CPlusPlus0x) {
- S.Diag(L, diag::note_insert_fallthrough_fixit) <<
- FixItHint::CreateInsertion(L, "[[clang::fallthrough]]; ");
+ const Stmt *Term = B.getTerminator();
+ if (!(B.empty() && Term && isa<BreakStmt>(Term))) {
+ S.Diag(L, diag::note_insert_fallthrough_fixit) <<
+ FixItHint::CreateInsertion(L, "[[clang::fallthrough]]; ");
+ }
}
S.Diag(L, diag::note_insert_break_fixit) <<
FixItHint::CreateInsertion(L, "break; ");
@@ -700,13 +865,14 @@
}
-typedef std::pair<const Expr*, bool> UninitUse;
-
namespace {
struct SLocSort {
bool operator()(const UninitUse &a, const UninitUse &b) {
- SourceLocation aLoc = a.first->getLocStart();
- SourceLocation bLoc = b.first->getLocStart();
+ // Prefer a more confident report over a less confident one.
+ if (a.getKind() != b.getKind())
+ return a.getKind() > b.getKind();
+ SourceLocation aLoc = a.getUser()->getLocStart();
+ SourceLocation bLoc = b.getUser()->getLocStart();
return aLoc.getRawEncoding() < bLoc.getRawEncoding();
}
};
@@ -735,9 +901,8 @@
return V;
}
- void handleUseOfUninitVariable(const Expr *ex, const VarDecl *vd,
- bool isAlwaysUninit) {
- getUses(vd).first->push_back(std::make_pair(ex, isAlwaysUninit));
+ void handleUseOfUninitVariable(const VarDecl *vd, const UninitUse &use) {
+ getUses(vd).first->push_back(use);
}
void handleSelfInit(const VarDecl *vd) {
@@ -748,6 +913,8 @@
if (!uses)
return;
+ // FIXME: This iteration order, and thus the resulting diagnostic order,
+ // is nondeterministic.
for (UsesMap::iterator i = uses->begin(), e = uses->end(); i != e; ++i) {
const VarDecl *vd = i->first;
const UsesMap::mapped_type &V = i->second;
@@ -759,8 +926,9 @@
// variable, but the root cause is an idiomatic self-init. We want
// to report the diagnostic at the self-init since that is the root cause.
if (!vec->empty() && hasSelfInit && hasAlwaysUninitializedUse(vec))
- DiagnoseUninitializedUse(S, vd, vd->getInit()->IgnoreParenCasts(),
- /* isAlwaysUninit */ true,
+ DiagnoseUninitializedUse(S, vd,
+ UninitUse(vd->getInit()->IgnoreParenCasts(),
+ /* isAlwaysUninit */ true),
/* alwaysReportSelfInit */ true);
else {
// Sort the uses by their SourceLocations. While not strictly
@@ -770,8 +938,10 @@
for (UsesVec::iterator vi = vec->begin(), ve = vec->end(); vi != ve;
++vi) {
- if (DiagnoseUninitializedUse(S, vd, vi->first,
- /*isAlwaysUninit=*/vi->second))
+ // If we have self-init, downgrade all uses to 'may be uninitialized'.
+ UninitUse Use = hasSelfInit ? UninitUse(vi->getUser(), false) : *vi;
+
+ if (DiagnoseUninitializedUse(S, vd, Use))
// Skip further diagnostics for this variable. We try to warn only
// on the first point at which a variable is used uninitialized.
break;
@@ -787,7 +957,7 @@
private:
static bool hasAlwaysUninitializedUse(const UsesVec* vec) {
for (UsesVec::const_iterator i = vec->begin(), e = vec->end(); i != e; ++i) {
- if (i->second) {
+ if (i->getKind() == UninitUse::Always) {
return true;
}
}
@@ -1129,6 +1299,8 @@
if (Diags.getDiagnosticLevel(diag::warn_uninit_var, D->getLocStart())
!= DiagnosticsEngine::Ignored ||
+ Diags.getDiagnosticLevel(diag::warn_sometimes_uninit_var,D->getLocStart())
+ != DiagnosticsEngine::Ignored ||
Diags.getDiagnosticLevel(diag::warn_maybe_uninit_var, D->getLocStart())
!= DiagnosticsEngine::Ignored) {
if (CFG *cfg = AC.getCFG()) {
Modified: cfe/branches/tooling/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaDecl.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaDecl.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaDecl.cpp Tue May 29 07:04:37 2012
@@ -1166,9 +1166,9 @@
return; // First should already be in the vector.
}
- if (ShouldWarnIfUnusedFileScopedDecl(D))
- UnusedFileScopedDecls.push_back(D);
- }
+ if (ShouldWarnIfUnusedFileScopedDecl(D))
+ UnusedFileScopedDecls.push_back(D);
+}
static bool ShouldDiagnoseUnusedDecl(const NamedDecl *D) {
if (D->isInvalidDecl())
Modified: cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaDeclAttr.cpp Tue May 29 07:04:37 2012
@@ -922,6 +922,81 @@
}
}
+static void handleAllocSizeAttr(Sema &S, Decl *D, const AttributeList &Attr) {
+ if (!checkAttributeAtLeastNumArgs(S, Attr, 1))
+ return;
+
+ // In C++ the implicit 'this' function parameter also counts, and they are
+ // counted from one.
+ bool HasImplicitThisParam = isInstanceMethod(D);
+ unsigned NumArgs = getFunctionOrMethodNumArgs(D) + HasImplicitThisParam;
+
+ SmallVector<unsigned, 8> SizeArgs;
+
+ for (AttributeList::arg_iterator I = Attr.arg_begin(),
+ E = Attr.arg_end(); I!=E; ++I) {
+ // The argument must be an integer constant expression.
+ Expr *Ex = *I;
+ llvm::APSInt ArgNum;
+ if (Ex->isTypeDependent() || Ex->isValueDependent() ||
+ !Ex->isIntegerConstantExpr(ArgNum, S.Context)) {
+ S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int)
+ << "alloc_size" << Ex->getSourceRange();
+ return;
+ }
+
+ uint64_t x = ArgNum.getZExtValue();
+
+ if (x < 1 || x > NumArgs) {
+ S.Diag(Attr.getLoc(), diag::err_attribute_argument_out_of_bounds)
+ << "alloc_size" << I.getArgNum() << Ex->getSourceRange();
+ return;
+ }
+
+ --x;
+ if (HasImplicitThisParam) {
+ if (x == 0) {
+ S.Diag(Attr.getLoc(),
+ diag::err_attribute_invalid_implicit_this_argument)
+ << "alloc_size" << Ex->getSourceRange();
+ return;
+ }
+ --x;
+ }
+
+ // check if the function argument is of an integer type
+ QualType T = getFunctionOrMethodArgType(D, x).getNonReferenceType();
+ if (!T->isIntegerType()) {
+ S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int)
+ << "alloc_size" << Ex->getSourceRange();
+ return;
+ }
+
+ // check if the argument is a duplicate
+ SmallVectorImpl<unsigned>::iterator Pos;
+ Pos = std::find(SizeArgs.begin(), SizeArgs.end(), x);
+ if (Pos != SizeArgs.end()) {
+ S.Diag(Attr.getLoc(), diag::err_attribute_argument_duplicate)
+ << "alloc_size" << I.getArgNum() << Ex->getSourceRange();
+ return;
+ }
+
+ SizeArgs.push_back(x);
+ }
+
+ // check if the function returns a pointer
+ if (!getFunctionType(D)->getResultType()->isAnyPointerType()) {
+ S.Diag(Attr.getLoc(), diag::warn_ns_attribute_wrong_return_type)
+ << "alloc_size" << 0 /*function*/<< 1 /*pointer*/ << D->getSourceRange();
+ }
+
+ unsigned size = SizeArgs.size();
+ unsigned* start = &SizeArgs[0];
+ llvm::array_pod_sort(start, start + size);
+ D->addAttr(::new (S.Context) AllocSizeAttr(Attr.getRange(), S.Context, start,
+ size));
+}
+
static void handleNonNullAttr(Sema &S, Decl *D, const AttributeList &Attr) {
// GCC ignores the nonnull attribute on K&R style function prototypes, so we
// ignore it as well
@@ -3844,6 +3919,7 @@
break;
case AttributeList::AT_alias: handleAliasAttr (S, D, Attr); break;
case AttributeList::AT_aligned: handleAlignedAttr (S, D, Attr); break;
+ case AttributeList::AT_alloc_size: handleAllocSizeAttr (S, D, Attr); break;
case AttributeList::AT_always_inline:
handleAlwaysInlineAttr (S, D, Attr); break;
case AttributeList::AT_analyzer_noreturn:
@@ -4413,8 +4489,12 @@
: diag::note_previous_decl) << D->getDeclName();
}
else {
- if (!UnknownObjCClass)
+ if (!UnknownObjCClass) {
Diag(Loc, diag::warn_deprecated) << D->getDeclName();
+ Diag(D->getLocation(),
+ isa<ObjCMethodDecl>(D) ? diag::note_method_declared_at
+ : diag::note_previous_decl) << D->getDeclName();
+ }
else {
Diag(Loc, diag::warn_deprecated_fwdclass_message) << D->getDeclName();
Diag(UnknownObjCClass->getLocation(), diag::note_forward_class);
Modified: cfe/branches/tooling/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaDeclObjC.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaDeclObjC.cpp Tue May 29 07:04:37 2012
@@ -1491,8 +1491,8 @@
void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc,
ObjCProtocolDecl *PDecl,
bool& IncompleteImpl,
- const llvm::DenseSet<Selector> &InsMap,
- const llvm::DenseSet<Selector> &ClsMap,
+ const SelectorSet &InsMap,
+ const SelectorSet &ClsMap,
ObjCContainerDecl *CDecl) {
ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(CDecl);
ObjCInterfaceDecl *IDecl = C ? C->getClassInterface()
@@ -1588,10 +1588,10 @@
/// MatchAllMethodDeclarations - Check methods declared in interface
/// or protocol against those declared in their implementations.
///
-void Sema::MatchAllMethodDeclarations(const llvm::DenseSet<Selector> &InsMap,
- const llvm::DenseSet<Selector> &ClsMap,
- llvm::DenseSet<Selector> &InsMapSeen,
- llvm::DenseSet<Selector> &ClsMapSeen,
+void Sema::MatchAllMethodDeclarations(const SelectorSet &InsMap,
+ const SelectorSet &ClsMap,
+ SelectorSet &InsMapSeen,
+ SelectorSet &ClsMapSeen,
ObjCImplDecl* IMPDecl,
ObjCContainerDecl* CDecl,
bool &IncompleteImpl,
@@ -1687,7 +1687,7 @@
/// warns each time an exact match is found.
void Sema::CheckCategoryVsClassMethodMatches(
ObjCCategoryImplDecl *CatIMPDecl) {
- llvm::DenseSet<Selector> InsMap, ClsMap;
+ SelectorSet InsMap, ClsMap;
for (ObjCImplementationDecl::instmeth_iterator
I = CatIMPDecl->instmeth_begin(),
@@ -1708,7 +1708,7 @@
ObjCInterfaceDecl *IDecl = CatDecl->getClassInterface();
if (!IDecl)
return;
- llvm::DenseSet<Selector> InsMapSeen, ClsMapSeen;
+ SelectorSet InsMapSeen, ClsMapSeen;
bool IncompleteImpl = false;
MatchAllMethodDeclarations(InsMap, ClsMap, InsMapSeen, ClsMapSeen,
CatIMPDecl, IDecl,
@@ -1719,7 +1719,7 @@
void Sema::ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl* IMPDecl,
ObjCContainerDecl* CDecl,
bool IncompleteImpl) {
- llvm::DenseSet<Selector> InsMap;
+ SelectorSet InsMap;
// Check and see if instance methods in class interface have been
// implemented in the implementation class.
for (ObjCImplementationDecl::instmeth_iterator
@@ -1734,7 +1734,7 @@
IDecl->isObjCRequiresPropertyDefs())
DiagnoseUnimplementedProperties(S, IMPDecl, CDecl, InsMap);
- llvm::DenseSet<Selector> ClsMap;
+ SelectorSet ClsMap;
for (ObjCImplementationDecl::classmeth_iterator
I = IMPDecl->classmeth_begin(),
E = IMPDecl->classmeth_end(); I != E; ++I)
@@ -1742,7 +1742,7 @@
// Check for type conflict of methods declared in a class/protocol and
// its implementation; if any.
- llvm::DenseSet<Selector> InsMapSeen, ClsMapSeen;
+ SelectorSet InsMapSeen, ClsMapSeen;
MatchAllMethodDeclarations(InsMap, ClsMap, InsMapSeen, ClsMapSeen,
IMPDecl, CDecl,
IncompleteImpl, true);
Modified: cfe/branches/tooling/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaExpr.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaExpr.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaExpr.cpp Tue May 29 07:04:37 2012
@@ -1371,7 +1371,8 @@
// unqualified lookup. This is useful when (for example) the
// original lookup would not have found something because it was a
// dependent name.
- DeclContext *DC = SS.isEmpty() ? CurContext : 0;
+ DeclContext *DC = (SS.isEmpty() && !CallsUndergoingInstantiation.empty())
+ ? CurContext : 0;
while (DC) {
if (isa<CXXRecordDecl>(DC)) {
LookupQualifiedName(R, DC);
@@ -7412,8 +7413,6 @@
// C99 6.5.17
static QualType CheckCommaOperands(Sema &S, ExprResult &LHS, ExprResult &RHS,
SourceLocation Loc) {
- S.DiagnoseUnusedExprResult(LHS.get());
-
LHS = S.CheckPlaceholderExpr(LHS.take());
RHS = S.CheckPlaceholderExpr(RHS.take());
if (LHS.isInvalid() || RHS.isInvalid())
@@ -7429,6 +7428,8 @@
if (LHS.isInvalid())
return QualType();
+ S.DiagnoseUnusedExprResult(LHS.get());
+
if (!S.getLangOpts().CPlusPlus) {
RHS = S.DefaultFunctionArrayLvalueConversion(RHS.take());
if (RHS.isInvalid())
Modified: cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaExprCXX.cpp Tue May 29 07:04:37 2012
@@ -5267,6 +5267,61 @@
return BuildCXXNoexceptExpr(KeyLoc, Operand, RParen);
}
+static bool IsSpecialDiscardedValue(Expr *E) {
+ // In C++11, discarded-value expressions of a certain form are special,
+ // according to [expr]p10:
+ // The lvalue-to-rvalue conversion (4.1) is applied only if the
+ // expression is an lvalue of volatile-qualified type and it has
+ // one of the following forms:
+ E = E->IgnoreParens();
+
+ // - id-expression (5.1.1),
+ if (isa<DeclRefExpr>(E))
+ return true;
+
+ // - subscripting (5.2.1),
+ if (isa<ArraySubscriptExpr>(E))
+ return true;
+
+ // - class member access (5.2.5),
+ if (isa<MemberExpr>(E))
+ return true;
+
+ // - indirection (5.3.1),
+ if (UnaryOperator *UO = dyn_cast<UnaryOperator>(E))
+ if (UO->getOpcode() == UO_Deref)
+ return true;
+
+ if (BinaryOperator *BO = dyn_cast<BinaryOperator>(E)) {
+ // - pointer-to-member operation (5.5),
+ if (BO->isPtrMemOp())
+ return true;
+
+ // - comma expression (5.18) where the right operand is one of the above.
+ if (BO->getOpcode() == BO_Comma)
+ return IsSpecialDiscardedValue(BO->getRHS());
+ }
+
+ // - conditional expression (5.16) where both the second and the third
+ // operands are one of the above, or
+ if (ConditionalOperator *CO = dyn_cast<ConditionalOperator>(E))
+ return IsSpecialDiscardedValue(CO->getTrueExpr()) &&
+ IsSpecialDiscardedValue(CO->getFalseExpr());
+ // The related edge case of "*x ?: *x".
+ if (BinaryConditionalOperator *BCO =
+ dyn_cast<BinaryConditionalOperator>(E)) {
+ if (OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(BCO->getTrueExpr()))
+ return IsSpecialDiscardedValue(OVE->getSourceExpr()) &&
+ IsSpecialDiscardedValue(BCO->getFalseExpr());
+ }
+
+ // Objective-C++ extensions to the rule.
+ if (isa<PseudoObjectExpr>(E) || isa<ObjCIvarRefExpr>(E))
+ return true;
+
+ return false;
+}
+
/// Perform the conversions required for an expression used in a
/// context that ignores the result.
ExprResult Sema::IgnoredValueConversions(Expr *E) {
@@ -5291,8 +5346,21 @@
return Owned(E);
}
- // Otherwise, this rule does not apply in C++, at least not for the moment.
- if (getLangOpts().CPlusPlus) return Owned(E);
+ if (getLangOpts().CPlusPlus) {
+ // The C++11 standard defines the notion of a discarded-value expression;
+ // normally, we don't need to do anything to handle it, but if it is a
+ // volatile lvalue with a special form, we perform an lvalue-to-rvalue
+ // conversion.
+ if (getLangOpts().CPlusPlus0x && E->isGLValue() &&
+ E->getType().isVolatileQualified() &&
+ IsSpecialDiscardedValue(E)) {
+ ExprResult Res = DefaultLvalueConversion(E);
+ if (Res.isInvalid())
+ return Owned(E);
+ E = Res.take();
+ }
+ return Owned(E);
+ }
// GCC seems to also exclude expressions of incomplete enum type.
if (const EnumType *T = E->getType()->getAs<EnumType>()) {
Modified: cfe/branches/tooling/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaExprObjC.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaExprObjC.cpp Tue May 29 07:04:37 2012
@@ -1483,7 +1483,11 @@
SelectorTable::constructSetterName(PP.getIdentifierTable(),
PP.getSelectorTable(), Member);
ObjCMethodDecl *Setter = IFace->lookupInstanceMethod(SetterSel);
-
+ if (Setter && Setter->isSynthesized())
+ // Check for corner case of: @property int p; ... self.P = 0;
+ // setter name is synthesized "setP" but there is no property name 'P'.
+ Setter = 0;
+
// May be founf in property's qualified list.
if (!Setter)
Setter = LookupMethodInQualifiedType(SetterSel, OPT, true);
Modified: cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaObjCProperty.cpp Tue May 29 07:04:37 2012
@@ -1523,7 +1523,7 @@
void Sema::DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl* IMPDecl,
ObjCContainerDecl *CDecl,
- const llvm::DenseSet<Selector>& InsMap) {
+ const SelectorSet &InsMap) {
llvm::DenseMap<IdentifierInfo *, ObjCPropertyDecl*> SuperPropMap;
if (ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(CDecl))
CollectSuperClassPropertyImplementations(IDecl, SuperPropMap);
Modified: cfe/branches/tooling/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaOverload.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaOverload.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaOverload.cpp Tue May 29 07:04:37 2012
@@ -4153,7 +4153,7 @@
// qualifier.
// This is also the point where rvalue references and lvalue inits no longer
// go together.
- if (!isRValRef && !T1.isConstQualified())
+ if (!isRValRef && (!T1.isConstQualified() || T1.isVolatileQualified()))
return ICS;
// -- If the initializer expression
Modified: cfe/branches/tooling/lib/Sema/SemaPseudoObject.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaPseudoObject.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaPseudoObject.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaPseudoObject.cpp Tue May 29 07:04:37 2012
@@ -34,6 +34,7 @@
#include "clang/Sema/Initialization.h"
#include "clang/AST/ExprObjC.h"
#include "clang/Lex/Preprocessor.h"
+#include "llvm/ADT/SmallString.h"
using namespace clang;
using namespace sema;
@@ -232,7 +233,7 @@
Expr *op);
bool tryBuildGetOfReference(Expr *op, ExprResult &result);
- bool findSetter();
+ bool findSetter(bool warn=true);
bool findGetter();
Expr *rebuildAndCaptureObject(Expr *syntacticBase);
@@ -505,7 +506,7 @@
/// reference.
///
/// \return true if a setter was found, in which case Setter
-bool ObjCPropertyOpBuilder::findSetter() {
+bool ObjCPropertyOpBuilder::findSetter(bool warn) {
// For implicit properties, just trust the lookup we already did.
if (RefExpr->isImplicitProperty()) {
if (ObjCMethodDecl *setter = RefExpr->getImplicitPropertySetter()) {
@@ -531,6 +532,23 @@
// Do a normal method lookup first.
if (ObjCMethodDecl *setter =
LookupMethodInReceiverType(S, SetterSelector, RefExpr)) {
+ if (setter->isSynthesized() && warn)
+ if (const ObjCInterfaceDecl *IFace =
+ dyn_cast<ObjCInterfaceDecl>(setter->getDeclContext())) {
+ const StringRef thisPropertyName(prop->getName());
+ char front = thisPropertyName.front();
+ front = islower(front) ? toupper(front) : tolower(front);
+ SmallString<100> PropertyName = thisPropertyName;
+ PropertyName[0] = front;
+ IdentifierInfo *AltMember = &S.PP.getIdentifierTable().get(PropertyName);
+ if (ObjCPropertyDecl *prop1 = IFace->FindPropertyDeclaration(AltMember))
+ if (prop != prop1 && (prop1->getSetterMethodDecl() == setter)) {
+ S.Diag(RefExpr->getExprLoc(), diag::error_property_setter_ambiguous_use)
+ << prop->getName() << prop1->getName() << setter->getSelector();
+ S.Diag(prop->getLocation(), diag::note_property_declare);
+ S.Diag(prop1->getLocation(), diag::note_property_declare);
+ }
+ }
Setter = setter;
return true;
}
@@ -603,7 +621,7 @@
/// value being set as the value of the property operation.
ExprResult ObjCPropertyOpBuilder::buildSet(Expr *op, SourceLocation opcLoc,
bool captureSetValueAsResult) {
- bool hasSetter = findSetter();
+ bool hasSetter = findSetter(false);
assert(hasSetter); (void) hasSetter;
if (SyntacticRefExpr)
Modified: cfe/branches/tooling/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaStmt.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaStmt.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaStmt.cpp Tue May 29 07:04:37 2012
@@ -153,10 +153,11 @@
if (!E)
return;
+ const Expr *WarnExpr;
SourceLocation Loc;
SourceRange R1, R2;
if (SourceMgr.isInSystemMacro(E->getExprLoc()) ||
- !E->isUnusedResultAWarning(Loc, R1, R2, Context))
+ !E->isUnusedResultAWarning(WarnExpr, Loc, R1, R2, Context))
return;
// Okay, we have an unused result. Depending on what the base expression is,
@@ -171,7 +172,7 @@
if (DiagnoseUnusedComparison(*this, E))
return;
- E = E->IgnoreParenImpCasts();
+ E = WarnExpr;
if (const CallExpr *CE = dyn_cast<CallExpr>(E)) {
if (E->getType()->isVoidType())
return;
@@ -229,6 +230,11 @@
}
}
+ if (E->isGLValue() && E->getType().isVolatileQualified()) {
+ Diag(Loc, diag::warn_unused_volatile) << R1 << R2;
+ return;
+ }
+
DiagRuntimeBehavior(Loc, 0, PDiag(DiagID) << R1 << R2);
}
Modified: cfe/branches/tooling/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Serialization/ASTReaderDecl.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/branches/tooling/lib/Serialization/ASTReaderDecl.cpp Tue May 29 07:04:37 2012
@@ -1534,7 +1534,7 @@
// We temporarily set the first (canonical) declaration as the previous one
// which is the one that matters and mark the real previous DeclID to be
// loaded & attached later on.
- D->RedeclLink = typename Redeclarable<T>::PreviousDeclLink(FirstDecl);
+ D->RedeclLink = Redeclarable<T>::PreviousDeclLink(FirstDecl);
}
// Note that this declaration has been deserialized.
@@ -1562,8 +1562,7 @@
// Have our redeclaration link point back at the canonical declaration
// of the existing declaration, so that this declaration has the
// appropriate canonical declaration.
- D->RedeclLink
- = typename Redeclarable<T>::PreviousDeclLink(ExistingCanon);
+ D->RedeclLink = Redeclarable<T>::PreviousDeclLink(ExistingCanon);
// When we merge a namespace, update its pointer to the first namespace.
if (NamespaceDecl *Namespace
@@ -1805,22 +1804,22 @@
void ASTDeclReader::attachPreviousDecl(Decl *D, Decl *previous) {
assert(D && previous);
if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
- TD->RedeclLink.setPointer(cast<TagDecl>(previous));
+ TD->RedeclLink.setNext(cast<TagDecl>(previous));
} else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
- FD->RedeclLink.setPointer(cast<FunctionDecl>(previous));
+ FD->RedeclLink.setNext(cast<FunctionDecl>(previous));
} else if (VarDecl *VD = dyn_cast<VarDecl>(D)) {
- VD->RedeclLink.setPointer(cast<VarDecl>(previous));
+ VD->RedeclLink.setNext(cast<VarDecl>(previous));
} else if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D)) {
- TD->RedeclLink.setPointer(cast<TypedefNameDecl>(previous));
+ TD->RedeclLink.setNext(cast<TypedefNameDecl>(previous));
} else if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(D)) {
- ID->RedeclLink.setPointer(cast<ObjCInterfaceDecl>(previous));
+ ID->RedeclLink.setNext(cast<ObjCInterfaceDecl>(previous));
} else if (ObjCProtocolDecl *PD = dyn_cast<ObjCProtocolDecl>(D)) {
- PD->RedeclLink.setPointer(cast<ObjCProtocolDecl>(previous));
+ PD->RedeclLink.setNext(cast<ObjCProtocolDecl>(previous));
} else if (NamespaceDecl *ND = dyn_cast<NamespaceDecl>(D)) {
- ND->RedeclLink.setPointer(cast<NamespaceDecl>(previous));
+ ND->RedeclLink.setNext(cast<NamespaceDecl>(previous));
} else {
RedeclarableTemplateDecl *TD = cast<RedeclarableTemplateDecl>(D);
- TD->RedeclLink.setPointer(cast<RedeclarableTemplateDecl>(previous));
+ TD->RedeclLink.setNext(cast<RedeclarableTemplateDecl>(previous));
}
}
Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/Checkers.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/Checkers.td?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/Checkers.td (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/Checkers.td Tue May 29 07:04:37 2012
@@ -361,7 +361,7 @@
let ParentPackage = Cocoa in {
def ObjCAtSyncChecker : Checker<"AtSync">,
- HelpText<"Check for null pointers used as mutexes for @synchronized">,
+ HelpText<"Check for nil pointers used as mutexes for @synchronized">,
DescFile<"ObjCAtSyncChecker.cpp">;
def NilArgChecker : Checker<"NilArg">,
@@ -373,8 +373,8 @@
DescFile<"BasicObjCFoundationChecks.cpp">;
def VariadicMethodTypeChecker : Checker<"VariadicMethodTypes">,
- HelpText<"Check for passing non-Objective-C types to variadic methods that expect "
- "only Objective-C types">,
+ HelpText<"Check for passing non-Objective-C types to variadic collection "
+ "initialization methods that expect only Objective-C types">,
DescFile<"BasicObjCFoundationChecks.cpp">;
def NSAutoreleasePoolChecker : Checker<"NSAutoreleasePool">,
@@ -401,7 +401,7 @@
HelpText<"Check for leaks and improper reference count management">,
DescFile<"RetainCountChecker.cpp">;
-} // end "cocoa"
+} // end "osx.cocoa"
let ParentPackage = CocoaExperimental in {
Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp Tue May 29 07:04:37 2012
@@ -473,17 +473,14 @@
}
static unsigned getHashValue(const ObjCSummaryKey &V) {
- return (DenseMapInfo<IdentifierInfo*>::getHashValue(V.getIdentifier())
- & 0x88888888)
- | (DenseMapInfo<Selector>::getHashValue(V.getSelector())
- & 0x55555555);
+ typedef std::pair<IdentifierInfo*, Selector> PairTy;
+ return DenseMapInfo<PairTy>::getHashValue(PairTy(V.getIdentifier(),
+ V.getSelector()));
}
static bool isEqual(const ObjCSummaryKey& LHS, const ObjCSummaryKey& RHS) {
- return DenseMapInfo<IdentifierInfo*>::isEqual(LHS.getIdentifier(),
- RHS.getIdentifier()) &&
- DenseMapInfo<Selector>::isEqual(LHS.getSelector(),
- RHS.getSelector());
+ return LHS.getIdentifier() == RHS.getIdentifier() &&
+ LHS.getSelector() == RHS.getSelector();
}
};
Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineC.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineC.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineC.cpp Tue May 29 07:04:37 2012
@@ -279,7 +279,6 @@
case CK_Dependent:
case CK_ArrayToPointerDecay:
case CK_BitCast:
- case CK_LValueBitCast:
case CK_IntegralCast:
case CK_NullToPointer:
case CK_IntegralToPointer:
@@ -378,7 +377,8 @@
case CK_UserDefinedConversion:
case CK_ConstructorConversion:
case CK_VectorSplat:
- case CK_MemberPointerToBoolean: {
+ case CK_MemberPointerToBoolean:
+ case CK_LValueBitCast: {
// Recover some path-sensitivty by conjuring a new value.
QualType resultType = CastE->getType();
if (CastE->isGLValue())
Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/SValBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/SValBuilder.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/SValBuilder.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/SValBuilder.cpp Tue May 29 07:04:37 2012
@@ -325,7 +325,7 @@
// Are we casting from an array to a pointer? If so just pass on
// the decayed value.
- if (castTy->isPointerType())
+ if (castTy->isPointerType() || castTy->isReferenceType())
return val;
// Are we casting from an array to an integer? If so, cast the decayed
Modified: cfe/branches/tooling/lib/Tooling/CompilationDatabase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Tooling/CompilationDatabase.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Tooling/CompilationDatabase.cpp (original)
+++ cfe/branches/tooling/lib/Tooling/CompilationDatabase.cpp Tue May 29 07:04:37 2012
@@ -179,8 +179,10 @@
std::vector<CompileCommand>
JSONCompilationDatabase::getCompileCommands(StringRef FilePath) const {
+ llvm::SmallString<128> NativeFilePath;
+ llvm::sys::path::native(FilePath, NativeFilePath);
llvm::StringMap< std::vector<CompileCommandRef> >::const_iterator
- CommandsRefI = IndexByFile.find(FilePath);
+ CommandsRefI = IndexByFile.find(NativeFilePath);
if (CommandsRefI == IndexByFile.end())
return std::vector<CompileCommand>();
const std::vector<CompileCommandRef> &CommandsRef = CommandsRefI->getValue();
@@ -271,7 +273,9 @@
return false;
}
llvm::SmallString<8> FileStorage;
- IndexByFile[File->getValue(FileStorage)].push_back(
+ llvm::SmallString<128> NativeFilePath;
+ llvm::sys::path::native(File->getValue(FileStorage), NativeFilePath);
+ IndexByFile[NativeFilePath].push_back(
CompileCommandRef(Directory, Command));
}
return true;
Modified: cfe/branches/tooling/lib/Tooling/Tooling.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Tooling/Tooling.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Tooling/Tooling.cpp (original)
+++ cfe/branches/tooling/lib/Tooling/Tooling.cpp Tue May 29 07:04:37 2012
@@ -142,17 +142,21 @@
/// \param BaseDirectory An absolute path.
static std::string getAbsolutePath(
StringRef File, StringRef BaseDirectory) {
+ SmallString<1024> PathStorage;
assert(llvm::sys::path::is_absolute(BaseDirectory));
if (llvm::sys::path::is_absolute(File)) {
- return File;
+ llvm::sys::path::native(File, PathStorage);
+ return PathStorage.str();
}
StringRef RelativePath(File);
+ // FIXME: Should '.\\' be accepted on Win32?
if (RelativePath.startswith("./")) {
RelativePath = RelativePath.substr(strlen("./"));
}
llvm::SmallString<1024> AbsolutePath(BaseDirectory);
llvm::sys::path::append(AbsolutePath, RelativePath);
- return AbsolutePath.str();
+ llvm::sys::path::native(Twine(AbsolutePath), PathStorage);
+ return PathStorage.str();
}
ToolInvocation::ToolInvocation(
Modified: cfe/branches/tooling/test/ARCMT/Common.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/Common.h?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/Common.h (original)
+++ cfe/branches/tooling/test/ARCMT/Common.h Tue May 29 07:04:37 2012
@@ -68,3 +68,14 @@
extern __attribute__((ns_returns_retained)) id objc_retainedObject(objc_objectptr_t __attribute__((cf_consumed)) pointer);
extern __attribute__((ns_returns_not_retained)) id objc_unretainedObject(objc_objectptr_t pointer);
extern objc_objectptr_t objc_unretainedPointer(id object);
+
+#define dispatch_retain(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); (void)[_o retain]; })
+#define dispatch_release(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); [_o release]; })
+#define xpc_retain(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o retain]; })
+#define xpc_release(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o release]; })
+
+typedef id dispatch_object_t;
+typedef id xpc_object_t;
+
+void _dispatch_object_validate(dispatch_object_t object);
+void _xpc_object_validate(xpc_object_t object);
Modified: cfe/branches/tooling/test/ARCMT/autoreleases.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/autoreleases.m?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/autoreleases.m (original)
+++ cfe/branches/tooling/test/ARCMT/autoreleases.m Tue May 29 07:04:37 2012
@@ -3,29 +3,21 @@
// RUN: diff %t %s.result
// DISABLE: mingw32
-typedef unsigned char BOOL;
+#include "Common.h"
- at interface NSObject {
- id isa;
-}
-+new;
-+alloc;
--init;
--autorelease;
- at end
-
- at interface NSAutoreleasePool : NSObject
-- drain;
- at end
-
@interface A : NSObject {
@package
id object;
}
@end
- at interface B : NSObject
+ at interface B : NSObject {
+ id _prop;
+ xpc_object_t _xpc_prop;
+}
- (BOOL)containsSelf:(A*)a;
+ at property (retain) id prop;
+ at property (retain) xpc_object_t xpc_prop;
@end
@implementation A
@@ -35,6 +27,26 @@
- (BOOL)containsSelf:(A*)a {
return a->object == self;
}
+
+-(id) prop {
+ return _prop;
+}
+-(void) setProp:(id) newVal {
+ [_prop autorelease];
+ _prop = [newVal retain];
+}
+-(void) setProp2:(CFTypeRef) newVal {
+ [_prop autorelease];
+ _prop = (id)CFRetain(newVal);
+}
+
+-(id) xpc_prop {
+ return _xpc_prop;
+}
+-(void) setXpc_prop:(xpc_object_t) newVal {
+ [_xpc_prop autorelease];
+ _xpc_prop = xpc_retain(newVal);
+}
@end
void NSLog(id, ...);
@@ -47,3 +59,8 @@
[pool drain];
return 0;
}
+
+void test(A *prevVal, A *newVal) {
+ [prevVal autorelease];
+ prevVal = [newVal retain];
+}
Modified: cfe/branches/tooling/test/ARCMT/autoreleases.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/autoreleases.m.result?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/autoreleases.m.result (original)
+++ cfe/branches/tooling/test/ARCMT/autoreleases.m.result Tue May 29 07:04:37 2012
@@ -3,29 +3,21 @@
// RUN: diff %t %s.result
// DISABLE: mingw32
-typedef unsigned char BOOL;
+#include "Common.h"
- at interface NSObject {
- id isa;
-}
-+new;
-+alloc;
--init;
--autorelease;
- at end
-
- at interface NSAutoreleasePool : NSObject
-- drain;
- at end
-
@interface A : NSObject {
@package
id object;
}
@end
- at interface B : NSObject
+ at interface B : NSObject {
+ id _prop;
+ xpc_object_t _xpc_prop;
+}
- (BOOL)containsSelf:(A*)a;
+ at property (strong) id prop;
+ at property (strong) xpc_object_t xpc_prop;
@end
@implementation A
@@ -35,6 +27,23 @@
- (BOOL)containsSelf:(A*)a {
return a->object == self;
}
+
+-(id) prop {
+ return _prop;
+}
+-(void) setProp:(id) newVal {
+ _prop = newVal;
+}
+-(void) setProp2:(CFTypeRef) newVal {
+ _prop = (__bridge_transfer id)CFRetain(newVal);
+}
+
+-(id) xpc_prop {
+ return _xpc_prop;
+}
+-(void) setXpc_prop:(xpc_object_t) newVal {
+ _xpc_prop = newVal;
+}
@end
void NSLog(id, ...);
@@ -47,3 +56,7 @@
}
return 0;
}
+
+void test(A *prevVal, A *newVal) {
+ prevVal = newVal;
+}
Modified: cfe/branches/tooling/test/ARCMT/checking.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/checking.m?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/checking.m (original)
+++ cfe/branches/tooling/test/ARCMT/checking.m Tue May 29 07:04:37 2012
@@ -91,6 +91,9 @@
[a release];
[a autorelease]; // expected-error {{it is not safe to remove an unused 'autorelease' message; its receiver may be destroyed immediately}} \
// expected-error {{ARC forbids explicit message send}}
+ [a autorelease]; // expected-error {{it is not safe to remove an unused 'autorelease' message; its receiver may be destroyed immediately}} \
+ // expected-error {{ARC forbids explicit message send}}
+ a = 0;
CFStringRef cfstr;
NSString *str = (NSString *)cfstr; // expected-error {{cast of C pointer type 'CFStringRef' (aka 'const struct __CFString *') to Objective-C pointer type 'NSString *' requires a bridged cast}} \
Modified: cfe/branches/tooling/test/ARCMT/dispatch.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/dispatch.m?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/dispatch.m (original)
+++ cfe/branches/tooling/test/ARCMT/dispatch.m Tue May 29 07:04:37 2012
@@ -4,17 +4,6 @@
#include "Common.h"
-#define dispatch_retain(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); (void)[_o retain]; })
-#define dispatch_release(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); [_o release]; })
-#define xpc_retain(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o retain]; })
-#define xpc_release(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o release]; })
-
-typedef id dispatch_object_t;
-typedef id xpc_object_t;
-
-void _dispatch_object_validate(dispatch_object_t object);
-void _xpc_object_validate(xpc_object_t object);
-
dispatch_object_t getme(void);
void func(dispatch_object_t o) {
Modified: cfe/branches/tooling/test/ARCMT/dispatch.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/dispatch.m.result?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/dispatch.m.result (original)
+++ cfe/branches/tooling/test/ARCMT/dispatch.m.result Tue May 29 07:04:37 2012
@@ -4,17 +4,6 @@
#include "Common.h"
-#define dispatch_retain(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); (void)[_o retain]; })
-#define dispatch_release(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); [_o release]; })
-#define xpc_retain(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o retain]; })
-#define xpc_release(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o release]; })
-
-typedef id dispatch_object_t;
-typedef id xpc_object_t;
-
-void _dispatch_object_validate(dispatch_object_t object);
-void _xpc_object_validate(xpc_object_t object);
-
dispatch_object_t getme(void);
void func(dispatch_object_t o) {
Modified: cfe/branches/tooling/test/ARCMT/objcmt-boxing.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/objcmt-boxing.m?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/objcmt-boxing.m (original)
+++ cfe/branches/tooling/test/ARCMT/objcmt-boxing.m Tue May 29 07:04:37 2012
@@ -1,5 +1,5 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -objcmt-migrate-literals -objcmt-migrate-subscripting -mt-migrate-directory %t %s -x objective-c++
+// RUN: %clang_cc1 -objcmt-migrate-literals -objcmt-migrate-subscripting -mt-migrate-directory %t %s -x objective-c++ -verify
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c++ %s.result
@@ -81,6 +81,7 @@
MyEnm myenum;
[NSNumber numberWithInteger:myenum];
[NSNumber numberWithInteger:ME_foo];
+ [NSNumber numberWithDouble:cppb]; // expected-warning {{converting to boxing syntax requires a cast}}
}
void boxString() {
Modified: cfe/branches/tooling/test/ARCMT/objcmt-boxing.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/objcmt-boxing.m.result?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/objcmt-boxing.m.result (original)
+++ cfe/branches/tooling/test/ARCMT/objcmt-boxing.m.result Tue May 29 07:04:37 2012
@@ -1,5 +1,5 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -objcmt-migrate-literals -objcmt-migrate-subscripting -mt-migrate-directory %t %s -x objective-c++
+// RUN: %clang_cc1 -objcmt-migrate-literals -objcmt-migrate-subscripting -mt-migrate-directory %t %s -x objective-c++ -verify
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c++ %s.result
@@ -81,6 +81,7 @@
MyEnm myenum;
@(myenum);
@(ME_foo);
+ [NSNumber numberWithDouble:cppb]; // expected-warning {{converting to boxing syntax requires a cast}}
}
void boxString() {
Modified: cfe/branches/tooling/test/Analysis/cxx11-crashes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/cxx11-crashes.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/cxx11-crashes.cpp (original)
+++ cfe/branches/tooling/test/Analysis/cxx11-crashes.cpp Tue May 29 07:04:37 2012
@@ -32,7 +32,35 @@
fs::path p;
}
-// PR12873 radrar://11499139
+// PR12873 radar://11499139
void testFloatInitializer() {
const float ysize={0.015}, xsize={0.01};
}
+
+
+// PR12874, radar://11487525
+template<class T> struct addr_impl_ref {
+ T & v_;
+ inline addr_impl_ref( T & v ): v_( v ) {
+ }
+ inline operator T& () const {return v_;}
+};
+template<class T> struct addressof_impl {
+ static inline T * f( T & v, long ) {
+ return reinterpret_cast<T*>(&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
+ }
+};
+template<class T> T * addressof( T & v ) {
+ return addressof_impl<T>::f( addr_impl_ref<T>( v ), 0 );
+}
+void testRadar11487525_1(){
+ bool s[25];
+ addressof(s);
+}
+
+// radar://11487525 Don't crash on CK_LValueBitCast.
+bool begin(double *it) {
+ typedef bool type[25];
+ bool *a = reinterpret_cast<type &>(*( reinterpret_cast<char *>( it )));
+ return *a;
+}
Modified: cfe/branches/tooling/test/Analysis/retain-release.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/retain-release.m?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/retain-release.m (original)
+++ cfe/branches/tooling/test/Analysis/retain-release.m Tue May 29 07:04:37 2012
@@ -199,7 +199,7 @@
typedef void (*IOServiceMatchingCallback)( void * refcon, io_iterator_t iterator );
io_service_t IOServiceGetMatchingService( mach_port_t masterPort, CFDictionaryRef matching );
kern_return_t IOServiceGetMatchingServices( mach_port_t masterPort, CFDictionaryRef matching, io_iterator_t * existing );
-kern_return_t IOServiceAddNotification( mach_port_t masterPort, const io_name_t notificationType, CFDictionaryRef matching, mach_port_t wakePort, uintptr_t reference, io_iterator_t * notification ) __attribute__((deprecated));
+kern_return_t IOServiceAddNotification( mach_port_t masterPort, const io_name_t notificationType, CFDictionaryRef matching, mach_port_t wakePort, uintptr_t reference, io_iterator_t * notification ) __attribute__((deprecated)); // expected-note {{'IOServiceAddNotification' declared here}}
kern_return_t IOServiceAddMatchingNotification( IONotificationPortRef notifyPort, const io_name_t notificationType, CFDictionaryRef matching, IOServiceMatchingCallback callback, void * refCon, io_iterator_t * notification );
CFMutableDictionaryRef IOServiceMatching( const char * name );
CFMutableDictionaryRef IOServiceNameMatching( const char * name );
Modified: cfe/branches/tooling/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp (original)
+++ cfe/branches/tooling/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp Tue May 29 07:04:37 2012
@@ -1,5 +1,13 @@
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+struct pr12960 {
+ int begin;
+ void foo(int x) {
+ for (int& it : x) { // expected-error {{use of undeclared identifier 'begin'}} expected-note {{range has type 'int'}}
+ }
+ }
+};
+
namespace std {
template<typename T>
auto begin(T &&t) -> decltype(t.begin()) { return t.begin(); } // expected-note 4{{ignored: substitution failure}}
@@ -207,3 +215,4 @@
for (int &x : array)
x *= 2;
}
+
Removed: cfe/branches/tooling/test/CodeGen/builtins-ptx.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGen/builtins-ptx.c?rev=157609&view=auto
==============================================================================
--- cfe/branches/tooling/test/CodeGen/builtins-ptx.c (original)
+++ cfe/branches/tooling/test/CodeGen/builtins-ptx.c (removed)
@@ -1,99 +0,0 @@
-// RUN: %clang_cc1 -triple ptx32-unknown-unknown -emit-llvm -o %t %s
-// RUN: %clang_cc1 -triple ptx64-unknown-unknown -emit-llvm -o %t %s
-
-
-int read_tid() {
-
- int x = __builtin_ptx_read_tid_x();
- int y = __builtin_ptx_read_tid_y();
- int z = __builtin_ptx_read_tid_z();
- int w = __builtin_ptx_read_tid_w();
-
- return x + y + z + w;
-
-}
-
-int read_ntid() {
-
- int x = __builtin_ptx_read_ntid_x();
- int y = __builtin_ptx_read_ntid_y();
- int z = __builtin_ptx_read_ntid_z();
- int w = __builtin_ptx_read_ntid_w();
-
- return x + y + z + w;
-
-}
-
-int read_ctaid() {
-
- int x = __builtin_ptx_read_ctaid_x();
- int y = __builtin_ptx_read_ctaid_y();
- int z = __builtin_ptx_read_ctaid_z();
- int w = __builtin_ptx_read_ctaid_w();
-
- return x + y + z + w;
-
-}
-
-int read_nctaid() {
-
- int x = __builtin_ptx_read_nctaid_x();
- int y = __builtin_ptx_read_nctaid_y();
- int z = __builtin_ptx_read_nctaid_z();
- int w = __builtin_ptx_read_nctaid_w();
-
- return x + y + z + w;
-
-}
-
-int read_ids() {
-
- int a = __builtin_ptx_read_laneid();
- int b = __builtin_ptx_read_warpid();
- int c = __builtin_ptx_read_nwarpid();
- int d = __builtin_ptx_read_smid();
- int e = __builtin_ptx_read_nsmid();
- int f = __builtin_ptx_read_gridid();
-
- return a + b + c + d + e + f;
-
-}
-
-int read_lanemasks() {
-
- int a = __builtin_ptx_read_lanemask_eq();
- int b = __builtin_ptx_read_lanemask_le();
- int c = __builtin_ptx_read_lanemask_lt();
- int d = __builtin_ptx_read_lanemask_ge();
- int e = __builtin_ptx_read_lanemask_gt();
-
- return a + b + c + d + e;
-
-}
-
-
-long read_clocks() {
-
- int a = __builtin_ptx_read_clock();
- long b = __builtin_ptx_read_clock64();
-
- return (long)a + b;
-
-}
-
-int read_pms() {
-
- int a = __builtin_ptx_read_pm0();
- int b = __builtin_ptx_read_pm1();
- int c = __builtin_ptx_read_pm2();
- int d = __builtin_ptx_read_pm3();
-
- return a + b + c + d;
-
-}
-
-void sync() {
-
- __builtin_ptx_bar_sync(0);
-
-}
Removed: cfe/branches/tooling/test/CodeGen/ptx-cc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGen/ptx-cc.c?rev=157609&view=auto
==============================================================================
--- cfe/branches/tooling/test/CodeGen/ptx-cc.c (original)
+++ cfe/branches/tooling/test/CodeGen/ptx-cc.c (removed)
@@ -1,9 +0,0 @@
-// RUN: %clang_cc1 -triple ptx32-unknown-unknown -O3 -S -o %t %s -emit-llvm
-// RUN: %clang_cc1 -triple ptx64-unknown-unknown -O3 -S -o %t %s -emit-llvm
-
-// Just make sure Clang uses the proper calling convention for the PTX back-end.
-// If something is wrong, the back-end will fail.
-void foo(float* a,
- float* b) {
- a[0] = b[0];
-}
Modified: cfe/branches/tooling/test/CodeGenCUDA/address-spaces.cu
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenCUDA/address-spaces.cu?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenCUDA/address-spaces.cu (original)
+++ cfe/branches/tooling/test/CodeGenCUDA/address-spaces.cu Tue May 29 07:04:37 2012
@@ -1,24 +1,24 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -fcuda-is-device -triple ptx32-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -fcuda-is-device -triple nvptx-unknown-unknown | FileCheck %s
#include "../SemaCUDA/cuda.h"
-// CHECK: @i = global
+// CHECK: @i = addrspace(1) global
__device__ int i;
-// CHECK: @j = addrspace(1) global
+// CHECK: @j = addrspace(4) global
__constant__ int j;
-// CHECK: @k = addrspace(4) global
+// CHECK: @k = addrspace(3) global
__shared__ int k;
__device__ void foo() {
- // CHECK: load i32* @i
+ // CHECK: load i32* bitcast (i32 addrspace(1)* @i to i32*)
i++;
- // CHECK: load i32* bitcast (i32 addrspace(1)* @j to i32*)
+ // CHECK: load i32* bitcast (i32 addrspace(4)* @j to i32*)
j++;
- // CHECK: load i32* bitcast (i32 addrspace(4)* @k to i32*)
+ // CHECK: load i32* bitcast (i32 addrspace(3)* @k to i32*)
k++;
}
Modified: cfe/branches/tooling/test/CodeGenCUDA/ptx-kernels.cu
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenCUDA/ptx-kernels.cu?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenCUDA/ptx-kernels.cu (original)
+++ cfe/branches/tooling/test/CodeGenCUDA/ptx-kernels.cu Tue May 29 07:04:37 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple ptx32-unknown-unknown -fcuda-is-device -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple nvptx-unknown-unknown -fcuda-is-device -emit-llvm -o - | FileCheck %s
#include "../SemaCUDA/cuda.h"
Modified: cfe/branches/tooling/test/CodeGenCXX/visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenCXX/visibility.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenCXX/visibility.cpp (original)
+++ cfe/branches/tooling/test/CodeGenCXX/visibility.cpp Tue May 29 07:04:37 2012
@@ -818,3 +818,66 @@
// CHECK: define hidden void @_ZN6test433barINS_3fooEEEvv
// CHECK-HIDDEN: define hidden void @_ZN6test433barINS_3fooEEEvv
}
+
+namespace test44 {
+ template <typename T>
+ struct foo {
+ foo() {}
+ };
+ namespace {
+ struct bar;
+ }
+ template struct DEFAULT foo<bar>;
+ foo<bar> x;
+ // CHECK: define internal void @_ZN6test443fooINS_12_GLOBAL__N_13barEEC1Ev
+ // CHECK-HIDDEN: define internal void @_ZN6test443fooINS_12_GLOBAL__N_13barEEC1Ev
+}
+
+namespace test45 {
+ template <typename T>
+ struct foo {
+ template <typename T2>
+ struct bar {
+ bar() {};
+ };
+ };
+ namespace {
+ struct zed;
+ }
+ template struct DEFAULT foo<int>::bar<zed>;
+ foo<int>::bar<zed> x;
+ // CHECK: define internal void @_ZN6test453fooIiE3barINS_12_GLOBAL__N_13zedEEC1Ev
+ // CHECK-HIDDEN: define internal void @_ZN6test453fooIiE3barINS_12_GLOBAL__N_13zedEEC1Ev
+}
+
+namespace test46 {
+ template <typename T>
+ void foo() {
+ }
+ namespace {
+ struct bar;
+ }
+ template DEFAULT void foo<bar>();
+ void zed() {
+ foo<bar>();
+ }
+ // CHECK: define internal void @_ZN6test463fooINS_12_GLOBAL__N_13barEEEvv
+ // CHECK-HIDDEN: define internal void @_ZN6test463fooINS_12_GLOBAL__N_13barEEEvv
+}
+
+namespace test47 {
+ struct foo {
+ template <typename T>
+ static void bar() {
+ }
+ };
+ namespace {
+ struct zed;
+ }
+ template __attribute__((visibility("default"))) void foo::bar<zed>();
+ void baz() {
+ foo::bar<zed>();
+ }
+ // CHECK: define internal void @_ZN6test473foo3barINS_12_GLOBAL__N_13zedEEEvv
+ // CHECK-HIDDEN: define internal void @_ZN6test473foo3barINS_12_GLOBAL__N_13zedEEEvv
+}
Modified: cfe/branches/tooling/test/CodeGenOpenCL/ptx-calls.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenOpenCL/ptx-calls.cl?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenOpenCL/ptx-calls.cl (original)
+++ cfe/branches/tooling/test/CodeGenOpenCL/ptx-calls.cl Tue May 29 07:04:37 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple ptx32-unknown-unknown -emit-llvm -O0 -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple nvptx-unknown-unknown -emit-llvm -O0 -o - | FileCheck %s
void device_function() {
}
Modified: cfe/branches/tooling/test/CodeGenOpenCL/ptx-kernels.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenOpenCL/ptx-kernels.cl?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenOpenCL/ptx-kernels.cl (original)
+++ cfe/branches/tooling/test/CodeGenOpenCL/ptx-kernels.cl Tue May 29 07:04:37 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple ptx32-unknown-unknown -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple nvptx-unknown-unknown -emit-llvm -o - | FileCheck %s
void device_function() {
}
Modified: cfe/branches/tooling/test/Driver/debug-options.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Driver/debug-options.c?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/Driver/debug-options.c (original)
+++ cfe/branches/tooling/test/Driver/debug-options.c Tue May 29 07:04:37 2012
@@ -7,8 +7,13 @@
// RUN: %clang -### -c -ganything %s 2>&1 | FileCheck -check-prefix=GANY %s
// RUN: %clang -### -c -ggdb %s 2>&1 | FileCheck -check-prefix=GGDB %s
// RUN: %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=GFOO %s
+// RUN: %clang -### -c -g -g0 %s 2>&1 | FileCheck -check-prefix=GG0 %s
// RUN: %clang -### -c -gline-tables-only %s 2>&1 \
// RUN: | FileCheck -check-prefix=GLTO %s
+// RUN: %clang -### -c -gline-tables-only -g %s 2>&1 \
+// RUN: | FileCheck -check-prefix=GLTO2 %s
+// RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \
+// RUN: | FileCheck -check-prefix=GLTO3 %s
//
// G: "-cc1"
// G: "-g"
@@ -28,5 +33,18 @@
// GFOO: "-cc1"
// GFOO-NOT: "-g"
//
+// GG0: "-cc1"
+// GG0-NOT: "-g"
+//
// GLTO: "-cc1"
-// GLTO: "-g"
+// GLTO-NOT: "-g"
+// GLTO: "-gline-tables-only"
+// GLTO-NOT: "-g"
+//
+// GLTO2: "-cc1"
+// GLTO2-NOT: "-gline-tables-only"
+// GLTO2: "-g"
+// GLTO2-NOT: "-gline-tables-only"
+//
+// GLTO3: "-cc1"
+// GLTO3-NOT: "-gline-tables-only"
Modified: cfe/branches/tooling/test/Index/print-typekind.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Index/print-typekind.m?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/Index/print-typekind.m (original)
+++ cfe/branches/tooling/test/Index/print-typekind.m Tue May 29 07:04:37 2012
@@ -1,10 +1,10 @@
@interface Foo
@property (readonly) id x;
-(int) mymethod;
--(int) mymethod2:(id)x blah:(Class)y boo:(SEL)z;
+-(const id) mymethod2:(id)x blah:(Class)y boo:(SEL)z;
@end
// RUN: c-index-test -test-print-typekind %s | FileCheck %s
// CHECK: ObjCPropertyDecl=x:2:25 typekind=ObjCId [canonical=ObjCObjectPointer]
// CHECK: ObjCInstanceMethodDecl=mymethod:3:8 typekind=Invalid [result=Int]
-// CHECK: ObjCInstanceMethodDecl=mymethod2:blah:boo::4:8 typekind=Invalid [result=Int] [args= ObjCId ObjCClass ObjCSel]
+// CHECK: ObjCInstanceMethodDecl=mymethod2:blah:boo::4:13 typekind=Invalid [result=ObjCId] [args= ObjCId ObjCClass ObjCSel]
Modified: cfe/branches/tooling/test/Sema/attr-deprecated.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Sema/attr-deprecated.c?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/Sema/attr-deprecated.c (original)
+++ cfe/branches/tooling/test/Sema/attr-deprecated.c Tue May 29 07:04:37 2012
@@ -1,10 +1,10 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
-int f() __attribute__((deprecated));
+int f() __attribute__((deprecated)); // expected-note {{declared here}}
void g() __attribute__((deprecated));
-void g();
+void g(); // expected-note {{declared here}}
-extern int var __attribute__((deprecated));
+extern int var __attribute__((deprecated)); // expected-note {{declared here}}
int a() {
int (*ptr)() = f; // expected-warning {{'f' is deprecated}}
@@ -17,7 +17,7 @@
}
// test if attributes propagate to variables
-extern int var;
+extern int var; // expected-note {{declared here}}
int w() {
return var; // expected-warning {{'var' is deprecated}}
}
@@ -32,7 +32,7 @@
struct foo {
- int x __attribute__((deprecated));
+ int x __attribute__((deprecated)); // expected-note {{declared here}}
};
void test1(struct foo *F) {
@@ -41,7 +41,7 @@
struct foo f2 = { 17 }; // expected-warning {{'x' is deprecated}}
}
-typedef struct foo foo_dep __attribute__((deprecated));
+typedef struct foo foo_dep __attribute__((deprecated)); // expected-note 3 {{declared here}}
foo_dep *test2; // expected-warning {{'foo_dep' is deprecated}}
struct __attribute__((deprecated,
@@ -103,8 +103,8 @@
// rdar://problem/8518751
enum __attribute__((deprecated)) Test20 {
- test20_a __attribute__((deprecated)),
- test20_b
+ test20_a __attribute__((deprecated)), // expected-note {{declared here}}
+ test20_b // expected-note {{declared here}}
};
void test20() {
enum Test20 f; // expected-warning {{'Test20' is deprecated}}
Modified: cfe/branches/tooling/test/Sema/attr-unavailable-message.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Sema/attr-unavailable-message.c?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/Sema/attr-unavailable-message.c (original)
+++ cfe/branches/tooling/test/Sema/attr-unavailable-message.c Tue May 29 07:04:37 2012
@@ -30,7 +30,7 @@
// rdar://10201690
enum foo {
a = 1,
- b __attribute__((deprecated())) = 2,
+ b __attribute__((deprecated())) = 2, // expected-note {{declared here}}
c = 3
}__attribute__((deprecated()));
Modified: cfe/branches/tooling/test/Sema/uninit-variables.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Sema/uninit-variables.c?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/Sema/uninit-variables.c (original)
+++ cfe/branches/tooling/test/Sema/uninit-variables.c Tue May 29 07:04:37 2012
@@ -39,17 +39,19 @@
int test7(int y) {
int x; // expected-note{{initialize the variable 'x' to silence this warning}}
- if (y)
+ if (y) // expected-warning{{variable 'x' is used uninitialized whenever 'if' condition is false}} \
+ // expected-note{{remove the 'if' if its condition is always true}}
x = 1;
- return x; // expected-warning{{variable 'x' may be uninitialized when used here}}
+ return x; // expected-note{{uninitialized use occurs here}}
}
int test7b(int y) {
int x = x; // expected-note{{variable 'x' is declared here}}
if (y)
x = 1;
- // Warn with "may be uninitialized" here (not "is uninitialized"), since the
- // self-initialization is intended to suppress a -Wuninitialized warning.
+ // Warn with "may be uninitialized" here (not "is sometimes uninitialized"),
+ // since the self-initialization is intended to suppress a -Wuninitialized
+ // warning.
return x; // expected-warning{{variable 'x' may be uninitialized when used here}}
}
@@ -293,8 +295,9 @@
int test41(int x) {
int y; // expected-note{{initialize the variable 'y' to silence this warning}}
- if (x) y = 1; // no-warning
- return y; // expected-warning {{variable 'y' may be uninitialized when used here}}
+ if (x) y = 1; // expected-warning{{variable 'y' is used uninitialized whenever 'if' condition is false}} \
+ // expected-note{{remove the 'if' if its condition is always true}}
+ return y; // expected-note{{uninitialized use occurs here}}
}
void test42() {
Modified: cfe/branches/tooling/test/Sema/unused-expr.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Sema/unused-expr.c?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/Sema/unused-expr.c (original)
+++ cfe/branches/tooling/test/Sema/unused-expr.c Tue May 29 07:04:37 2012
@@ -92,6 +92,7 @@
fn2(92, 21); // expected-warning {{ignoring return value of function declared with pure attribute}}
fn3(42); // expected-warning {{ignoring return value of function declared with const attribute}}
__builtin_fabsf(0); // expected-warning {{ignoring return value of function declared with const attribute}}
+ (void)0, fn1(); // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
return 0;
}
Modified: cfe/branches/tooling/test/SemaCXX/attr-deprecated.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/attr-deprecated.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/attr-deprecated.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/attr-deprecated.cpp Tue May 29 07:04:37 2012
@@ -1,10 +1,10 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
class A {
- void f() __attribute__((deprecated));
+ void f() __attribute__((deprecated)); // expected-note 2 {{declared here}}
void g(A* a);
void h(A* a) __attribute__((deprecated));
- int b __attribute__((deprecated));
+ int b __attribute__((deprecated)); // expected-note 2 {{declared here}}
};
void A::g(A* a)
@@ -26,7 +26,7 @@
}
struct B {
- virtual void f() __attribute__((deprecated));
+ virtual void f() __attribute__((deprecated)); // expected-note 4 {{declared here}}
void g();
};
@@ -68,20 +68,20 @@
// Overloaded namespace members.
namespace test1 {
- void foo(int) __attribute__((deprecated));
+ void foo(int) __attribute__((deprecated)); // expected-note {{declared here}}
void test1() { foo(10); } // expected-warning {{deprecated}}
- void foo(short) __attribute__((deprecated));
+ void foo(short) __attribute__((deprecated)); // expected-note {{declared here}}
void test2(short s) { foo(s); } // expected-warning {{deprecated}}
void foo(long);
void test3(long l) { foo(l); }
struct A {
- friend void foo(A*) __attribute__((deprecated));
+ friend void foo(A*) __attribute__((deprecated)); // expected-note {{declared here}}
};
void test4(A *a) { foo(a); } // expected-warning {{deprecated}}
namespace ns {
struct Foo {};
- void foo(const Foo &f) __attribute__((deprecated));
+ void foo(const Foo &f) __attribute__((deprecated)); // expected-note {{declared here}}
}
void test5() {
foo(ns::Foo()); // expected-warning {{deprecated}}
@@ -91,9 +91,9 @@
// Overloaded class members.
namespace test2 {
struct A {
- void foo(int) __attribute__((deprecated));
+ void foo(int) __attribute__((deprecated)); // expected-note 2 {{declared here}}
void foo(long);
- static void bar(int) __attribute__((deprecated));
+ static void bar(int) __attribute__((deprecated)); // expected-note 3 {{declared here}}
static void bar(long);
void test2(int i, long l);
@@ -120,12 +120,12 @@
namespace test3 {
struct A {
void operator*(const A &);
- void operator*(int) __attribute__((deprecated));
+ void operator*(int) __attribute__((deprecated)); // expected-note {{declared here}}
void operator-(const A &) const;
};
void operator+(const A &, const A &);
- void operator+(const A &, int) __attribute__((deprecated));
- void operator-(const A &, int) __attribute__((deprecated));
+ void operator+(const A &, int) __attribute__((deprecated)); // expected-note {{declared here}}
+ void operator-(const A &, int) __attribute__((deprecated)); // expected-note {{declared here}}
void test() {
A a, b;
@@ -143,9 +143,9 @@
struct A {
typedef void (*intfn)(int);
typedef void (*unintfn)(unsigned);
- operator intfn() __attribute__((deprecated));
+ operator intfn() __attribute__((deprecated)); // expected-note {{declared here}}
operator unintfn();
- void operator ()(A &) __attribute__((deprecated));
+ void operator ()(A &) __attribute__((deprecated)); // expected-note {{declared here}}
void operator ()(const A &);
};
@@ -163,7 +163,7 @@
namespace test5 {
struct A {
- operator int() __attribute__((deprecated));
+ operator int() __attribute__((deprecated)); // expected-note 2 {{declared here}}
operator long();
};
void test1(A a) {
@@ -193,8 +193,8 @@
// rdar://problem/8518751
namespace test6 {
- enum __attribute__((deprecated)) A {
- a0
+ enum __attribute__((deprecated)) A { // expected-note {{declared here}}
+ a0 // expected-note {{declared here}}
};
void testA() {
A x; // expected-warning {{'A' is deprecated}}
@@ -202,7 +202,7 @@
}
enum B {
- b0 __attribute__((deprecated)),
+ b0 __attribute__((deprecated)), // expected-note {{declared here}}
b1
};
void testB() {
@@ -212,8 +212,8 @@
}
template <class T> struct C {
- enum __attribute__((deprecated)) Enum {
- c0
+ enum __attribute__((deprecated)) Enum { // expected-note {{declared here}}
+ c0 // expected-note {{declared here}}
};
};
void testC() {
@@ -224,7 +224,7 @@
template <class T> struct D {
enum Enum {
d0,
- d1 __attribute__((deprecated)),
+ d1 __attribute__((deprecated)), // expected-note {{declared here}}
};
};
void testD() {
Modified: cfe/branches/tooling/test/SemaCXX/overload-call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/overload-call.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/overload-call.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/overload-call.cpp Tue May 29 07:04:37 2012
@@ -260,14 +260,12 @@
int& cvqual_subsume(X&); // expected-note{{candidate function}}
float& cvqual_subsume(const Y&); // expected-note{{candidate function}}
-int& cvqual_subsume2(const X&); // expected-note{{candidate function}}
-float& cvqual_subsume2(const volatile Y&); // expected-note{{candidate function}}
-
-Z get_Z();
+int& cvqual_subsume2(X&); // expected-note{{candidate function}}
+float& cvqual_subsume2(volatile Y&); // expected-note{{candidate function}}
void cvqual_subsume_test(Z z) {
cvqual_subsume(z); // expected-error{{call to 'cvqual_subsume' is ambiguous}}
- int& x = cvqual_subsume2(get_Z()); // expected-error{{call to 'cvqual_subsume2' is ambiguous}}
+ cvqual_subsume2(z); // expected-error{{call to 'cvqual_subsume2' is ambiguous}}
}
// Test overloading with cv-qualification differences in reference
@@ -444,10 +442,10 @@
namespace PR6177 {
struct String { String(char const*); };
- void f(bool const volatile&); // expected-note{{passing argument to parameter here}}
- void f(String);
+ void f(bool const volatile&);
+ int &f(String);
- void g() { f(""); } // expected-error{{volatile lvalue reference to type 'const volatile bool' cannot bind to a value of unrelated type 'const char [1]'}}
+ void g() { int &r = f(""); }
}
namespace PR7095 {
@@ -574,3 +572,11 @@
void fun(int (*x)[10]); // expected-note{{candidate function not viable: 1st argument ('const int (*)[10]') would lose const qualifier}}
void g() { fun((const int(*)[10])0); } // expected-error{{no matching function for call to 'fun'}}
}
+
+// DR1152: Take 'volatile' into account when handling reference bindings in
+// overload resolution.
+namespace PR12931 {
+ void f(const int &, ...);
+ void f(const volatile int &, int);
+ void g() { f(0, 0); }
+}
Modified: cfe/branches/tooling/test/SemaCXX/reinterpret-cast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/reinterpret-cast.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/reinterpret-cast.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/reinterpret-cast.cpp Tue May 29 07:04:37 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -ffreestanding -Wundefined-reinterpret-cast %s
+// RUN: %clang_cc1 -fsyntax-only -verify -ffreestanding -Wundefined-reinterpret-cast -Wno-unused-volatile-lvalue %s
#include <stdint.h>
Modified: cfe/branches/tooling/test/SemaCXX/switch-implicit-fallthrough.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/switch-implicit-fallthrough.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/switch-implicit-fallthrough.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/switch-implicit-fallthrough.cpp Tue May 29 07:04:37 2012
@@ -33,6 +33,8 @@
}
case 6: // expected-warning{{unannotated fall-through between switch labels}} expected-note{{insert '[[clang::fallthrough]];' to silence this warning}} expected-note{{insert 'break;' to avoid fall-through}}
n += 300;
+ case 66: // expected-warning{{unannotated fall-through between switch labels}} expected-note{{insert 'break;' to avoid fall-through}}
+ break;
}
switch (n / 20) {
case 7:
Modified: cfe/branches/tooling/test/SemaCXX/unused.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/unused.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/unused.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/unused.cpp Tue May 29 07:04:37 2012
@@ -1,24 +1,36 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+
// PR4103 : Make sure we don't get a bogus unused expression warning
-class APInt {
- char foo;
-};
-class APSInt : public APInt {
- char bar;
-public:
- APSInt &operator=(const APSInt &RHS);
-};
+namespace PR4103 {
+ class APInt {
+ char foo;
+ };
+ class APSInt : public APInt {
+ char bar;
+ public:
+ APSInt &operator=(const APSInt &RHS);
+ };
-APSInt& APSInt::operator=(const APSInt &RHS) {
- APInt::operator=(RHS);
- return *this;
-}
+ APSInt& APSInt::operator=(const APSInt &RHS) {
+ APInt::operator=(RHS);
+ return *this;
+ }
-template<typename T>
-struct X {
- X();
-};
+ template<typename T>
+ struct X {
+ X();
+ };
+
+ void test() {
+ X<int>();
+ }
+}
-void test() {
- X<int>();
+namespace derefvolatile {
+ void f(volatile char* x) {
+ *x; // expected-warning {{expression result unused; assign into a variable to force a volatile load}}
+ (void)*x; // expected-warning {{expression result unused; assign into a variable to force a volatile load}}
+ volatile char y = 10;
+ (void)y; // don't warn here, because it's a common pattern.
+ }
}
Propchange: cfe/branches/tooling/test/SemaCXX/warn-unreachable.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 29 07:04:37 2012
@@ -1,2 +1,2 @@
/cfe/branches/type-system-rewrite/test/SemaCXX/warn-unreachable.cpp:134693-134817
-/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,146581-157321
+/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,146581-157609
Modified: cfe/branches/tooling/test/SemaCXX/warn-unused-value.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/warn-unused-value.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/warn-unused-value.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/warn-unused-value.cpp Tue May 29 07:04:37 2012
@@ -12,7 +12,7 @@
// pointer to volatile has side effect (thus no warning)
Box* box = new Box;
box->i; // expected-warning {{expression result unused}}
- box->j;
+ box->j; // expected-warning {{expression result unused}}
}
}
Modified: cfe/branches/tooling/test/SemaObjC/attr-deprecated.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaObjC/attr-deprecated.m?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/attr-deprecated.m (original)
+++ cfe/branches/tooling/test/SemaObjC/attr-deprecated.m Tue May 29 07:04:37 2012
@@ -1,10 +1,10 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
@interface A {
- int X __attribute__((deprecated));
+ int X __attribute__((deprecated)); // expected-note 2 {{declared here}}
}
-+ (void)F __attribute__((deprecated));
-- (void)f __attribute__((deprecated));
++ (void)F __attribute__((deprecated)); // expected-note 2 {{declared here}}
+- (void)f __attribute__((deprecated)); // expected-note 4 {{declared here}}
@end
@implementation A
@@ -42,7 +42,7 @@
@end
@protocol P
-- (void)p __attribute__((deprecated));
+- (void)p __attribute__((deprecated)); // expected-note {{declared here}}
@end
void t1(A *a)
@@ -71,7 +71,7 @@
@interface Bar
- at property (assign, setter = MySetter:) int FooBar __attribute__ ((deprecated));
+ at property (assign, setter = MySetter:) int FooBar __attribute__ ((deprecated)); // expected-note 2 {{declared here}}
- (void) MySetter : (int) value;
@end
@@ -83,7 +83,7 @@
__attribute ((deprecated))
- at interface DEPRECATED {
+ at interface DEPRECATED { // expected-note 2 {{declared here}}
@public int ivar;
DEPRECATED *ivar2; // no warning.
}
@@ -107,7 +107,7 @@
@interface Test2
- at property int test2 __attribute__((deprecated));
+ at property int test2 __attribute__((deprecated)); // expected-note 4 {{declared here}}
@end
void test(Test2 *foo) {
Modified: cfe/branches/tooling/test/SemaObjC/no-ivar-in-interface-block.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaObjC/no-ivar-in-interface-block.m?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/no-ivar-in-interface-block.m (original)
+++ cfe/branches/tooling/test/SemaObjC/no-ivar-in-interface-block.m Tue May 29 07:04:37 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Winterface-ivars %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wobjc-interface-ivars %s
// rdar://10763173
@interface I
Modified: cfe/branches/tooling/test/SemaObjC/property-user-setter.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaObjC/property-user-setter.m?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/property-user-setter.m (original)
+++ cfe/branches/tooling/test/SemaObjC/property-user-setter.m Tue May 29 07:04:37 2012
@@ -102,3 +102,37 @@
abort ();
return 0;
}
+
+// rdar://11363363
+ at interface rdar11363363
+{
+ id R;
+}
+ at property (copy) id p;
+ at property (copy) id r;
+ at property (copy) id Q;
+ at property (copy) id t; // expected-note 2 {{property declared here}}
+ at property (copy) id T; // expected-note 2 {{property declared here}}
+ at property (copy) id Pxyz; // expected-note 2 {{property declared here}}
+ at property (copy) id pxyz; // expected-note 2 {{property declared here}}
+ at end
+
+ at implementation rdar11363363
+ at synthesize p;
+ at synthesize r;
+ at synthesize Q;
+ at synthesize t, T;
+ at synthesize Pxyz, pxyz;
+- (id) Meth {
+ self.P = 0; // expected-error {{property 'P' not found on object of type 'rdar11363363 *'}}
+ self.q = 0; // expected-error {{property 'q' not found on object of type 'rdar11363363 *'}}
+// rdar://11528439
+ self.t = 0; // expected-error {{synthesized properties 't' and 'T' both claim setter 'setT:'}}
+ self.T = 0; // expected-error {{synthesized properties 'T' and 't' both claim setter 'setT:'}}
+ self.Pxyz = 0; // expected-error {{synthesized properties 'Pxyz' and 'pxyz' both claim setter 'setPxyz:'}}
+ self.pxyz = 0; // expected-error {{synthesized properties 'pxyz' and 'Pxyz' both claim setter 'setPxyz:'}}
+ self.R = 0; // expected-error {{property 'R' not found on object of type 'rdar11363363 *'; did you mean to access ivar 'R'?}}
+ return self.R; // expected-error {{property 'R' not found on object of type 'rdar11363363 *'; did you mean to access ivar 'R'?}}
+}
+ at end
+
Modified: cfe/branches/tooling/test/SemaObjC/protocol-attribute.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaObjC/protocol-attribute.m?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/protocol-attribute.m (original)
+++ cfe/branches/tooling/test/SemaObjC/protocol-attribute.m Tue May 29 07:04:37 2012
@@ -6,7 +6,7 @@
Class <FwProto> cFw = 0; // expected-error {{'FwProto' is unavailable}}
-__attribute ((deprecated)) @protocol MyProto1
+__attribute ((deprecated)) @protocol MyProto1 // expected-note 5 {{declared here}}
@end
@protocol Proto2 <MyProto1> // expected-warning {{'MyProto1' is deprecated}}
Modified: cfe/branches/tooling/test/SemaObjC/special-dep-unavail-warning.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaObjC/special-dep-unavail-warning.m?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/special-dep-unavail-warning.m (original)
+++ cfe/branches/tooling/test/SemaObjC/special-dep-unavail-warning.m Tue May 29 07:04:37 2012
@@ -45,7 +45,7 @@
// rdar://10268422
__attribute ((deprecated))
- at interface DEPRECATED
+ at interface DEPRECATED // expected-note {{declared here}}
+(id)new;
@end
Modified: cfe/branches/tooling/test/SemaObjC/warn-deprecated-implementations.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaObjC/warn-deprecated-implementations.m?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/warn-deprecated-implementations.m (original)
+++ cfe/branches/tooling/test/SemaObjC/warn-deprecated-implementations.m Tue May 29 07:04:37 2012
@@ -20,7 +20,7 @@
@end
__attribute__((deprecated))
- at interface CL // expected-note 2 {{class declared here}}
+ at interface CL // expected-note 2 {{class declared here}} // expected-note 2 {{declared here}}
@end
@implementation CL // expected-warning {{Implementing deprecated class}}
Modified: cfe/branches/tooling/test/Tooling/clang-check-args.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Tooling/clang-check-args.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/Tooling/clang-check-args.cpp (original)
+++ cfe/branches/tooling/test/Tooling/clang-check-args.cpp Tue May 29 07:04:37 2012
@@ -3,5 +3,5 @@
// CHECK: C++ requires
invalid;
-// FIXME: JSON doesn't like path separator '\', on Win32 hosts.
+// FIXME: This is incompatible to -fms-compatibility.
// XFAIL: win32
Modified: cfe/branches/tooling/test/Tooling/clang-check-builtin-headers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Tooling/clang-check-builtin-headers.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/Tooling/clang-check-builtin-headers.cpp (original)
+++ cfe/branches/tooling/test/Tooling/clang-check-builtin-headers.cpp Tue May 29 07:04:37 2012
@@ -1,7 +1,7 @@
// RUN: rm -rf %t
// RUN: mkdir %t
// Add a path that doesn't exist as argv[0] for the compile command line:
-// RUN: echo '[{"directory":".","command":"/random/tool -c %t/test.cpp","file":"%t/test.cpp"}]' > %t/compile_commands.json
+// RUN: echo '[{"directory":".","command":"/random/tool -c %t/test.cpp","file":"%t/test.cpp"}]' | sed -e 's/\\/\//g' > %t/compile_commands.json
// RUN: cp "%s" "%t/test.cpp"
// RUN: clang-check "%t" "%t/test.cpp" 2>&1|FileCheck %s
// FIXME: Make the above easier.
@@ -11,5 +11,5 @@
// CHECK: C++ requires
invalid;
-// FIXME: JSON doesn't like path separator '\', on Win32 hosts.
+// FIXME: This is incompatible to -fms-compatibility.
// XFAIL: win32
Modified: cfe/branches/tooling/test/Tooling/clang-check-chdir.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Tooling/clang-check-chdir.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/Tooling/clang-check-chdir.cpp (original)
+++ cfe/branches/tooling/test/Tooling/clang-check-chdir.cpp Tue May 29 07:04:37 2012
@@ -2,7 +2,7 @@
// compilation database.
// RUN: rm -rf %t
// RUN: mkdir %t
-// RUN: echo "[{\"directory\":\"%t\",\"command\":\"clang -c test.cpp -I.\",\"file\":\"%t/test.cpp\"}]" > %t/compile_commands.json
+// RUN: echo "[{\"directory\":\"%t\",\"command\":\"clang -c test.cpp -I.\",\"file\":\"%t/test.cpp\"}]" | sed -e 's/\\/\//g' > %t/compile_commands.json
// RUN: cp "%s" "%t/test.cpp"
// RUN: touch "%t/clang-check-test.h"
// RUN: clang-check "%t" "%t/test.cpp" 2>&1|FileCheck %s
@@ -13,5 +13,5 @@
// CHECK: C++ requires
invalid;
-// FIXME: JSON doesn't like path separator '\', on Win32 hosts.
+// FIXME: This is incompatible to -fms-compatibility.
// XFAIL: win32
Modified: cfe/branches/tooling/test/Tooling/clang-check-pwd.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Tooling/clang-check-pwd.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/Tooling/clang-check-pwd.cpp (original)
+++ cfe/branches/tooling/test/Tooling/clang-check-pwd.cpp Tue May 29 07:04:37 2012
@@ -1,6 +1,6 @@
// RUN: rm -rf %t
// RUN: mkdir %t
-// RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c %t/test.cpp\",\"file\":\"%t/test.cpp\"}]" > %t/compile_commands.json
+// RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c %t/test.cpp\",\"file\":\"%t/test.cpp\"}]" | sed -e 's/\\/\\\\/g' > %t/compile_commands.json
// RUN: cp "%s" "%t/test.cpp"
// RUN: PWD="%t" clang-check "%t" "test.cpp" 2>&1|FileCheck %s
// FIXME: Make the above easier.
@@ -9,4 +9,3 @@
invalid;
// REQUIRES: shell
-// XFAIL: mingw32
Modified: cfe/branches/tooling/test/Tooling/clang-check.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Tooling/clang-check.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/Tooling/clang-check.cpp (original)
+++ cfe/branches/tooling/test/Tooling/clang-check.cpp Tue May 29 07:04:37 2012
@@ -1,6 +1,6 @@
// RUN: rm -rf %t
// RUN: mkdir %t
-// RUN: echo '[{"directory":".","command":"clang++ -c %t/test.cpp","file":"%t/test.cpp"}]' > %t/compile_commands.json
+// RUN: echo '[{"directory":".","command":"clang++ -c %t/test.cpp","file":"%t/test.cpp"}]' | sed -e 's/\\/\//g' > %t/compile_commands.json
// RUN: cp "%s" "%t/test.cpp"
// RUN: clang-check "%t" "%t/test.cpp" 2>&1|FileCheck %s
// FIXME: Make the above easier.
@@ -8,5 +8,5 @@
// CHECK: C++ requires
invalid;
-// FIXME: JSON doesn't like path separator '\', on Win32 hosts.
+// FIXME: This is incompatible to -fms-compatibility.
// XFAIL: win32
Modified: cfe/branches/tooling/test/Tooling/multi-jobs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Tooling/multi-jobs.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/test/Tooling/multi-jobs.cpp (original)
+++ cfe/branches/tooling/test/Tooling/multi-jobs.cpp Tue May 29 07:04:37 2012
@@ -3,5 +3,5 @@
// CHECK: C++ requires
invalid;
-// FIXME: JSON doesn't like path separator '\', on Win32 hosts.
+// FIXME: This is incompatible to -fms-compatibility.
// XFAIL: win32
Modified: cfe/branches/tooling/tools/libclang/CXType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/libclang/CXType.cpp?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/tools/libclang/CXType.cpp (original)
+++ cfe/branches/tooling/tools/libclang/CXType.cpp Tue May 29 07:04:37 2012
@@ -96,14 +96,15 @@
CXType cxtype::MakeCXType(QualType T, CXTranslationUnit TU) {
CXTypeKind TK = CXType_Invalid;
- if (TU) {
+ if (TU && !T.isNull()) {
ASTContext &Ctx = static_cast<ASTUnit *>(TU->TUData)->getASTContext();
if (Ctx.getLangOpts().ObjC1) {
- if (Ctx.isObjCIdType(T))
+ QualType UnqualT = T.getUnqualifiedType();
+ if (Ctx.isObjCIdType(UnqualT))
TK = CXType_ObjCId;
- else if (Ctx.isObjCClassType(T))
+ else if (Ctx.isObjCClassType(UnqualT))
TK = CXType_ObjCClass;
- else if (Ctx.isObjCSelType(T))
+ else if (Ctx.isObjCSelType(UnqualT))
TK = CXType_ObjCSel;
}
}
Modified: cfe/branches/tooling/tools/libclang/IndexingContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/libclang/IndexingContext.h?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/tools/libclang/IndexingContext.h (original)
+++ cfe/branches/tooling/tools/libclang/IndexingContext.h Tue May 29 07:04:37 2012
@@ -542,10 +542,8 @@
}
static unsigned getHashValue(clang::cxindex::RefFileOccurence S) {
- llvm::FoldingSetNodeID ID;
- ID.AddPointer(S.File);
- ID.AddPointer(S.Dcl);
- return ID.ComputeHash();
+ typedef std::pair<const clang::FileEntry *, const clang::Decl *> PairTy;
+ return DenseMapInfo<PairTy>::getHashValue(PairTy(S.File, S.Dcl));
}
static bool isEqual(clang::cxindex::RefFileOccurence LHS,
Modified: cfe/branches/tooling/tools/scan-build/ccc-analyzer
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/scan-build/ccc-analyzer?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/tools/scan-build/ccc-analyzer (original)
+++ cfe/branches/tooling/tools/scan-build/ccc-analyzer Tue May 29 07:04:37 2012
@@ -434,6 +434,9 @@
# Get the analysis options.
my $Analyses = $ENV{'CCC_ANALYZER_ANALYSIS'};
+# Get the plugins to load.
+my $Plugins = $ENV{'CCC_ANALYZER_PLUGINS'};
+
# Get the store model.
my $StoreModel = $ENV{'CCC_ANALYZER_STORE_MODEL'};
@@ -649,6 +652,10 @@
push @AnalyzeArgs, split '\s+', $Analyses;
}
+ if (defined $Plugins) {
+ push @AnalyzeArgs, split '\s+', $Plugins;
+ }
+
if (defined $OutputFormat) {
push @AnalyzeArgs, "-analyzer-output=" . $OutputFormat;
if ($OutputFormat =~ /plist/) {
Modified: cfe/branches/tooling/tools/scan-build/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/scan-build/scan-build?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/tools/scan-build/scan-build (original)
+++ cfe/branches/tooling/tools/scan-build/scan-build Tue May 29 07:04:37 2012
@@ -36,6 +36,7 @@
my $CurrentDir = HtmlEscape(getcwd());
my $CurrentDirSuffix = basename($CurrentDir);
+my @PluginsToLoad;
my $CmdArgs;
my $HtmlTitle;
@@ -77,6 +78,21 @@
}
##----------------------------------------------------------------------------##
+# Print default checker names
+##----------------------------------------------------------------------------##
+
+if (grep /^--help-checkers$/, @ARGV) {
+ my @options = qx($0 -h);
+ foreach (@options) {
+ next unless /^ \+/;
+ s/^\s*//;
+ my ($sign, $name, @text) = split ' ', $_;
+ print $name, $/ if $sign eq '+';
+ }
+ exit 1;
+}
+
+##----------------------------------------------------------------------------##
# Some initial preprocessing of Clang options.
##----------------------------------------------------------------------------##
@@ -91,7 +107,7 @@
$Clang = `which clang`;
chomp $Clang;
if ($Clang eq "") {
- DieDiag("No 'clang' executable found in path.");
+ DieDiag("No 'clang' executable found in path.\n");
}
}
else {
@@ -1017,9 +1033,23 @@
-enable-checker [checker name]
-disable-checker [checker name]
+
+LOADING CHECKERS:
+
+ Loading external checkers using the clang plugin interface:
+
+ -load-plugin [plugin library]
ENDTEXT
# Query clang for list of checkers that are enabled.
+
+# create a list to load the plugins via the 'Xclang' command line
+# argument
+my @PluginLoadCommandline_xclang;
+foreach my $param ( @PluginsToLoad ) {
+ push ( @PluginLoadCommandline_xclang, "-Xclang" );
+ push ( @PluginLoadCommandline_xclang, $param );
+}
my %EnabledCheckers;
foreach my $lang ("c", "objective-c", "objective-c++", "c++") {
pipe(FROM_CHILD, TO_PARENT);
@@ -1028,7 +1058,7 @@
close FROM_CHILD;
open(STDOUT,">&", \*TO_PARENT);
open(STDERR,">&", \*TO_PARENT);
- exec $Clang, ('--analyze', '-x', $lang, '-', '-###');
+ exec $Clang, ( @PluginLoadCommandline_xclang, '--analyze', '-x', $lang, '-', '-###');
}
close(TO_PARENT);
while(<FROM_CHILD>) {
@@ -1050,7 +1080,7 @@
close FROM_CHILD;
open(STDOUT,">&", \*TO_PARENT);
open(STDERR,">&", \*TO_PARENT);
- exec $Clang, ('-cc1', '-analyzer-checker-help');
+ exec $Clang, ('-cc1', @PluginsToLoad , '-analyzer-checker-help');
}
close(TO_PARENT);
my $foundCheckers = 0;
@@ -1086,7 +1116,9 @@
if ($EnabledCheckers{$aggregate}) {
$enabled =1;
last;
- }
+ }
+ # append a dot, if an additional domain is added in the next iteration
+ $aggregate .= ".";
}
if ($enabled) {
@@ -1329,7 +1361,12 @@
push @AnalysesToRun, "-analyzer-disable-checker", shift @ARGV;
next;
}
-
+ if ($arg eq "-load-plugin") {
+ shift @ARGV;
+ push @PluginsToLoad, "-load", shift @ARGV;
+ next;
+ }
+
DieDiag("unrecognized option '$arg'\n") if ($arg =~ /^-/);
last;
@@ -1397,6 +1434,8 @@
$ENV{'CCC_ANALYZER_ANALYSIS'} = join ' ', at AnalysesToRun;
+$ENV{'CCC_ANALYZER_PLUGINS'} = join ' ', at PluginsToLoad;
+
if (defined $StoreModel) {
$ENV{'CCC_ANALYZER_STORE_MODEL'} = $StoreModel;
}
Propchange: cfe/branches/tooling/tools/scan-build/scan-build
------------------------------------------------------------------------------
svn:keywords = Id
Modified: cfe/branches/tooling/tools/scan-build/scan-build.1
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/scan-build/scan-build.1?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/tools/scan-build/scan-build.1 (original)
+++ cfe/branches/tooling/tools/scan-build/scan-build.1 Tue May 29 07:04:37 2012
@@ -1,6 +1,9 @@
-.Dd May 3, 2012
-.Os [clang] [3.1]
-.Dt SCAN-BUILD 1
+.\" This file is distributed under the University of Illinois Open Source
+.\" License. See LICENSE.TXT for details.
+.\" $Id$
+.Dd May 25, 2012
+.Os "clang" "3.1"
+.Dt SCAN-BUILD \&1 CLANG
.Sh NAME
.Nm scan-build
.Nd Clang static analyzer
@@ -10,15 +13,16 @@
.Op Fl analyze-headers
.Op Fl enable-checker Op Ar checker_name
.Op Fl disable-checker Op Ar checker_name
-.Op Fl -help
-.Op Fl -html-title Op Ar =title
-.Op Fl -keep-going
-.Op Fl -plist
-.Op Fl -plist-html
-.Op Fl -status-bugs
-.Op Fl -use-c++ Op Ar =compiler_path
-.Op Fl -use-cc Op Ar =compiler_path
-.Op Fl -view
+.Op Fl Fl help
+.Op Fl Fl help-checkers
+.Op Fl Fl html-title Op Ar =title
+.Op Fl Fl keep-going
+.Op Fl plist
+.Op Fl plist-html
+.Op Fl Fl status-bugs
+.Op Fl Fl use-c++ Op Ar =compiler_path
+.Op Fl Fl use-cc Op Ar =compiler_path
+.Op Fl Fl view
.Op Fl constraints Op Ar model
.Op Fl maxloop Ar N
.Op Fl no-failure-reports
@@ -28,72 +32,86 @@
.Op build_options
.\"
.\" Sh DESCRIPTION
-.Sh OPTIONS
+.Sh DESCRIPTION
+.Nm
+is a Perl script that invokes the Clang static analyzer. Options used by
+.Nm
+or by the analyzer appear first, followed by the
+.Ar build_command
+and any
+.Ar build_options
+normally used to build the target system.
+.Pp
+The static analyzer employs a long list of checking algorithms, see
+.Sx CHECKERS .
+Output can be written in standard
+.Li .plist
+and/or HTML format.
+.Pp
+The following options are supported:
.Bl -tag -width indent
.It Fl analyze-headers
Also analyze functions in #included files.
-.It Fl enable-checker Op Ar checker_name
-.It Fl disable-checker Op Ar checker_name
+.It Fl enable-checker Ar checker_name , Fl disable-checker Ar checker_name
Enable/disable
.Ar checker_name .
-See
-.Sx CONTROLLING CHECKERS
-below.
-.It Fl h
-.It Fl -help
-Display this message
-.It Fl -html-title Ns Op = Ns Ar title
+See
+.Sx CHECKERS .
+.It Fl h , Fl Fl help
+Display this message.
+.It Fl Fl help-checkers
+List default checkers, see
+.Sx CHECKERS .
+.It Fl Fl html-title Ns Op = Ns Ar title
Specify the title used on generated HTML pages.
-If
-.Ar title
-is not specified, a default title is used.
-.It Fl k
-.It Fl -keep-going
-Add a
+A default title is generated if
+.Ar title
+is not specified.
+.It Fl k , Fl Fl keep-going
+Add a
.Dq keep on going
-option to the specified build command. Currently supports
-make and xcodebuild. This is a convenience option; one can specify
-this behavior directly using build options.
+option to
+.Ar build_command .
+Currently supports make and xcodebuild. This is a convenience option;
+one can specify this behavior directly using build options.
.It Fl o
Target directory for HTML report files. Subdirectories will be
-created as needed to represent separate
-.Dq runs
+created as needed to represent separate invocations
of the analyzer. If this option is not specified, a directory is
created in /tmp (TMPDIR on Mac OS X) to store the reports.
-.It Fl -plist
-Output the results as a set of
-.Li
-\.plist
+.It Fl plist
+Output the results as a set of
+.Li .plist
files. (By default the output of
.Nm
is a set of HTML files.)
-.It Fl -plist-html
+.It Fl plist-html
Output the results as a set of HTML and .plist files
-.It Fl -status-bugs
+.It Fl Fl status-bugs
Set exit status to 1 if it found potential bugs and 0 otherwise. By
default the exit status of
.Nm
-is the same as the executed build command.
-.It Fl -use-c++ Ns Op = Ns Ar compiler_path
+is that returned by
+.Ar build_command .
+.It Fl Fl use-c++ Ns Op = Ns Ar compiler_path
Guess the default compiler for your C++ and Objective-C++ code. Use this
option to specify an alternate compiler.
-.It Fl -use-cc Ns Op = Ns Ar compiler_path
+.It Fl Fl use-cc Ns Op = Ns Ar compiler_path
Guess the default compiler for your C and Objective-C code. Use this
option to specify an alternate compiler.
.It Fl v
Verbose output from
.Nm
and the analyzer. A second and
-third
+third
.Ar v
increases verbosity.
-.It Fl V
-.It Fl -view
+.It Fl V , Fl Fl view
View analysis results in a web browser when the build completes.
.It Fl constraints Op Ar model
Specify the contraint engine used by the analyzer. By default the
.Ql range
-model is used. Specifying
+model is used. Specifying
.Ql basic
uses a simpler, less powerful constraint model used by checker-0.160
and earlier.
@@ -116,15 +134,19 @@
specifies a field-
sensitive store model. Users can also specify
.Ql basic
- which is far less precise but can more quickly analyze code.
+which is far less precise but can more quickly analyze code.
.Ql basic
was the default store model for checker-0.221 and earlier.
-.\"
+.\"
.El
.Sh RETURN VALUES
.Nm
-returns the value returned by the called compiler unless
-.Fl -status-bugs
+returns the value returned by
+.Ar build_command
+unless
+.Fl Fl status-bugs
+or
+.Fl Fl keep-going
is used.
.\"
.\" Other sections not yet used ...
@@ -133,185 +155,174 @@
.\" .Sh DIAGNOSTICS
.\" .Sh COMPATIBILITY
.\" .Sh HISTORY
-.\" .Sh AUTHORS
.\" .Sh BUGS
.\"
-.Sh CONTROLLING CHECKERS
-A default group of checkers are always run unless explicitly disabled.
+.Sh CHECKERS
The checkers listed below may be enabled/disabled using the
.Fl enable-checker
-and
+and
.Fl disable-checker
-options.
-.Bl -tag -width indent
+options.
+A default group of checkers is run unless explicitly disabled.
+Exactly which checkers constitute the default group is a function
+of the operating system in use; they are listed with
+.Fl Fl help-checkers .
+.Bl -tag -width indent.
.It core.AdjustedReturnValue
Check to see if the return value of a function call is different than
-the caller expects (e.g., from calls through function pointers)
-.Bq on
+the caller expects (e.g., from calls through function pointers).
.It core.AttributeNonNull
Check for null pointers passed as arguments to a function whose arguments are marked with the
-.Qlnonnull' attribute
-.Bq on
+.Ql nonnull
+attribute.
.It core.CallAndMessage
-Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers)
-.Bq on
+Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers).
.It core.DivideZero
-Check for division by zero
-.Bq on
+Check for division by zero.
.It core.NullDereference
-Check for dereferences of null pointers
-.Bq on
+Check for dereferences of null pointers.
.It core.StackAddressEscape
-Check that addresses to stack memory do not escape the function
-.Bq on
+Check that addresses to stack memory do not escape the function.
.It core.UndefinedBinaryOperatorResult
-Check for undefined results of binary operators
-.Bq on
+Check for undefined results of binary operators.
.It core.VLASize
-Check for declarations of VLA of undefined or zero size
-.Bq on
+Check for declarations of VLA of undefined or zero size.
.It core.builtin.BuiltinFunctions
-Evaluate compiler builtin functions (e.g., alloca())
-.Bq on
-.It core.builtin.NoReturnFunctions Evaluate "panic" functions that are known to not return to the caller
-.Bq on
+Evaluate compiler builtin functions, e.g.
+.Fn alloca .
+.It core.builtin.NoReturnFunctions
+Evaluate
+.Ql panic
+functions that are known to not return to the caller.
.It core.uninitialized.ArraySubscript
-Check for uninitialized values used as array subscripts
-.Bq on
+Check for uninitialized values used as array subscripts.
.It core.uninitialized.Assign
-Check for assigning uninitialized values
-.Bq on
-.It core.uninitialized.Bqanch
-Check for uninitialized values used as branch conditions
-.Bq on
+Check for assigning uninitialized values.
+.It core.uninitialized.Branch
+Check for uninitialized values used as branch conditions.
.It core.uninitialized.CapturedBlockVariable
-Check for blocks that capture uninitialized values
-.Bq on
-.It core.uninitialized.UndefReturn Check for uninitialized values being returned to the caller
-.Bq on
+Check for blocks that capture uninitialized values.
+.It core.uninitialized.UndefReturn
+Check for uninitialized values being returned to the caller.
.It deadcode.DeadStores
-Check for values stored to variables that are never read afterwards
-.Bq off
+Check for values stored to variables that are never read afterwards.
.It debug.DumpCFG
-Display Control-Flow Graphs
-.Bq off
+Display Control-Flow Graphs.
.It debug.DumpCallGraph
-Display Call Graph
-.Bq off
+Display Call Graph.
.It debug.DumpDominators
-Print the dominance tree for a given CFG
-.Bq off
+Print the dominance tree for a given Control-Flow Graph.
.It debug.DumpLiveVars
-Print results of live variable analysis
-.Bq off
+Print results of live variable analysis.
.It debug.Stats
-Emit warnings with analyzer statistics
-.Bq off
+Emit warnings with analyzer statistics.
.It debug.TaintTest
Mark tainted symbols as such.
-.Bq off
.It debug.ViewCFG
-View Control-Flow Graphs using GraphViz
-.Bq off
+View Control-Flow Graphs using
+.Ic GraphViz .
.It debug.ViewCallGraph
-View Call Graph using GraphViz
-.Bq off
+View Call Graph using
+.Ic GraphViz .
.It llvm.Conventions
-Check code for LLVM codebase conventions
-.Bq off
+Check code for LLVM codebase conventions.
.It osx.API
-Check for proper uses of various Mac OS X APIs
-.Bq off
+Check for proper uses of various Mac OS X APIs.
.It osx.AtomicCAS
-Evaluate calls to OSAtomic functions
-.Bq off
+Evaluate calls to
+.Vt OSAtomic
+functions.
.It osx.SecKeychainAPI
-Check for proper uses of Secure Keychain APIs
-.Bq off
+Check for proper uses of Secure Keychain APIs.
.It osx.cocoa.AtSync
-Check for null pointers used as mutexes for @synchronized
-.Bq off
+Check for null pointers used as mutexes for @synchronized.
.It osx.cocoa.ClassRelease
-Check for sending 'retain', 'release', or 'autorelease' directly to a Class
-.Bq off
+Check for sending
+.Ql retain ,
+.Ql release,
+or
+.Ql autorelease
+directly to a Class.
.It osx.cocoa.IncompatibleMethodTypes
-Warn about Objective-C method signatures with type incompatibilities
-.Bq off
+Warn about Objective-C method signatures with type incompatibilities.
.It osx.cocoa.NSAutoreleasePool
-Warn for suboptimal uses of NSAutoreleasePool in Objective-C GC mode
-.Bq off
+Warn for suboptimal uses of
+.Vt NSAutoreleasePool
+in Objective-C GC mode.
.It osx.cocoa.NSError
-Check usage of NSError** parameters
-.Bq off
+Check usage of NSError** parameters.
.It osx.cocoa.NilArg
-Check for prohibited nil arguments to ObjC method calls
-.Bq off
+Check for prohibited nil arguments to Objective-C method calls.
.It osx.cocoa.RetainCount
-Check for leaks and improper reference count management
-.Bq off
+Check for leaks and improper reference count management.
.It osx.cocoa.SelfInit
-Check that 'self' is properly initialized inside an initializer method
-.Bq off
+Check that
+.Ql self
+is properly initialized inside an initializer method.
.It osx.cocoa.UnusedIvars
-Warn about private ivars that are never used
-.Bq off
+Warn about private ivars that are never used.
.It osx.cocoa.VariadicMethodTypes
-Check for passing non-Objective-C types to variadic methods that expect only Objective-C types
-.Bq off
+Check for passing non-Objective-C types to variadic methods that expect only Objective-C types.
.It osx.coreFoundation.CFError
-Check usage of CFErrorRef* parameters
-.Bq off
+Check usage of CFErrorRef* parameters.
.It osx.coreFoundation.CFNumber
-Check for proper uses of CFNumberCreate
-.Bq off
+Check for proper uses of
+.Fn CFNumberCreate .
.It osx.coreFoundation.CFRetainRelease
-Check for null arguments to CFRetain/CFRelease
-.Bq off
+Check for null arguments to
+.Fn CFRetain
+and
+.Fn CFRelease .
.It osx.coreFoundation.containers.OutOfBounds
-Checks for index out-of-bounds when using 'CFArray' API
-.Bq off
+Checks for index out-of-bounds when using the
+.Vt CFArray
+API.
.It osx.coreFoundation.containers.PointerSizedValues
-Warns if 'CFArray', 'CFDictionary', 'CFSet' are created with non-pointer-size values
-.Bq off
+Warns if
+.Vt CFArray ,
+.Vt CFDictionary ,
+or
+.Vt CFSet
+are created with non-pointer-size values.
.It security.FloatLoopCounter
-Warn on using a floating point value as a loop counter (CERT: FLP30-C, FLP30-CPP)
-.Bq off
+Warn on using a floating point value as a loop counter (CERT: FLP30-C, FLP30-CPP).
.It security.insecureAPI.UncheckedReturn
-Warn on uses of functions whose return values must be always checked
-.Bq off
+Warn on uses of functions whose return values must be always checked.
.It security.insecureAPI.getpw
-Warn on uses of the 'getpw' function
-.Bq off
+Warn on uses of
+.Fn getpw .
.It security.insecureAPI.gets
-Warn on uses of the 'gets' function
-.Bq off
+Warn on uses of
+.Fn gets .
.It security.insecureAPI.mkstemp
-Warn when 'mkstemp' is passed fewer than 6 X's in the format string
-.Bq off
+Warn when
+.Fn mkstemp
+is passed fewer than 6 X's in the format string.
.It security.insecureAPI.mktemp
-Warn on uses of the 'mktemp' function
-.Bq off
+Warn on uses of
+.Fn mktemp .
.It security.insecureAPI.rand
-Warn on uses of the 'rand', 'random', and related functions
-.Bq off
+Warn on uses of
+.Fn rand ,
+.Fn random ,
+and related functions.
.It security.insecureAPI.strcpy
-Warn on uses of the 'strcpy' and 'strcat' functions
-.Bq off
+Warn on uses of
+.Fn strcpy
+and
+.Fn strcat .
.It security.insecureAPI.vfork
-Warn on uses of the 'vfork' function
-.Bq off
+Warn on uses of
+.Fn vfork .
.It unix.API
-Check calls to various UNIX/Posix functions
-.Bq off
+Check calls to various UNIX/Posix functions.
.It unix.Malloc
-Check for memory leaks, double free, and use-after-free problems.
-.Bq off
+Check for memory leaks, double free, and use-after-free.
.It unix.cstring.BadSizeArg
-Check the size argument passed into C string functions for common erroneous patterns
-.Bq off
+Check the size argument passed into C string functions for common
+erroneous patterns.
.It unix.cstring.NullArg
-Check for null pointers being passed as arguments to C string functions
-.Bq off
+Check for null pointers being passed as arguments to C string functions.
.El
.\"
.Sh EXAMPLE
@@ -319,14 +330,19 @@
.Pp
The above example causes analysis reports to be deposited into
a subdirectory of
-.Ql /tmp/myhtmldir
+.Pa /tmp/myhtmldir
and to run
-.Ql make
+.Ic make
with the
-.Ql -j4
+.Fl j4
option.
A different subdirectory is created each time
.Nm
analyzes a project.
The analyzer should support most parallel builds, but not distributed builds.
-
+.Sh AUTHORS
+.Nm
+was written by
+.An "Ted Kremenek" .
+Documentation contributed by
+.An "James K. Lowden" Aq jklowden at schemamania.org .
Propchange: cfe/branches/tooling/tools/scan-build/scan-build.1
------------------------------------------------------------------------------
svn:keywords = Id
Modified: cfe/branches/tooling/unittests/Tooling/RewriterTestContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/unittests/Tooling/RewriterTestContext.h?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/unittests/Tooling/RewriterTestContext.h (original)
+++ cfe/branches/tooling/unittests/Tooling/RewriterTestContext.h Tue May 29 07:04:37 2012
@@ -43,11 +43,6 @@
}
~RewriterTestContext() {
- if (TemporaryDirectory.isValid()) {
- std::string ErrorInfo;
- TemporaryDirectory.eraseFromDisk(true, &ErrorInfo);
- assert(ErrorInfo.empty());
- }
}
FileID createInMemoryFile(StringRef Name, StringRef Content) {
Modified: cfe/branches/tooling/www/analyzer/latest_checker.html.incl
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/www/analyzer/latest_checker.html.incl?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/www/analyzer/latest_checker.html.incl (original)
+++ cfe/branches/tooling/www/analyzer/latest_checker.html.incl Tue May 29 07:04:37 2012
@@ -1 +1 @@
-<b><a href="http://bit.ly/JceZBE">checker-265.tar.bz2</a></b> (built May 8, 2012)
+<b><a href="http://bit.ly/LgtUWx">checker-266.tar.bz2</a></b> (built May 23, 2012)
Modified: cfe/branches/tooling/www/analyzer/release_notes.html
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/www/analyzer/release_notes.html?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/www/analyzer/release_notes.html (original)
+++ cfe/branches/tooling/www/analyzer/release_notes.html Tue May 29 07:04:37 2012
@@ -15,8 +15,14 @@
<h1>Release notes for <tt>checker-XXX</tt> builds</h1>
-<h4 id="checker_265">checker-265</h4>
+<h4 id="checker_266">checker-266</h4>
+<p><b>built:</b> May 23, 2012</br>
+ <b>download:</b> <a href="http://bit.ly/LgtUWx">checker-266.tar.bz2</a></p>
+ <p><b>highlights:</b></p>
+<p>Contains numerous stability fixes over checker-266, especially when analyzing C++11 code.</p>
+
+<h4 id="checker_265">checker-265</h4>
<p><b>built:</b> May 8, 2012</br>
<b>download:</b> <a href="http://bit.ly/JceZBE">checker-265.tar.bz2</a></p>
<p><b>highlights:</b></p>
Modified: cfe/branches/tooling/www/content.css
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/www/content.css?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/www/content.css (original)
+++ cfe/branches/tooling/www/content.css Tue May 29 07:04:37 2012
@@ -24,6 +24,8 @@
.itemTitle { color:#2d58b7 }
span.error { color:red }
+span.warning { color:purple }
+span.note { color:gray }
span.caret { color:green; font-weight:bold }
/* Tables */
Modified: cfe/branches/tooling/www/menu.html.incl
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/www/menu.html.incl?rev=157610&r1=157609&r2=157610&view=diff
==============================================================================
--- cfe/branches/tooling/www/menu.html.incl (original)
+++ cfe/branches/tooling/www/menu.html.incl Tue May 29 07:04:37 2012
@@ -28,6 +28,7 @@
<div class="submenu">
<label>Clang Tools</label>
<a href="http://clang-analyzer.llvm.org">Automatic Bug-Finding</a>
+ <a href="/docs/Tooling.html">Writing Clang Tools</a>
</div>
<div class="submenu">
More information about the llvm-branch-commits
mailing list