summaryrefslogtreecommitdiffstats
path: root/clang/Lex/IdentifierTable.cpp
Commit message (Collapse)AuthorAgeFilesLines
* move IdentifierTable.h from liblex to libbasic.Chris Lattner2007-10-071-374/+0
| | | | llvm-svn: 42730
* implement the Token class in the Lexer.cpp file instead of IdentifierInfo.cppChris Lattner2007-10-071-19/+0
| | | | llvm-svn: 42728
* improve layering:Chris Lattner2007-10-071-24/+3
| | | | | | | | | 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
* Remove the PPID bitfield from IdentifierInfo, shrinking it by a word Chris Lattner2007-10-071-11/+45
| | | | | | | | (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
* First step to fixing a long lived layering violation: thisChris Lattner2007-10-071-2/+21
| | | | | | | | | | 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
* simplify the interfaces to create selectors: getSelector can take any Chris Lattner2007-10-071-12/+3
| | | | | | | | 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
* simplify some Selector interfaces.Chris Lattner2007-10-071-44/+46
| | | | llvm-svn: 42715
* Implement DenseMapInfo for Selector, allowing use of DenseMap/DenseSet ofChris Lattner2007-10-051-0/+8
| | | | | | | | Selector's instead of requiring void* to be used. I converted one use of DenseSet<void*> over to use DenseSet<Selector> but the others should change as well. llvm-svn: 42645
* Layering refinements for selectors (suggested by Chris). Specifics...Steve Naroff2007-10-051-0/+148
| | | | | | | | | | | - Add SelectorTable, which enables us to remove MultiKeywordSelector from the public header. - Remove FoldingSet from IdentifierInfo.h and Preprocessor.h. - Remove Parser::ObjcGetUnarySelector and Parser::ObjcGetKeywordSelector, they are subsumed by SelectorTable. - Add MultiKeywordSelector to IdentifierInfo.cpp. - Move a bunch of selector related methods from ParseObjC.cpp to IdentifierInfo.cpp. - Added some comments. llvm-svn: 42643
* Add some comments to MultiKeywordSelector, make all methods private, add a ↵Steve Naroff2007-09-281-30/+0
| | | | | | friend, move some methods around. llvm-svn: 42456
* Yesterday I discovered that 78% of all selectors in "Cocoa.h" take 0/1 argument.Steve Naroff2007-09-281-18/+24
| | | | | | | | | | | | This motivated implementing a devious clattner inspired solution:-) This approach uses a small value "Selector" class to point to an IdentifierInfo for the 0/1 case. For multi-keyword selectors, we instantiate a MultiKeywordSelector object (previously known as SelectorInfo). Now, the incremental cost for selectors is only 24,800 for Cocoa.h! This saves 156,592 bytes, or 86%!! The size reduction is also the result of getting rid of the AST slot, which was not strictly necessary (we will associate a selector with it's method using another table...most likely in Sema). This change was critical to make now, before we have too many clients. I still need to add some comments to the Selector class...will likely add later today/tomorrow. llvm-svn: 42452
* Fix bug in SelectorInfo::getName() - method buffer needs to be passed by ↵Steve Naroff2007-09-271-6/+8
| | | | | | reference. llvm-svn: 42411
* Add SelectorInfo (similar in spirit to IdentifierInfo). The key difference ↵Steve Naroff2007-09-271-0/+23
| | | | | | | | | | | | | | | | | | | | is SelectorInfo is not string-oriented, it is a unique aggregate of IdentifierInfo's (using a folding set). SelectorInfo also has a richer API that simplifies the parser/action interface. 3 noteworthy benefits: #1: It is cleaner. I never "liked" storing keyword selectors (i.e. foo:bar:baz) in the IdentifierTable. #2: It is more space efficient. Since Cocoa keyword selectors can be quite long, this technique is space saving. For Cocoa.h, pulling the keyword selectors out saves ~180k. The cost of the SelectorInfo data is ~100k. Saves ~80k, or 43%. #3: It results in many API simplifications. Here are some highlights: - Removed 3 actions (ActOnKeywordMessage, ActOnUnaryMessage, & one flavor of ObjcBuildMethodDeclaration that was specific to unary messages). - Removed 3 funky structs from DeclSpec.h (ObjcKeywordMessage, ObjcKeywordDecl, and ObjcKeywordInfo). - Removed 2 ivars and 2 constructors from ObjCMessageExpr (fyi, this space savings has not been measured). I am happy with the way it turned out (though it took a bit more hacking than I expected). Given the central role of selectors in ObjC, making sure this is "right" will pay dividends later. Thanks to Chris for talking this through with me and suggesting this approach. llvm-svn: 42395
* Remove SelectorTable/SelectorInfo, simply store all selectors in the central ↵Steve Naroff2007-09-191-31/+0
| | | | | | | | | | | | | | | | | | | | | | | | IdentifierTable. Rationale: We currently have a separate table to unique ObjC selectors. Since I don't need all the instance data in IdentifierInfo, I thought this would save space (and make more sense conceptually). It turns out the cost of having duplicate entries for unary selectors (i.e. names without colons) outweighs the cost difference between the IdentifierInfo & SelectorInfo structures. Here is the data: Two tables: *** Selector/Identifier Stats: # Selectors/Identifiers: 51635 Bytes allocated: 1999824 One table: *** Identifier Table Stats: # Identifiers: 49500 Bytes allocated: 1990316 llvm-svn: 42139
* Add support for ObjC keyword selectors.Steve Naroff2007-09-171-0/+31
| | | | | | | | | | - Add SelectorInfo/SelectorTable classes, modeled after IdentifierInfo/IdentifierTable. - Add SelectorTable instance to ASTContext, created lazily through ASTContext::getSelectorInfo(). - Add SelectorInfo slot to ObjcMethodDecl. - Add helper function to derive a SelectorInfo from ObjcKeywordInfo. Misc: Got the Decl stats stuff up and running again...it was missing support for ObjC AST's. llvm-svn: 42023
* Add helper functions Token::isObjCAtKeyword() and Token::getObjCKeywordID().Steve Naroff2007-08-231-0/+16
| | | | | | Convert all clients to the new cleaner, more robust API. llvm-svn: 41330
* Make sure to initialize an ivar, patch by Benoit Boissinot.Chris Lattner2007-07-191-0/+1
| | | | llvm-svn: 40027
* Add support for C++'0x keywords, patch by Doug GregorChris Lattner2007-07-161-6/+12
| | | | llvm-svn: 39897
* Finally bite the bullet and make the major change: split the clang namespaceChris Lattner2007-06-151-11/+9
| | | | | | | | | | | | | 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
* Fix a bug steve noticed where we warned that __attribute is an extension,Chris Lattner2007-06-081-1/+11
| | | | | | but where we didn't warn about __attribute__. llvm-svn: 39607
* switch to using iterators instead of stringmap visitors.Chris Lattner2007-02-111-17/+7
| | | | llvm-svn: 39336
* CStringMap -> StringMap.Chris Lattner2007-02-081-1/+1
| | | | llvm-svn: 39334
* adjust to CStringMap interface change.Chris Lattner2007-02-081-2/+2
| | | | llvm-svn: 39333
* Add support for target-independent builtin functions (like __builtin_abs),Chris Lattner2007-01-281-0/+1
| | | | | | | | | | | | | | | | | | whose decl objects are lazily created the first time they are referenced. Builtin functions are described by the clang/AST/Builtins.def file, which makes it easy to add new ones. This is missing two important pieces: 1. Support for the rest of the gcc builtins. 2. Support for target-specific builtins (e.g. __builtin_ia32_emms). Just adding this builtins reduces the number of implicit function definitions by 6, reducing the # diagnostics from 550 to 544 when parsing carbon.h. I need to add all the i386-specific ones to eliminate several hundred more. ugh. llvm-svn: 39327
* Add support for -fno-operator-names, patch by Bill.Chris Lattner2006-12-041-1/+1
| | | | llvm-svn: 39245
* Add support for C++ operator keywords. Patch by Bill Wendling.Chris Lattner2006-11-211-2/+14
| | | | llvm-svn: 39214
* remove some temporary testing codeChris Lattner2006-10-291-7/+1
| | | | llvm-svn: 39080
* Pull the string hashtable out of the IdentifierTable, moving into LLVM'sChris Lattner2006-10-291-192/+35
| | | | | | libsupport. Now it can be used for other things besides identifier hashing. llvm-svn: 39079
* move memory allocation abstraction stuff out into LLVM's libsupportChris Lattner2006-10-291-103/+8
| | | | llvm-svn: 39078
* genericize IdentifierInfo interface to make it work more naturally.Chris Lattner2006-10-281-10/+14
| | | | llvm-svn: 39076
* Remove identifier length field from IdentifierInfo, it is now dead.Chris Lattner2006-10-271-6/+4
| | | | llvm-svn: 39063
* fix bug reprobing.Chris Lattner2006-10-271-2/+2
| | | | llvm-svn: 39062
* reimplement identifier hash table in terms of a probed table instead of a ↵Chris Lattner2006-10-271-99/+132
| | | | | | | | | chained table. This is about 25% faster for identifier lookup. This also implements resizing of the hash table. llvm-svn: 39058
* Use the full hash as a filter to reduce # strcmpsChris Lattner2006-10-261-0/+1
| | | | llvm-svn: 39057
* Track the full (not mod the hash table size) hash value for each token.Chris Lattner2006-10-261-2/+15
| | | | | | This lets us find interesting properties of the hash distribution. llvm-svn: 39056
* Start removing LexerToken from the actions interface.Chris Lattner2006-10-251-1/+1
| | | | llvm-svn: 39043
* Switch to using a bitwise and instead of modulus.Chris Lattner2006-10-221-1/+3
| | | | llvm-svn: 39038
* renameChris Lattner2006-10-201-2/+2
| | | | llvm-svn: 39024
* Move keyword setup from the preprocessor into the IdentifierTable class.Chris Lattner2006-10-181-1/+86
| | | | llvm-svn: 39014
* Make the identifier table track objc keywordsChris Lattner2006-10-171-0/+1
| | | | llvm-svn: 39003
* Make preprocessor keywords like 'define' first class citizens in theChris Lattner2006-10-171-0/+1
| | | | | | IdentifierTable, instead of making them resort to strcmp'ing. llvm-svn: 39002
* Implement the #define_other_target directive.Chris Lattner2006-10-141-0/+1
| | | | llvm-svn: 38984
* Eliminate the IdentifierInfo::IsMacroArg flag.Chris Lattner2006-07-151-1/+0
| | | | llvm-svn: 38715
* Add a simple but useful optimization for identifier lookup. Each time weChris Lattner2006-07-101-4/+16
| | | | | | | | query the hash table, when we look up an identifier that isn't at the head of it's bucket's list, move it there. This reduces the number of list traversals in the common case where identifiers are used in bursts. llvm-svn: 38689
* Add identifiers for macro arguments to MacroInfo, check for duplicates,Chris Lattner2006-07-081-0/+1
| | | | | | enhance macro equality testing to verify argument lists match. llvm-svn: 38682
* Fix indentationChris Lattner2006-07-041-1/+1
| | | | llvm-svn: 38655
* Rename IdentifierTokenInfo -> IdentifierInfo.Chris Lattner2006-07-041-9/+9
| | | | llvm-svn: 38650
* Add a new IdentifierVisitor class and a new IdentifierTable::VisitIdentifiersChris Lattner2006-07-031-2/+17
| | | | | | method to support iteration over all identifiers. llvm-svn: 38628
* Finish implementation of #pragma once. Implement #pragma GCC poison.Chris Lattner2006-06-241-0/+1
| | | | llvm-svn: 38568
* Initial checkin of c-language parserChris Lattner2006-06-181-0/+268
llvm-svn: 38539
OpenPOWER on IntegriCloud