Commit Graph

415 Commits

Author SHA1 Message Date
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