Commit Graph

444 Commits

Author SHA1 Message Date
Chris Lattner 65531e8fb7 Fix a fixme, by only parsing extern "C" in C++ mode.
llvm-svn: 45905
2008-01-12 07:08:43 +00:00
Chris Lattner 38376f1595 Add first pieces of support for parsing and representing
extern "C" in C++ mode.  Patch by Mike Stump!

llvm-svn: 45904
2008-01-12 07:05:38 +00:00
Fariborz Jahanian c644ee4992 Warn (as gcc does) when @end does not close anything.
llvm-svn: 45834
2008-01-10 17:58:07 +00:00
Ted Kremenek 1b0ea82459 Substituted all instances of the string "Objc" for "ObjC". This fixes
some naming inconsistencies in the names of classes pertaining to Objective-C
support in clang.

llvm-svn: 45715
2008-01-07 19:49:32 +00:00
Fariborz Jahanian e908cab389 Added a comment, minor refactoring of foreach parsing code per Chris's suggestion.
llvm-svn: 45601
2008-01-04 23:23:46 +00:00
Fariborz Jahanian 3622e5954b Minor changes as suggested by Chris L.
llvm-svn: 45598
2008-01-04 23:04:08 +00:00
Fariborz Jahanian 732b8c2dc5 Patch to parse/build AST ObjC2's foreach statement.
llvm-svn: 45539
2008-01-03 17:55:25 +00:00
Fariborz Jahanian 8361552af9 New declarations/defs for Objc2's foreach-statement. This is work in progress.
llvm-svn: 45511
2008-01-02 22:54:34 +00:00
Fariborz Jahanian 056e3a4e90 Issue diagnostic when objective-c's @interface is preceeded by a type specifier.
llvm-svn: 45491
2008-01-02 19:17:38 +00:00
Fariborz Jahanian 5e57e1890d Prevent crash on incorrect objc messaging expression.
llvm-svn: 45489
2008-01-02 18:09:46 +00:00
Chris Lattner 5926c0ebfb remove attribution from makefiles.
llvm-svn: 45412
2007-12-29 20:02:25 +00:00
Chris Lattner 5b12ab8c93 Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.

llvm-svn: 45410
2007-12-29 19:59:25 +00:00
Chris Lattner 11221033be Fix a crash on a top-level objc string, patch by Nico Weber
llvm-svn: 45370
2007-12-27 20:29:42 +00:00
Chris Lattner 5e530bcee3 - Use Tok.isObjCAtKeyword instead of Tok.getIdentifierInfo()->getObjCKeywordID().
The later fails if the token is not an identifier.
 - Replace tabs with spaces.
 - Various other cleanups.

Patch by Nico Weber!

llvm-svn: 45368
2007-12-27 19:57:00 +00:00
Chris Lattner dcb7cc59ae Fix an nice and subtle parser bug reported by Nico Weber.
llvm-svn: 45149
2007-12-18 06:06:23 +00:00
Steve Naroff 2050b0d05a Add __private_extern__ keyword and recognize it. Added a FIXME to indicate there is still work to do.
llvm-svn: 45135
2007-12-18 00:16:02 +00:00
Chris Lattner 52a6f82d0f use new interface.
llvm-svn: 44978
2007-12-13 02:05:09 +00:00
Fariborz Jahanian 4d1288a67e Concatenation of objc strings.
llvm-svn: 44964
2007-12-12 23:55:49 +00:00
Ted Kremenek 1daa3cfbae TargetInfo no longer includes a reference to SourceManager.
Moved all clients of Diagnostics to use FullSourceLoc instead of SourceLocation.
Added many utility methods to FullSourceLoc to provide shorthand for:

    FullLoc.getManager().someMethod(FullLoc.getLocation());
    
instead we have:

    FullLoc.someMethod();
    
Modified TextDiagnostics (and related classes) to use this short-hand.

llvm-svn: 44957
2007-12-12 22:39:36 +00:00
Chris Lattner 61511e12e0 move function to a more logical location, add its grammar productions.
llvm-svn: 44923
2007-12-12 06:56:32 +00:00
Chris Lattner 074f325746 remove todo
llvm-svn: 44922
2007-12-12 06:54:22 +00:00
Chris Lattner 840e05ba11 simplify some code.
llvm-svn: 44913
2007-12-12 06:13:27 +00:00
Chris Lattner e002fbea56 Add ObjC parser support for concatenated ObjC strings. Note that
this is passed to sema and ignored there, so the second part of the
string will not make it into the AST.  Passing to Fariborz to finish
Sema + AST construction.

llvm-svn: 44898
2007-12-12 01:04:12 +00:00
Ted Kremenek d4e5fbacab Mega-patch: ripped SourceManager out of Diagnostic/DiagnosticClient. Now
SourceManager is passed by reference, allowing the SourceManager to be
associated with a specific translation unit, and not the entire execution
of the driver.

Modified all users of Diagnostics to comply with this new interface.

Integrated SourceManager as a member variable of TargetInfo. TargetInfo will
eventually be associated with a single translation unit (just like
SourceManager).

Made the SourceManager reference in ASTContext private. Provided accessor
getSourceManager() for clients to use instead. Modified clients to comply with
new interface.

llvm-svn: 44878
2007-12-11 21:27:55 +00:00
Fariborz Jahanian 251a943ce9 Fixed a parsing bug whereby @optional/@required keyword is not followed by
a method declaration.

llvm-svn: 44870
2007-12-11 18:34:51 +00:00
Fariborz Jahanian 2bbd03a755 Patch to implement "Protocol" as a built-in type declared as
"@class Protocol;"

llvm-svn: 44670
2007-12-07 00:18:54 +00:00
Steve Naroff 152dd812b2 Make sure Parser::ParseObjCSelectorExpression() handles unary selectors (with no arguments) properly.
llvm-svn: 44636
2007-12-05 22:21:29 +00:00
Chris Lattner 9724ce12f9 improve VC++ compatibility, patch by Cédric Venet.
llvm-svn: 44496
2007-12-02 00:47:03 +00:00
Seo Sanghyeon 34f92ace1f Test commit
llvm-svn: 44488
2007-12-01 08:06:07 +00:00
Steve Naroff 205ec3d07a Yesterday, I simplified how we stream top-level decls.
After a discussion with Ted, we both came to the conclusion that adding a "HandleTopLevelDeclaration" hook to ASConsumer is far more elegant. The default implementation of HandleTopLevelDeclaration will be responsible for iterating over the ScopedDecl (which has a chain of the decls:-).

TODO: Once Ted adds HandleTopLevelDeclaration, make sure TagDecls are chainged appropriately...
llvm-svn: 44445
2007-11-29 23:05:20 +00:00
Steve Naroff 197616c3a8 Several fixes/simplifications surrounding how we stream top-level decl AST's.
The following code...

typedef struct cssm_data {} CSSM_DATA, *CSSM_DATA_PTR;

struct Y { int A; };

struct X { int A; } D; 

struct X E, F;

...now produces the following output...

> ../../Debug/bin/clang xx.c -ast-print
Read top-level tag decl: 'cssm_data'
typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data *CSSM_DATA_PTR;
Read top-level tag decl: 'Y'
Read top-level tag decl: 'X'
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'F'

...which is much more accurate than the previous -ast-print output...

typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data CSSM_DATA;
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'E'

llvm-svn: 44421
2007-11-28 22:54:11 +00:00
Anders Carlsson 660bdd1c87 Keep track of whether the asm is volatile or not.
llvm-svn: 44297
2007-11-23 23:12:25 +00:00
Anders Carlsson 94ea8aab34 Store output and input operands as well as clobber information in the AsmStmt. Ted, could you please review the serialization/deserialization code?
llvm-svn: 44266
2007-11-22 01:36:19 +00:00
Anders Carlsson 091a059c55 GCC fails if there is a trailing colon but no clobbers.
llvm-svn: 44265
2007-11-21 23:27:34 +00:00
Anders Carlsson 81a5a69682 Store inline asm code in the AST.
llvm-svn: 44255
2007-11-20 19:21:03 +00:00
Steve Naroff e3ffc2f4a9 Finish up variadic methods/messages.
llvm-svn: 44172
2007-11-15 13:05:42 +00:00
Steve Naroff d8ea1ac576 Implement support for variadic methods (work in progress).
llvm-svn: 44171
2007-11-15 12:35:21 +00:00
Chris Lattner bb31a42fef Handle "bool" in all places that touch _Bool.
This fixes code like "if((bool)x) {}" for example.

Patch by Nate Begeman.

llvm-svn: 44159
2007-11-15 05:25:19 +00:00
Steve Naroff 7b8fa4746a Rewrite method definition bodies. Also renamed a method to distinguish between method declarations and definitions.
llvm-svn: 44080
2007-11-13 23:01:27 +00:00
Nate Begeman a0f78974a6 Give AST-walk passes a way to access DeclSpec attributes on functions and
variables.

llvm-svn: 44073
2007-11-13 22:14:47 +00:00
Chris Lattner 47791a4051 Parse "sizeof(arr)[0]" as a sizeof of an expr if arr
is an expression.

llvm-svn: 44065
2007-11-13 20:50:37 +00:00
Fariborz Jahanian d98a734bd6 'super' nailed.
llvm-svn: 44025
2007-11-12 20:13:27 +00:00
Steve Naroff cd002f5a0e Add an error diagnostic to Parse::ParseObjCMessageExpression().
This now exposes the following bug...

******************** TEST 'Sema/message.m' FAILED! ********************
Command: 
 clang -fsyntax-only -verify Sema/message.m
Output:
Errors seen but not expected:
  Line 9: invalid receiver to message expression
******************** TEST 'Sema/message.m' FAILED! ********************

As far as I can tell, all messages to method agruments fail.

The method arguments are built by Sema::ObjcActOnStartOfMethodDef().

llvm-svn: 44022
2007-11-12 19:18:37 +00:00
Steve Naroff b313fc3203 Replace 2 method definition actions (ActOnFunctionDefBody, ActOnMethodDefBody) with 1 method definition action (ActOnFinishFunctionBody). I can't think of any reason that we would need two action hooks.
llvm-svn: 44000
2007-11-11 23:20:51 +00:00
Steve Naroff bb87572d70 Replace 3 method definition functions (ObjcParseMethodDefinition, ParseObjCInstanceMethodDefinition, ParseObjCClassMethodDefinition) with 1 method definition function (ParseObjCMethodDefinition).
Less code/confusion.

llvm-svn: 43999
2007-11-11 19:54:21 +00:00
Steve Naroff cac26f4f5f This is the last 5% of the solution to teaching Sema::ActOnInstanceMessage() about private methods (r43989).
While the diff is large, the idea is very simple. When we parse method definitions (in an @implementation), we need to add them incrementally (rather than wait until the @end).

Other details...

- Renamed Sema::ActOnAddMethodsToObjcDecl() to Sema::ActOnAtEnd(). The methods are now optional arguments.
- Removed Parser::AllImplMethods (a nice cleanup).
- Added location info to ObjcImplementationDecl (since we will need it very soon:-)
- Modified message.m test to no longer allow the bogus diagnostic.

llvm-svn: 43995
2007-11-11 17:19:15 +00:00
Fariborz Jahanian 16e3123071 pretty priting for method definitions.
llvm-svn: 43986
2007-11-10 20:59:13 +00:00
Fariborz Jahanian 85e1d0d807 Represent method definitions as separate AST nodes. Pretty print will come next.
llvm-svn: 43979
2007-11-10 16:31:34 +00:00
Fariborz Jahanian 7a017215eb Some code clean up in the form of name changes for functions which
process method definitions.

llvm-svn: 43967
2007-11-09 22:27:59 +00:00
Fariborz Jahanian b5605179c4 Added class context to method declarations. Provide "interface *" type
to 'self' method of instance methods.

llvm-svn: 43957
2007-11-09 19:52:12 +00:00