]> granicus.if.org Git - clang/log
clang
13 years agoAllow comparison between block pointers and NULL pointer
Douglas Gregor [Thu, 16 Jun 2011 18:52:05 +0000 (18:52 +0000)]
Allow comparison between block pointers and NULL pointer
constants. Fixes PR10145.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133179 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTeach the warning about non-POD memset/memcpy/memmove to deal with the
Douglas Gregor [Thu, 16 Jun 2011 17:56:04 +0000 (17:56 +0000)]
Teach the warning about non-POD memset/memcpy/memmove to deal with the
__builtin_ versions of these functions as well as the normal function
versions, so that it works on platforms where memset/memcpy/memmove
are macros that map down to the builtins (e.g., Darwin). Fixes
<rdar://problem/9372688>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133173 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoarc: diagnose dereferencing a __weak pointer which may be
Fariborz Jahanian [Thu, 16 Jun 2011 17:29:56 +0000 (17:29 +0000)]
arc: diagnose dereferencing a __weak pointer which may be
null at any time. // rdar://9612030

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133168 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Fix the test when running in Lion.
Argyrios Kyrtzidis [Thu, 16 Jun 2011 17:28:31 +0000 (17:28 +0000)]
[arcmt] Fix the test when running in Lion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133167 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoGive arcmt-test an explicit triple for this test.
John McCall [Thu, 16 Jun 2011 17:13:30 +0000 (17:13 +0000)]
Give arcmt-test an explicit triple for this test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133165 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement the consistency checking for C++ [temp.deduct.call]p3, which
Douglas Gregor [Thu, 16 Jun 2011 16:50:48 +0000 (16:50 +0000)]
Implement the consistency checking for C++ [temp.deduct.call]p3, which
checks that the deduced argument type for a function call matches the
actual argument type provided. The only place we've found where the
consistency checking should actually cause template argument deduction
failure is due to qualifier differences that don't fall into the realm
of qualification conversions (which are *not* checked when we
initially perform deduction). However, we're performing the full
checking as specified in the standard to ensure that no other cases
exist.

Fixes PR9233 / <rdar://problem/9039590>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133163 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRaise the ARCMT functionality in Clang into proper FrontendActions.
Chandler Carruth [Thu, 16 Jun 2011 16:17:05 +0000 (16:17 +0000)]
Raise the ARCMT functionality in Clang into proper FrontendActions.
These are somewhat special in that they wrap any other FrontendAction,
running various ARC transformations or checks prior to the standard
action's run. To implement them easily, this extends FrontendAction to
have a WrapperFrontendAction utility class which forwards all calls by
default to an inner action setup at construction time. This is then
subclassed to override the specific behavior needed by the different
ARCMT tools.

Finally, FrontendTool is taught how to create these wrapper actions from
the existing flags and options structures.

The result is that clangFrontend no longer depends on clangARCMigrate.
This is very important, as clangARCMigrate *heavily* depends on
clangFrontend. Fundamentally ARCMigrate is at the same layer as
a library like Rewrite, sitting firmly on top of the Frontend, but tied
together with the FrontendTool when building the clang binary itself.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133161 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSet the visibility to 'hidden' when previous
Fariborz Jahanian [Thu, 16 Jun 2011 14:49:42 +0000 (14:49 +0000)]
Set the visibility to 'hidden' when previous
declaration of global var is __private_extern__.
// rdar://9609649

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133157 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoBe aware of (x86_64-redhat-linux6E-)g++44 on RHEL5.
NAKAMURA Takumi [Thu, 16 Jun 2011 12:43:57 +0000 (12:43 +0000)]
Be aware of (x86_64-redhat-linux6E-)g++44 on RHEL5.

AFAIK, RHEL5 (and its clones) provides g++44 as the package "gcc44-c++".
By default, g++-4.1.1 is available, though, its libstdc++ would not be suitable to clang++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133156 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRework the warning for 'memset(p, 0, sizeof(p))' where 'p' is a pointer
Chandler Carruth [Thu, 16 Jun 2011 09:09:40 +0000 (09:09 +0000)]
Rework the warning for 'memset(p, 0, sizeof(p))' where 'p' is a pointer
and the programmer intended to write 'sizeof(*p)'. There are several
elements to the new version:

1) The actual expressions are compared in order to more accurately flag
   the case where the pattern that works for an array has been used, or
   a '*' has been omitted.
2) Only do a loose type-based check for record types. This prevents us
   from warning when we happen to be copying around chunks of data the
   size of a pointer and the pointer types for the sizeof and
   source/dest match.
3) Move all the diagnostics behind the runtime diagnostic filter. Not
   sure this is really important for this particular diagnostic, but
   almost everything else in SemaChecking.cpp does so.
4) Make the wording of the diagnostic more precise and informative. At
   least to my eyes.
5) Provide highlighting for the two expressions which had the unexpected
   similarity.
6) Place this diagnostic under a flag: -Wsizeof-pointer-memaccess

This uses the Stmt::Profile system for computing #1. Because of the
potential cost, this is guarded by the warning flag. I'd be interested
in feedback on how bad this is in practice; I would expect it to be
quite cheap in practice. Ideas for a cheaper / better way to do this are
also welcome.

The diagnostic wording could likely use some further wordsmithing.
Suggestions welcome here. The goals I had were to: clarify that its the
interaction of 'memset' and 'sizeof' and give more reasonable
suggestions for a resolution.

An open question is whether these diagnostics should have the note
attached for silencing by casting the dest/source pointer to void*.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133155 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] Clean up modeling of strcmp, including cases where a string literal has...
Jordy Rose [Thu, 16 Jun 2011 07:13:34 +0000 (07:13 +0000)]
[analyzer] Clean up modeling of strcmp, including cases where a string literal has an embedded null character, and where both arguments are the same buffer. Also use nested ifs rather than early returns; in this case early returns will lose any assumptions we've made earlier in the function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133154 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake the Stmt::Profile method const, and the StmtProfile visitor
Chandler Carruth [Thu, 16 Jun 2011 06:47:06 +0000 (06:47 +0000)]
Make the Stmt::Profile method const, and the StmtProfile visitor
a ConstStmtVisitor. This also required adding some const iteration
support for designated initializers and making some of the getters on
the designators const.

It also made the formatting of StmtProfile.cpp rather awkward. I'm happy
to adjust any of the formatting if folks have suggestions. I've at least
fitted it all within 80 columns.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133152 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] Fix trivial errors in previous commit.
Jordy Rose [Thu, 16 Jun 2011 05:56:50 +0000 (05:56 +0000)]
[analyzer] Fix trivial errors in previous commit.

I will not commit without building first.
I will not commit without building first.
I will not commit without building first...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133150 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] Cleanup: mainly 80-char violations and preferring SValBuilder::getComparis...
Jordy Rose [Thu, 16 Jun 2011 05:51:02 +0000 (05:51 +0000)]
[analyzer] Cleanup: mainly 80-char violations and preferring SValBuilder::getComparisonType() to just referencing IntTy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133149 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoThis random unit test also depends on ARCMigrate.
John McCall [Thu, 16 Jun 2011 05:35:43 +0000 (05:35 +0000)]
This random unit test also depends on ARCMigrate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133148 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoc-index-test also depends on ARCMigrate, oh boy
John McCall [Thu, 16 Jun 2011 05:29:03 +0000 (05:29 +0000)]
c-index-test also depends on ARCMigrate, oh boy

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133147 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoARCMigrate depends on libAnalysis, and on unhelpful linkers must appear
John McCall [Thu, 16 Jun 2011 04:30:11 +0000 (04:30 +0000)]
ARCMigrate depends on libAnalysis, and on unhelpful linkers must appear
before it on the link line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133145 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRestore correct use of GC barriers.
John McCall [Thu, 16 Jun 2011 04:16:24 +0000 (04:16 +0000)]
Restore correct use of GC barriers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133144 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix my test case from r133136 so that it actually represents the code
Chandler Carruth [Thu, 16 Jun 2011 04:13:47 +0000 (04:13 +0000)]
Fix my test case from r133136 so that it actually represents the code
pattern found in the wild where this warning was firing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133143 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Fix tests in non-darwin.
Argyrios Kyrtzidis [Thu, 16 Jun 2011 02:41:46 +0000 (02:41 +0000)]
[arcmt] Fix tests in non-darwin.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133140 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd another dependency to the clang-test CMake target, this time to support lit.
Chandler Carruth [Thu, 16 Jun 2011 02:21:11 +0000 (02:21 +0000)]
Add another dependency to the clang-test CMake target, this time to support lit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133138 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd the new arcmt-test tool to the clang-test dependencies with
Chandler Carruth [Thu, 16 Jun 2011 02:01:48 +0000 (02:01 +0000)]
Add the new arcmt-test tool to the clang-test dependencies with
c-index-test and friends. This brings the failures on CMake clang tests
from 23 to 2 on Linux.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133137 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSkip both character pointers and void pointers when diagnosing bad
Chandler Carruth [Thu, 16 Jun 2011 02:00:04 +0000 (02:00 +0000)]
Skip both character pointers and void pointers when diagnosing bad
argument types for mem{set,cpy,move}. Character pointers, much like void
pointers, often point to generic "memory", so trying to check whether
they match the type of the argument to 'sizeof' (or other checks) is
unproductive and often results in false positives.

Nico, please review; does this miss any of the bugs you were trying to
find with this warning? The array test case you had should be caught by
the array-specific sizeof warning I think.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133136 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate clang's lit.site.cfg.in in preparation for adding config.llvm_build_modes.
Andrew Trick [Thu, 16 Jun 2011 01:32:21 +0000 (01:32 +0000)]
Update clang's lit.site.cfg.in in preparation for adding config.llvm_build_modes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133130 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoGrr. Of course libARCMigrate depends on libRewrite. This is a lot to be
John McCall [Thu, 16 Jun 2011 01:29:56 +0000 (01:29 +0000)]
Grr.  Of course libARCMigrate depends on libRewrite.  This is a lot to be
linking unnecessarily into libclang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133129 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake this test pretend to be on a darwin host.
John McCall [Thu, 16 Jun 2011 01:18:08 +0000 (01:18 +0000)]
Make this test pretend to be on a darwin host.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133125 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWeaken the type-matching rules for methods that return aggregates when
John McCall [Thu, 16 Jun 2011 01:15:19 +0000 (01:15 +0000)]
Weaken the type-matching rules for methods that return aggregates when
complaining about mismatches in the global method pool.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133123 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRefactor parentheses suggestion notes to have less code duplication and
Chandler Carruth [Thu, 16 Jun 2011 01:05:14 +0000 (01:05 +0000)]
Refactor parentheses suggestion notes to have less code duplication and
be more consistent in how parenthesized ranges which hit macros are
handled. Also makes the code significantly shorter, and the diagnostics
when macros are present a bit more useful.

Pair programmed w/ Matthew.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133122 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake the presentation of the warnings on 'x + y ? 1 : 0' a bit more
Chandler Carruth [Thu, 16 Jun 2011 01:05:12 +0000 (01:05 +0000)]
Make the presentation of the warnings on 'x + y ? 1 : 0' a bit more
pretty. In particular this makes it much easier for me to read messages
such as:

  x.cc:42: ?: has lower ...

Where I'm inclined to associate the third ':' with a missing column
number, but in fact column numbers have been turned off. Similar
punctuation collisions happened elsewhere as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133121 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCleanup the parameter naming style.
Chandler Carruth [Thu, 16 Jun 2011 01:05:08 +0000 (01:05 +0000)]
Cleanup the parameter naming style.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133120 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Make arcmt-test accept cc1 options to make it more portable and hopefully...
Argyrios Kyrtzidis [Thu, 16 Jun 2011 00:53:46 +0000 (00:53 +0000)]
[arcmt] Make arcmt-test accept cc1 options to make it more portable and hopefully fix MSVC failures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133119 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agolibFrontend depends on ARCMigrate, so link it into libclang.
John McCall [Thu, 16 Jun 2011 00:38:00 +0000 (00:38 +0000)]
libFrontend depends on ARCMigrate, so link it into libclang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133116 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoGive this test a triple; I don't think we want to #define __unsafe_unretained
John McCall [Thu, 16 Jun 2011 00:32:01 +0000 (00:32 +0000)]
Give this test a triple;  I don't think we want to #define __unsafe_unretained
on all platforms in non-ARC mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133114 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUnconditionally #define the ARC ownership qualifiers, instead of #defining
John McCall [Thu, 16 Jun 2011 00:03:19 +0000 (00:03 +0000)]
Unconditionally #define the ARC ownership qualifiers, instead of #defining
them only on Darwin tool chains.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133112 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSuppress a warning in -Asserts builds.
John McCall [Wed, 15 Jun 2011 23:40:09 +0000 (23:40 +0000)]
Suppress a warning in -Asserts builds.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133110 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSuppress an over-zealous MSVC warning.
John McCall [Wed, 15 Jun 2011 23:39:23 +0000 (23:39 +0000)]
Suppress an over-zealous MSVC warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133109 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoThe ARC Migration Tool. All the credit goes to Argyrios and Fariborz
John McCall [Wed, 15 Jun 2011 23:25:17 +0000 (23:25 +0000)]
The ARC Migration Tool.  All the credit goes to Argyrios and Fariborz
for this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133104 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAutomatic Reference Counting.
John McCall [Wed, 15 Jun 2011 23:02:42 +0000 (23:02 +0000)]
Automatic Reference Counting.

Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133103 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIntroduce a utility routine for checking whether a block's captures
John McCall [Wed, 15 Jun 2011 22:51:16 +0000 (22:51 +0000)]
Introduce a utility routine for checking whether a block's captures
include a specific variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133102 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMissing files.
John McCall [Wed, 15 Jun 2011 22:11:51 +0000 (22:11 +0000)]
Missing files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133096 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPer Chris's suggestion, simplify code using llvm::getOrEnforceKnownAlignment.
Eli Friedman [Wed, 15 Jun 2011 22:09:18 +0000 (22:09 +0000)]
Per Chris's suggestion, simplify code using llvm::getOrEnforceKnownAlignment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133095 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoGenerate enumerators for diagnostic categories. Patch by Argyrios!
John McCall [Wed, 15 Jun 2011 21:46:43 +0000 (21:46 +0000)]
Generate enumerators for diagnostic categories.  Patch by Argyrios!
Depends on LLVM r133093.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133094 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoThe specification document for the new ObjC Automatic Reference Counting
John McCall [Wed, 15 Jun 2011 21:21:53 +0000 (21:21 +0000)]
The specification document for the new ObjC Automatic Reference Counting
feature.

Implementation to follow. :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133090 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoremove the index page, we have dox now!
Chris Lattner [Wed, 15 Jun 2011 21:13:48 +0000 (21:13 +0000)]
remove the index page, we have dox now!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133087 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTest for r133070.
Eli Friedman [Wed, 15 Jun 2011 20:17:07 +0000 (20:17 +0000)]
Test for r133070.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133079 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a couple more tests with ARM ABI.
Eli Friedman [Wed, 15 Jun 2011 18:37:44 +0000 (18:37 +0000)]
Fix a couple more tests with ARM ABI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133073 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse isAnyComplexType here so we don't pass complex numbers into the aggregate handlin...
Eli Friedman [Wed, 15 Jun 2011 18:27:44 +0000 (18:27 +0000)]
Use isAnyComplexType here so we don't pass complex numbers into the aggregate handling code; found by inspection.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133070 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a regression from r132957 involving complex integers. (Fixes failures on gcc...
Eli Friedman [Wed, 15 Jun 2011 18:26:32 +0000 (18:26 +0000)]
Fix a regression from r132957 involving complex integers.  (Fixes failures on gcc-testsuite bot.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133069 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDo not emit stoppoint before emitting debug info for parameters.
Devang Patel [Wed, 15 Jun 2011 17:57:08 +0000 (17:57 +0000)]
Do not emit stoppoint before emitting debug info for parameters.
- llvm.dbg.declare already receives line number information from ParmDecl
- Additional extra stoppoint messes up gdb's understanding of where function body starts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133065 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEliminate a 'default' case in template argument deduction, where we
Douglas Gregor [Wed, 15 Jun 2011 16:02:29 +0000 (16:02 +0000)]
Eliminate a 'default' case in template argument deduction, where we
were just punting on template argument deduction for a number of type
nodes. Most of them, obviously, didn't matter.

As a consequence of this, make extended vector types (via the
ext_vector_type attribute) actually work properly for several
important cases:
  - If the attribute appears in a type-id (i.e, not attached to a
  typedef), actually build a proper vector type
  - Build ExtVectorType whenever the size is constant; previously, we
  were building DependentSizedExtVectorType when the size was constant
  but the type was dependent, which makes no sense at all.
  - Teach template argument deduction to handle
  ExtVectorType/DependentSizedExtVectorType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133060 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEliminate an unnecessary include. FIXMEs -=1
Douglas Gregor [Wed, 15 Jun 2011 14:26:34 +0000 (14:26 +0000)]
Eliminate an unnecessary include. FIXMEs -=1

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133056 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen performing substitution of default template template parameters
Douglas Gregor [Wed, 15 Jun 2011 14:20:42 +0000 (14:20 +0000)]
When performing substitution of default template template parameters
before the template parameters have acquired a proper context (e.g.,
because the enclosing context has yet to be built), provide empty
parameter lists for all outer template parameter scopes to inhibit any
substitution for those template parameters. Fixes PR9643 /
<rdar://problem/9251019>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133055 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoremove some more empty dirs.
Chris Lattner [Wed, 15 Jun 2011 06:07:34 +0000 (06:07 +0000)]
remove some more empty dirs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133049 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoremove an empty dir.
Chris Lattner [Wed, 15 Jun 2011 06:06:16 +0000 (06:06 +0000)]
remove an empty dir.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133048 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] Revise CStringChecker's modelling of strcpy() and strcat():
Jordy Rose [Wed, 15 Jun 2011 05:52:56 +0000 (05:52 +0000)]
[analyzer] Revise CStringChecker's modelling of strcpy() and strcat():
- (bounded copies) Be more conservative about how much is being copied.
- (str(n)cat) If we can't compute the exact final length of an append operation, we can still lower-bound it.
- (stpcpy) Fix the conjured return value at the end to actually be returned.

This requires these supporting changes:
- C string metadata symbols are still live even when buried in a SymExpr.
- "Hypothetical" C string lengths, to represent a value that /will/ be passed to setCStringLength() if all goes well. (The idea is to allow for temporary constrainable symbols that may end up becoming permanent.)
- The 'checkAdditionOverflow' helper makes sure that the two strings being appended in a strcat don't overflow size_t. This should never *actually* happen; the real effect is to keep the final string length from "wrapping around" in the constraint manager.

This doesn't actually test the "bounded" operations (strncpy and strncat) because they can leave strings unterminated. Next on the list!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133046 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't add redundant FormatAttr, ConstAttr, or NoThrowAttr attributes,
Douglas Gregor [Wed, 15 Jun 2011 05:45:11 +0000 (05:45 +0000)]
Don't add redundant FormatAttr, ConstAttr, or NoThrowAttr attributes,
either imlicitly (for builtins) or explicitly (due to multiple
specification of the same attributes). Fixes <rdar://problem/9612060>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133045 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] If a C string length is UnknownVal, clear any existing length binding...
Jordy Rose [Wed, 15 Jun 2011 05:14:03 +0000 (05:14 +0000)]
[analyzer] If a C string length is UnknownVal, clear any existing length binding. No tests yet because the only thing that sets string length is strcpy(), and that needs some work anyway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133044 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] When performing a binary operation on symbolic operands, we convert the...
Jordy Rose [Wed, 15 Jun 2011 04:55:49 +0000 (04:55 +0000)]
[analyzer] When performing a binary operation on symbolic operands, we convert the symbol values to a common type. But in a relational operation, the result is an 'int' or 'bool', which may not be the appropriate type to convert the operands to. In these cases, use the left-hand operand's type as the conversion type.

There's no associated test for this because fully-constrained symbolic values are evaluated ahead of time in normal expressions. This can only come up in checker-constructed expressions (like the ones in an upcoming patch to CStringChecker).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133041 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoBuild fix attempt.
Nico Weber [Wed, 15 Jun 2011 04:50:13 +0000 (04:50 +0000)]
Build fix attempt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133039 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoProperly implement C++0x [stmt.dcl]p3, which requires a scope to be
Douglas Gregor [Wed, 15 Jun 2011 03:23:34 +0000 (03:23 +0000)]
Properly implement C++0x [stmt.dcl]p3, which requires a scope to be
protected in the case where a variable is being initialized by a
trivial default constructor but has a non-trivial destructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133037 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWarn on "void f(int a[10]) { sizeof(a); }"
Nico Weber [Wed, 15 Jun 2011 02:47:03 +0000 (02:47 +0000)]
Warn on "void f(int a[10]) { sizeof(a); }"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133036 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSema: show shift result in hexadecimal
Ted Kremenek [Wed, 15 Jun 2011 00:54:52 +0000 (00:54 +0000)]
Sema: show shift result in hexadecimal

Change the output for -Wshift-overflow and
-Wshift-sign-overflow to an unsigned hexadecimal. It makes
more sense for looking at bits than a signed decimal does.
Also, change the diagnostic's wording from "overrides"
to "sets".

This uses a new optional argument in APInt::toString()
that adds the '0x' prefix to hexademical numbers.

This fixes PR 9651.

Patch by nobled@dreamwidth.org!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133033 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agomention new VLA behavior in gnu* vs c* mode dox.
Chris Lattner [Wed, 15 Jun 2011 00:41:40 +0000 (00:41 +0000)]
mention new VLA behavior in gnu* vs c* mode dox.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133030 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIntroduce a -cc1-level option to turn off related result type
Douglas Gregor [Tue, 14 Jun 2011 23:20:43 +0000 (23:20 +0000)]
Introduce a -cc1-level option to turn off related result type
inference, to be used (only) by the Objective-C rewriter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133025 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[format strings] correctly suggest correct type for '%@' specifiers. Fixes <rdar...
Ted Kremenek [Tue, 14 Jun 2011 22:56:51 +0000 (22:56 +0000)]
[format strings] correctly suggest correct type for '%@' specifiers.  Fixes <rdar://problem/9607158>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133024 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoBad table discription of fromat-y2k causes
Fariborz Jahanian [Tue, 14 Jun 2011 21:54:00 +0000 (21:54 +0000)]
Bad table discription of fromat-y2k causes
no-format-y2k turn off -Wformat altogether.
// rdar://9504680

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133015 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agofix example as per rdar://problem/9461587
Blaine Garst [Tue, 14 Jun 2011 21:41:00 +0000 (21:41 +0000)]
fix example as per rdar://problem/9461587

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133012 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhack a bunch of tests in CodeGenCXX to work on ARM (using ARM ABI). Batch 2 of 3.
Eli Friedman [Tue, 14 Jun 2011 21:20:53 +0000 (21:20 +0000)]
Whack a bunch of tests in CodeGenCXX to work on ARM (using ARM ABI).  Batch 2 of 3.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133011 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agorevert r133003 and fix the bug properly: the issue was that ## in a token
Chris Lattner [Tue, 14 Jun 2011 18:19:37 +0000 (18:19 +0000)]
revert r133003 and fix the bug properly: the issue was that ## in a token
lexer is not a paste operator, it is a normal token.  This fixes a conformance
issue shown here:
http://p99.gforge.inria.fr/c99-conformance/c99-conformance-clang-2.9.html

and it defines away the crash from before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133005 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a crash on the testcase in PR9981 / rdar://9486765.
Chris Lattner [Tue, 14 Jun 2011 18:12:03 +0000 (18:12 +0000)]
Fix a crash on the testcase in PR9981 / rdar://9486765.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133003 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen profiling FunctionProtoTypes, don't canonicalize the expression
Douglas Gregor [Tue, 14 Jun 2011 16:42:44 +0000 (16:42 +0000)]
When profiling FunctionProtoTypes, don't canonicalize the expression
in a noexcept exception specification because it isn't part of the
canonical type. This ensures that we keep the exact expression written
in the noexcept exception specification, rather than accidentally
"adopting" a previously-written and canonically "equivalent" function
prototype. Fixes PR10087.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132998 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWarn on memset(ptr, 0, sizeof(ptr)). Diagnostic wording by Jordy Rose.
Nico Weber [Tue, 14 Jun 2011 16:14:58 +0000 (16:14 +0000)]
Warn on memset(ptr, 0, sizeof(ptr)). Diagnostic wording by Jordy Rose.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132996 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove the Fix-it for missing statement in switches
David Majnemer [Tue, 14 Jun 2011 15:24:38 +0000 (15:24 +0000)]
Remove the Fix-it for missing statement in switches

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132994 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoStaticDiagNameIndex is never written to, place it into .rodata.
Benjamin Kramer [Tue, 14 Jun 2011 13:15:38 +0000 (13:15 +0000)]
StaticDiagNameIndex is never written to, place it into .rodata.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132990 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoHyphenate "argument-dependent".
Jay Foad [Tue, 14 Jun 2011 12:59:25 +0000 (12:59 +0000)]
Hyphenate "argument-dependent".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132989 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agowhen compiling in a GNU mode (e.g. gnu99) treat VLAs with a size that can be folded...
Chris Lattner [Tue, 14 Jun 2011 06:38:10 +0000 (06:38 +0000)]
when compiling in a GNU mode (e.g. gnu99) treat VLAs with a size that can be folded to a constant
as constant size arrays.  This has slightly different semantics in some insane cases, but allows
us to accept some constructs that GCC does.  Continue to be pedantic in -std=c99 and other
modes.  This addressed rdar://8733881 - error "variable-sized object may not be initialized"; g++ accepts same code

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132983 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agofix rdar://9204520 - Accept int(0.85 * 10) as an initializer in a class member
Chris Lattner [Tue, 14 Jun 2011 05:46:29 +0000 (05:46 +0000)]
fix rdar://9204520 - Accept int(0.85 * 10) as an initializer in a class member
as an extension.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132980 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoProperly diagnose using abstract and incomplete types in va_arg
David Majnemer [Tue, 14 Jun 2011 05:17:32 +0000 (05:17 +0000)]
Properly diagnose using abstract and incomplete types in va_arg

- Move a test from test/SemaTemplate/instantiate-expr-3.cpp, it did not belong there
- Incomplete and abstract types are considered hard errors

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132979 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate the prefetch intrinsic usage. Now the last argument tells codegen
Bruno Cardoso Lopes [Tue, 14 Jun 2011 05:00:30 +0000 (05:00 +0000)]
Update the prefetch intrinsic usage. Now the last argument tells codegen
whether it's a data or instruction cache access.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132977 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agofix rdar://9546171 - -Wshorten-64-to-32 shouldn't warn on vector bitcasts.
Chris Lattner [Tue, 14 Jun 2011 04:51:15 +0000 (04:51 +0000)]
fix rdar://9546171 - -Wshorten-64-to-32 shouldn't warn on vector bitcasts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132975 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMove GlobalDecl to AST
Peter Collingbourne [Tue, 14 Jun 2011 04:02:39 +0000 (04:02 +0000)]
Move GlobalDecl to AST

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132973 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] CStringChecker checks functions in the C standard library, not C++. Its...
Jordy Rose [Tue, 14 Jun 2011 01:40:43 +0000 (01:40 +0000)]
[analyzer] CStringChecker checks functions in the C standard library, not C++. Its external name is now unix.experimental.CString.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132958 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoThe LLVM IR representation of byval arguments has a rather strange property: if the...
Eli Friedman [Tue, 14 Jun 2011 01:37:52 +0000 (01:37 +0000)]
The LLVM IR representation of byval arguments has a rather strange property: if the alignment of an argument to a call is less than the specified byval alignment for that argument, there is no way to specify the alignment of the implied copy.  Therefore, we must ensure that the alignment of the argument is at least the byval alignment.  To do this, we have to mess with the alignment of relevant alloca's in some cases, and insert a copy that conceptually shouldn't be necessary in some cases.

This patch tries relatively hard to avoid creating an extra copy if it can be avoided (see test3 in the included testcase), but it is not possible to avoid in some cases (like test2 in the included testcase).

rdar://9483886

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132957 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] Change large if body to early return. No functionality change.
Jordy Rose [Tue, 14 Jun 2011 01:26:48 +0000 (01:26 +0000)]
[analyzer] Change large if body to early return. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132956 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] Fix modeling of strnlen to be more conservative. Move tests we can't prope...
Jordy Rose [Tue, 14 Jun 2011 01:15:31 +0000 (01:15 +0000)]
[analyzer] Fix modeling of strnlen to be more conservative. Move tests we can't properly model (yet?) to string-fail.c.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132955 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake __gnu_inline__ functions in gnu99 mode work the same way as inline functions...
Eli Friedman [Mon, 13 Jun 2011 23:56:42 +0000 (23:56 +0000)]
Make __gnu_inline__ functions in gnu99 mode work the same way as inline functions in gnu89 mode in terms of redefinitions.

rdar://9559708 .

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132953 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPut local variables in appropriate debug info scope.
Devang Patel [Mon, 13 Jun 2011 23:15:32 +0000 (23:15 +0000)]
Put local variables in appropriate debug info scope.
This fixes radar 8757124.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132949 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemote this unreliable test case because it did not do its job.
Devang Patel [Mon, 13 Jun 2011 23:14:35 +0000 (23:14 +0000)]
Remote this unreliable test case because it did not do its job.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132948 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate extensions section of the docs to account for wacky gcc stuff we did end up...
Eli Friedman [Mon, 13 Jun 2011 23:12:01 +0000 (23:12 +0000)]
Update extensions section of the docs to account for wacky gcc stuff we did end up implementing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132947 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhack a bunch of tests in CodeGenCXX to work on ARM (using ARM ABI). Batch 1 of...
Eli Friedman [Mon, 13 Jun 2011 22:51:21 +0000 (22:51 +0000)]
Whack a bunch of tests in CodeGenCXX to work on ARM (using ARM ABI).  Batch 1 of 3 or so.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132945 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPut classes into anonymous namespaces.
Benjamin Kramer [Mon, 13 Jun 2011 18:38:45 +0000 (18:38 +0000)]
Put classes into anonymous namespaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132924 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEliminate the -f[no]objc-infer-related-result-type flags; there's no
Douglas Gregor [Mon, 13 Jun 2011 16:42:53 +0000 (16:42 +0000)]
Eliminate the -f[no]objc-infer-related-result-type flags; there's no
reason to allow the user to control these semantics through a flag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132919 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate Indexer test for new 'atomic' keyword.
Fariborz Jahanian [Mon, 13 Jun 2011 16:42:02 +0000 (16:42 +0000)]
Update Indexer test for new 'atomic' keyword.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132918 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDocument CheckObjCMethodOverrides
Douglas Gregor [Mon, 13 Jun 2011 16:07:18 +0000 (16:07 +0000)]
Document CheckObjCMethodOverrides

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132917 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoGive a diagnostic when using non-POD types in a va_arg
David Majnemer [Mon, 13 Jun 2011 06:37:03 +0000 (06:37 +0000)]
Give a diagnostic when using non-POD types in a va_arg

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132905 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImprove the diagnostics generated for switch statements missing expressions
David Majnemer [Mon, 13 Jun 2011 05:50:12 +0000 (05:50 +0000)]
Improve the diagnostics generated for switch statements missing expressions

- Move the diagnostic to the case statement instead of at the end of the switch
- Add a fix-it hint as to how to fix the compilation error

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132903 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a broken index left over from before this function was converted to
Chandler Carruth [Mon, 13 Jun 2011 05:00:35 +0000 (05:00 +0000)]
Fix a broken index left over from before this function was converted to
handle memcpy and memmove. Spotted by Nico.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132902 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCorrect the spelling of instantiation
David Majnemer [Mon, 13 Jun 2011 04:29:15 +0000 (04:29 +0000)]
Correct the spelling of instantiation

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132901 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMy calendar says it's 2011.
Benjamin Kramer [Sun, 12 Jun 2011 15:26:54 +0000 (15:26 +0000)]
My calendar says it's 2011.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132894 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't assert on initialized typedef declarations in classes:
Richard Smith [Sun, 12 Jun 2011 11:43:46 +0000 (11:43 +0000)]
Don't assert on initialized typedef declarations in classes:

  struct {
    typedef int A = 0;
  };

According to the C++11 standard, this is not ill-formed, but does not have any ascribed meaning. We can't reasonably accept it, so treat it as ill-formed.

Also switch C++ from an incorrect 'fields can only be initialized in constructors' diagnostic for this case to C's 'illegal initializer (only variables can be initialized)'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132890 91177308-0d34-0410-b5e6-96231b3b80d8