]> granicus.if.org Git - clang/log
clang
17 years agoSilenced a VC++ warning.
Hartmut Kaiser [Wed, 24 Oct 2007 00:06:59 +0000 (00:06 +0000)]
Silenced a VC++ warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43277 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd some plumbing to rewrite message expressions (still under construction).
Steve Naroff [Tue, 23 Oct 2007 23:50:29 +0000 (23:50 +0000)]
Add some plumbing to rewrite message expressions (still under construction).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43274 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix typo.
Devang Patel [Tue, 23 Oct 2007 23:29:51 +0000 (23:29 +0000)]
Fix typo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43269 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoHandle nested structs.
Devang Patel [Tue, 23 Oct 2007 23:26:46 +0000 (23:26 +0000)]
Handle nested structs.
typdef struct A { int i; struct A *next; } A

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43268 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplemented serialization for IdentifierInfo and IdentifierTable.
Ted Kremenek [Tue, 23 Oct 2007 22:18:37 +0000 (22:18 +0000)]
Implemented serialization for IdentifierInfo and IdentifierTable.
Updated serialization test code in the driver to test serialization of
these types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43266 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoHandle simple struct member expr.
Devang Patel [Tue, 23 Oct 2007 20:28:39 +0000 (20:28 +0000)]
Handle simple struct member expr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43258 91177308-0d34-0410-b5e6-96231b3b80d8

17 years ago- Add rewrite rule for @class.
Steve Naroff [Tue, 23 Oct 2007 20:20:08 +0000 (20:20 +0000)]
- Add rewrite rule for @class.
- Add setter/getter to ObjcClassDecl.
- Predefined key runtime functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43257 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoPatch to complete metadata generation for each implemented class.
Fariborz Jahanian [Tue, 23 Oct 2007 18:53:48 +0000 (18:53 +0000)]
Patch to complete metadata generation for each implemented class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43255 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoBegin struct layout work.
Devang Patel [Tue, 23 Oct 2007 02:10:49 +0000 (02:10 +0000)]
Begin struct layout work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43236 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoPatch for initialization of class's Meta-class metadata.
Fariborz Jahanian [Tue, 23 Oct 2007 00:02:02 +0000 (00:02 +0000)]
Patch for initialization of class's Meta-class metadata.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43235 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoThis patch generates protocol metadata and all its sub-metadata.
Fariborz Jahanian [Mon, 22 Oct 2007 21:41:37 +0000 (21:41 +0000)]
This patch generates protocol metadata and all its sub-metadata.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43233 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix a crash on test/Sema/invalid-decl.c
Chris Lattner [Fri, 19 Oct 2007 20:10:30 +0000 (20:10 +0000)]
Fix a crash on test/Sema/invalid-decl.c

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43188 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoSilenced a VC++ warning.
Hartmut Kaiser [Fri, 19 Oct 2007 15:50:35 +0000 (15:50 +0000)]
Silenced a VC++ warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43179 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd NL at end of file
Gabor Greif [Fri, 19 Oct 2007 15:38:32 +0000 (15:38 +0000)]
add NL at end of file

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43178 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agorewrite of metadata for implemented instance methods.
Fariborz Jahanian [Fri, 19 Oct 2007 00:36:46 +0000 (00:36 +0000)]
rewrite of metadata for implemented instance methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43159 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoInclude a simple test case for the previous commit...
Steve Naroff [Fri, 19 Oct 2007 00:05:15 +0000 (00:05 +0000)]
Include a simple test case for the previous commit...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43158 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix the previous (short lived:-) FIXME.
Steve Naroff [Thu, 18 Oct 2007 23:53:51 +0000 (23:53 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43157 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFixed DeclStmt::child_begin() to actually create an iterator that
Ted Kremenek [Thu, 18 Oct 2007 23:28:49 +0000 (23:28 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43156 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoCheck for Nullness of value built in GetObjcProtoType.
Fariborz Jahanian [Thu, 18 Oct 2007 22:59:23 +0000 (22:59 +0000)]
Check for Nullness of value built in GetObjcProtoType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43155 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMinor grammar fix.
Ted Kremenek [Thu, 18 Oct 2007 22:50:52 +0000 (22:50 +0000)]
Minor grammar fix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43154 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd a FIXME to an assert.
Steve Naroff [Thu, 18 Oct 2007 22:17:45 +0000 (22:17 +0000)]
Add a FIXME to an assert.
Change a dyn_cast_or_null back to cast (which is more efficient).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43152 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoPatch to rewrite ivar tables metadata for classes defined.
Fariborz Jahanian [Thu, 18 Oct 2007 22:09:03 +0000 (22:09 +0000)]
Patch to rewrite ivar tables metadata for classes defined.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43151 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove dead #include
Chris Lattner [Thu, 18 Oct 2007 21:23:00 +0000 (21:23 +0000)]
remove dead #include

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43149 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFirst patch toward rewriting of objective-c's meta data.
Fariborz Jahanian [Thu, 18 Oct 2007 19:23:00 +0000 (19:23 +0000)]
First patch toward rewriting of objective-c's meta data.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43143 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoTweak a recent fix to UsualArithmeticConversions (made by Chris - r43113). The benefi...
Steve Naroff [Thu, 18 Oct 2007 18:55:53 +0000 (18:55 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43142 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdded StmtIterator.cpp and StmtIterator.h to the XCode project.
Ted Kremenek [Thu, 18 Oct 2007 18:22:01 +0000 (18:22 +0000)]
Added StmtIterator.cpp and StmtIterator.h to the XCode project.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43139 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoRefactored StmtIterator into classes StmtIteratorBase (non-templated)
Ted Kremenek [Thu, 18 Oct 2007 18:19:31 +0000 (18:19 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43138 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoReplaced virtual method call to child_begin() in child_end() by
Ted Kremenek [Thu, 18 Oct 2007 18:17:43 +0000 (18:17 +0000)]
Replaced virtual method call to child_begin() in child_end() by
directly inlining its logic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43137 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFixed broken build.
Ted Kremenek [Thu, 18 Oct 2007 16:25:40 +0000 (16:25 +0000)]
Fixed broken build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43132 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoSilenced a couple of VC++ warnings.
Hartmut Kaiser [Thu, 18 Oct 2007 12:47:01 +0000 (12:47 +0000)]
Silenced a couple of VC++ warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43125 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUpdated VC++ build system
Hartmut Kaiser [Thu, 18 Oct 2007 12:32:10 +0000 (12:32 +0000)]
Updated VC++ build system

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43124 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix a bug in Sema::CheckConditionalOperands(). When mixing pointers and null pointer...
Steve Naroff [Thu, 18 Oct 2007 05:13:08 +0000 (05:13 +0000)]
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...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43114 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUsualArithmeticConversions is crashing with an assert
Chris Lattner [Thu, 18 Oct 2007 03:50:33 +0000 (03:50 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43113 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix the following bug...
Steve Naroff [Thu, 18 Oct 2007 03:27:23 +0000 (03:27 +0000)]
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...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43112 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove extraneous space in @selector()
Chris Lattner [Thu, 18 Oct 2007 00:39:29 +0000 (00:39 +0000)]
remove extraneous space in @selector()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43110 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove typedef.
Chris Lattner [Thu, 18 Oct 2007 00:38:23 +0000 (00:38 +0000)]
remove typedef.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43109 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplemented 90% functionality of new child_iterator for Stmt objects
Ted Kremenek [Thu, 18 Oct 2007 00:24:38 +0000 (00:24 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43105 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMake control flow in Expr::isConstantExpr more simple and
Chris Lattner [Thu, 18 Oct 2007 00:20:32 +0000 (00:20 +0000)]
Make control flow in Expr::isConstantExpr more simple and
local, making the code easier to read.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43104 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd new API to rewrite one stmt/expr with another.
Chris Lattner [Wed, 17 Oct 2007 22:35:30 +0000 (22:35 +0000)]
Add new API to rewrite one stmt/expr with another.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43101 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd rewriter support for @encode expressions. For example,
Chris Lattner [Wed, 17 Oct 2007 21:28:00 +0000 (21:28 +0000)]
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 :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43093 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoThe size returned by Rewriter::getRangeSize should include
Chris Lattner [Wed, 17 Oct 2007 21:23:07 +0000 (21:23 +0000)]
The size returned by Rewriter::getRangeSize should include
the size of the last token.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43092 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix assertion for raw lexer.
Chris Lattner [Wed, 17 Oct 2007 21:22:38 +0000 (21:22 +0000)]
Fix assertion for raw lexer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43091 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMove token length calculation out of the diagnostics machinery into
Chris Lattner [Wed, 17 Oct 2007 21:18:47 +0000 (21:18 +0000)]
Move token length calculation out of the diagnostics machinery into
the lexer, where it can be shared.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43090 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agowean the diagnostics machinery off the preprocessor.
Chris Lattner [Wed, 17 Oct 2007 20:53:57 +0000 (20:53 +0000)]
wean the diagnostics machinery off the preprocessor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43085 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd a new type of lexer: a raw lexer, which does not require a preprocessor
Chris Lattner [Wed, 17 Oct 2007 20:41:00 +0000 (20:41 +0000)]
Add a new type of lexer: a raw lexer, which does not require a preprocessor
object in order to do its thing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43084 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agorename test file for builtin "id"...
Steve Naroff [Wed, 17 Oct 2007 18:39:04 +0000 (18:39 +0000)]
rename test file for builtin "id"...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43082 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFixed includes of "clang/AST/DeclObjC.h" to work on case-sensitive
Ted Kremenek [Wed, 17 Oct 2007 18:36:42 +0000 (18:36 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43080 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd some comments.
Chris Lattner [Wed, 17 Oct 2007 18:28:59 +0000 (18:28 +0000)]
add some comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43079 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoPredefine all the ObjC goodies from <objc/objc.h>. Removed all the ObjC goodies from...
Steve Naroff [Wed, 17 Oct 2007 17:53:50 +0000 (17:53 +0000)]
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!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43077 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplementation of AST for @protocol expression.
Fariborz Jahanian [Wed, 17 Oct 2007 16:58:11 +0000 (16:58 +0000)]
Implementation of AST for @protocol expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43075 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUpdated VC++ build system.
Hartmut Kaiser [Wed, 17 Oct 2007 15:00:17 +0000 (15:00 +0000)]
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?

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43074 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agofix problems with test/sema/Cocoa.m etc on non-apple machines.
Chris Lattner [Wed, 17 Oct 2007 06:04:46 +0000 (06:04 +0000)]
fix problems with test/sema/Cocoa.m etc on non-apple machines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43067 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoGenerate code for static variables that don't have initializers. Also, report an...
Anders Carlsson [Wed, 17 Oct 2007 00:52:43 +0000 (00:52 +0000)]
Generate code for static variables that don't have initializers. Also, report an error if a static initializer is not constant.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43058 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix the build.
Anders Carlsson [Wed, 17 Oct 2007 00:50:25 +0000 (00:50 +0000)]
Fix the build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43057 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdded Driver/SerializationTest.cpp to the XCode project.
Ted Kremenek [Tue, 16 Oct 2007 23:40:12 +0000 (23:40 +0000)]
Added Driver/SerializationTest.cpp to the XCode project.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43054 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoStarted work on clang object serialization. Experimental
Ted Kremenek [Tue, 16 Oct 2007 23:37:27 +0000 (23:37 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43052 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix location processing of @selector: the range should include the @ sign.
Fariborz Jahanian [Tue, 16 Oct 2007 23:21:02 +0000 (23:21 +0000)]
Fix location processing of @selector: the range should include the @ sign.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43051 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd Sema::CheckMessageArgumentTypes()...
Steve Naroff [Tue, 16 Oct 2007 23:12:48 +0000 (23:12 +0000)]
Add Sema::CheckMessageArgumentTypes()...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43050 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix location processing of @encode: the range should include the @ sign.
Chris Lattner [Tue, 16 Oct 2007 22:51:17 +0000 (22:51 +0000)]
Fix location processing of @encode: the range should include the @ sign.
@selector probably gets this wrong also.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43048 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd a new Rewriter::getRangeSize method.
Chris Lattner [Tue, 16 Oct 2007 22:36:42 +0000 (22:36 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43047 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoPatch to diagnose duplicate method implementations.
Fariborz Jahanian [Tue, 16 Oct 2007 21:52:23 +0000 (21:52 +0000)]
Patch to diagnose duplicate method implementations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43046 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoRemove ObjcMethodDecl::getNumMethodParams/getMethodParamDecl, they aren't used/needed.
Steve Naroff [Tue, 16 Oct 2007 21:36:54 +0000 (21:36 +0000)]
Remove ObjcMethodDecl::getNumMethodParams/getMethodParamDecl, they aren't used/needed.
Change ObjcMethodDecl::getMethodType to getResultType, to match FunctionDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43045 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agopublish location info
Chris Lattner [Tue, 16 Oct 2007 21:21:26 +0000 (21:21 +0000)]
publish location info

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43044 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoSteve, pointer out that getName() is available for selectors. Made code much smaller...
Fariborz Jahanian [Tue, 16 Oct 2007 21:07:53 +0000 (21:07 +0000)]
Steve, pointer out that getName() is available for selectors. Made code much smaller, thanks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43042 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoPush the rewriter forward a bit more. Now it rewrites
Chris Lattner [Tue, 16 Oct 2007 21:07:07 +0000 (21:07 +0000)]
Push the rewriter forward a bit more.  Now it rewrites
#import to #include's as a test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43041 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agothese aren't const.
Chris Lattner [Tue, 16 Oct 2007 21:04:49 +0000 (21:04 +0000)]
these aren't const.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43040 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix problem dumping/printing method names with null selector.
Fariborz Jahanian [Tue, 16 Oct 2007 20:52:13 +0000 (20:52 +0000)]
Fix problem dumping/printing method names with null selector.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43039 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoPatch to implement AST generation for objective-c's @selector expression.
Fariborz Jahanian [Tue, 16 Oct 2007 20:40:23 +0000 (20:40 +0000)]
Patch to implement AST generation for objective-c's @selector expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43038 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoEmit diagnostics for methods not found.
Steve Naroff [Tue, 16 Oct 2007 20:39:36 +0000 (20:39 +0000)]
Emit diagnostics for methods not found.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43037 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUnbreak mingw32. Maybe there should be something like libClandSystem? :)
Anton Korobeynikov [Tue, 16 Oct 2007 09:09:44 +0000 (09:09 +0000)]
Unbreak mingw32. Maybe there should be something like libClandSystem? :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43029 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoinitialization of references should not do default fn/array promotions.
Chris Lattner [Tue, 16 Oct 2007 02:55:40 +0000 (02:55 +0000)]
initialization of references should not do default fn/array promotions.
This fixes a bug Anders noticed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43024 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoBad cast...need to use dyn_cast_or_null. Also changed Sema::InitBuiltinVaListType...
Steve Naroff [Tue, 16 Oct 2007 00:00:18 +0000 (00:00 +0000)]
Bad cast...need to use dyn_cast_or_null. Also changed Sema::InitBuiltinVaListType (which had the same bug).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43023 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoPatch to parse @selector expressions.
Fariborz Jahanian [Mon, 15 Oct 2007 23:39:13 +0000 (23:39 +0000)]
Patch to parse @selector expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43022 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoChange the type of ObjCStringLiteral from "struct __builtin_CFString *" to "NSConstan...
Steve Naroff [Mon, 15 Oct 2007 23:35:17 +0000 (23:35 +0000)]
Change the type of ObjCStringLiteral from "struct __builtin_CFString *" to "NSConstantString *".

This makes the typecheck much happier. Without this change, the type checker would have to special case "struct __builtin_CFString *". This change does assume the interface for NSConstantString is declared in the translation unit.

I left ASTContext::getCFConstantStringType() around for now (with a comment that says it is currently unused).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43021 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix a parser bug with message expressions - need to call ParsePostfixExpressionSuffix().
Steve Naroff [Mon, 15 Oct 2007 20:55:58 +0000 (20:55 +0000)]
Fix a parser bug with message expressions - need to call ParsePostfixExpressionSuffix().

Now were correctly allow the following...

    i = [str rangeOfString:@"]"].length;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43012 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMove type compatibility predicates from Type to ASTContext. In addition, the predicat...
Steve Naroff [Mon, 15 Oct 2007 20:41:53 +0000 (20:41 +0000)]
Move type compatibility predicates from Type to ASTContext. In addition, the predicates are now instance methods (they were previously static class methods on Type).

This allowed me to fix the following hack from this weekend...

// FIXME: Devise a way to do this without using strcmp.
// Would like to say..."return getAsStructureType() == IdStructType;", but
// we don't have a pointer to ASTContext.
bool Type::isObjcIdType() const {
  if (const RecordType *RT = getAsStructureType())
    return !strcmp(RT->getDecl()->getName(), "objc_object");
  return false;
}

...which is now...

bool isObjcIdType(QualType T) const {
  return T->getAsStructureType() == IdStructType;
}

Side notes:

- I had to remove a convenience function from the TypesCompatibleExpr class.

int typesAreCompatible() const {return Type::typesAreCompatible(Type1,Type2);}

Which required a couple clients get a little more verbose...

-    Result = TCE->typesAreCompatible();
+    Result = Ctx.typesAreCompatible(TCE->getArgType1(), TCE->getArgType2());

Overall, I think this change also makes sense for a couple reasons...

1) Since ASTContext vends types, it makes sense for the type compatibility API to be there.
2) This allows the type compatibility predeciates to refer to data not strictly present in the AST (which I have found problematic on several occasions).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43009 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd code generation and sema checking for __builtin_va_arg.
Anders Carlsson [Mon, 15 Oct 2007 20:28:48 +0000 (20:28 +0000)]
Add code generation and sema checking for __builtin_va_arg.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43006 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoSeveral name lookup conflict detection fixes involving objective-c names.
Fariborz Jahanian [Mon, 15 Oct 2007 19:16:57 +0000 (19:16 +0000)]
Several name lookup conflict detection fixes involving objective-c names.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43000 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdded ASTContext::setObjcIdType/getObjcIdType(), set by Sema.
Steve Naroff [Mon, 15 Oct 2007 14:41:52 +0000 (14:41 +0000)]
Added ASTContext::setObjcIdType/getObjcIdType(), set by Sema.

Also noticed ASTContext::BuiltinVaListType wasn't being initialized to the null type (so I set it).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42983 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoTeach the type checker about "id". This removes the following bogus warning...
Steve Naroff [Mon, 15 Oct 2007 03:14:16 +0000 (03:14 +0000)]
Teach the type checker about "id". This removes the following bogus warning...

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang t.m
t.m:29:18: warning: incompatible pointer types assigning 'id' to 'NSString *'
    resultString = [[NSString alloc] initWithFormat:0 arguments:0];
    ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42975 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd support for Pascal strings.
Anders Carlsson [Mon, 15 Oct 2007 02:50:23 +0000 (02:50 +0000)]
Add support for Pascal strings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42974 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix a warning
Anders Carlsson [Mon, 15 Oct 2007 02:50:04 +0000 (02:50 +0000)]
Fix a warning

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42973 91177308-0d34-0410-b5e6-96231b3b80d8

17 years ago- Teach ObjcInterfaceDecl::lookupInstance/ClassMethod to look through protocols.
Steve Naroff [Sun, 14 Oct 2007 23:13:51 +0000 (23:13 +0000)]
- Teach ObjcInterfaceDecl::lookupInstance/ClassMethod to look through protocols.
- Start looking up methods in the global method pools (for "id").
- Start integrating interface types into the type system.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42971 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd category lookup (removing a couple FIXME's).
Steve Naroff [Sun, 14 Oct 2007 18:27:41 +0000 (18:27 +0000)]
Add category lookup (removing a couple FIXME's).
Changed ObjcInterfaceDecl::ListCategories->CategoryList.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42968 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix -ast-dump for ObjC.
Steve Naroff [Sun, 14 Oct 2007 17:03:01 +0000 (17:03 +0000)]
Fix -ast-dump for ObjC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42967 91177308-0d34-0410-b5e6-96231b3b80d8

17 years ago- Added Sema::AddFactoryMethodToGlobalPool and Sema::AddInstanceMethodToGlobalPool...
Steve Naroff [Sun, 14 Oct 2007 00:58:41 +0000 (00:58 +0000)]
- Added Sema::AddFactoryMethodToGlobalPool and Sema::AddInstanceMethodToGlobalPool and DenseMaps. This will allow us to efficiently lookup a method from a selector given no type information (for the "id" data type).

- Fixed some funky "}
                    else {" indentation in Sema::ActOnAddMethodsToObjcDecl(). I'd prefer we stay away from this style...it wastes space and isn't any easier to read (from my perspective, at least:-)

- Changed Parser::ParseObjCInterfaceDeclList() to only call Action::ActOnAddMethodsToObjcDecl() when it actually has methods to add (since most interface have methods, this is a very minor cleanup).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42957 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix an incorrect assertion.
Anders Carlsson [Sat, 13 Oct 2007 05:52:34 +0000 (05:52 +0000)]
Fix an incorrect assertion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42951 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agohaha, my devious plot is complete:
Chris Lattner [Sat, 13 Oct 2007 00:46:29 +0000 (00:46 +0000)]
haha, my devious plot is complete:

$ clang rewrite.c -rewrite-test
prints:

int foo() {
        b:      foo();
f:      foo();
    foo();
}

for:

int foo() {
b: foo();
f: foo();
    foo();
}

amazing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42944 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd __builtin_va_list definitions for x86_64 and ppc64.
Anders Carlsson [Sat, 13 Oct 2007 00:45:48 +0000 (00:45 +0000)]
Add __builtin_va_list definitions for x86_64 and ppc64.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42943 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoWith this I can now insert stuff before tabs, woo.
Chris Lattner [Sat, 13 Oct 2007 00:21:23 +0000 (00:21 +0000)]
With this I can now insert stuff before tabs, woo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42942 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoWoo, tab deletion now works. Next lets see if we can
Chris Lattner [Sat, 13 Oct 2007 00:17:04 +0000 (00:17 +0000)]
Woo, tab deletion now works.  Next lets see if we can
insert stuff.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42941 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoanother step forward in rewriter stuff. This still has
Chris Lattner [Sat, 13 Oct 2007 00:11:23 +0000 (00:11 +0000)]
another step forward in rewriter stuff.  This still has
some incredibly subtle details that I'm working on getting
right.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42940 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoGenerate code for va_start and va_end.
Anders Carlsson [Fri, 12 Oct 2007 23:56:29 +0000 (23:56 +0000)]
Generate code for va_start and va_end.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42939 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoPatch to check for duplicate method decls in protocols.
Fariborz Jahanian [Fri, 12 Oct 2007 23:43:31 +0000 (23:43 +0000)]
Patch to check for duplicate method decls in protocols.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42938 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove dead method with bogus comment.
Chris Lattner [Fri, 12 Oct 2007 23:18:19 +0000 (23:18 +0000)]
remove dead method with bogus comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42937 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoCheck and diagnose that objective-c objects may not be statically allocated.
Fariborz Jahanian [Fri, 12 Oct 2007 22:10:42 +0000 (22:10 +0000)]
Check and diagnose that objective-c objects may not be statically allocated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42936 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdded notion of '*' specified format width/specifiers when checking
Ted Kremenek [Fri, 12 Oct 2007 20:51:52 +0000 (20:51 +0000)]
Added notion of '*' specified format width/specifiers when checking
printf format strings.  Added type checking to see if the matching
width/precision argument was of type 'int'.

Thanks to Anders Carlsson for reporting this missing feature.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42933 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd a new SM::getDecomposedFileLoc method.
Chris Lattner [Fri, 12 Oct 2007 20:24:19 +0000 (20:24 +0000)]
add a new SM::getDecomposedFileLoc method.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42931 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFixed typo in comment.
Fariborz Jahanian [Fri, 12 Oct 2007 19:53:08 +0000 (19:53 +0000)]
Fixed typo in comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42928 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFixed a @compatible_alias bug. In the process, discovered unnecessary 2ndry lookup
Fariborz Jahanian [Fri, 12 Oct 2007 19:38:20 +0000 (19:38 +0000)]
Fixed a @compatible_alias bug. In the process, discovered unnecessary 2ndry lookup
ok class names and streamlined this logic to do the lookup once.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42926 91177308-0d34-0410-b5e6-96231b3b80d8