]> granicus.if.org Git - clang/log
clang
13 years ago80 cols.
Benjamin Kramer [Sat, 18 Jun 2011 10:34:00 +0000 (10:34 +0000)]
80 cols.

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

13 years agoRemove more unnecessary dependencies now that the Frontend -> ARCMigrate
Chandler Carruth [Sat, 18 Jun 2011 09:07:35 +0000 (09:07 +0000)]
Remove more unnecessary dependencies now that the Frontend -> ARCMigrate
edge has been broken.

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

13 years agotools/arcmt-test: Don't attempt to link redundant libclang (clang-c).
NAKAMURA Takumi [Sat, 18 Jun 2011 08:52:27 +0000 (08:52 +0000)]
tools/arcmt-test: Don't attempt to link redundant libclang (clang-c).

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

13 years agoClarify the semantics of init methods, and point out a few places
John McCall [Sat, 18 Jun 2011 08:15:19 +0000 (08:15 +0000)]
Clarify the semantics of init methods, and point out a few places
where mismatched semantics can cause undefined behavior.

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

13 years agoA couple of minor changes to the ARC spec, plus a new section
John McCall [Sat, 18 Jun 2011 07:31:30 +0000 (07:31 +0000)]
A couple of minor changes to the ARC spec, plus a new section
specifying that retain/release/autorelease/retainCount are forbidden,
plus a section talking about the behavior of dealloc.

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

13 years agoAccept no-return stripping conversions for pointer type arguments after
Chandler Carruth [Sat, 18 Jun 2011 01:19:03 +0000 (01:19 +0000)]
Accept no-return stripping conversions for pointer type arguments after
deducing template parameter types. Recently Clang began enforcing the
more strict checking that the argument type and the deduced function
parameter type (after substitution) match, but that only consideres
qualification conversions.

One problem with this patch is that we check noreturn conversions and
qualification conversions independently. If a valid conversion would
require *both*, perhaps interleaved with each other, it will be
rejected. If this actually occurs (I'm not yet sure it does) and is in
fact a problem (I'm not yet sure it is), there is a FIXME to implement
more intelligent conversion checking.

However, this step at least allows Clang to resume accepting valid code
we're seeing in the wild.

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

13 years ago[arcmt] Fix the ARC migrator. -arcmt-modify requires running before the initializatio...
Argyrios Kyrtzidis [Sat, 18 Jun 2011 00:53:41 +0000 (00:53 +0000)]
[arcmt] Fix the ARC migrator. -arcmt-modify requires running before the initialization of SourceManager
because it is going to modify the input file.

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

13 years ago[arcmt] Const'ify.
Argyrios Kyrtzidis [Sat, 18 Jun 2011 00:53:34 +0000 (00:53 +0000)]
[arcmt] Const'ify.

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

13 years ago[arcmt] Remove '-arcmt-modify-in-memory', it turned out less useful than we hoped...
Argyrios Kyrtzidis [Fri, 17 Jun 2011 23:49:31 +0000 (23:49 +0000)]
[arcmt] Remove '-arcmt-modify-in-memory', it turned out less useful than we hoped it would be.

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

13 years agoFix regression with @encode string. rdar://9624314.
Argyrios Kyrtzidis [Fri, 17 Jun 2011 23:19:38 +0000 (23:19 +0000)]
Fix regression with @encode string. rdar://9624314.

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

13 years agoObjective-C++ ARC: eliminate the utterly unjustified loophole that
Douglas Gregor [Fri, 17 Jun 2011 23:16:24 +0000 (23:16 +0000)]
Objective-C++ ARC: eliminate the utterly unjustified loophole that
silently dropped ownership qualifiers that were being applied to
ownership-qualified, substituted type that was *not* a substituted
template type parameter. We now provide a diagnostic in such cases,
and recover by dropping the added qualifiers.

Document this behavior in the ARC specification.

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

13 years agoObjective-C++ ARC: do not mangle __unsafe_unretained lifetime
Douglas Gregor [Fri, 17 Jun 2011 22:26:49 +0000 (22:26 +0000)]
Objective-C++ ARC: do not mangle __unsafe_unretained lifetime
qualifiers, so that an __unsafe_unretained-qualified type T in ARC code
will have the same mangling as T in non-ARC code, improving ABI
interoperability. This works now because we infer or require a
lifetime qualifier everywhere one can appear in an external
interface. Another part of <rdar://problem/9595486>.

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

13 years agoFix a grammaro
Douglas Gregor [Fri, 17 Jun 2011 22:19:27 +0000 (22:19 +0000)]
Fix a grammaro

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

13 years agoObjective-ARC++: infer template type arguments of
Douglas Gregor [Fri, 17 Jun 2011 22:11:49 +0000 (22:11 +0000)]
Objective-ARC++: infer template type arguments of
ownership-unqualified retainable object type as __strong. This allows
us to write, e.g.,

  std::vector<id>

and we'll infer that the vector's element types have __strong
ownership semantics, which is far nicer than requiring:

  std::vector<__strong id>

Note that we allow one to override the ownership qualifier of a
substituted template type parameter, e.g., given

  template<typename T>
  struct X {
    typedef __weak T type;
  };

X<id> is treated the same as X<__strong id>. At instantiation type,
the __weak in "__weak T" overrides the (inferred or specified)
__strong on the template argument type, so that we can still provide
metaprogramming transformations.

This is part of <rdar://problem/9595486>.

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

13 years agoOnly accept __bridge_retain in system headers, as Doug suggested.
John McCall [Fri, 17 Jun 2011 21:56:12 +0000 (21:56 +0000)]
Only accept __bridge_retain in system headers, as Doug suggested.

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

13 years agoAs a hopefully temporary workaround for a header mistake, treat
John McCall [Fri, 17 Jun 2011 21:23:37 +0000 (21:23 +0000)]
As a hopefully temporary workaround for a header mistake, treat
__bridge_retain as a synonym for __bridge_retained.

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

13 years agoAdd a minor hack to avoid using isNullPointerConstant on a hot path. Fixes -O0 compi...
Eli Friedman [Fri, 17 Jun 2011 20:52:22 +0000 (20:52 +0000)]
Add a minor hack to avoid using isNullPointerConstant on a hot path.  Fixes -O0 compile-time regressions from r133196.

rdar://9629775 .

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

13 years agoPut the new warning from revision 133196 on NULL arithmetic behind the flag -Wnull...
Richard Trieu [Fri, 17 Jun 2011 20:35:48 +0000 (20:35 +0000)]
Put the new warning from revision 133196 on NULL arithmetic behind the flag -Wnull-arthimetic and set to DefaultIgnore.  A few edge cases need to be worked out before this can be set to default.

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

13 years agoDon't emit 'unavailable' errors inside an unavailable function. rdar://9623855.
Argyrios Kyrtzidis [Fri, 17 Jun 2011 17:28:30 +0000 (17:28 +0000)]
Don't emit 'unavailable' errors inside an unavailable function. rdar://9623855.

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

13 years agoLoosen up the IR matching slightly
Douglas Gregor [Fri, 17 Jun 2011 17:23:28 +0000 (17:23 +0000)]
Loosen up the IR matching slightly

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

13 years agoRemove another variable.
Eric Christopher [Fri, 17 Jun 2011 17:04:30 +0000 (17:04 +0000)]
Remove another variable.

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

13 years agoWhen emitting a compound literal of POD type, continue to emit a
Douglas Gregor [Fri, 17 Jun 2011 16:37:20 +0000 (16:37 +0000)]
When emitting a compound literal of POD type, continue to emit a
separate aggregate temporary and then memcpy it over to the
destination. This fixes a regression I introduced with r133235, where
the compound literal on the RHS of an assignment makes use of the
structure on the LHS of the assignment.

I'm deeply suspicious of AggExprEmitter::VisitBinAssign()'s
optimization where it emits the RHS of an aggregate assignment
directly into the LHS lvalue without checking whether there is any
aliasing between the LHS/RHS. However, I'm not in a position to
revisit this now.

Big thanks to Eli for finding the regression!

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

13 years agoFix refactoro, silencing an MSVC warning. Thanks, Francois.
Douglas Gregor [Fri, 17 Jun 2011 14:36:00 +0000 (14:36 +0000)]
Fix refactoro, silencing an MSVC warning. Thanks, Francois.

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

13 years agoPerform an acquire memory barrier on the fast path of a thread-safe
John McCall [Fri, 17 Jun 2011 07:33:57 +0000 (07:33 +0000)]
Perform an acquire memory barrier on the fast path of a thread-safe
static initializer check, as required by the Itanium ABI.

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

13 years agoInitialize a couple of variables to shut GCC up.
John McCall [Fri, 17 Jun 2011 06:50:50 +0000 (06:50 +0000)]
Initialize a couple of variables to shut GCC up.

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

13 years agoObjective-C fast enumeration loop variables are not retained in ARC, but
John McCall [Fri, 17 Jun 2011 06:42:21 +0000 (06:42 +0000)]
Objective-C fast enumeration loop variables are not retained in ARC, but
they should still be officially __strong for the purposes of errors,
block capture, etc.  Make a new bit on variables, isARCPseudoStrong(),
and set this for 'self' and these enumeration-loop variables.  Change
the code that was looking for the old patterns to look for this bit,
and change IR generation to find this bit and treat the resulting
variable as __unsafe_unretained for the purposes of init/destroy in
the two places it can come up.

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

13 years agoClean up test to avoid using standard headers and remove an unneeded
Eric Christopher [Fri, 17 Jun 2011 06:16:34 +0000 (06:16 +0000)]
Clean up test to avoid using standard headers and remove an unneeded
#define.

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

13 years agoExtend the deduced/actual argument type checking of C++
Douglas Gregor [Fri, 17 Jun 2011 05:31:46 +0000 (05:31 +0000)]
Extend the deduced/actual argument type checking of C++
[temp.deduct.call]p4 to the deduction performed for 'auto', finishing
the fix for PR9233.

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

13 years agoMake this test suitable for optimized builds by avoiding the name.
Eric Christopher [Fri, 17 Jun 2011 05:24:17 +0000 (05:24 +0000)]
Make this test suitable for optimized builds by avoiding the name.

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

13 years agoFactor the checking of the deduced argument type against the actual
Douglas Gregor [Fri, 17 Jun 2011 05:18:17 +0000 (05:18 +0000)]
Factor the checking of the deduced argument type against the actual
argument type for C++ [temp.deduct.call]p4 out of
Sema::FinishTemplateArgumentDeduction(). No functionality change.

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

13 years agoWhen an explicit specialization has a storage specifier, error if that
Douglas Gregor [Fri, 17 Jun 2011 05:09:08 +0000 (05:09 +0000)]
When an explicit specialization has a storage specifier, error if that
storage specifier is different from the storage specifier on the
template. If that storage specifier is the same, then we only warn.

Thanks to John for the prodding.

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

13 years agoImplement proper support for generating code for compound literals in
Douglas Gregor [Fri, 17 Jun 2011 04:59:12 +0000 (04:59 +0000)]
Implement proper support for generating code for compound literals in
C++, which means:
  - binding the temporary as needed in Sema, so that we generate the
  appropriate call to the destructor, and
  - emitting the compound literal into the appropriate location for
  the aggregate, rather than trying to emit it as a temporary and
  memcpy() it.

Fixes PR10138 / <rdar://problem/9615901>.

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

13 years agoDowngrade the error complaining about presence of a storage class
Douglas Gregor [Fri, 17 Jun 2011 03:41:35 +0000 (03:41 +0000)]
Downgrade the error complaining about presence of a storage class
specifier on an explicit specialization to a warning, since neither
EDG nor GCC diagnose this code as ill-formed.

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

13 years agoCheck the specific target to figure out if a constraint is a valid
Eric Christopher [Fri, 17 Jun 2011 01:53:34 +0000 (01:53 +0000)]
Check the specific target to figure out if a constraint is a valid
register constraint. Note that we're not checking if the register itself
is valid for the constraint.

Fixes rdar://9382985

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

13 years agoAdd some more memory constraints for ARM.
Eric Christopher [Fri, 17 Jun 2011 01:40:49 +0000 (01:40 +0000)]
Add some more memory constraints for ARM.

Part of rdar://9197685

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

13 years agoOn ARM make sure that we continue translating 'p' to 'r' for the
Eric Christopher [Fri, 17 Jun 2011 00:40:18 +0000 (00:40 +0000)]
On ARM make sure that we continue translating 'p' to 'r' for the
constraints.

rdar://9618597

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

13 years agoWhen synthesizing implicit copy/move constructors and copy/move assignment
John McCall [Fri, 17 Jun 2011 00:18:42 +0000 (00:18 +0000)]
When synthesizing implicit copy/move constructors and copy/move assignment
operators, don't make an initializer or sub-operation for zero-width
bitfields.

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

13 years agoCheck for placeholder expressions before promoting an argument passed
Douglas Gregor [Fri, 17 Jun 2011 00:15:10 +0000 (00:15 +0000)]
Check for placeholder expressions before promoting an argument passed
through an ellipsis. Fixes <rdar://problem/9623945>.

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

13 years agoAdd support for -force_load flag, for compat with Apple gcc. rdar://9555962 .
Eli Friedman [Thu, 16 Jun 2011 23:59:43 +0000 (23:59 +0000)]
Add support for -force_load flag, for compat with Apple gcc.  rdar://9555962 .

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

13 years agoRemove ARCMigrate from more builds that it isn't needed in now that the
Chandler Carruth [Thu, 16 Jun 2011 23:53:28 +0000 (23:53 +0000)]
Remove ARCMigrate from more builds that it isn't needed in now that the
layering problem has been addressed.

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

13 years agoBe sure to try a final ARC-production even in Objective-C++.
John McCall [Thu, 16 Jun 2011 23:24:51 +0000 (23:24 +0000)]
Be sure to try a final ARC-production even in Objective-C++.

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

13 years agoFinish 2 sentences.
Francois Pichet [Thu, 16 Jun 2011 23:19:36 +0000 (23:19 +0000)]
Finish 2 sentences.

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

13 years agocomment improvements.
Chris Lattner [Thu, 16 Jun 2011 22:58:30 +0000 (22:58 +0000)]
comment improvements.

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

13 years agoFix a regression introduced by r131955 which broke #include_next in subtle situations
Chris Lattner [Thu, 16 Jun 2011 22:58:10 +0000 (22:58 +0000)]
Fix a regression introduced by r131955 which broke #include_next in subtle situations
because the Angled directories and the System directories were not being uniqued
together, breaking #include_next.  I'll see about a testcase, but it will be insane.

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

13 years agocode cleanups, no behavior change.
Chris Lattner [Thu, 16 Jun 2011 22:56:45 +0000 (22:56 +0000)]
code cleanups, no behavior change.

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

13 years agoFor the purpose of @encode'ing, accept 'void' type
Fariborz Jahanian [Thu, 16 Jun 2011 22:34:44 +0000 (22:34 +0000)]
For the purpose of @encode'ing, accept 'void' type
(even though it is incomplete type) because gcc
says so. // rdar://9622422

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

13 years agocmake may require LIT_TOOLS_DIR.
Andrew Trick [Thu, 16 Jun 2011 21:47:59 +0000 (21:47 +0000)]
cmake may require LIT_TOOLS_DIR.
Reviewed by chapuni. Sorry for breaking.

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

13 years agoAdd a new warning when a NULL constant is used in arithmetic operations. The warning...
Richard Trieu [Thu, 16 Jun 2011 21:36:56 +0000 (21:36 +0000)]
Add a new warning when a NULL constant is used in arithmetic operations.  The warning will fire on cases such as:

int x = 1 + NULL;

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

13 years agoFix of a minor typo.
Jonathan D. Turner [Thu, 16 Jun 2011 20:47:21 +0000 (20:47 +0000)]
Fix of a minor typo.

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

13 years ago[arcmt] Fix test for MSVC build.
Argyrios Kyrtzidis [Thu, 16 Jun 2011 20:19:55 +0000 (20:19 +0000)]
[arcmt] Fix test for MSVC build.

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

13 years agoMove computation of __private_extern__ visibilty to
Fariborz Jahanian [Thu, 16 Jun 2011 20:14:50 +0000 (20:14 +0000)]
Move computation of __private_extern__ visibilty to
getLVForNamespaceScopeDecl(). // rdar://9609649

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

13 years agoStylistic fix: move virtual keyword before return type.
Evan Cheng [Thu, 16 Jun 2011 19:13:15 +0000 (19:13 +0000)]
Stylistic fix: move virtual keyword before return type.

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

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