Commit Graph

5610 Commits

Author SHA1 Message Date
Chris Lattner d7352d6801 minor cleanup to the actions interface to pass around SmallVectorImpl instead
of a specific smallvector size.

Fix protocol lists to pass down proper location info, so we get diagnostics
like this:

t.m:3:35: error: cannot find protocol definition for 'NSCopying', referenced by 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
                                  ^

instead of this:

t.m:3:44: error: cannot find protocol definition for 'NSCopying', referenced by 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
                                           ^


Add a new IdentifierLocPair typedef which is just a pair<IdentifierInfo*, SourceLocation>

llvm-svn: 53883
2008-07-21 22:17:28 +00:00
Ted Kremenek 5224e6a81d Add test case for nonnull attribute.
Fix indexing bug.

llvm-svn: 53882
2008-07-21 22:09:15 +00:00
Ted Kremenek 2d63bc1e99 Added sema support for the nonnull attribute. Will add test cases soon.
llvm-svn: 53881
2008-07-21 21:53:04 +00:00
Daniel Dunbar 7ed03c4cdd Kill an unused variable warning
llvm-svn: 53878
2008-07-21 21:43:28 +00:00
Chris Lattner 388f6e97e1 unindent this function by using an early exit, not functionality change.
llvm-svn: 53877
2008-07-21 21:33:21 +00:00
Chris Lattner 390d39ac7e move two more lists of protocols over to use ObjCList<ObjCProtocolDecl>,
simplifying code along the way and fixing a problem and memory leak or two.

llvm-svn: 53876
2008-07-21 21:32:27 +00:00
Daniel Dunbar c2f67966f4 Add __builtin_powi[fl] support
llvm-svn: 53866
2008-07-21 18:44:41 +00:00
Daniel Dunbar 5b288788b3 Fix a test RUN line to not generate '=-' in test directory
llvm-svn: 53865
2008-07-21 18:42:27 +00:00
Chris Lattner 102ccc4f8c add forward definition protocols to the protocol list for a class.
llvm-svn: 53864
2008-07-21 18:35:17 +00:00
Chris Lattner 461d3f8eb8 references to completely undeclared protocols should be errors.
References to forward definitions should be warnings.

llvm-svn: 53863
2008-07-21 18:34:02 +00:00
Steve Naroff f0ff879881 RewriteObjC::RewriteObjCForCollectionStmt() needs to handle bodies with a single statement.
Fixes <rdar://problem/6084870> clang ObjC rewriter: for-in enumeration in 1 line produces output with error.

llvm-svn: 53858
2008-07-21 18:26:02 +00:00
Chris Lattner d004505b74 introduce a new ObjCList templated class and start moving
various objc lists over to it.  First up, the protocol list 
on ObjCInterfaceDecl.

llvm-svn: 53856
2008-07-21 18:19:38 +00:00
Ted Kremenek b47772535b Update checker build.
llvm-svn: 53855
2008-07-21 17:53:09 +00:00
Chris Lattner 65056c48a7 rename setReferencedProtocolList -> addReferencedProtocols to
be consistent with ObjCInterfaceDecl.

llvm-svn: 53852
2008-07-21 17:23:15 +00:00
Daniel Dunbar d93abc3bb0 Implement ffs, parity, and popcount builtins.
+ test case

llvm-svn: 53851
2008-07-21 17:19:41 +00:00
Argyrios Kyrtzidis b3fa8639e1 Change 'MDecl' to 'MD' to fix redefinition compiler error in MSVC++.
llvm-svn: 53849
2008-07-21 09:18:38 +00:00
Chris Lattner 046485640d fix typo
llvm-svn: 53848
2008-07-21 07:13:18 +00:00
Chris Lattner ca1e848588 Switch initialization of the protocol list for an interface decl to use
the standard "set these as the list of protocols" interface instead of a 
strange "set this as the size and then set each one to the value" interface.
The problem with the later is that it a) is completely different from 
everything else, b) is awkward, and c) doesn't handle the case when a
referenced protocol is invalid: it set it to null.

This meant that all clients downstream would have to handle null protocols
in the protocol list, and empirically they didn't.  Fix this by not setting
invalid protocols in the referenced protocol list, fixing the crash on 
test/Sema/objc-interface-1.m

While I'm at it, clean up some locations so that we produce:

t.m:1:25: error: cannot find interface declaration for 'NSObject', superclass of 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
~~~~~~~~~~~~~~~~~~~~~   ^

instead of:

t.m:1:1: error: cannot find interface declaration for 'NSObject', superclass of 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
^

llvm-svn: 53846
2008-07-21 07:06:49 +00:00
Chris Lattner 87899be4cc when in the context of an @implementation, look for private methods in the
@implementation to resolve nullary selector references.

llvm-svn: 53845
2008-07-21 06:44:27 +00:00
Chris Lattner f1c149db9f don't pass in null as the Name for GenerateClassStructure,
it goes and makes std::strings out of them, which is not 
defined.

llvm-svn: 53843
2008-07-21 06:31:05 +00:00
Chris Lattner 12bf571fa8 improve diagnostics about problems with receivers to highlight the receiver.
llvm-svn: 53842
2008-07-21 06:16:07 +00:00
Chris Lattner bd2d634424 continue cleaning up code, and disable sending a message directly to an
interface.  This fixes a bug where we used to accept:

void test2(NSNumber x) {
	[x METH];
}

which doesn't make sense and GCC rejects.

llvm-svn: 53841
2008-07-21 06:12:56 +00:00
Chris Lattner 6b946cc788 simplify control flow a bit, reducing indentation. No functionality change.
llvm-svn: 53837
2008-07-21 05:57:44 +00:00
Chris Lattner 79f14789d8 tighten up some checks, don't allow sending a message to NSString****
llvm-svn: 53836
2008-07-21 05:54:02 +00:00
Chris Lattner 393f4ae047 update diagnostic to include string
llvm-svn: 53835
2008-07-21 05:38:58 +00:00
Chris Lattner 0c373078e2 improve invalid member reference diagnostics to print the type and
have better source ranges.  Before:

t.m:11:53: error: member reference is not to a structure or union
    CGFloat maxOffsetY = [_outlineLayer contentSize].height - [_outlineLayer frame].size.height;
                                                    ^~~~~~~

after:

t.m:11:54: error: member reference base type ('id') is not a structure or union
    CGFloat maxOffsetY = [_outlineLayer contentSize].height - [_outlineLayer frame].size.height;
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^

llvm-svn: 53834
2008-07-21 05:35:34 +00:00
Chris Lattner 3f44d70771 merge a bunch of code that is now common between qual interfaces and interfaces.
llvm-svn: 53833
2008-07-21 05:27:51 +00:00
Chris Lattner d7983b472e rename getProtocols -> getProtocol, as it only returns a single
protocol.  Simplify some code to use unconditional form of the
protocol access list.

llvm-svn: 53832
2008-07-21 05:20:01 +00:00
Chris Lattner 419f699b55 use iterators instead of direct access to protocol list.
llvm-svn: 53831
2008-07-21 05:19:23 +00:00
Chris Lattner 13b2ace8df improve documentation of ObjCInterfaceType significantly. Also,
make the qual_* iterators and getNumProtocols() lists be accessible through
ObjCInterfaceType (returning an empty range if not a 
ObjCQualifiedInterfaceType).  This eliminates special checks in clients.

llvm-svn: 53830
2008-07-21 05:13:51 +00:00
Chris Lattner dc420f4866 Fix a bunch of crashes that occur in (attempted) handling of objc properties.
This code would previously crash on x.y where x is 'id'.

llvm-svn: 53827
2008-07-21 04:59:05 +00:00
Chris Lattner f8f5682998 right, the error is when the itf *doesn't* have the member.
llvm-svn: 53826
2008-07-21 04:54:33 +00:00
Chris Lattner bf58ba78df use the simplified form of lookupInstanceVariable for callers who
don't care which class actually defines it.

llvm-svn: 53825
2008-07-21 04:44:44 +00:00
Chris Lattner 8bb52cb5a2 improve the diagnostic for an erroneous objc ivar reference
from:

t.m:8:7: error: member reference is not to a structure or union
  pool->farm = 0;
      ^ ~~~~
to:

t.m:8:7: error: 'NSAutoreleasePool' has member named 'farm'
  pool->farm = 0;
  ~~~~^ ~~~~

llvm-svn: 53824
2008-07-21 04:42:08 +00:00
Chris Lattner 4befd736b2 simplify a bunch of code, no functionality change.
llvm-svn: 53823
2008-07-21 04:36:39 +00:00
Chris Lattner b63a745331 rearrange some code, no functionality change.
llvm-svn: 53822
2008-07-21 04:28:12 +00:00
Chris Lattner 530315fe89 improve comments yet again, now I know what this does :)
llvm-svn: 53821
2008-07-21 04:16:33 +00:00
Chris Lattner 6886f38369 minor rename, also, reject pointer to qualified id.
id<NSCopyable>*  is not an "objc pointer type", id<NSCopyable> is.

llvm-svn: 53820
2008-07-21 04:13:58 +00:00
Chris Lattner c47d930448 Fix a crash that can happen when you have typedefs for pointers to
interfaces.  Just because they x->isPointerType() doesn't mean it is
valid to just cast to a pointertype.  We have to handle typedefs etc
as well.

llvm-svn: 53819
2008-07-21 04:09:54 +00:00
Chris Lattner 15727f69fa improve comments.
llvm-svn: 53818
2008-07-21 04:07:11 +00:00
Chris Lattner 2a47fa7372 simplify this predicate, only checking isObjCQualifiedIdType once.
llvm-svn: 53817
2008-07-21 04:03:34 +00:00
Chris Lattner 9099474130 Add a space, ted apparently has philosophical problems with spaces ;-)
llvm-svn: 53808
2008-07-20 04:22:06 +00:00
Nuno Lopes 8a48c2f7d9 fix test
llvm-svn: 53802
2008-07-19 22:11:43 +00:00
Ted Kremenek 4f2fb96d18 Updated latest checker build.
llvm-svn: 53800
2008-07-19 19:50:00 +00:00
Ted Kremenek f487548c17 Patch by Kovarththanan Rajaratnam:
"When dumping the tokens (-dumptokens output type), the column numbers are not
correctly shown. This patch fixes that issue."

llvm-svn: 53797
2008-07-19 19:10:40 +00:00
Ted Kremenek 0fff6d3c06 Patch by
"When dumping the tokens (-dumptokens output type), the column numbers are not
correctly shown. This patch fixes that issue."

llvm-svn: 53796
2008-07-19 19:10:04 +00:00
Ted Kremenek f7ffd66551 Reimplement ccc-analyzer in a language I actually know, and implement some obvious optimizations when processing command line arguments.
llvm-svn: 53783
2008-07-19 06:11:04 +00:00
Ted Kremenek d2d122961d Remove typo.
llvm-svn: 53776
2008-07-18 23:13:03 +00:00
Ted Kremenek 2a6b0b5d5e Quote invocation of clang in pipe to handle paths with spaces.
llvm-svn: 53775
2008-07-18 23:11:33 +00:00
Ted Kremenek 8857703b57 Added test case.
llvm-svn: 53770
2008-07-18 20:48:10 +00:00