Граф коммитов

11151 Коммитов

Автор SHA1 Сообщение Дата
Devang Patel 478b94b945 Check column number also.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135437 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 22:18:04 +00:00
Sean Hunt 858a325e5f Remember to add a has_feature macro for __underlying_type now that it is
correctly impelmented

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135401 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 17:08:00 +00:00
Argyrios Kyrtzidis 05fdf9bc3f [arcmt] When a NSData's 'bytes' family of methods are used on a local var,
add __attribute__((objc_precise_lifetime)) to make sure that the object
(and its data) will not get released before the var goes out-of-scope.

rdar://9206226

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135382 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 07:44:50 +00:00
Argyrios Kyrtzidis fd10398c10 [arcmt] NSInvocation's [get/set]ReturnValue and [get/set]Argument are only safe
with __unsafe_unretained parameters. Emit error for strong/weak ones. rdar://9206226

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135381 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 07:44:45 +00:00
Nick Lewycky f57ef0516c Don't crash when codegen'ing an empty redecl of a function in C99 mode, when
neither was inline. Fixes bug introduced in r135377.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135380 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 07:11:55 +00:00
Nick Lewycky dce67a70a8 In C99, emit an inline function when encountering an extern redeclaration.
Fixes PR10233!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135377 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 05:26:13 +00:00
Chandler Carruth 8435069798 Revert r135217, which wasn't the correct fix for PR10358. With this
patch, we actually move the state-machine for the value set backwards
one step. This can pretty easily lead to infinite loops where we
continually try to propagate a bit, succeed for one iteration, but then
back up because we find an uninitialized use.

A reduced test case from PR10379 is included.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135359 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-16 22:27:02 +00:00
Ted Kremenek 797a7be0de [analyzer] Per discussions with the Cocoa team, extend CF naming conventions to extend to camel case functions instead of just title case functions. Fixes <rdar://problem/9732321>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135350 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-16 19:50:36 +00:00
Argyrios Kyrtzidis 82a921a1a4 [arcmt] It's not safe to remove the -release on "[[someivar delegate] release];" since it's very likely
that, after migration, the object that was passed to 'setDelegate:' will not be properly retained, e.g:

-whatever {
  id x = [[MyDoHicky alloc] init];
  [someivar setDelegate: x]; // x won't get retained in ARC.
}
-dealloc {
  [[someivar delegate] release]; // give migration error here.
}

rdar://8858009

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135327 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 23:48:56 +00:00
Tanya Lattner 61b4bc80e9 This handles the missing cases of opencl vector literals.
Test cases provided by Anton Lokhmot.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135322 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 23:07:01 +00:00
Jordy Rose deefaf6eac Update retain-release.m to match updated warnings from r135310
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135317 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 22:38:26 +00:00
Jordy Rose 5b5402bbda Add tests for CFRefReport's path notes, and fix a few typos and non-standard terminology ('+0 retain counts') caught by the tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135310 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 22:17:54 +00:00
Argyrios Kyrtzidis 1aa60ff0ad [arcmt] Rewrite to "foo = nil;" not "foo = 0;", as suggested by Jordy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135309 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 22:04:00 +00:00
Argyrios Kyrtzidis f55a869ba4 [arcmt] For:
id x = ...
@try {
 ...
} @finally {
 [x release];
}

Migrator will drop the release. It's better to change it to "x = 0" in a @finally to avoid leak when exception is thrown.

rdar://9398256

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135301 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 21:11:23 +00:00
Douglas Gregor fc71ac810f Don't refer to check.deps unless LLVM_INCLUDE_TESTS is enabled
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135300 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 21:03:20 +00:00
Jordy Rose 8f08426e6f [analyzer] GNU __null is a pointer-sized integer, not a pointer. Fixes PR10372.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135294 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 20:29:02 +00:00
Douglas Gregor 91ae6b43b3 When creating a property in a class extension, make sure to check its
attributes. Fixes <rdar://problem/9561076>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135273 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 15:30:21 +00:00
John McCall 4e9272de54 Restore the C-style cast hack for enum template arguments,
which is required given the current setup for template
argument deduction substitution validation, and add a test
case to make sure we don't break it in the future.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135262 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 07:47:58 +00:00
Chris Lattner 71305cc81b Enhance the IR type lowering code to be much smarter about recursively lowering
types.  Fore xample, we used to lower:

struct bar { int a; };
struct foo {
 void (*FP)(struct bar);
} G;

to:

%struct.foo = type { {}* }

since the function pointer would cause recursive translation of bar and
we didn't know if that would get us into trouble.  We are now smart enough
to know that it is fine, so we get this type instead:

%struct.foo = type { void (i32)* }

Codegen still needs to be prepared for uncooperative types at any place,
which is why I let the maximally uncooperative code sit around for awhile to
help shake out the bugs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135244 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 05:16:14 +00:00
Richard Trieu e5adf59d3a Remove warnings of constant operands of logical operators from template instantiations. Upon instantiation of template, value-dependent parameters are replaced by equivalent literals, so code like:
template<unsigned int A, unsigned int B> struct S {
  int foo() {
    int x = A && B;
  }
}

will not warn on A && B on every instantiation.  This will still warn on other cases inside templates, which will be caught on checking the template definition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135222 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 00:00:51 +00:00
Ted Kremenek 05bcade018 Fix false negative reported in PR 10358 by using 'Unknown' in -Wuninitialized to avoid cascading warnings. Patch by Kaelyn Uhrain.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135217 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 23:43:06 +00:00
Argyrios Kyrtzidis 2c18ca0575 [arcmt] Don't remove retains/releases on a global variable, flag them with errors. rdar://9402555.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135213 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 23:32:04 +00:00
Rafael Espindola 12ce0a085f Revert 135177 to fix PR10363.
Revert "For C++11, do more checking of initializer lists up-front, enabling some subset of the final functionality. C just leaves the function early. C++98 runs through the same code path, but has no changed functionality either."

This reverts commit ac420c5053.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135210 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 22:58:04 +00:00
Argyrios Kyrtzidis 2cd5366ff5 [arcmt] Allow -retain of an __unsafe_unretained receiver if the result gets used.
Keep the error if the result is unused. rdar://9552694.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135209 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 22:46:12 +00:00
John McCall 00fe761849 Teach -Wconversion, -Wsign-compare etc. about division and remainder.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135208 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 22:39:48 +00:00
Richard Smith cf6b0a20c6 PR10359: Template declarations which define classes are not permitted to also contain declarators. Previously we would accept code like this:
template<typename T> struct S { } f() { return 0; }

This case now produces a missing ';' diagnostic, since that seems like a much more likely error than an attempt to declare a function or variable in addition to the class template.

Treat this 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135195 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 21:35:26 +00:00
Argyrios Kyrtzidis e0e40768cc [arcmt] Emit an error for unused -autorelease messages.
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, so leave it
and emit an error to force the user to restructure his code.

rdar://9599884

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135193 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 21:26:49 +00:00
Sebastian Redl ac420c5053 For C++11, do more checking of initializer lists up-front, enabling some subset of the final functionality. C just leaves the function early. C++98 runs through the same code path, but has no changed functionality either.
This is a first baby step towards supporting generalized initializer lists. This also removes an aggregate
test case that was just plain wrong, assuming that non-aggregates couldn't be initialized with initializer lists
in C++11 mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135177 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 19:08:10 +00:00
Sebastian Redl dc998b4445 Fix problems Johannes noticed, and extend test cases further.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135176 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 19:08:01 +00:00
Ted Kremenek 1ad35bebcc Revert r135147 and r135075. The consensus was that this wasn't the right thing to do.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135152 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 17:05:32 +00:00
Chandler Carruth 9b2a0ac970 Update all of the libclang code corresponding to the preprocessor
MacroInstantiation -> MacroExpansion rename. Internally, everything is
switched.

Introduce a new cursor kind enum with the new name, but retain the old
name as an alias so that we don't break backwards compatibility.

Also update the debug printing routine to use 'macro expansions' as its
explicitly not guaranteed to be stable, and mechanically switch the test
cases over to that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135140 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 08:41:15 +00:00
Chandler Carruth 4e80546712 Switch the diagnostic messages about macros to use the terms 'expanded'
and 'expansions' rather than 'instantiated' and 'contexts'.

This is the first of several patches migrating Clang's terminology
surrounding macros from 'instantiation' to 'expansion'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135135 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 08:20:28 +00:00
Ted Kremenek 826d5b4782 Reapply r135075, but modify format-strings.c and format-strings-fixit.c test cases to be more portable with an explicit target triple.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135134 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 06:49:52 +00:00
NAKAMURA Takumi 13d99bf2e9 Revert r135075, "format string checking: long and int have the same widths on 32-bit, so we shouldn't warn about using"
It fails on freebsd, mingw and msvc10.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135129 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 05:16:18 +00:00
Douglas Gregor 3a348c86ff Add a hackaround to avoid the crash in PR10355. However, our recovery
is still terrible here because typo correction is not behaving well in
the presence of overloaded functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135128 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 04:54:23 +00:00
Argyrios Kyrtzidis a944b123e4 [arcmt] Make sure migrating to ARC works even if '-fobjc-arc' is included in command-line flags. rdar://9567824
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135115 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 00:17:54 +00:00
Richard Smith 87c1f1f7c4 PR8800: When building a conversion to A& using a member operatorA&(), do not require A to be a complete type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135101 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 22:53:21 +00:00
Bruno Cardoso Lopes b8981df0ed Reapply r134946 with fixes. Tested on Benjamin testcase and other test-suite failures.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135091 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 21:58:55 +00:00
Douglas Gregor 1255aaf102 Fix an incorrect namespace typo-correction diagnostic, from Kaelyn
Uhrain! Fixes PR10318.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135086 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 21:36:26 +00:00
Devang Patel d15608e986 Emit debug info for extended vectors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135083 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 21:23:30 +00:00
Ted Kremenek 8da9316c5a format string checking: long and int have the same widths on 32-bit, so we shouldn't warn about using
an "int" format specifier with a "long" type in 32-bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135075 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 20:20:58 +00:00
John McCall 84ff0fccb1 Enforce access control for the destructor in a new[] expression and mark
it as used.  Otherwise, we can fail to instantiate or validate the destructor,
which can lead to crashes in IR gen like PR10351.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135073 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 20:12:57 +00:00
Argyrios Kyrtzidis 968860904a [arcmt] Add weak/unsafe_unretained for "@property (readonly)" when we are @synthesizing it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135067 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 19:47:57 +00:00
Argyrios Kyrtzidis 14c4b4405f [arcmt] For properties rewrite 'assign' -> 'weak or unsafe_unretained', 'retain' -> 'strong', and add
'weak or unsafe_unretained' when 'assign' is missing. rdar://9496219&9602589.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135065 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 19:22:00 +00:00
Fariborz Jahanian 4c91d89453 With -Wselector, don't warn about unimplemented optional method
used in @selector expression because, well, their implementation 
is optional. // rdar://9545564


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135057 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 19:05:43 +00:00
John McCall 799d34e950 Don't crash if defining -dealloc in a category.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135054 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 18:26:47 +00:00
John McCall 48218c60d6 In debugger mode, make ObjC message sends to unknown selectors return
__unknown_anytype, and rewrite such message sends correctly.

I had to bite the bullet and actually add a debugger support mode for this
one, which is a bit unfortunate, but there really isn't anything else
I could imagine doing;  this is clearly just debugger-specific behavior.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135051 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 17:56:40 +00:00
Fariborz Jahanian 8beb6a2426 objc++: Some level of covariance is allowed in ObjC properties.
Make it also available in ObjC++ propeties. Use common code for
objc and objc++ so they don't diverge. // rdar://9740328


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135050 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 17:55:01 +00:00
Ted Kremenek dc00d8158d Re-relax conversion specifier checking for printf format strings and conversion specifiers. My recent change was a mistake.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135048 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 17:35:14 +00:00
Ted Kremenek 45eb7022ff Fix inversion in argument type checking for format strings with conversion specifiers for character types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135046 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 17:25:47 +00:00