Commit Graph

917 Commits

Author SHA1 Message Date
Eli Friedman 169ec35bb3 Add a missing RequireCompleteType call when synthesizing properties. <rdar://problem/11333367>.
While I'm here, fix source locations for other diagnostics related to property synthesis.

llvm-svn: 155953
2012-05-01 22:26:06 +00:00
David Blaikie afd3d0ba40 Fix test cases broken by 155936.
llvm-svn: 155948
2012-05-01 21:29:03 +00:00
Ted Kremenek 124066c5cb Place several uncovered warnings under warning flags, and tweak diagnostic output including the term "gc" (in lowercase).
llvm-svn: 155892
2012-05-01 05:56:02 +00:00
Fariborz Jahanian 08a1eb77c5 with -Wdeprecated, include a note to its deprecated declaration
location. // rdar://10893232

llvm-svn: 155385
2012-04-23 20:30:52 +00:00
Fariborz Jahanian 344d65c248 objective-c arc: With currnt documentation,
objc_returns_inner_pointer attribute can be applied to
methods only. Diagnsose otherwise, instead of
crashing. // rdar://11253688

llvm-svn: 155245
2012-04-20 22:00:46 +00:00
Fariborz Jahanian d155c78d18 objective-arc: Retune my previous patch so warning
is issued on weak property as receiver and not on
any other use of a weak property. // rdar://10225276

llvm-svn: 155169
2012-04-19 23:49:39 +00:00
Fariborz Jahanian fce89c609d objective-c arc: Issue warning under -Wreceiver-is-weak
if receiver is a 'weak' property, by type or by attribute.
// rdar://10225276

llvm-svn: 155159
2012-04-19 21:44:57 +00:00
Patrick Beard 0caa39474b Implements boxed expressions for Objective-C. <rdar://problem/10194391>
llvm-svn: 155082
2012-04-19 00:25:12 +00:00
Fariborz Jahanian b525b52987 objective-c: Issue diagnostic when an implicit
property accessor (getter) missing, instead of crashing.
// rdar://11273060

llvm-svn: 155036
2012-04-18 19:13:23 +00:00
Fariborz Jahanian 29898f4565 objective-c modern translator: buildit objc bool
type for rewriter project will be BoolTy.
// rdar://11231426. 

llvm-svn: 154861
2012-04-16 21:03:30 +00:00
John McCall d239387098 When we're flagging a protected scope to prevent jumps into the
shadow of a block expression with non-trivial destructed cleanups,
we should flag that in the enclosing function, not in the block
that we're about to pop.

llvm-svn: 154646
2012-04-13 01:08:17 +00:00
Fariborz Jahanian e2b037d6ea objective-c literals: Issue warning and ignore
when BOOL is not of an intergal type when
boolean literals are used. // rdar://11231426

llvm-svn: 154619
2012-04-12 21:24:56 +00:00
Patrick Beard acfbe9e1f2 Added a new attribute, objc_root_class, which informs the compiler when a root class is intentionally declared.
The warning this inhibits, -Wobjc-root-class, is opt-in for now. However, all clang unit tests that would trigger
the warning have been updated to use -Wno-objc-root-class. <rdar://problem/7446698>

llvm-svn: 154187
2012-04-06 18:12:22 +00:00
Fariborz Jahanian c806b90717 objective-c: Don't warn when a category does not implement a method
declared in its adopted protocol when another category declares it  
because that category will implement it. // rdar://11186449

llvm-svn: 154132
2012-04-05 22:14:12 +00:00
Fariborz Jahanian 6bd2226037 objc-arc: provide a warning when 'receiver' of a message is 'weak'
in arc mode and opted-in with -Wreceiver-is-weak flag.
// rdar://10225276

llvm-svn: 154042
2012-04-04 20:05:25 +00:00
John McCall bc15335e58 Handle placeholder expressions in an ObjC for-collection loop.
The way we handle this implicitly removes the ability to use
property l-values in this position, but that's really okay.

llvm-svn: 153729
2012-03-30 05:43:39 +00:00
John McCall 67cd5e094e Forbid the block and lambda copy-capture of __autoreleasing variables
in ARC, under the usual reasoning limiting the use of __autoreleasing.

llvm-svn: 153725
2012-03-30 05:23:48 +00:00
Eli Friedman 410fc7ae89 Make sure we perform the relevant implied conversions correctly for ObjC methods with related result types. PR12384.
llvm-svn: 153716
2012-03-30 01:13:43 +00:00
Fariborz Jahanian e798ba4b67 Fix typo in my last patch.
llvm-svn: 153602
2012-03-28 21:13:53 +00:00
Fariborz Jahanian ba0afde486 objective-c: Improve diagnostics and
provide 'fixit' hint when dictionary index 
is not of proper type. // rdar://11062080

llvm-svn: 153584
2012-03-28 17:56:49 +00:00
Argyrios Kyrtzidis 822c433a27 Make sure we don't accept an @interface inside another objc container
just because there was an attribute in front of it.

llvm-svn: 153355
2012-03-23 23:24:23 +00:00
Ted Kremenek c08c475fe0 Support '%p' format specifier with block pointers.
llvm-svn: 152839
2012-03-15 21:22:27 +00:00
Argyrios Kyrtzidis 3b60cffa22 Fix crash at @implementation with a forward reference as base class.
rdar://11020003

llvm-svn: 152596
2012-03-13 01:09:36 +00:00
Richard Smith c5b0552055 Fix parsing of type-specifier-seq's. Types are syntactically allowed to be
defined here, but not semantically, so

  new struct S {};

is always ill-formed, even if there is a struct S in scope.

We also had a couple of bugs in ParseOptionalTypeSpecifier caused by it being
under-loved (due to it only being used in a few places) so merge it into
ParseDeclarationSpecifiers with a new DeclSpecContext. To avoid regressing, this
required improving ParseDeclarationSpecifiers' diagnostics in some cases. This
also required teaching ParseSpecifierQualifierList about constexpr... which
incidentally fixes an issue where we'd allow the constexpr specifier in other
bad places.

llvm-svn: 152549
2012-03-12 07:56:15 +00:00
Fariborz Jahanian c8a322a407 lldb support: under debugger support flag, when sending message
to forward class, and assigning to an 'id' type var, message
sends default to 'id'. // rdar"//10988847

llvm-svn: 152420
2012-03-09 18:47:16 +00:00
John McCall 85110b47c8 Don't crash when a statement in a block is ill-formed but
introduces cleanups anyway.

llvm-svn: 152345
2012-03-08 22:00:17 +00:00
Fariborz Jahanian d6cb4a858d objective-c lldb support: don't perform ivar access control check
when debugging. // rdar://10997647

llvm-svn: 152187
2012-03-07 00:58:41 +00:00
Ted Kremenek 5022f1dffe Fix horrific CFG bug where '@autoreleasepool' would be put in a dangling block in the CFG.
llvm-svn: 152163
2012-03-06 23:40:47 +00:00
Ted Kremenek e65b086e07 Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,
NSNumber, and boolean literals.  This includes both Sema and Codegen support.
Included is also support for new Objective-C container subscripting.

My apologies for the large patch.  It was very difficult to break apart.
The patch introduces changes to the driver as well to cause clang to link
in additional runtime support when needed to support the new language features.

Docs are forthcoming to document the implementation and behavior of these features.

llvm-svn: 152137
2012-03-06 20:05:56 +00:00
Fariborz Jahanian 7923ef41e1 objc: When issue diagnostic about deprecated method, also
issue the note if it is because message is sent to a forward class
declaration in delayed diagnostic. // rdar://10290322

llvm-svn: 151942
2012-03-02 21:50:02 +00:00
Argyrios Kyrtzidis 4af2cb3355 [Sema] Fix crash-on-invalid-code issue:
@class I;
@implementation I(cat) // crashes here
@end

rdar://10968158

llvm-svn: 151931
2012-03-02 19:14:29 +00:00
Ted Kremenek 05e916bc95 Fix regression from llvm-gcc where we should NOT emit a warning about __attribute__((NSObject)) on a property declaration. This is needed to have retain properties for non-object pointers. Fixes <rdar://problem/10930507>.
llvm-svn: 151786
2012-03-01 01:40:32 +00:00
Fariborz Jahanian 86c2f5cc70 objective-c: provide fixit hint when atomic property does not
have matching user defined setter/getter and a warning is issued. 
In this case, a fixit note is displayed. // rdar://10267155

llvm-svn: 151766
2012-02-29 22:18:55 +00:00
Ted Kremenek 59b10db2bc After numerous requests, have Objective-C 'method declared here' notes mention the actual method. This looks better within an IDE, where text isn't always regurgitated in the presentation of a warning. Fixes radar 10914035.
llvm-svn: 151579
2012-02-27 22:55:11 +00:00
Eli Friedman 8a78a58188 Improve the diagnostic in ARC mode when a conditional with an Objective-C type and void* is used. <rdar://problem/10486347>.
llvm-svn: 151416
2012-02-25 00:23:44 +00:00
Eli Friedman ec52f92db3 Handle "#pragma GCC visibility" in a few more places. Switch over "#pragma pack" to use the same handling that gcc does. Fixes <rdar://problem/10871094> and <rdar://problem/10893316>.
(Hopefully, common usage of these pragmas isn't irregular enough to break our current handling.  Doug has ideas for a more crazy approach if necessary.)

llvm-svn: 151307
2012-02-23 23:47:16 +00:00
Fariborz Jahanian 86f8266b9f objective-c++: Type of an objc string literal is NSString, not 'id'.
// rdar://10907410

llvm-svn: 151296
2012-02-23 22:51:36 +00:00
John McCall 24992371a5 Don't crash on attempts to synthesize an invalid property.
rdar://problem/10904479

llvm-svn: 151089
2012-02-21 21:48:05 +00:00
Jean-Daniel Dupas 58dab6829a When calling a non variadic format function(vprintf, vscanf, NSLogv, …), warn if the format string argument is a parameter that is not itself declared as a format string with compatible format.
llvm-svn: 151080
2012-02-21 20:00:53 +00:00
Ted Kremenek 084e1b48a1 Change wording of warning about using __bridge casts in non-ARC.
llvm-svn: 150868
2012-02-18 04:42:38 +00:00
Ted Kremenek 6eb25628c5 Revert r145999. This turned out to be a bad idea. Unfortunately, 'id' is used so profusely
in many APIs and large codebases that this made the deprecated warning trigger happy to
the point of not being useful.

llvm-svn: 150223
2012-02-10 02:45:47 +00:00
Fariborz Jahanian 29082a5f1d objc: If a method is not implemented in the category implementation but
has been declared in its primary class, superclass,
or in one of their protocols, no need to issue unimplemented method. 
// rdar://10823023

llvm-svn: 150206
2012-02-09 21:30:24 +00:00
John McCall 5ece54ce3f Only complain about __strong __strong id, not __strong SomeStrongTypedef
or __strong __typeof__(some.strong.thing).

llvm-svn: 150029
2012-02-08 00:46:41 +00:00
Argyrios Kyrtzidis b6c6a58366 Make parsing of objc @implementations more robust.
Parsing of @implementations was based on modifying global state from
the parser; the logic for late parsing of methods was spread in multiple places
making it difficult to have a robust error recovery.

  -it was difficult to ensure that we don't neglect parsing the lexed methods.
  -it was difficult to setup the original objc container context for parsing the lexed methods
   after completing ParseObjCAtImplementationDeclaration and returning to top level context.

Enhance parsing of @implementations by centralizing it in Parser::ParseObjCAtImplementationDeclaration().
ParseObjCAtImplementationDeclaration now returns only after an @implementation is fully parsed;
all the data and logic for late parsing of methods is now in one place.

This allows us to provide code-completion for late parsed methods with mis-matched braces.
rdar://10775381

llvm-svn: 149987
2012-02-07 16:50:53 +00:00
Eli Friedman 2beed114ba Fix a couple of nasty bugs involving negative enum constants. <rdar://problem/10760113>.
llvm-svn: 149965
2012-02-07 04:34:38 +00:00
Ted Kremenek d22b98aad2 Tweak format string checking to work with %@ and ObjC toll-free bridging. <rdar://problem/10814120>
llvm-svn: 149907
2012-02-06 21:45:29 +00:00
Fariborz Jahanian adfe905145 objc: fixes a problem in block type comparison involving
enums with underlying type explicitly specified
(feature which is on by default in objective-c). 
// rdar://10798770

llvm-svn: 149888
2012-02-06 19:06:20 +00:00
Sean Callanan 8870a32408 Fixed some testsuite problems introduced by my
last commit.  Sorry for the outage.

llvm-svn: 149744
2012-02-04 02:28:18 +00:00
Nico Weber d1928cb912 Revert r149721. chapuni tells me akyrtzi already fixed the test
by adding a triple, and the typedef makes things worse on windows.

llvm-svn: 149740
2012-02-04 01:50:30 +00:00
Sean Callanan 1ce3a6b650 Clang has existing support for debuggers that
want to provide "po"-like functionality which
treats the result of an expression implicitly as
"id" (if it is not otherwise known) and prints
it as an Objective-C object.

This has in the past been gated by the
"DebuggerSupport" language option, but that is
too general.  Debuggers also provide other commands
like "print" that do not make any assumptions
about whether the object is an Objective-C object.

This patch makes the assumption conditional on a
new language option: DebuggerCastResultToId.  I
have also made corresponding modifications to the
testsuite.

llvm-svn: 149735
2012-02-04 01:29:37 +00:00