Fariborz Jahanian
40efc0feb4
Fix a crash when overloading id with objc_object*.
...
Radar 8400356.
llvm-svn: 113397
2010-09-08 20:08:18 +00:00
Chris Lattner
938cebc076
"const id<NSFoo> *" instead of "id<NSFoo> const *".
...
I think this wraps up all the legal cases.
llvm-svn: 113096
2010-09-05 00:43:21 +00:00
Chris Lattner
24b89469ac
'const std::type_info*' instead of 'std::type_info const*'
...
llvm-svn: 113092
2010-09-05 00:17:29 +00:00
Chris Lattner
53fa04909c
make clang print types as "const int *" instead of "int const*",
...
which is should have done from the beginning. As usual, the most
fun with this sort of change is updating all the testcases.
llvm-svn: 113090
2010-09-05 00:04:01 +00:00
Chris Lattner
0073962025
when emitting an error about a missing } in a compound statement, emit
...
a "to match this {" note, pointing out the opener.
llvm-svn: 112709
2010-09-01 15:49:26 +00:00
Eric Christopher
52d5ec11cc
Fix typo in error message and testcase.
...
llvm-svn: 112115
2010-08-25 23:45:44 +00:00
Fariborz Jahanian
54d75f6925
No need to default synthesize property if implementation
...
has its own getter and setter methods declared.
Fixed 8349319 (nonfragile-abi2).
llvm-svn: 112003
2010-08-25 00:31:58 +00:00
Fariborz Jahanian
76b35379f5
Fix a bug in nonfragile-abi2 when attempting to diagnose
...
previous use of a synthesized 'ivar' with property of same name
declared as @dynamic. In this case, 'ivar' is in the
inherited class and no diagnostics should be issued.
llvm-svn: 111940
2010-08-24 18:48:05 +00:00
Fariborz Jahanian
9d7d3d84ac
Diagnose if type of iboutletcollection attribute is a builtin type.
...
llvm-svn: 111324
2010-08-17 23:19:16 +00:00
Fariborz Jahanian
798f83239c
Diagnose use of iboutletcollection on ivar/property
...
of non-object types. Radar 8308053.
llvm-svn: 111296
2010-08-17 21:39:27 +00:00
Fariborz Jahanian
b5d59b66c2
Patch to add type parameter support for attribute iboutletcollection.
...
Radar 8308053.
llvm-svn: 111275
2010-08-17 20:23:12 +00:00
Fariborz Jahanian
99311ba1a8
Diagnose assiging to an interface object in
...
non-fragile abi mode as sizes are not statically known.
Fixes radar 8315734.
llvm-svn: 111191
2010-08-16 21:51:12 +00:00
Fariborz Jahanian
18d90a97df
When issuing warning for future conflict resolution,
...
(nonfragile-abi2), do not consider 'ivar' access
in class methods. Also, improve on diagnostics.
Radar 8304561.
llvm-svn: 111023
2010-08-13 18:09:39 +00:00
Fariborz Jahanian
753783a062
Fixes block type matching bug. Radar 8302845.
...
llvm-svn: 110950
2010-08-12 20:46:12 +00:00
Douglas Gregor
62157e5342
Downgrade error about nonnull attribute bbeing applied to a function without point arguments to a warning
...
llvm-svn: 110939
2010-08-12 18:48:43 +00:00
Fariborz Jahanian
0bce17e572
Change text of diagnostics on user request.
...
radar 7948654.
llvm-svn: 110857
2010-08-11 21:22:15 +00:00
Fariborz Jahanian
d539d098a4
IRGen support for functions returning objc object
...
types. Fixes PR7865.
llvm-svn: 110832
2010-08-11 17:37:35 +00:00
Fariborz Jahanian
32e59ba01d
Fix a spurious warning when message sent to qualified-id
...
type receiver (pr7861).
llvm-svn: 110696
2010-08-10 18:10:50 +00:00
Fariborz Jahanian
3337b2e8dd
Implements gcc's -Wstrict-selector-match.
...
(radar 8127244).
llvm-svn: 110622
2010-08-09 23:27:58 +00:00
Fariborz Jahanian
ec43022b99
Warn if class object does not implement qualified
...
id's protocols. Fixes radar 8154220.
llvm-svn: 110583
2010-08-09 18:21:43 +00:00
Douglas Gregor
114e55df5b
Fix an Objective-C crasher, PR7839.
...
llvm-svn: 110515
2010-08-07 12:29:18 +00:00
Fariborz Jahanian
7b70eb4bb1
Tighten the rules when deciding if an ivar must be
...
auto-synthesized (nonfragile-abi2 specific).
Fixes radar 8251648.
llvm-svn: 109866
2010-07-30 16:59:05 +00:00
Ted Kremenek
28e1c9155e
Don't print out ivars twice in Decl::print(). Fixes <rdar://problem/8253668>.
...
llvm-svn: 109833
2010-07-30 00:47:46 +00:00
Fariborz Jahanian
c15dfd8a87
Tigthen the condition for issung ivar shadowing
...
variables to those in file scope (nonfragile-abi2).
Fixes radar 8248681.
llvm-svn: 109758
2010-07-29 16:53:53 +00:00
Fariborz Jahanian
86151343b4
Warn when property ivar lookup finds a global variable
...
of same name. In nonfragile-abi2, lookup accesses a synthesized
ivar. This is a transition warning. Radar 8225011.
llvm-svn: 109197
2010-07-22 23:33:21 +00:00
Ted Kremenek
1ddd6d2b6b
Upgrade "'X' is unavailable" from a warning to an error. This matches GCC's behavior. Note that
...
GCC emits a warning instead of an error when using an unavailable Objective-C protocol, so now
Clang's behavior is more strict in this case, but more consistent. We will need to see how much
this fires on real code and determine whether this case should be downgraded to a warning.
Fixes <rdar://problem/8213093>.
llvm-svn: 109033
2010-07-21 20:43:11 +00:00
Fariborz Jahanian
3c7ebc3a5e
Patch to type match comparing Objective-C Classes which implement
...
protocols (Radar 8191774).
llvm-svn: 108758
2010-07-19 22:02:22 +00:00
Fariborz Jahanian
2a36089eef
Categories cannot synthesize property ivars,
...
and a minor cleanup.
llvm-svn: 108707
2010-07-19 16:14:33 +00:00
Fariborz Jahanian
6a06144021
Another test case for on demand synthesis of ivars.
...
llvm-svn: 108600
2010-07-17 01:16:59 +00:00
Fariborz Jahanian
18722981e2
Patch to synthesize property ivars on demand as
...
part of the new property synthesis by default.
wip.
llvm-svn: 108599
2010-07-17 00:59:30 +00:00
Fariborz Jahanian
56a9d54de8
Don't error when doing default property synthesis
...
and some are already synthesized by user declaration.
llvm-svn: 108341
2010-07-14 18:11:52 +00:00
Fariborz Jahanian
c0b0ced477
Consider obective-c pointer arguments as valid sentinel args
...
as well. Fixes radar 7975788.
llvm-svn: 108333
2010-07-14 16:37:51 +00:00
Fariborz Jahanian
5848d333b4
Check on property attributes which are declared
...
in class extensions (radar 8171968).
llvm-svn: 108283
2010-07-13 22:04:56 +00:00
Ted Kremenek
3f1240b614
Add test case for <rdar://problem/4289832>. Clang actuallys gets
...
the test case right (for the noreturn warning) because the CFG
doesn't support @try yet, but the test case is now present when
we do properly implement CFG support for @try...@catch.
llvm-svn: 107203
2010-06-29 20:25:42 +00:00
Fariborz Jahanian
66f9a6560e
This patch fixes a bug whereby, clang skipped
...
unimplemented property warning for properties
coming from class's conformin protocol. It also
simplifies the algorithm in the process.
Fixes radar 8035776.
llvm-svn: 107174
2010-06-29 18:12:32 +00:00
Fariborz Jahanian
3bf0ded346
Patch to provide separate ASTs for multiple ObjC class extension
...
declarations (implements radar 7928731).
llvm-svn: 106597
2010-06-22 23:20:40 +00:00
Ted Kremenek
64c235e4c6
Extend format string type-checking to include '%p'. Fixes remaining cases PR 4468.
...
llvm-svn: 106151
2010-06-16 21:23:04 +00:00
Fariborz Jahanian
5981b04718
Clang missing warning about conflicting declaration vs. definition
...
for variable arguments list methods. (radar 8006060).
llvm-svn: 104407
2010-05-21 23:28:58 +00:00
Fariborz Jahanian
9f963c2488
Misc. fixes to bring Objetive-C++'s handling of
...
gc attributes to be inline with Objective-C
(for radar 7925141).
llvm-svn: 104084
2010-05-18 23:04:17 +00:00
Fariborz Jahanian
87b915a9bc
These test now run in objective-c++ mode we well.
...
llvm-svn: 104041
2010-05-18 18:24:06 +00:00
Douglas Gregor
3f324d569b
Diagnose unused exception parameters under a different warning group
...
(-Wunused-exception-parameter) than normal variables, since it's more
common to name and then ignore an exception parameter. This warning is
neither enabled by default nor by -Wall. Fixes <rdar://problem/7931045>.
llvm-svn: 102931
2010-05-03 18:51:14 +00:00
Douglas Gregor
50ec46d4af
Complain when we try to initialize an object of Objective-C class type
...
(which is ill-formed) with an initializer list. Also, change the
fallback from an assertion to a generic error message, which is far
friendlier. Fixes <rdar://problem/7730948>.
llvm-svn: 102930
2010-05-03 18:24:37 +00:00
Fariborz Jahanian
58f11d6245
Do not issue warning on unimplemented property in the class, if it
...
conforms to a protocol as one of its super classes does. This is because
conforming super class will implement the property. This implements
new warning rules for unimplemented properties (radar 7884086).
llvm-svn: 102919
2010-05-03 15:49:20 +00:00
Fariborz Jahanian
9e1a3af030
Properties cannot be synthesized by-dafult in
...
categories. Issue usual warnings instead of
confusing error message. Radar 7920807
llvm-svn: 102645
2010-04-29 17:52:18 +00:00
Chris Lattner
8f68b777e2
wordsmith an objc warning, rdar://7900756
...
llvm-svn: 102388
2010-04-26 21:44:01 +00:00
Douglas Gregor
f356419bf5
Refactor Objective-C @catch parameter checking by detangling it from
...
function-parameter checking and splitting it into the normal
ActOn*/Build* pair in Sema. We now use VarDecl to represent the @catch
parameter rather than the ill-fitting ParmVarDecl.
llvm-svn: 102347
2010-04-26 17:32:49 +00:00
Fariborz Jahanian
f9b52d5f63
Improve on my previous diagnostics: per Doug's comment.
...
llvm-svn: 102190
2010-04-23 17:52:02 +00:00
Fariborz Jahanian
e459686aac
Trying to improve on a diagnostics for properties.
...
llvm-svn: 102187
2010-04-23 17:22:07 +00:00
Anders Carlsson
58e24a8fd8
Change the 'declared at' diagnostic to say 'declared here'.
...
llvm-svn: 102163
2010-04-23 02:20:12 +00:00
Douglas Gregor
4f4946aaaa
Whenever we complain about a failed initialization of a function or
...
method parameter, provide a note pointing at the parameter itself so
the user does not have to manually look for the function/method being
called and match up parameters to arguments. For example, we now get:
t.c:4:5: warning: incompatible pointer types passing 'long *' to
parameter of
type 'int *' [-pedantic]
f(long_ptr);
^~~~~~~~
t.c:1:13: note: passing argument to parameter 'x' here
void f(int *x);
^
llvm-svn: 102038
2010-04-22 00:20:18 +00:00
Douglas Gregor
0c78ad9665
Rework the Parser-Sema interaction for Objective-C message
...
sends. Major changes include:
- Expanded the interface from two actions (ActOnInstanceMessage,
ActOnClassMessage), where ActOnClassMessage also handled sends to
"super" by checking whether the identifier was "super", to three
actions (ActOnInstanceMessage, ActOnClassMessage,
ActOnSuperMessage). Code completion has the same changes.
- The parser now resolves the type to which we are sending a class
message, so ActOnClassMessage now accepts a TypeTy* (rather than
an IdentifierInfo *). This opens the door to more interesting
types (for Objective-C++ support).
- Split ActOnInstanceMessage and ActOnClassMessage into parser
action functions (with their original names) and semantic
functions (BuildInstanceMessage and BuildClassMessage,
respectively). At present, this split is onyl used by
ActOnSuperMessage, which decides which kind of super message it
has and forwards to the appropriate Build*Message. In the future,
Build*Message will be used by template instantiation.
- Use getObjCMessageKind() within the disambiguation of Objective-C
message sends vs. array designators.
Two notes about substandard bits in this patch:
- There is some redundancy in the code in ParseObjCMessageExpr and
ParseInitializerWithPotentialDesignator; this will be addressed
shortly by centralizing the mapping from identifiers to type names
for the message receiver.
- There is some #if 0'd code that won't likely ever be used---it
handles the use of 'super' in methods whose class does not have a
superclass---but could be used to model GCC's behavior more
closely. This code will die in my next check-in, but I want it in
Subversion.
llvm-svn: 102021
2010-04-21 19:57:20 +00:00
Fariborz Jahanian
422cb21862
Improve on source location of diagnostic when default
...
property synthesis is using a super class ivar.
llvm-svn: 102011
2010-04-21 18:57:20 +00:00
Ted Kremenek
15a81e59ca
Fix crash on invalid code where a @throw statement is not followed by a ';'
...
llvm-svn: 101941
2010-04-20 21:21:51 +00:00
Fariborz Jahanian
877aaa9706
Patch to support transparent_union types on
...
objective-c methods. Fixes radar 7875968.
llvm-svn: 101935
2010-04-20 20:28:15 +00:00
Douglas Gregor
26380d493b
More tests for Objective-C-related name lookup weirdness. Yes, it's
...
weird; yes, it's what GCC does. Almost.
llvm-svn: 101803
2010-04-19 19:10:40 +00:00
Ted Kremenek
36712b2ac1
Allow the 'ibaction' attribute to be attached to method declarations (and not issue a warning).
...
llvm-svn: 101699
2010-04-18 04:59:38 +00:00
Anders Carlsson
7a4a25de1e
Improve the bit-field too wide error message.
...
llvm-svn: 101384
2010-04-15 18:47:32 +00:00
Fariborz Jahanian
b5795c01c4
Fix a -pedantic spurious warning involving @dynamic.
...
llvm-svn: 101284
2010-04-14 20:52:42 +00:00
Chris Lattner
5ff40fc7ab
tighten the check for cast of super to avoid rejecting valid code,
...
rdar://7853261
llvm-svn: 101048
2010-04-12 17:09:27 +00:00
Chris Lattner
08e774b7ef
fix rdar://7852959 - Use of super within a block is actually ok.
...
(aka, Fariborz was right ;-)
llvm-svn: 101046
2010-04-12 17:03:29 +00:00
Chris Lattner
3adb17d44f
fix a bug I noticed by inspection, correcting two reject-valid bugs.
...
llvm-svn: 101026
2010-04-12 06:36:00 +00:00
Chris Lattner
3ab8ca2894
fix a rejects-valid bug that I introduced, pointed out
...
by David Chisnall
llvm-svn: 101024
2010-04-12 06:27:57 +00:00
Chris Lattner
cd963185f0
fix a rejects-valid testcase involving super that I dreamt up.
...
This also fixes cases where super is used in a block in a
method which isn't valid.
llvm-svn: 101021
2010-04-12 06:20:33 +00:00
Chris Lattner
c2ebb03297
Have the parser decide whether a message to super is a variable or
...
type, instead of having sema do it.
llvm-svn: 101016
2010-04-12 05:38:43 +00:00
Chris Lattner
6033be79b3
avoid double negatives
...
llvm-svn: 100976
2010-04-11 18:53:08 +00:00
Chris Lattner
a36ec4243b
fix PR6811 by not parsing 'super' as a magic expression in
...
LookupInObjCMethod. Doing so allows all sorts of invalid code
to slip through to codegen. This patch does not change the
AST representation of super, though that would now be a natural
thing to do since it can only be in the receiver position and
in the base of a ObjCPropertyRefExpr.
There are still several ugly areas handling super in the parser,
but this is definitely a step in the right direction.
llvm-svn: 100959
2010-04-11 08:28:14 +00:00
Chris Lattner
00dcffded1
fix a problem causing us to lose the ''s around objc interface names
...
in a diagnostic.
llvm-svn: 100956
2010-04-11 07:04:01 +00:00
Douglas Gregor
b10646d4ce
Improve diagnostics like "initializing <type> from an expression of
...
type..." with "initializing <type> with an expression of type...",
which reads better. Thanks to John for the improved wording.
llvm-svn: 100873
2010-04-09 17:53:29 +00:00
Douglas Gregor
c68e140657
Improve diagnostics when we fail to convert from a source type to a
...
destination type for initialization, assignment, parameter-passing,
etc. The main issue fixed here is that we used rather confusing
wording for diagnostics such as
t.c:2:9: warning: initializing 'char const [2]' discards qualifiers,
expected 'char *' [-pedantic]
char *name = __func__;
^ ~~~~~~~~
We're not initializing a 'char const [2]', we're initializing a 'char
*' with an expression of type 'char const [2]'. Similar problems
existed for other diagnostics in this area, so I've normalized them all
with more precise descriptive text to say what we're
initializing/converting/assigning/etc. from and to. The warning for
the code above is now:
t.c:2:9: warning: initializing 'char *' from an expression of type
'char const [2]' discards qualifiers [-pedantic]
char *name = __func__;
^ ~~~~~~~~
Fixes <rdar://problem/7447179>.
llvm-svn: 100832
2010-04-09 00:35:39 +00:00
Douglas Gregor
f19ac0ede9
Downgrade the "declaration does not declare anything" error to a
...
warning. It's not harmful to have such pointless declarations, and GCC
does not diagnose this issue consistently.
llvm-svn: 100814
2010-04-08 21:33:23 +00:00
Ted Kremenek
5c7f596b4c
Match GCC's behavior and do not include '-Wunused-parameter' in '-Wunused'.
...
llvm-svn: 100810
2010-04-08 21:10:56 +00:00
Fariborz Jahanian
60462098d4
Patch to implement gcc's cstyle arguments in objc
...
methods. wip.
llvm-svn: 100734
2010-04-08 00:30:06 +00:00
Fariborz Jahanian
ea7a133775
Improve on diagnostics when an objc class is used as
...
a stand-alone type declaration.
llvm-svn: 100588
2010-04-07 00:22:00 +00:00
Fariborz Jahanian
b2c1aac544
default access for synthesize ivar is @protect.
...
Fixes radar 7823675.
llvm-svn: 100582
2010-04-06 23:36:17 +00:00
Fariborz Jahanian
6a0a2e0ccc
Patch to not build ivar ASTs when they are ilegally
...
declared in categories.
llvm-svn: 100577
2010-04-06 22:43:48 +00:00
Fariborz Jahanian
440a6832c5
Put type restriction on convesion to nonconforming 'id' back in
...
block pointer type comparison.
llvm-svn: 100533
2010-04-06 17:23:39 +00:00
Fariborz Jahanian
e16cdb407a
diagnose declaring class extension after its implementation
...
(radar 7822210).
llvm-svn: 100226
2010-04-02 20:53:05 +00:00
Fariborz Jahanian
a9f8675e02
Diagnose invalid code with -fobjc-nonfragile-abi2 when
...
property is being accessed without the dot-syntax notation.
(radar 7822344).
llvm-svn: 100212
2010-04-02 20:09:24 +00:00
Fariborz Jahanian
d603b54c55
Relax the typesafty rules of block pointers types which
...
take'id' or return 'id' in their type. Fixes radar 7814131.
llvm-svn: 100129
2010-04-01 19:50:22 +00:00
Fariborz Jahanian
c1fb862fda
Patch implements gcc's -Wno-protocol option to suppress warning
...
on unimplemented methods in protocols adopted by a class.
(radar 7056600).
llvm-svn: 100028
2010-03-31 18:23:33 +00:00
Fariborz Jahanian
df58603c26
Recognize __attribute__((NSObject)) directly applied
...
on retain properties. (radar 7809468).
llvm-svn: 99951
2010-03-30 22:40:11 +00:00
Fariborz Jahanian
5cab26d058
Add Support for 'warn_unused_result" attribute on
...
objective-c methods. (radar 7418262).
llvm-svn: 99903
2010-03-30 18:22:15 +00:00
Fariborz Jahanian
2e8074bfc3
Further improvement to point to category
...
whose protocolls methods needs implementation.
llvm-svn: 99730
2010-03-27 21:10:05 +00:00
Fariborz Jahanian
97752f7c95
Improve diagnostics on incomplete implementation
...
of objc classes; including which methods
need be implemented and where they come from.
WIP.
llvm-svn: 99724
2010-03-27 19:02:17 +00:00
Fariborz Jahanian
9b37b1d6bb
Allow conversion of qualified Class type to unqualified
...
Class type to match gcc's. Fixes radar 7789113.
llvm-svn: 99425
2010-03-24 21:00:27 +00:00
Fariborz Jahanian
c5b7bfc657
Improve diagnostics when ivar added to class
...
extension (radar 6812436).
llvm-svn: 99408
2010-03-24 18:08:23 +00:00
Ted Kremenek
5921b83f54
Improve diagnostic for @property/ivar type mismatch by including the types of the
...
ivar and @property respectively.
llvm-svn: 99312
2010-03-23 19:02:22 +00:00
Fariborz Jahanian
00c291b012
Set the relevent attributes declared in class extension
...
and fix a missing diagnostics on assigning to a read-only
property. Fixes radar 7766184.
llvm-svn: 99230
2010-03-22 23:25:52 +00:00
Fariborz Jahanian
cf711fb353
Diagnose miuse of property dot-syntax instead of crashing.
...
(radar 7634653).
llvm-svn: 99210
2010-03-22 21:02:34 +00:00
Fariborz Jahanian
a9effb55f3
Fixes access rues for ivars declared in class
...
implementations (radar 7547942).
llvm-svn: 99198
2010-03-22 19:04:14 +00:00
Rafael Espindola
568586ff22
Fix PR6618.
...
If a struct has an invalid field, mark it as invalid. Also avoid producing
errors about incomplete types that are invalid.
llvm-svn: 99150
2010-03-21 22:56:43 +00:00
Fariborz Jahanian
5140920a48
More coherent diagnostics when ivar is placed n categories.
...
(related to radar 7538989).
llvm-svn: 98993
2010-03-19 21:25:51 +00:00
Fariborz Jahanian
d5bb8cb348
Diagnose conversion of 'Class' to/from objective-c
...
object pointer types.
Fixes radar 7634850.
llvm-svn: 98970
2010-03-19 18:06:10 +00:00
Ted Kremenek
361ffd947c
Make PredefinedExpr::ComputeName() more robust to incorrect
...
code when we are printing the name of an Objective-C method
whose class has not been declared. Fixes <rdar://problem/7495713>.
llvm-svn: 98874
2010-03-18 21:23:08 +00:00
Fariborz Jahanian
8342e5776e
Some cleanup, change diagnostic when assigning to
...
a property which is not lvalue.
llvm-svn: 98848
2010-03-18 18:50:41 +00:00
Fariborz Jahanian
b8b0ea330c
objective-c patch to provide type safty when blocks are passing or
...
returning objc objects. There will be a corresponding objective-c++
patch soon.
llvm-svn: 98696
2010-03-17 00:20:01 +00:00
Ted Kremenek
e01bec9791
Add 'expected-note'
...
llvm-svn: 98560
2010-03-15 18:47:29 +00:00
Ted Kremenek
679708ee34
Correctly determine if the @property has been previously declared. If
...
a property has the same name as the ivar it wraps then the old logic
wouldn't find the previous property declaration.
llvm-svn: 98559
2010-03-15 18:47:25 +00:00
John McCall
c33dec3664
Add support for -Wwrite-strings. Patch by Mike M! Fixes PR 4804.
...
llvm-svn: 98541
2010-03-15 10:54:44 +00:00
Douglas Gregor
6cf3f3c75e
Statement expressions can be used in global- or namespace-scoped blocks
...
llvm-svn: 98135
2010-03-10 04:54:39 +00:00
Fariborz Jahanian
c4813e8d02
Don't error when a block pointer is passed to a
...
vararg functions/methods. Fixes radar 7725203.
llvm-svn: 98070
2010-03-09 18:34:52 +00:00
Ted Kremenek
a00c5db1a8
Augment __has_feature to report that Clang supports adding attribute 'unused'
...
to an Objective-C instance variable.
llvm-svn: 97850
2010-03-05 22:43:32 +00:00
Fariborz Jahanian
d2bccafe82
Patch to build qualifier on objective-c
...
pointer types. Fixes radar 7626768.
llvm-svn: 97847
2010-03-05 22:42:55 +00:00
Ted Kremenek
09597b461d
Fix crasher caused by setting a bit in a possibly empty bitvector while
...
doing printf format string checking. This is a recent regression.
llvm-svn: 97318
2010-02-27 08:34:51 +00:00
Fariborz Jahanian
8e3b9db27f
Forgot to include nested protocols in collection, resulting in
...
bogus warning. Fixes radar 7682116.
llvm-svn: 97157
2010-02-25 18:24:33 +00:00
Ted Kremenek
6bf658abef
Allow __attribute__((unused)) to be applied to ObjC ivars.
...
llvm-svn: 97103
2010-02-25 03:26:51 +00:00
Fariborz Jahanian
545643c309
More Sema check for ivars in class continuation.
...
llvm-svn: 97002
2010-02-23 23:41:11 +00:00
Ted Kremenek
514ff70d04
Fix another crash on invalid code. In this case, handle ObjC categories (with no names)
...
that refer to an undefined class.
llvm-svn: 96976
2010-02-23 19:39:46 +00:00
Fariborz Jahanian
404dc425bc
A test case for property synthesis using ivar in class extensions.
...
llvm-svn: 96968
2010-02-23 18:50:01 +00:00
Fariborz Jahanian
afe1386ed9
More support for ivars in class extension.
...
llvm-svn: 96850
2010-02-23 01:26:30 +00:00
Ted Kremenek
2fb89539f7
Clang really intends to reject attribute 'warn_unused_result' on Objective-C methods, but
...
instead it crashes on them. We might extend this attribute to work on methods, but for
now fix the crasher. Addresses <rdar://problem/7670939>.
llvm-svn: 96723
2010-02-21 05:15:32 +00:00
Fariborz Jahanian
34e3cef483
Start supporting declaration of ivars in @implementation
...
blocks. WIP.
llvm-svn: 96696
2010-02-19 20:58:54 +00:00
Fariborz Jahanian
c5d61df0a9
Issue extended diagnostic when property dot-syntax is used and
...
there is a setter but no getter (part of radar 7664555).
llvm-svn: 96687
2010-02-19 18:30:30 +00:00
Fariborz Jahanian
20912d644a
Allow for declaration and use of ivars in a stand-alone
...
implementation (toward radar 7547942).
llvm-svn: 96479
2010-02-17 17:00:07 +00:00
Fariborz Jahanian
30a42923d3
Class continuation now has its own property ast for
...
those declared in it. This is to allow duplicate
property diagnostics for properties declared in class extensions
multiple times (radar 7629420) and for future use.
llvm-svn: 96276
2010-02-15 21:55:26 +00:00
Fariborz Jahanian
dc68f9539c
Patch to fix a warning which exposed a bug in building
...
a qualified objective-c pointer type. Fixes radar 7638810.
(Also removes a FIXME).
llvm-svn: 96003
2010-02-12 19:27:33 +00:00
Fariborz Jahanian
13b9782cc0
Diagnose when user provided getter is being used as lvalue
...
using property dot-syntax. Fixes radar 7628953.
llvm-svn: 95838
2010-02-11 01:11:34 +00:00
Fariborz Jahanian
113b8ad7cf
Reverse a partial fix patch for radar 7214820. It broke some code and
...
I don't have time to refix it for now.
llvm-svn: 95733
2010-02-10 00:32:12 +00:00
Fariborz Jahanian
5db5281db8
Finish implementing property synthesis by default.
...
(radar 7381956).
llvm-svn: 95695
2010-02-09 21:49:50 +00:00
Fariborz Jahanian
04477f3de9
Merge block/function pointer types with objc's __weak
...
attribute properly and avoid bogus warning. This is
an objective-c fix only. objective-c++ follows different code
pass and requires separate fix (which will come at a later time).
Fixes radar 7214820.
llvm-svn: 95571
2010-02-08 21:09:39 +00:00
Ted Kremenek
2f2692f8ca
Rename -cc1 option '-checker-cfref' to '-analyzer-check-objc-mem'.
...
llvm-svn: 95348
2010-02-05 02:06:54 +00:00
Anders Carlsson
8345a07c25
Fix test.
...
llvm-svn: 95108
2010-02-02 19:09:34 +00:00
Ted Kremenek
b0fe9b9a40
Add test case for <rdar://problem/7068334> (which was fixed by r94864).
...
llvm-svn: 94865
2010-01-30 00:56:00 +00:00
Ted Kremenek
8d9842d43f
Switch Sema over to using the new implementation of format string
...
checking. It passes all existing tests, and the diagnostics have been
refined to provide better range information (we now highlight
individual format specifiers) and more precise wording in the
diagnostics.
llvm-svn: 94837
2010-01-29 20:55:36 +00:00
Mike Stump
0978af83b3
Insulate these from changes to the default for -Wunreachable-code.
...
llvm-svn: 94326
2010-01-23 20:12:18 +00:00
Fariborz Jahanian
935f041243
outside a method, 'super' should resolve in a normal name look up
...
to mimic gcc's behavior. Fixes radar 7400691.
llvm-svn: 94246
2010-01-22 23:04:44 +00:00
Fariborz Jahanian
4f8a57112f
Settled rule on warning on unimplemented property in
...
category implementation when some implementations
are missing in the primary class implementation.
(fixes radar 6505200).
llvm-svn: 94014
2010-01-20 19:36:21 +00:00
Fariborz Jahanian
98609b3a07
Patch to implement required warnings for unimplemented
...
properties imported frfom protocol. Fixes radar 7544809.
llvm-svn: 93965
2010-01-20 01:51:55 +00:00
Fariborz Jahanian
6d77a96111
objective-c test case for __attribute__((unused)) on method arguments.
...
llvm-svn: 93887
2010-01-19 18:39:17 +00:00
Fariborz Jahanian
c1d2fa5d48
Issue diagnostics (instead of crashing in code gen) when using
...
property dot-syntax notation to use setter/getters in objective-c.
Fixes radar 7553050.
llvm-svn: 93883
2010-01-19 17:48:02 +00:00
Fariborz Jahanian
6fada5be91
When in objective-c methods, do the built-in name lookup after
...
ivar name lookup. Fixes pr5986.
llvm-svn: 93271
2010-01-12 23:58:59 +00:00
Chris Lattner
f9895c48fd
add a bunch of missing prototypes to tests
...
llvm-svn: 93072
2010-01-09 20:43:19 +00:00
Douglas Gregor
6da83624e4
Whenever we emit a typo-correction diagnostic, also emit a note
...
pointing to the declaration that we found that has that name (if it is
unique).
llvm-svn: 92877
2010-01-07 00:17:44 +00:00
Douglas Gregor
10f1e4dda8
When suggesting a typo correction for an @implementation without a
...
corresponding @interface, provide a note showing which interface we're
referring to. This note has the fix-it hint on it.
Also, don't automatically apply fix-it hints for notes. They're meant
to express fix-its that would change semantics.
llvm-svn: 92870
2010-01-06 23:44:25 +00:00
Fariborz Jahanian
8e356bfe28
Fix a bug when property is redeclared in multiple
...
continuation classes and its original declaration
is imported from a protocol. This fixes radar 7509234.
llvm-svn: 92856
2010-01-06 21:38:30 +00:00
Fariborz Jahanian
1a5f292fbf
Do not diagnose method disguised as property setter
...
for a 'readonly' property. Fixes radar 7427072.
llvm-svn: 92808
2010-01-06 00:18:12 +00:00
Douglas Gregor
40f7a007e9
When declaring an Objective-C implementation without a corresponding
...
interface, suggest correction of typos. For example, given:
@interface NSString
@end
@implementation NSstring
@end
we'll warn with:
t.m:4:19: warning: cannot find interface declaration for 'NSstring';
did you mean 'NSString'?
@implementation NSstring
^
However, since this is just a warning, we don't provide a fix-it
hint. Good idea, Ted!
llvm-svn: 92488
2010-01-04 17:27:12 +00:00
Douglas Gregor
35b0bac8c5
Implement typo correction for a variety of Objective-C-specific
...
constructs:
- Instance variable lookup ("foo->ivar" and, in instance methods, "ivar")
- Property name lookup ("foo.prop")
- Superclasses
- Various places where a class name is required
- Protocol names (e.g., id<proto>)
This seems to cover many of the common places where typos could occur.
llvm-svn: 92449
2010-01-03 18:01:57 +00:00
Daniel Dunbar
a7d0231b66
clang -cc1: Rename -mcpu to -target-cpu to match other target options and not alias driver/backend option.
...
llvm-svn: 91671
2009-12-18 06:30:12 +00:00
Fariborz Jahanian
057a17e4c5
Diagnose duplicate declaration of a property. Fixes
...
PR5809
llvm-svn: 91575
2009-12-17 00:49:09 +00:00
Eli Friedman
53b3cde60f
Add abort() as a builtin. This has two effects: one, we warn for incorrect
...
declarations of abort(), and two, we mark it noreturn. Missing the latter
shows up in one of the "embarassing" tests (from the thread on llvmdev
"detailed comparison of generated code size for LLVM and other compilers").
llvm-svn: 91515
2009-12-16 06:28:21 +00:00
Fariborz Jahanian
e8d28904b0
Diagnose attempting to assign to a sub-structure of an ivar
...
using objective-c property. (fixes radar 7449707)
llvm-svn: 91474
2009-12-15 23:59:41 +00:00
Daniel Dunbar
8fbe78f6fc
Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
...
- This is designed to make it obvious that %clang_cc1 is a "test variable"
which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
can be useful to redefine what gets run as 'clang -cc1' (for example, to set
a default target).
llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Fariborz Jahanian
0399c1c9c0
Change tests to use clang -cc1...
...
llvm-svn: 91297
2009-12-14 17:36:25 +00:00
Fariborz Jahanian
4569f69558
Patch to warn when discarding objective-c pointer type qualifiers
...
Still some refactoring to do.
llvm-svn: 90830
2009-12-08 03:35:08 +00:00
Fariborz Jahanian
c2949f9f26
Allow accessing 'isa' via '->' operator.
...
(fixes radar 7447251).
llvm-svn: 90795
2009-12-07 20:09:25 +00:00
Fariborz Jahanian
1b31c37922
Patch to allow restrict applied to id/Class types.
...
(fixes radar 7442244).
llvm-svn: 90773
2009-12-07 18:08:58 +00:00
Eli Friedman
d0e8de2cd8
Move RequireCompleteType requirement for fields early into ActOnField so that
...
subsequent code which depends on a complete type does the right thing.
llvm-svn: 90727
2009-12-07 00:22:08 +00:00
John McCall
d14a86427f
"Incremental" progress on using expressions, by which I mean totally ripping
...
into pretty much everything about overload resolution in order to wean
BuildDeclarationNameExpr off LookupResult::getAsSingleDecl(). Replace
UnresolvedFunctionNameExpr with UnresolvedLookupExpr, which generalizes the
idea of a non-member lookup that we haven't totally resolved yet, whether by
overloading, argument-dependent lookup, or (eventually) the presence of
a function template in the lookup results.
Incidentally fixes a problem with argument-dependent lookup where we were
still performing ADL even when the lookup results contained something from
a block scope.
Incidentally improves a diagnostic when using an ObjC ivar from a class method.
This just fell out from rewriting BuildDeclarationNameExpr's interaction with
lookup, and I'm too apathetic to break it out.
The only remaining uses of OverloadedFunctionDecl that I know of are in
TemplateName and MemberExpr.
llvm-svn: 89544
2009-11-21 08:51:07 +00:00
Daniel Dunbar
4274685b63
Pass '-mcpu' 'FOO' instead of '-mcpu=FOO'.
...
llvm-svn: 89498
2009-11-20 22:21:52 +00:00
Fariborz Jahanian
e774fa6412
Don't issue spurious diagnostic with Obj-C fast enumeration.
...
(radar 7409165).
llvm-svn: 89400
2009-11-19 22:12:37 +00:00
Fariborz Jahanian
1e3609f6c4
Do not enter forward class 'Protocol' in decl context.
...
Will do it later. Fixes pr5552.
llvm-svn: 89269
2009-11-18 23:15:37 +00:00
Fariborz Jahanian
41e803d8c7
Don't warn if objc method param types in declaration and
...
implementation mismatch in their qualifiers only.
This will match similar behavior in c/c++ and
fixes radar 7211653.
llvm-svn: 89220
2009-11-18 18:56:09 +00:00
Daniel Dunbar
fba0b44d35
Use -fblocks and -fobjc-nonfragile-abi when that is what is being tested, instead of forcing the triple.
...
llvm-svn: 89072
2009-11-17 09:04:12 +00:00
Daniel Dunbar
feedba68b5
Don't #include <stdio.h> when tests don't need it, or use clang instead of clang-cc when they do.
...
llvm-svn: 89070
2009-11-17 08:57:36 +00:00
Ted Kremenek
c40943224d
Remove extra space in warn_maynot_respond diagnostic. Fixes <rdar://problem/7364274>.
...
llvm-svn: 89013
2009-11-17 00:35:14 +00:00
Fariborz Jahanian
9290ede494
Handle case of missing '@end' in implementation context
...
gracefully, on par with gcc, by: Issuing a warning,
doing final sematinc check of its definitions and generating
its meta-data.
llvm-svn: 88934
2009-11-16 18:57:01 +00:00
John McCall
b0e419e34d
Add <foo> = [<bar> nextObject] to the -Widiomatic-parentheses category,
...
and give that category an explicit test. Generalize the internal diagnostic
name.
llvm-svn: 86905
2009-11-12 00:06:05 +00:00
Fariborz Jahanian
13e0c90fc1
writable atomic property's setter/getter must be in 'lock' step of
...
either both synthesized or bith user defined.
Implements radar 6557233.
llvm-svn: 86887
2009-11-11 22:40:11 +00:00
John McCall
0506e4af2c
Apparently the following idiom is specifically encouraged:
...
if (self = [super init])
Recognize it and only warn if -Wparentheses is explicitly enabled.
llvm-svn: 86790
2009-11-11 02:41:58 +00:00
Ted Kremenek
f9a28abe8d
Make -Wsemicolon-before-method-body opt-in (and part of -Wextra). Addresses <rdar://problem/7381735>.
...
llvm-svn: 86731
2009-11-10 22:16:29 +00:00
Daniel Dunbar
8b57697954
Eliminate &&s in tests.
...
- 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious.
llvm-svn: 86430
2009-11-08 01:45:36 +00:00
Fariborz Jahanian
3600f41a3a
Since default writable attribute is 'assign', allow
...
specification of 'assign' (no warning to be issued),
when a continuation class makes a 'readonly' attribute
'readwrite' but also specifies the 'assign' attribute.
(this matches gcc's behavior and prevents exessive
warnings)/
llvm-svn: 86297
2009-11-06 22:59:12 +00:00
Daniel Dunbar
a530841b4f
Switch XFAIL format to match LLVM.
...
llvm-svn: 85880
2009-11-03 07:25:45 +00:00
Fariborz Jahanian
a386d9533b
Assortment of property attributes declared in continuation
...
class must match those of same property declared
in its primary class. (Fixes radar 7352425)
llvm-svn: 85843
2009-11-03 00:01:38 +00:00
Fariborz Jahanian
de8db16a7d
Property declared in continuation class can only be used to
...
change a readonly property declared in the class (and its inherited protocols)
to writable property. (Fixes radar 7350645).
llvm-svn: 85836
2009-11-02 22:45:15 +00:00
Fariborz Jahanian
ec344ed2f5
Diagnose implementation of a property declared in a category
...
in its class implementation instead of crashing. Fixes radar 7350345.
llvm-svn: 85813
2009-11-02 18:45:36 +00:00
Fariborz Jahanian
6c5a8e2555
This patch computes composite type of two objective-c expressions
...
used in a conditional expression by finding the most-derived common
super class of the two and qualifies the resulting type by the
intersection of the protocl qualifier list of the two objective-c
pointer types. ( this is continuation of radar 7334235).
llvm-svn: 85554
2009-10-30 01:13:23 +00:00
Fariborz Jahanian
ef8b8ce207
Type of a conditional expression with two distinct objective-c
...
class pointer is the most derived common class of the two.
This is <rdar://problem/7334235>.
llvm-svn: 85337
2009-10-27 23:02:38 +00:00
Mike Stump
ab8b2e08c3
Refine noreturn handling. Fixes -Wmissing-noreturn so that it doesn't
...
complain that functions that have a return statement should be
declared noreturn. Fixed PR5286.
llvm-svn: 85195
2009-10-27 01:59:05 +00:00
Fariborz Jahanian
b14d70413f
Changed text of warning in my last patch.
...
Related to radar:
<rdar://problem/7308503> clang should disallow the trailing semicolon in method definitions
llvm-svn: 84647
2009-10-20 17:24:11 +00:00
Fariborz Jahanian
040d75d9b6
Issue warning if method body starts with a semicolon.
...
Fixes
<rdar://problem/7308503> clang should disallow the trailing semicolon in method definitions
llvm-svn: 84645
2009-10-20 16:39:13 +00:00
Daniel Dunbar
88f2300d19
Add a test case demonstrating a situation where we get protocol type checking
...
right for multiple anonymous categories.
llvm-svn: 83085
2009-09-29 18:51:43 +00:00
Fariborz Jahanian
e983d17570
Fix a regression in accessing class getter using the dot-syntax
...
notation. There is still an issue accessing field of a 'Class''s isa
in legacy code using dot field access notation (as noted in the test case)
but unrelated to this patch.
llvm-svn: 82555
2009-09-22 16:48:37 +00:00
Daniel Dunbar
1188987e23
clang-cc: Remove -ObjC -ObjC++ handling from clang-cc.
...
llvm-svn: 82103
2009-09-17 00:47:27 +00:00
Anders Carlsson
2898af59dc
Update tests
...
llvm-svn: 81802
2009-09-14 22:00:20 +00:00
Fariborz Jahanian
cb1c19147f
Using the property dot-syntax to invoke a non-eixsting
...
structure-valued setter should cause a user error instead of
crash.
llvm-svn: 81769
2009-09-14 16:40:48 +00:00
Fariborz Jahanian
f15d4b6050
This patch does the following.
...
1) Issue digsnostics in non-fragile ABI, when an expression
evaluates to an interface type (except when it is used to
access a non-fragile ivar).
2) Issue unsupported error in fragile ABI when an expression
evaluates to an interface type (except when it is used to
access a fragile ivar).
llvm-svn: 80860
2009-09-03 00:43:07 +00:00
Fariborz Jahanian
589202d8e6
Added a FIXME to the test case.
...
llvm-svn: 80840
2009-09-02 21:24:14 +00:00
Fariborz Jahanian
3a964ebdc4
Changed abi mode for these test which are dereferencing
...
an interface pointer.
llvm-svn: 80836
2009-09-02 21:06:27 +00:00
Fariborz Jahanian
f40183f436
Test for my last patch.
...
llvm-svn: 80740
2009-09-02 00:05:10 +00:00
Fariborz Jahanian
18f4107eb7
test case for my last patch.
...
llvm-svn: 80382
2009-08-28 17:53:05 +00:00
Fariborz Jahanian
a83c016d22
Type of a ?: expression whose either expression is a built-in 'id'
...
type is 'id' type.
llvm-svn: 79781
2009-08-22 22:27:17 +00:00
Fariborz Jahanian
cbf10f5de5
Don't issue warning on multiple selector found when
...
selector name is for a @selector expression.
llvm-svn: 79776
2009-08-22 21:13:55 +00:00
Fariborz Jahanian
1b5d6133f9
Removed -Wundeclared-selector and -Wreadonly-setter-attrs from
...
-Wmost group (too noisy). Placed warning on parameter type
misatch between methods in sub and super class under
-Wsuper-class-method-mismatch (also too noisy).
llvm-svn: 79745
2009-08-22 19:24:56 +00:00
Daniel Dunbar
3a4fc4b2ec
XFAIL this test for now. David/Steve, please sort out the correct fix.
...
llvm-svn: 79259
2009-08-17 18:01:54 +00:00
Chris Lattner
2ba5ca9d4f
Improve the diagnostic emitted when an unused ObjC property getter
...
is found. Instead of complaining about a generic "unused expr",
emit:
t.m:7:3: warning: property access result unused - getters should not have side effects
While objc property getters *could* have side effects, according to
the language best practices, they *shouldn't*. Hopefully the
diagnostic now gets this across.
llvm-svn: 79192
2009-08-16 16:57:27 +00:00
Ted Kremenek
08479ae7fe
Change handling of attribute 'malloc' to only accept the attribute on function
...
declarations (and not function pointers). This is consistent with GCC. Accepting
this attribute on function pointers means that the attribute should be treated
as a type qualifier, which apparently is not what GCC does. We obviously can
change this later should we desire to enhance the 'malloc' attribute in this
way.
llvm-svn: 79060
2009-08-15 00:51:46 +00:00
Ted Kremenek
8d091dbe13
Add more attribute 'malloc' test cases involving function pointers.
...
llvm-svn: 79055
2009-08-14 22:06:01 +00:00
Fariborz Jahanian
2e4a46b745
objc2's foreach statement's selector type can be
...
a block pointer too.
llvm-svn: 79050
2009-08-14 21:53:27 +00:00
Ted Kremenek
026d201eca
This test case does not need to include 'stdlib.h'.
...
llvm-svn: 79042
2009-08-14 20:53:10 +00:00
Ted Kremenek
527042b5a9
Improve Sema's handling of attribute 'malloc' to reject the attribute when
...
attaching to Objective-C methods (which mirrors GCC's behavior) and to allow the
return type of the function to be an Objective-C pointer or Block pointer (which
GCC also accepts).
Along the way, add 'const' to some of the pointer arguments of various utility
functions...
llvm-svn: 79040
2009-08-14 20:49:40 +00:00
Fariborz Jahanian
83b000c713
Fixed a regression in deciding when to issue warning on properties which
...
implement NSCopying protocol in GC mode.
llvm-svn: 79008
2009-08-14 18:06:25 +00:00
Fariborz Jahanian
887cd6a8eb
error on property of objc interface type instead of crashing
...
llvm-svn: 78826
2009-08-12 18:17:53 +00:00
Fariborz Jahanian
853d21a18a
Warn on use of property dot syntax when unused.
...
llvm-svn: 78760
2009-08-12 00:45:33 +00:00
Fariborz Jahanian
3f8917abf6
Patch to warn if a property which is 'assign' by default
...
may not implement NSCopying protocol in -fobjc-gc[-only] mode.
llvm-svn: 78726
2009-08-11 22:02:25 +00:00
Chris Lattner
66a388b859
merge two tests.
...
llvm-svn: 78705
2009-08-11 20:08:52 +00:00
Chris Lattner
f1c9797ffa
Fix rdar://7126285: don't warn on unused ObjC property access
...
that uses "dot syntax" since it might have a side effect.
llvm-svn: 78704
2009-08-11 20:08:03 +00:00
Daniel Dunbar
d3a114fe2d
Update test case; I don't really understand why packed enums changed this, but
...
the new havior is better so...
llvm-svn: 78473
2009-08-08 15:47:00 +00:00
Fariborz Jahanian
b61af4c566
Some code refactoring. Be more generous in issuance of warning
...
on method type mismatches per Chris's comment.
llvm-svn: 78075
2009-08-04 17:01:09 +00:00