Commit Graph

22 Commits

Author SHA1 Message Date
Fariborz Jahanian cfb31fab5e Patch for building method declaration nodes. Also fixed a segfault in cocoa.m due
to use of @property.

llvm-svn: 41880
2007-09-12 18:23:47 +00:00
Fariborz Jahanian 33d037441e Early patch to collect objective-c methods inserts them in
class object.

llvm-svn: 41801
2007-09-10 20:33:04 +00:00
Steve Naroff 09bf815f89 The goal of this commit is to get just enough Sema support to recognize Objective-C classes
as types. That said, the AST nodes ObjcInterfaceDecl, ObjcInterfaceType, and ObjcClassDecl are *very*
preliminary.

The good news is we no longer need -parse-noop (aka MinimalActions) to parse cocoa.m.

llvm-svn: 41752
2007-09-06 21:24:23 +00:00
Chris Lattner bd4de5df77 Fix "no newline at end of file" warnings. Patch contributed by
Benoit Boissinot!

llvm-svn: 39780
2007-07-12 15:43:07 +00:00
Chris Lattner 23b7eb677d Finally bite the bullet and make the major change: split the clang namespace
out of the llvm namespace.  This makes the clang namespace be a sibling of
llvm instead of being a child.

The good thing about this is that it makes many things unambiguous.  The
bad things is that many things in the llvm namespace (notably data structures
like smallvector) now require an llvm:: qualifier.  IMO, libsystem and libsupport
should be split out of llvm into their own namespace in the future, which will fix
this issue.

llvm-svn: 39659
2007-06-15 23:05:46 +00:00
Chris Lattner 53621a535d Implement support for formal arguments. We can now compile this:
int test(int X, short Y, float Z) {
  return (int)(X*Y+Z);
}

to:

define i32 @test(i32 %X, i16 %Y, float %Z) {
entry:
        %promote = sext i16 %Y to i32           ; <i32> [#uses=1]
        %mul = mul i32 %promote, %X             ; <i32> [#uses=1]
        %promote3 = sitofp i32 %mul to float            ; <float> [#uses=1]
        %add = add float %promote3, %Z          ; <float> [#uses=1]
        %conv = fptosi float %add to i32                ; <i32> [#uses=1]
        ret i32 %conv
}

with:

$ clang -emit-llvm t.c | llvm-as | opt -std-compile-opts | llvm-dis

llvm-svn: 39652
2007-06-13 20:44:40 +00:00
Chris Lattner 4ef40013d7 Implement capturing of enum values and chaining of enums together.
llvm-svn: 39644
2007-06-11 01:28:17 +00:00
Steve Naroff 6a0675f8a4 Bug #:
Submitted by:
Reviewed by:
Add implemention file for GCC attributes

llvm-svn: 39542
2007-06-01 21:54:34 +00:00
Steve Naroff 0f2fe17ff1 Bug #:
Submitted by:
Reviewed by:
Implement support for GCC __attribute__.

- Implement "TODO" in Parser::ParseAttributes. Changed the return type from
void to Parser::DeclTy. Changed all call sites to accept the return value.
- Added Action::ParseAttribute and Sema::ParseAttribute to return an
appropriate AST node. Added new node AttributeDecl to Decl.h.

Still to do...hook up to the Decl...

llvm-svn: 39539
2007-06-01 17:11:19 +00:00
Chris Lattner a5490953d1 correct printout, enums are separate.
llvm-svn: 39492
2007-05-24 01:09:39 +00:00
Chris Lattner fc234de388 silence a bunch of warnings, fix some funky indentation.
llvm-svn: 39487
2007-05-24 00:40:54 +00:00
Steve Naroff f84d11f9d7 Bug #:
Submitted by:
Reviewed by:
Added "global" statistics gathering for Decls/Stmts/Exprs.
Very useful for working with a single file. When we start compiling
multiple files, will need to enhance this to collect stats on a per-module
basis.

llvm-svn: 39485
2007-05-23 21:48:04 +00:00
Steve Naroff cc3214299b Bug #:
Submitted by:
Reviewed by:
Finish up Sema::ParseMemberReferenceExpr. This involved:
- added a getMember() function to RecordDecl.
- added stronger typing for "Members" (from Decl->FieldDecl).
- added a dignostic for members not found.
- changed MemberExpr to install the correct TypeRef.
- In general, simplified and cleaned up the routing.

llvm-svn: 39364
2007-03-26 23:09:51 +00:00
Chris Lattner c1915e2052 Create EnumConstantDecl objects for each enum value, and fill them into
the EnumDecl when the enum type is complete.  This allows us to detect
redefinitions of enums.

llvm-svn: 39300
2007-01-25 07:29:02 +00:00
Chris Lattner 5f521506aa Add EnumDecl, warn about forward references to enums:
t.c:2:6: warning: ISO C forbids forward references to 'enum' types
enum foo22* X;
     ^

llvm-svn: 39299
2007-01-25 06:27:24 +00:00
Chris Lattner 4194315681 Save the member list of a struct/union in the RecordDecl for the struct.
llvm-svn: 39297
2007-01-25 04:52:46 +00:00
Chris Lattner ec040b1d89 make Decl::getName() not crash if the decl is unnamed (e.g. an unnamed argument)
llvm-svn: 39260
2007-01-21 23:09:50 +00:00
Chris Lattner 8f5bf2f233 avoid allocating memory for empty arg lists
llvm-svn: 39255
2007-01-21 19:04:10 +00:00
Chris Lattner c5cdf4d092 Next big step in function parsing: create decl objects for parameters,
inserting them into the function body scope and registering them with the
corresponding FunctionDecl.

llvm-svn: 39253
2007-01-21 07:42:07 +00:00
Chris Lattner 17ed487947 parse identifier expressions properly. This allows us diagnose this:
typedef int X;

int A() {
  return X;
}

int B() {
  return Y;
}

as:

/Users/sabre/test.c:5:10: error: unexpected type name 'X': expected expression
return X;
       ^
/Users/sabre/test.c:9:10: error: use of undeclared 'Y' value
return Y;
       ^

llvm-svn: 39192
2006-11-20 04:58:19 +00:00
Chris Lattner 6d9a685d75 Make the driver print function bodies at -parse-print-ast
llvm-svn: 39048
2006-10-25 05:11:20 +00:00
Chris Lattner a11999d83a start creating proper ast nodes for variables and functions
llvm-svn: 38991
2006-10-15 22:34:45 +00:00