Commit Graph

2255 Commits

Author SHA1 Message Date
Hartmut Kaiser b5371d22eb Silenced a VC++ warning.
llvm-svn: 43179
2007-10-19 15:50:35 +00:00
Gabor Greif 24032f1ac2 add NL at end of file
llvm-svn: 43178
2007-10-19 15:38:32 +00:00
Fariborz Jahanian 74a1cfaf21 rewrite of metadata for implemented instance methods.
llvm-svn: 43159
2007-10-19 00:36:46 +00:00
Steve Naroff 648e029a3d Include a simple test case for the previous commit...
llvm-svn: 43158
2007-10-19 00:05:15 +00:00
Steve Naroff 684dc4107f Fix the previous (short lived:-) FIXME.
I didn't realize that GCC considers this a hard error (I thought it was built-in).

Since it's not, we should simply emit an error.

[dylan:~/llvm/tools/clang] admin% cc -c trivial.m
trivial.m:6: error: cannot find interface declaration for 'NSConstantString'

[administrators-powerbook59:~/llvm/tools/clang] admin% ../../Debug/bin/clang trivial.m 
trivial.m:6:16: error: cannot find interface declaration for 'NSConstantString'
NSString *s = @"123";
               ^
1 diagnostic generated.

llvm-svn: 43157
2007-10-18 23:53:51 +00:00
Ted Kremenek 04746ce6f9 Fixed DeclStmt::child_begin() to actually create an iterator that
visits its decls, rather than just creating an "end()" iterator.

Fixed child_end() for statements and expressions to use
child_iterator() to create the end() iterator, rather than just
returning NULL.

Fixed bug in StmtIterator where we did not correctly detect if we had
marched off the end of the ScopedDecls.

llvm-svn: 43156
2007-10-18 23:28:49 +00:00
Fariborz Jahanian e183a8259d Check for Nullness of value built in GetObjcProtoType.
llvm-svn: 43155
2007-10-18 22:59:23 +00:00
Ted Kremenek efc244722f Minor grammar fix.
llvm-svn: 43154
2007-10-18 22:50:52 +00:00
Steve Naroff eee59ebb15 Add a FIXME to an assert.
Change a dyn_cast_or_null back to cast (which is more efficient).

llvm-svn: 43152
2007-10-18 22:17:45 +00:00
Fariborz Jahanian c34409c281 Patch to rewrite ivar tables metadata for classes defined.
llvm-svn: 43151
2007-10-18 22:09:03 +00:00
Chris Lattner 0d466153b9 remove dead #include
llvm-svn: 43149
2007-10-18 21:23:00 +00:00
Fariborz Jahanian 93191afdef First patch toward rewriting of objective-c's meta data.
llvm-svn: 43143
2007-10-18 19:23:00 +00:00
Steve Naroff 1bb21df47f Tweak a recent fix to UsualArithmeticConversions (made by Chris - r43113). The benefit of this tweak is it guarantees the entire routine operates on unqualified types (which I believe is a bit clearer).
llvm-svn: 43142
2007-10-18 18:55:53 +00:00
Ted Kremenek 0f39de13a0 Added StmtIterator.cpp and StmtIterator.h to the XCode project.
llvm-svn: 43139
2007-10-18 18:22:01 +00:00
Ted Kremenek 2ba761c7b8 Refactored StmtIterator into classes StmtIteratorBase (non-templated)
and StmtIteratorImpl (templated), which StmtIterator and
ConstStmtIterator now succintly subclass.

Implemented iteration over the initializers in DeclStmts.  This is not
thoroughly tested, so there may be bugs.

llvm-svn: 43138
2007-10-18 18:19:31 +00:00
Ted Kremenek 614d84aab3 Replaced virtual method call to child_begin() in child_end() by
directly inlining its logic.

llvm-svn: 43137
2007-10-18 18:17:43 +00:00
Ted Kremenek 7aef89101d Fixed broken build.
llvm-svn: 43132
2007-10-18 16:25:40 +00:00
Hartmut Kaiser c8107e54d5 Silenced a couple of VC++ warnings.
llvm-svn: 43125
2007-10-18 12:47:01 +00:00
Hartmut Kaiser 597e172d0a Updated VC++ build system
llvm-svn: 43124
2007-10-18 12:32:10 +00:00
Steve Naroff a78c464c9e Fix a bug in Sema::CheckConditionalOperands(). When mixing pointers and null pointer constants, we need to promote the null pointer constant (which is an integer) to the pointer type. Test case is self explanatory.
This surfaced yesterday, when compiling test/Sema/cocoa.m on Leopard. Since this has nothing to do with ObjC, it's kind of bizarre this hasn't shown up before. I imagine Cocoa.h on Leopard may have changed recently? 

Thanks to Ted for localizing the bug and giving me a useful AST dump...

llvm-svn: 43114
2007-10-18 05:13:08 +00:00
Chris Lattner fac7ac4130 UsualArithmeticConversions is crashing with an assert
when comparing "float" and "const float".  This "fixes" the
issue, but may not be the right fix.  Steve, please review.

Testcase here: test/Sema/usual-float.c

llvm-svn: 43113
2007-10-18 03:50:33 +00:00
Steve Naroff 8569d77349 Fix the following bug...
unsigned char asso_values[] = { 34 };
int legal2() { 
  return asso_values[0]; 
}

The code that creates the new constant array type was operating on the original type.

As a result, the constant type being generated was "unsigned char [1][]" (which is wrong).

The fix is to operate on the element type - in this case, the correct type is "unsigned char [1]"

I added this case to array-init.c, which clearly didn't catch this bogosity...

llvm-svn: 43112
2007-10-18 03:27:23 +00:00
Chris Lattner c7f3981b27 remove extraneous space in @selector()
llvm-svn: 43110
2007-10-18 00:39:29 +00:00
Chris Lattner 810c1db3f5 remove typedef.
llvm-svn: 43109
2007-10-18 00:38:23 +00:00
Ted Kremenek 336886a344 Implemented 90% functionality of new child_iterator for Stmt objects
that will (soon) allow iteration over the initializers in
declarations.  This new iterator mechanism is implemented by the
classes StmtIterator and ConstStmtIterator.

Patched a few files to use "operator++" instead of "operator+" on
child_iterators.

Friendship added in VarDecl to StmtIterator to allow returning a
reference to the initializer within the VarDecl.  We may not wish this
as a permanent solution.

llvm-svn: 43105
2007-10-18 00:24:38 +00:00
Chris Lattner 9c0f9fe151 Make control flow in Expr::isConstantExpr more simple and
local, making the code easier to read.

llvm-svn: 43104
2007-10-18 00:20:32 +00:00
Chris Lattner c6d91c0f6d Add new API to rewrite one stmt/expr with another.
llvm-svn: 43101
2007-10-17 22:35:30 +00:00
Chris Lattner 9515625d0c Add rewriter support for @encode expressions. For example,
we currently turn:

    c = @encode(char *)[2] + 4;

into:

    c = "foo"[2] + 4;

Right now the foo string is hard coded, but you can imagine a world
where it wouldn't be :)

llvm-svn: 43093
2007-10-17 21:28:00 +00:00
Chris Lattner 42ebe5c1e6 The size returned by Rewriter::getRangeSize should include
the size of the last token.

llvm-svn: 43092
2007-10-17 21:23:07 +00:00
Chris Lattner fd64ebd3e4 Fix assertion for raw lexer.
llvm-svn: 43091
2007-10-17 21:22:38 +00:00
Chris Lattner 8e129c23c8 Move token length calculation out of the diagnostics machinery into
the lexer, where it can be shared.

llvm-svn: 43090
2007-10-17 21:18:47 +00:00
Chris Lattner 4050f071e1 wean the diagnostics machinery off the preprocessor.
llvm-svn: 43085
2007-10-17 20:53:57 +00:00
Chris Lattner 02b436a05a Add a new type of lexer: a raw lexer, which does not require a preprocessor
object in order to do its thing.

llvm-svn: 43084
2007-10-17 20:41:00 +00:00
Steve Naroff a3f1336e39 rename test file for builtin "id"...
llvm-svn: 43082
2007-10-17 18:39:04 +00:00
Ted Kremenek 5c84c01c8b Fixed includes of "clang/AST/DeclObjC.h" to work on case-sensitive
filesystems (was "#include "clang/AST/DeclObjc.h", which worked fine
on a case-insensitive HFS+ volume on the Mac).

llvm-svn: 43080
2007-10-17 18:36:42 +00:00
Chris Lattner caecf03215 add some comments.
llvm-svn: 43079
2007-10-17 18:28:59 +00:00
Steve Naroff 0f7a2d2dd1 Predefine all the ObjC goodies from <objc/objc.h>. Removed all the ObjC goodies from the respective test files. Moving forward, it will be very nice to assume these builtin!
llvm-svn: 43077
2007-10-17 17:53:50 +00:00
Fariborz Jahanian a32aaefadc Implementation of AST for @protocol expression.
llvm-svn: 43075
2007-10-17 16:58:11 +00:00
Hartmut Kaiser 7078da8e58 Updated VC++ build system.
Silenced some VC++ warnings.
Had to rephrase a partial specialization of the IntrospectionTrait struct in SerializationTest.cpp, please review.
Added a compiler specific workaround in IdentifierTable.h. Is that the way to fix this kind of issues?

llvm-svn: 43074
2007-10-17 15:00:17 +00:00
Chris Lattner 253023b25f fix problems with test/sema/Cocoa.m etc on non-apple machines.
llvm-svn: 43067
2007-10-17 06:04:46 +00:00
Anders Carlsson f94cd1ffe6 Generate code for static variables that don't have initializers. Also, report an error if a static initializer is not constant.
llvm-svn: 43058
2007-10-17 00:52:43 +00:00
Anders Carlsson 86edafc6d6 Fix the build.
llvm-svn: 43057
2007-10-17 00:50:25 +00:00
Ted Kremenek 970217fae9 Added Driver/SerializationTest.cpp to the XCode project.
llvm-svn: 43054
2007-10-16 23:40:12 +00:00
Ted Kremenek 4e816133c8 Started work on clang object serialization. Experimental
serialization logic as well as driver code is now in
Driver/SerializationTest.cpp.  The status of this code is that it
should be used by no clients.

Added --test-pickling option to driver to run the serialization code.

Modified IdentifierInfo and IdentifierTable to have friend classes
that permit object serialization.  Such friendship may not be needed
in the final design.

llvm-svn: 43052
2007-10-16 23:37:27 +00:00
Fariborz Jahanian 6bd1d612ac Fix location processing of @selector: the range should include the @ sign.
llvm-svn: 43051
2007-10-16 23:21:02 +00:00
Steve Naroff 077c83bddb Add Sema::CheckMessageArgumentTypes()...
llvm-svn: 43050
2007-10-16 23:12:48 +00:00
Chris Lattner 37390bed4d Fix location processing of @encode: the range should include the @ sign.
@selector probably gets this wrong also.

llvm-svn: 43048
2007-10-16 22:51:17 +00:00
Chris Lattner a7c19feca2 Add a new Rewriter::getRangeSize method.
Rename SourceRange::Begin()/End() to getBegin()/getEnd() for
consistency with other code.
Start building the rewriter towards handling @encode.

llvm-svn: 43047
2007-10-16 22:36:42 +00:00
Fariborz Jahanian ebac2cb235 Patch to diagnose duplicate method implementations.
llvm-svn: 43046
2007-10-16 21:52:23 +00:00
Steve Naroff d275426449 Remove ObjcMethodDecl::getNumMethodParams/getMethodParamDecl, they aren't used/needed.
Change ObjcMethodDecl::getMethodType to getResultType, to match FunctionDecl.

llvm-svn: 43045
2007-10-16 21:36:54 +00:00