Commit Graph

1388 Commits

Author SHA1 Message Date
Fariborz Jahanian 2618dbaf5f Patch to wrap up '_' as separator in version numbers
in availability attribute by preserving this info.
in VersionTuple and using it in pretty printing of attributes
and yet using '.' as separator when diagnosing unavailable 
message calls. rdar://18490958

llvm-svn: 219124
2014-10-06 16:46:02 +00:00
Fariborz Jahanian ce72e63d11 Diagnose mixed use of '_' and '.' as version
separators in my previous patch. 

llvm-svn: 218895
2014-10-02 17:57:26 +00:00
Fariborz Jahanian dbc956d3f6 Patch to accept '_' in addition to '.' as version
number separator in "availability" attribute.
rdar://18490958

llvm-svn: 218884
2014-10-02 16:39:45 +00:00
Fariborz Jahanian fba4fe6717 Objective-C. Under a special flag, -Wcstring-format-directive,
off by default, issue a warning if %s directive is used
in formart argument of a function/method declared as
__attribute__((format(CF/NSString, ...)))
To complete rdar://18182443

llvm-svn: 217619
2014-09-11 19:13:23 +00:00
Fariborz Jahanian a00a6526dc More test for "void *" argument as index of a dictionary literal.
llvm-svn: 217555
2014-09-10 22:12:13 +00:00
Fariborz Jahanian d13951ff2f Objective-C. Accept 'nil' as indexing argument to
dictionary literals since the API which implements 
them accepts it too.  // rdar://18254621

llvm-svn: 217543
2014-09-10 20:55:31 +00:00
Fariborz Jahanian 68e1867d89 Objective-C arc. Fixes a crash when issuing diagnostic for
passing parameter to an audited CF API. rdar://18222007

llvm-svn: 217530
2014-09-10 18:23:34 +00:00
Fariborz Jahanian 6485fe4b07 Objective-C. Under a special flag, -Wcstring-format-directive,
off by default, issue a warning if %s directive is used in
certain CF/NS formatting APIs, to assist user in deprecating
use of such %s in these APIs. rdar://18182443

llvm-svn: 217467
2014-09-09 23:10:54 +00:00
Richard Smith 091405d7e3 Reword switch/goto diagnostics "protected scope" diagnostics. Making up a term
"protected scope" is very unhelpful here and actively confuses users. Instead,
simply state the nature of the problem in the diagnostic: we cannot jump from
here to there. The notes explain nicely why not.

llvm-svn: 217293
2014-09-06 00:24:58 +00:00
Fariborz Jahanian 3b23008987 Objective-C [qoi]. If property is going to be implemented
in the super class, do not issue the warning about property
in current class's protocol will not be auto synthesized.
// rdar://18179833

llvm-svn: 216769
2014-08-29 20:29:31 +00:00
Fariborz Jahanian c9b771560a Objective-C. Tweak diagnosing properties that are not auto-synthesized.
Do not warn when property declared in class's protocol will be auto-synthesized
by its uper class implementation because super class has also declared this
property while this class has not. Continue to warn if current class
has declared the property also (because this declaration will not result
in a 2nd synthesis).
rdar://18152478

llvm-svn: 216753
2014-08-29 18:31:16 +00:00
Fariborz Jahanian 7e3e291b33 Objective-C. Change to method lookup rules to look
into primary class's named categories before looking 
into their protocols. This is because categories are
part of the public interface and , just as primary class,
preference should be given to them before class 
(and category) protocols.  // rdar://18013929

llvm-svn: 216610
2014-08-27 20:34:29 +00:00
Fariborz Jahanian 180d76b408 Objective-C. When multiple nullary selectors are found in
global pool in the course of method selection for
a messaging expression, select one with the most general
return type of 'id'. This is to remove type-mismatch 
warning (which is useless) as result of random selection of 
method with more restrictive return type. rdar://18095772

llvm-svn: 216560
2014-08-27 16:38:47 +00:00
Richard Smith 588bd9b7f8 Fix representation of __attribute__((nonnull)) to support correctly modeling
the no-arguments case. Don't expand this to an __attribute__((nonnull(A, B,
C))) attribute, since that does the wrong thing for function templates and
varargs functions.

In passing, fix a grammar error in the diagnostic, a crash if
__attribute__((nonnull(N))) is applied to a varargs function,
a bug where the same null argument could be diagnosed multiple
times if there were multiple nonnull attributes referring to it,
and a bug where nonnull attributes would not be accumulated correctly
across redeclarations.

llvm-svn: 216520
2014-08-27 04:59:42 +00:00
Fariborz Jahanian ffc120a900 revert patch r216469.
llvm-svn: 216485
2014-08-26 21:10:47 +00:00
Fariborz Jahanian 840438bb06 c11- Check for c11 language option as documentation says
feature is c11 about nested struct declarations must have
struct-declarator-list. Without this change, code
which was meant for c99 breaks. rdar://18125536

llvm-svn: 216469
2014-08-26 18:13:47 +00:00
Fariborz Jahanian 4229228389 Objective-C. Allow [super initialize] in an +initialize
implementation but not anywhere else.
rdar://16628028

llvm-svn: 216408
2014-08-25 21:27:38 +00:00
Fariborz Jahanian 4bf437ecd8 Objective-C. Warn when @encode'ing provides an incomplete
type encoding because in certain cases, such as for vector
types, because we still haven't designed encoding for them.
rdar://9255564

llvm-svn: 216301
2014-08-22 23:17:52 +00:00
Fariborz Jahanian e8b45505bc Objective-C. Update my previous patch to not warn if
+initialize is called on 'super' in its implementation.
rdar://16628028

llvm-svn: 216282
2014-08-22 19:52:49 +00:00
Fariborz Jahanian 78e9debf68 Objective-C. Warn if user has made explicit call
to +initilize as this results in an extra call
to this method. rdar://16628028

llvm-svn: 216271
2014-08-22 16:57:26 +00:00
Fariborz Jahanian 38c53fbf1f Objective-C. Recover from missing interface decl.
and checking on availability of method declaration
instead of crashing. // rdar://18059669

llvm-svn: 216191
2014-08-21 17:06:57 +00:00
Fariborz Jahanian 4eda2c0086 Objective-C. Do not warn if user is using property-dox syntax to name a
user provided setter name (as declared in @property attribute declaration).
rdar://18022762

llvm-svn: 215736
2014-08-15 17:39:00 +00:00
Fariborz Jahanian d288fad374 Objective-C. Handle case of multiple class methods
found in global pool as well. rdar://16808765

llvm-svn: 215603
2014-08-13 23:38:04 +00:00
Fariborz Jahanian 30ae8d4413 Objective-C. This patch is to resolve the method used in method
expression to the best method found in global method pools. 
This is wip.  // rdar://16808765

llvm-svn: 215577
2014-08-13 21:07:35 +00:00
David Majnemer 8f0ed91490 Sema: Handle declspecs without declarators in records properly in C mode
We had two bugs:
- We wouldn't properly warn when a struct/union/enum was mentioned
  inside of a record definition if no declarator was provided.  We
  should have mentioned that this declaration declares nothing.
- We didn't properly support Microsoft's extension where certain
  declspecs without declarators would act as anonymous structs/unions.
  * We completely ignored the case where such a declspec could be a
    union.
  * We didn't properly handle the case where a record was defined inside
    another record:
      struct X {
        int a;
        struct Y {
          int b;
        };
      };

llvm-svn: 215347
2014-08-11 07:29:54 +00:00
Bob Wilson 7400e596a3 Predefine IB_DESIGNABLE and IBInspectable macros. <rdar://problem/17441860>
These macros are used as markers for Interface Builder and need to be defined
to empty strings since they have no impact on the code.

Patch by Ted Kremenek.

llvm-svn: 215259
2014-08-08 23:46:25 +00:00
Fariborz Jahanian 0b1d28866c Objective-C [qoi]. Issue warning and fixit if property-dot syntax
use mis-cased property name (which is currently accepted silently
due to the way property setters are named). rdar://17911746

llvm-svn: 215250
2014-08-08 22:33:24 +00:00
Fariborz Jahanian 495bc3f5f6 Objective-C ARC. Use of non-retain/autorelease API
for building Objective-C array literals in ARC
mode. rdar://17554063

llvm-svn: 215232
2014-08-08 17:31:14 +00:00
Fariborz Jahanian d45e7cec42 Objective-C arc. Switch the Objective-C dictionary literal in ARC mode
to use non-retain/autorelease API variants of ObjC objects. wip.
rdar://17554063

llvm-svn: 215146
2014-08-07 20:57:35 +00:00
Fariborz Jahanian 2a25dba153 Objective-C ARC. More code for Objective-C's
new APIs for literals. nfc. wip. rdar://17554063

llvm-svn: 215043
2014-08-06 23:40:31 +00:00
Fariborz Jahanian 261aa1f23a Objective-C. Improve diagnostic when property is
not auto synthesized in current implementation.
rdar://17774815

llvm-svn: 214090
2014-07-28 16:35:45 +00:00
Fariborz Jahanian 6c9ee7b0c8 Objective-C. Issue more warning diagnostic when certain
properties are not synthesized in property auto-synthesis,
as it can potentiall lead to runtime errors.
rdar://17774815

llvm-svn: 214032
2014-07-26 20:52:26 +00:00
Fariborz Jahanian a57d91c2ae Objective-C. Warn if protocol used in an @protocol
expression is a forward declaration as this results
in undefined behavior. rdar://17768630

llvm-svn: 213968
2014-07-25 19:45:01 +00:00
Fariborz Jahanian ac6b4efaab Objective-C. Patch to warn if the result of calling a property getter
is unused (this is match behavior when property-dot syntax is used to
use same getter). rdar://17514245
Patch by Anders Carlsson with minor refactoring by me.

llvm-svn: 213423
2014-07-18 22:59:10 +00:00
Fariborz Jahanian b93355e9b1 Objective-C. deprecated attribute is not inherited on methods
overriden in interfaces and protocols (this is already the case
for properties). rdar://16068470

llvm-svn: 213282
2014-07-17 17:05:04 +00:00
Fariborz Jahanian a2e5deb86d Objective-C. Changes per A. Ballman's comment
for my last patch. // rdar://17631257

llvm-svn: 213185
2014-07-16 19:44:34 +00:00
Alp Toker a3c494f0db Revert "clang/test/Driver/crash-report.c: This requires rewriter for -frewrite-includes. [PR20321]"
We've decided to make the core rewriter class and PP rewriters mandatory.
They're only a few hundred lines of code in total and not worth supporting as a
distinct build configuration, especially since doing so disables key compiler
features.

This reverts commit r213150.

Revert "clang/test: Introduce the feature "rewriter" for --enable-clang-rewriter."

This reverts commit r213148.

Revert "Move clang/test/Frontend/rewrite-*.c to clang/test/Frontend/Rewriter/"

This reverts commit r213146.

llvm-svn: 213159
2014-07-16 15:12:48 +00:00
NAKAMURA Takumi 692d6bb544 clang/test: Introduce the feature "rewriter" for --enable-clang-rewriter.
llvm-svn: 213148
2014-07-16 13:36:39 +00:00
Kaelyn Takata 22101f9689 Continue parsing an expression list even after an error is encountered.
Otherwise, multiple errors such as having unknown identifiers for two
arguments won't be diagnosed properly (e.g. only the first one would
have a diagnostic message if typo correction fails even though both
would be diagnosed if typo correction suggests a replacement).

llvm-svn: 213003
2014-07-14 22:48:10 +00:00
Alp Toker 5d96e0a3a7 Consolidate header inclusion diagnostics
Make argument orders match, unify diagnostic IDs and reword the message to be a
little less saccharine.

llvm-svn: 212845
2014-07-11 20:53:51 +00:00
Fariborz Jahanian dacffc0d8d Objective-C. When we use @selector(save:), etc. there may be more
than one method with mismatched type of same selector name. 
clang issues a warning to point this out since it may cause 
undefined behavior. There are cases though that some APIs 
don't care about user methods and such warnings are perceived as 
noise. This patch allows users to add paren delimiters around
selector name to turn off such warnings. So, @selector((save:)) will
turn off the warning. It also provides 'fixit' so user knows 
what to do. // rdar://16458579

llvm-svn: 211611
2014-06-24 17:02:19 +00:00
Fariborz Jahanian d329674028 Objective-C qoi. When Objective-C pointer mismatches with
a qualified-id type because pointer is object of a forward
class declaration, include this info in a diagnostic note.
// rdar://10751015

llvm-svn: 211324
2014-06-19 23:05:46 +00:00
Fariborz Jahanian c03ef578eb Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
in the context of pointer comparison as this is in effect 
a +0 context. // rdar://16627903

llvm-svn: 211243
2014-06-18 23:52:49 +00:00
Fariborz Jahanian 1ad83a35b1 Objective-C. Revert my patch in r211234.
llvm-svn: 211237
2014-06-18 23:22:38 +00:00
Fariborz Jahanian 62aeb8b653 Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
by recognizing this as a +0 context. // rdar://16627903

llvm-svn: 211234
2014-06-18 22:50:40 +00:00
Fariborz Jahanian 5d64abba0a Objective-C. Check for integer overflow in Objective-C's
boxed expression. // rdar://16417427

llvm-svn: 211215
2014-06-18 20:49:02 +00:00
Fariborz Jahanian caaa5f55b6 Objective-C. Try to fix the test in buildbot in my last patch.
llvm-svn: 211197
2014-06-18 18:16:37 +00:00
Fariborz Jahanian 285b6b6585 Objective-C. Attributes on class declarations carry over
to forward class declarations for diagnosis. 
// rdar://16681279

llvm-svn: 211195
2014-06-18 17:58:27 +00:00
Fariborz Jahanian 9277ff426d Objective-C ARC. Do not warn about properties with both
IBOutlet and weak attributes when accessed being
unpredictably set to nil because usage of such properties
are always single threaded and its ivar cannot be set
to nil asynchronously. // rdar://15885642 

llvm-svn: 211132
2014-06-17 23:35:13 +00:00
Fariborz Jahanian 89ea9610b3 Objective-C. Diagnose when property access is using declared
property accessor methods which have become deprecated
or available. // rdar://15951801

llvm-svn: 211039
2014-06-16 17:25:41 +00:00