Commit Graph

2135 Commits

Author SHA1 Message Date
Steve Naroff 93eb5f1438 Remove Scope argument from ObjC actions that either don't need it or can now use TUScope.
Also improve a recently added comment.

llvm-svn: 42826
2007-10-10 17:32:04 +00:00
Chris Lattner 5d45178179 Add a dummy for the id typedef. Steve, plz fill this in. :)
llvm-svn: 42819
2007-10-09 22:58:09 +00:00
Chris Lattner 1f1b0dbc28 Make a significant change to invert the control flow handling
predefined macros.  Previously, these were handled by the driver,
now they are handled by the preprocessor.

Some fallout of this:

1. Instead of preprocessing two buffers (the predefines, then the 
   main source file)  we now start preprocessing the main source 
   file and inject the predefines as a "psuedo #include" from the
   main source file.
2. #1 allows us to nuke the Lexer::IsMainFile flag and simplify
   Preprocessor::isInPrimaryFile.
3. The driver doesn't have to know about standard #defines, the
   preprocessor knows, which is nice for people wanting to define
   their own drivers.
4. This allows us to put normal tokens in the predefine buffer,
   for example a definition for __builtin_va_list that is 
   target-specific, and a typedef for id in objc.

llvm-svn: 42818
2007-10-09 22:10:18 +00:00
Steve Naroff c62adb6d1a Make sure methods with no return type default to "id".
This fixes a crasher in Sema::MatchTwoMethodDeclarations(), identified by selector-overload.m (just added).

Added Action::ActOnTranslationUnitScope() and renamed Action::PopScope to ActOnPopScope.

Added a Translation Unit Scope instance variable to Sema (will be very useful to ObjC-related actions, since ObjC declarations are always file-scoped).

llvm-svn: 42817
2007-10-09 22:01:59 +00:00
Devang Patel 152f18f671 Recognize while(1) and avoid extra blocks.
llvm-svn: 42811
2007-10-09 20:51:27 +00:00
Devang Patel f8a76755df new test
llvm-svn: 42810
2007-10-09 20:37:41 +00:00
Chris Lattner 87547e6c15 avoid a noop virtual method call on the hot scope poping path.
llvm-svn: 42809
2007-10-09 20:37:18 +00:00
Devang Patel c1380400d5 Recognize "do {} while (0)" idiom and avoid extra basic blocks.
llvm-svn: 42808
2007-10-09 20:33:39 +00:00
Devang Patel 7ad0c2f1f9 Use LLVMFoldingBuilder
llvm-svn: 42807
2007-10-09 19:49:58 +00:00
Fariborz Jahanian eb2b34a9a5 Remove comment about protocols and namespace no longer relevant.
llvm-svn: 42804
2007-10-09 18:28:41 +00:00
Fariborz Jahanian c8e7a93b02 Minor code clean up to make it more readable.
llvm-svn: 42803
2007-10-09 18:22:59 +00:00
Chris Lattner 516ca70f5d Update DeclKind enums to reflect ObjcProtocolDecl's inheritance change.
llvm-svn: 42802
2007-10-09 18:18:24 +00:00
Fariborz Jahanian 06f84f5f84 Remove addition of protocol names to declaration scopes, use a separate
DenseMap to keep track of such declarations and derive ObjcProtocolDecl
directyly from NamedScope.

llvm-svn: 42801
2007-10-09 18:03:53 +00:00
Chris Lattner 3c69f12cbc convert driver over to use Token::is/isNot APIs. fwew, all done.
llvm-svn: 42800
2007-10-09 18:03:42 +00:00
Chris Lattner 98c1f7cfde Switch lexer/pp over to new Token::is/isNot api
llvm-svn: 42799
2007-10-09 18:02:16 +00:00
Chris Lattner 0ef1352a94 swtich to Token::is/isNot
llvm-svn: 42798
2007-10-09 17:51:17 +00:00
Chris Lattner feb00b6e12 switch more code to use Token::is/isNot where possible.
llvm-svn: 42797
2007-10-09 17:41:39 +00:00
Chris Lattner 76c7228ef9 switch some more of the parser over to using Token::is and isNot
llvm-svn: 42796
2007-10-09 17:33:22 +00:00
Chris Lattner 0ab032aa8f Add two new Token helper functions, "is" and "isNot". This allows us to write
stuff like this:

       // If we don't have a comma, it is either the end of the list (a ';') or
       // an error, bail out.
       if (Tok.isNot(tok::comma))
         break;
instead of:
       // If we don't have a comma, it is either the end of the list (a ';') or
       // an error, bail out.
       if (Tok.getKind() != tok::comma)
         break;

There is obviously no functionality change, but the code reads a bit better and is 
more terse.

llvm-svn: 42795
2007-10-09 17:23:58 +00:00
Fariborz Jahanian f483847233 Added better comment about protocol list for class ObjcQualifiedInterfaceType.
llvm-svn: 42794
2007-10-09 17:14:13 +00:00
Chris Lattner a55a2cc25c rename some "Parse" actions to "ActOn". Move code around in
ParseFunctionDefinition so that ActOnFunctionDefBody is always
called if ActOnStartOfFunctionDef is called.  This fixes a crash
reported by Nuno Lopes.

llvm-svn: 42793
2007-10-09 17:14:05 +00:00
Devang Patel eac5948348 Use const& for RHS.
Use copy for LHS, because it is incremented using ++ operator.

llvm-svn: 42792
2007-10-09 17:10:59 +00:00
Devang Patel 49a44f3b52 Fix comment. Describe what it is, instead of how it is used.
llvm-svn: 42791
2007-10-09 17:08:50 +00:00
Fariborz Jahanian cb995d8981 Prevent memory leak by not creating a category object when there is a
fatal error of category's undefined interface.

llvm-svn: 42790
2007-10-09 17:05:22 +00:00
Steve Naroff 8e748cb4e9 Remove 2 protocol related actions from MinimalActions (protocols shouldn't be recognized as types).
llvm-svn: 42777
2007-10-08 23:10:47 +00:00
Fariborz Jahanian da6c012ee7 Added a new class for Interfaces qualified by protocol list.
Protocols are now sorted and made unique in the list.
Enhanced pretty printer for @interface (So, I can see the protocol list).

llvm-svn: 42776
2007-10-08 23:06:41 +00:00
Steve Naroff b163154c2d Removed unused instance variable from FieldDecl.
llvm-svn: 42773
2007-10-08 21:56:47 +00:00
Chris Lattner ba9dddb01e Rename FileVariable -> FileVar for consistency with its class name,
likewise block and param.  Reorder the layout of the Decl kind enum
so that the inheritance tree is reflected in the ordering.  This allows
trivial range comparisons to determine whether something is an instance
of some abstract class, making classof faster.

llvm-svn: 42772
2007-10-08 21:37:32 +00:00
Chris Lattner 15b7278931 add a comment.
llvm-svn: 42771
2007-10-08 21:36:22 +00:00
Chris Lattner 6776a8d359 Move identifierTable.h to the right folder.
llvm-svn: 42770
2007-10-08 21:35:59 +00:00
Steve Naroff 71c3c1c715 Convert Selector Maps/Sets to use stronger typing (now that we have DenseMapInfo in IdentifierTable.h).
llvm-svn: 42767
2007-10-08 21:05:34 +00:00
Devang Patel 1166312e8b Code gen case statement ranges.
llvm-svn: 42766
2007-10-08 20:57:48 +00:00
Fariborz Jahanian e90597f593 Several small patches to do pretty printing for objective-c top-level decls
(minimal printing), Derive ObjcClassDecl from Decl. Ted may want to 
take note of the change I made to CFGRecStmtDeclVisitor.h

llvm-svn: 42764
2007-10-08 18:53:38 +00:00
Fariborz Jahanian 092e34d15b Removed unnecessary base class from some of objective-c classes:
ObjcProtocolDecl is now derived from ScopedDecl. ObjcForwardProtocolDecl from Decl.
ObjcImplementationDecl fom NamedDecl.

llvm-svn: 42756
2007-10-08 17:35:11 +00:00
Fariborz Jahanian 4b2113c281 Return NULL on invalid protocol.
llvm-svn: 42754
2007-10-08 16:07:03 +00:00
Chris Lattner c330d008f4 remove unneeded #include
llvm-svn: 42731
2007-10-07 08:59:27 +00:00
Chris Lattner ef6b136781 move IdentifierTable.h from liblex to libbasic.
llvm-svn: 42730
2007-10-07 08:58:51 +00:00
Chris Lattner 4894f485c7 implement the Token class in the Lexer.cpp file instead of IdentifierInfo.cpp
llvm-svn: 42728
2007-10-07 08:47:24 +00:00
Chris Lattner c43ddc84a3 improve layering:
Now instead of IdentifierInfo knowing anything about MacroInfo,
only the preprocessor knows.  This makes MacroInfo truly private
to the Lex library (and its direct clients) instead of being 
accessed in the Basic library.

llvm-svn: 42727
2007-10-07 08:44:20 +00:00
Chris Lattner 259716a6e1 change calls to getMacroInfo into hasMacroDefinition() where possible.
llvm-svn: 42726
2007-10-07 08:04:56 +00:00
Chris Lattner d7b971bf3d add a hasMacroDefinition() method to IdentifierInfo, strength reduce a
call to getMacroInfo to call it.

llvm-svn: 42725
2007-10-07 07:57:27 +00:00
Chris Lattner f49523d6ea update comment.
llvm-svn: 42724
2007-10-07 07:54:23 +00:00
Chris Lattner ff067ce555 Remove the PPID bitfield from IdentifierInfo, shrinking it by a word
(because all bitfields now fit in 32 bits).  This shrinks the identifier
table for carbon.h from 1634428 to 1451424 bytes (12%) and has no impact 
on compile time.

llvm-svn: 42723
2007-10-07 07:52:34 +00:00
Chris Lattner a441ca651f First step to fixing a long lived layering violation: this
moves the MacroInfo pointer to a side hash table (which currently 
lives in IdentifierTable.cpp).  This removes a pointer from 
Identifier info, but doesn't shrink it, as it requires a new bit 
be added.  This strange approach with the 'hasmacro' bit is needed
to not lose preprocessor performance.

llvm-svn: 42722
2007-10-07 07:09:52 +00:00
Chris Lattner 65cc87ffc2 The identifier shouldn't be added to the scope, the decl should.
This fixes strange assertions that just started triggering.

llvm-svn: 42721
2007-10-07 07:05:08 +00:00
Chris Lattner 65fc0f1fca classof isn't right. This is causing assertion failures somehow now.
llvm-svn: 42720
2007-10-07 07:04:41 +00:00
Chris Lattner 730160d32f Shrink the builtinID down by 3 bits, allowing all the bitfields to
fit in 32-bits, shrinking IdentifierInfo by a word.

This shrinks the total size of the identifier pool from 
1817264 to 1634428 bytes (11%) on carbon.h.

llvm-svn: 42719
2007-10-07 06:29:32 +00:00
Chris Lattner d1cdee7d1f Rename ASTStreamers.* -> ASTConsumers.*
llvm-svn: 42718
2007-10-07 06:04:32 +00:00
Chris Lattner 5700fab189 simplify the interfaces to create selectors: getSelector can take any
number of arguments now and does the right thing, but the nullary/unary
accessors are preserved as convenience functions.  This allows us to
slightly simplify clients.

llvm-svn: 42716
2007-10-07 02:00:24 +00:00
Chris Lattner f7f34d09e4 simplify some Selector interfaces.
llvm-svn: 42715
2007-10-07 01:33:16 +00:00