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
Nico Weber
bf5e6442e7
Try to get test passing on windows.
...
Idea by Jean-Daniel Dupas.
llvm-svn: 149721
2012-02-03 23:36:13 +00:00
Argyrios Kyrtzidis
e340deedbf
Add a triple to test/SemaObjC/format-strings-objc.m to make it pass in windows hosts.
...
llvm-svn: 149696
2012-02-03 17:13:43 +00:00
Ted Kremenek
60bbeb345b
Further downgrade -Warc-bridge-casts-disallowed-in-nonarc to a warning (not mapped to an error). We can consider mapping it back to an error later.
...
llvm-svn: 149670
2012-02-03 05:01:51 +00:00
Ted Kremenek
172039a89c
Make error about using bridge casts in non-ARC mode a warning that is default mapped to an error. This is to ease the transition of large apps moving from non-ARC to ARC.
...
llvm-svn: 149659
2012-02-03 01:30:34 +00:00
Fariborz Jahanian
c934de67e0
objc: Issue diagnostic when receiver type is a forward class declaration and
...
it is treated as of 'id' type resulting in multiple method lookup.
// rdar://10686120
llvm-svn: 149653
2012-02-03 01:02:44 +00:00
Fariborz Jahanian
6a73384b53
objective-c: When redeclaraing in continuation class a 'readonly'
...
property to 'readwrite', also allow redeclaration of
property type to a narrowring object type.
// rdar://10790488
llvm-svn: 149614
2012-02-02 18:54:58 +00:00
Fariborz Jahanian
17612b1dbf
objc: don't crash if primary class is missing and continuation class
...
is declaring ivars. // rdar://10752081
llvm-svn: 149573
2012-02-02 00:49:12 +00:00
Fariborz Jahanian
ccded6e447
objc2: add __has_feature(objc_default_synthesize_properties).
...
// rdar://10770497
llvm-svn: 149565
2012-02-02 00:15:51 +00:00
Fariborz Jahanian
30febeb224
Look for declaration of CFBridgingRetain/CFBridgingRetain before
...
changing the diagnostic. Also use correct spelling for both.
llvm-svn: 149554
2012-02-01 22:56:20 +00:00
Fariborz Jahanian
bcdc282d85
objc-arc: In various diagnostics mention
...
CFBridgingRetain/CFBridgingRelease calls instead
of __bridge_retained/__bridge_transfer casts as preferred
way of moving cf objects to arc land. // rdar://10207950
llvm-svn: 149449
2012-01-31 23:42:37 +00:00
Nico Weber
496cdc2cb7
Let %S, %ls, %C match 16bit types in NSStrings.
...
As discussed at http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120130/052200.html
llvm-svn: 149325
2012-01-31 01:43:25 +00:00
Jean-Daniel Dupas
537aa1ac68
Disable "non literal format string" for NSString that result from a macro expansion.
...
This is to prevent diagnostic when using NSLocalizedString or CFCopyLocalizedString
macros which are usually used in place of NS and CF strings literals.
llvm-svn: 149268
2012-01-30 19:46:17 +00:00
Jean-Daniel Dupas
028573e794
Update on format attribute handling.
...
- Remove the printf0 special handling as we treat it as printf anyway.
- Perform basic checks (non-literal, empty) for all formats and not only printf/scanf.
llvm-svn: 149236
2012-01-30 08:46:47 +00:00
Jean-Daniel Dupas
400dd1c3d0
Remove the "C" in "implicitly declaring C library function" diagnostic
...
because all functions are not C functions (i.e. NSLog).
llvm-svn: 149150
2012-01-27 23:21:02 +00:00
John McCall
18a962bab5
Don't suppress access-control or invalid-type diagnostics from a
...
declarator just because we were able to build an invalid decl
for it. The invalid-type diagnostics, in particular, are still useful
to know, and may indicate something about why the decl is invalid.
Also, recover from an illegal pointer/reference-to-unqualified-retainable
type using __strong instead of __autoreleasing; in general, a random
object is much more likely to be __strong, so this avoids unnecessary
cascading errors in the most common case.
llvm-svn: 149074
2012-01-26 20:04:03 +00:00
Fariborz Jahanian
194904e499
objc: 'id' and block pointer compare in mergeTypes is
...
made symmetrical. // rdar://10734265
llvm-svn: 149065
2012-01-26 17:08:50 +00:00
Fariborz Jahanian
26d8371b07
objc: allow block pointer matching 'id' type when
...
they show up as argument types of two block pointers.
// rdar://10734265
llvm-svn: 149007
2012-01-26 00:45:38 +00:00
Jean-Daniel Dupas
d5f7ef48e2
Add support for const pointer to literal-objc string as format attribute.
...
llvm-svn: 148948
2012-01-25 10:35:33 +00:00
Jean-Daniel Dupas
9aa95b16e1
Fix test on cygwin (where va_list expands to a different type)
...
llvm-svn: 148892
2012-01-25 01:02:26 +00:00
Ted Kremenek
9b1f3d46d0
Fix NSLog format string checking for %@.
...
llvm-svn: 148885
2012-01-25 00:04:09 +00:00
Jean-Daniel Dupas
78536ae5b5
Replace a hack to handle NSLog/NSLogv in sema by declaring them as Library Builtins.
...
llvm-svn: 148873
2012-01-24 22:32:46 +00:00
Jean-Daniel Dupas
5778cb8e06
Remove trailing slash in front of header name of ObjC builtins.
...
llvm-svn: 148872
2012-01-24 22:29:27 +00:00
Fariborz Jahanian
e2a7776eff
objc: Issue a generic diagnostic assigning to
...
an objc object in any abi mode.
llvm-svn: 148847
2012-01-24 19:40:13 +00:00
Fariborz Jahanian
04c4455dd4
objective-c: Ignore with warning forward class declaration whose name
...
matches a typedef declaring an object type. // rdar://10733000
llvm-svn: 148760
2012-01-24 00:40:15 +00:00
Ted Kremenek
e7b9d4342b
Tighten format string diagnostic and make it a bit clearer (and a bit closer to GCC's).
...
llvm-svn: 148579
2012-01-20 21:52:58 +00:00
Fariborz Jahanian
28324b0066
objc: deprecate direct usage of 'isa' of objc objects
...
in favor of usage of api's intended for.
// rdar://8290002
llvm-svn: 148404
2012-01-18 19:08:56 +00:00
Fariborz Jahanian
c72a807039
objc-arc: when 'assign' attribute is unspecified,
...
rely on property's type for its life-time to avoid
bogus warning with -Warc-unsafe-retained-assign.
// rdar://10694932
llvm-svn: 148355
2012-01-17 22:58:16 +00:00
Bob Wilson
206e2302eb
Disable -Wduplicate-method-match by default. <rdar://problem/10663536>
...
llvm-svn: 148343
2012-01-17 22:24:32 +00:00
Jean-Daniel Dupas
0ae6e671cc
Fix a couples of issues in format strings checking.
...
PR 10274: format function attribute with the NSString archetype yields no compiler warnings
PR 10275: format function attribute isn't checked in Objective-C methods
llvm-svn: 148324
2012-01-17 20:03:31 +00:00
Fariborz Jahanian
9d7cf2baaf
objc: fixes a bug where struct used inside an
...
objc class was not being exported to parent decl
context resulting in bogus mismatch warning later on.
// rdar://10655530
llvm-svn: 148320
2012-01-17 18:52:07 +00:00
Fariborz Jahanian
52d02f68e5
objc: disallow __block attribute on method params.
...
llvm-svn: 148197
2012-01-14 18:44:35 +00:00
Fariborz Jahanian
372030b2a1
objc parsing. Fixes a crash when parsing array initialization
...
inside a class implementation with parse errors. // rdar://10633434
llvm-svn: 148074
2012-01-13 00:14:12 +00:00
Fariborz Jahanian
e74d47ed03
objc: do not warn when converting to a const id qualfied by its
...
list of protools. // rdar://10669694
llvm-svn: 148051
2012-01-12 22:12:08 +00:00
Fariborz Jahanian
4f8cb1e83a
objective-c: fixes a regression in looking up names
...
in class extensions and categories by recent refactoring
of objc class ASTs. // rdar://1066654
llvm-svn: 147982
2012-01-12 00:18:35 +00:00
Fariborz Jahanian
39ba639f9d
objc-arc: evaluate 'readonly' property with no known
...
life-time to that of its backing 'ivar's lifetime.
// rdar://10558871
llvm-svn: 147956
2012-01-11 18:26:06 +00:00
John McCall
9b80c2186f
Do placeholder conversions on array bounds in both declarators and
...
new-expressions.
llvm-svn: 147900
2012-01-11 00:14:46 +00:00
Fariborz Jahanian
edbc345170
objc-arc: fixes a crash when trying to find out retaining cycle
...
ownership of property sent to 'super'. // rdar://10640891
llvm-svn: 147868
2012-01-10 19:28:26 +00:00