summaryrefslogtreecommitdiffstats
path: root/clang/Lex/Lexer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-1661/+0
| | | | | | | | | | lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. llvm-svn: 48402
* Fix PR2090, a typo in digraph processing.Chris Lattner2008-02-241-1/+1
| | | | llvm-svn: 47540
* simplify the lexer a bit, pulling stuff out of the default case.Chris Lattner2008-01-031-19/+27
| | | | llvm-svn: 45540
* Don't attribute in file headers anymore. See llvmdev for theChris Lattner2007-12-291-2/+2
| | | | | | discussion of this change. llvm-svn: 45410
* add a helper method.Chris Lattner2007-12-131-0/+7
| | | | llvm-svn: 44976
* start partitioning the diagnostics into two classes: thoseChris Lattner2007-11-301-2/+2
| | | | | | | | that are builtin and those that are aren't. This is a bunch of API refactoring that will make this possible, but there is no functionality change yet. llvm-svn: 44473
* Silenced a couple of VC++ warnings.Hartmut Kaiser2007-10-181-4/+5
| | | | llvm-svn: 43125
* Move token length calculation out of the diagnostics machinery into Chris Lattner2007-10-171-0/+33
| | | | | | the lexer, where it can be shared. llvm-svn: 43090
* Add a new type of lexer: a raw lexer, which does not require a preprocessorChris Lattner2007-10-171-22/+63
| | | | | | object in order to do its thing. llvm-svn: 43084
* Make a significant change to invert the control flow handlingChris Lattner2007-10-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | 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
* Switch lexer/pp over to new Token::is/isNot apiChris Lattner2007-10-091-6/+6
| | | | llvm-svn: 42799
* implement the Token class in the Lexer.cpp file instead of IdentifierInfo.cppChris Lattner2007-10-071-4/+25
| | | | llvm-svn: 42728
* Eliminate some VC++ warnings, patch by Hartmut Kaiser!Chris Lattner2007-09-031-4/+4
| | | | llvm-svn: 41685
* Use a smallstring instead of an std::string in FileChanged to avoid some ↵Chris Lattner2007-07-241-0/+11
| | | | | | | | malloc traffic. This speeds up -E on xalancbmk by 2.4% llvm-svn: 40461
* Change hte lexer to start a start pointer to the underlying Chris Lattner2007-07-221-5/+11
| | | | | | | | memorybuffer instead of a pointer to the memorybuffer itself. This reduces coupling and eliminates a pointer dereference on a hot path. This speeds up -Eonly on 483.xalancbmk by 2.1% llvm-svn: 40394
* split the slow path out of Lexer::getSourceLocation and do not let theChris Lattner2007-07-221-14/+27
| | | | | | compiler inline it. This speeds up -Eonly on 483.xalancbmk by about 1% llvm-svn: 40393
* avoid recursion between SkipBCPLComment and SkipWhitespace. In cases like this:Chris Lattner2007-07-221-24/+22
| | | | | | | | | | | // foo // bar // baz we'd get two levels of call (bcpl & whitespace) for each line, leading to some seriously deep stacks in some cases. llvm-svn: 40384
* Fix a lexer bug where we incorrectly rejectedChris Lattner2007-07-211-1/+12
| | | | | | | | int i = /*/ */ 1; Thanks to Neil for pointing this out. llvm-svn: 40379
* At one point there were going to be lexer and parser tokens.Chris Lattner2007-07-201-34/+34
| | | | | | | Since that point is now long gone, we should rename LexerToken to Token, as it is the only kind of token we have. llvm-svn: 40105
* simplify the lexer ctor to take a SLoc instead of a sloc and a redundant ↵Chris Lattner2007-07-201-7/+11
| | | | | | buffer*. llvm-svn: 40104
* Reimplement SourceLocation. Instead of having a Chris Lattner2007-07-201-5/+22
| | | | | | | | | | | | | | | | | fileid/offset pair, it now contains a bit discriminating between mapped locations and file locations. This separates the tables for macros and files in SourceManager, and allows better separation of concepts in the rest of the compiler. This allows us to have *many* macro instantiations before running out of 'addressing space'. This is also more efficient, because testing whether something is a macro expansion is now a bit test instead of a table lookup (which also used to require having a srcmgr around, now it doesn't). This is fully functional, but there are several refinements and optimizations left. llvm-svn: 40103
* Finally bite the bullet and make the major change: split the clang namespaceChris Lattner2007-06-151-2/+1
| | | | | | | | | | | | | 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
* Don't warn about escaped newlines in // comments if the next line is alsoChris Lattner2007-06-091-2/+13
| | | | | | a // comment, this reduces noise in the llvm testsuite. llvm-svn: 39636
* Bug #:Bill Wendling2007-05-231-1/+0
| | | | | | | | | Submitted by: Bill Wendling Reviewed by: Chris Lattner - Removed unneeded <iostream> header. llvm-svn: 39484
* Remove the clang::SourceBuffer class, switch to the llvm::MemoryBuffer class.Chris Lattner2007-04-291-3/+2
| | | | llvm-svn: 39426
* Change KeepComments/KeepMacroComments modes to be facets of the preprocessorChris Lattner2006-11-211-3/+3
| | | | | | state, not aspects of the language standard being parsed. llvm-svn: 39209
* Add altivec version of block comment skipping code.Chris Lattner2006-10-301-1/+12
| | | | llvm-svn: 39093
* Refactor the paths used for checking and getting the spelling of #includeChris Lattner2006-10-301-38/+4
| | | | | | | | | filenames (and also '#pragma GCC dependency' of course). Now, assuming no cleaning is needed, we can go all the way from lexing the filename to doing filename lookups with no mallocs. This speeds up user PP time from 0.077 to 0.075s for Cocoa.h (2.6%). llvm-svn: 39092
* Remove GNU C++ min/max operator extension support, they have been removedChris Lattner2006-10-271-20/+0
| | | | | | from gcc mainline. llvm-svn: 39067
* remove todoChris Lattner2006-10-271-2/+0
| | | | llvm-svn: 39061
* Implement an sse2 version of the block comment scanner.Chris Lattner2006-10-271-1/+17
| | | | llvm-svn: 39060
* Speed up block comment skipping by 35%.Chris Lattner2006-10-271-1/+21
| | | | llvm-svn: 39059
* Oversight: fixes test/Lexer/number.cChris Lattner2006-10-171-0/+1
| | | | llvm-svn: 38998
* Rename LexerToken methods to be more consistent.Chris Lattner2006-10-141-106/+106
| | | | llvm-svn: 38969
* Initial support for semantic analysis and AST building for StringExpr nodes.Chris Lattner2006-10-061-4/+5
| | | | llvm-svn: 38960
* Implement comment saving mode: the -C and -CC options.Chris Lattner2006-07-291-24/+66
| | | | llvm-svn: 38783
* disable malformed string/character errors when in raw mode. This fixesChris Lattner2006-07-201-4/+4
| | | | | | test/Lexer/badstring_in_if0.c llvm-svn: 38751
* If an invalid string or character is read, return the invalid part as a ↵Chris Lattner2006-07-201-8/+14
| | | | | | tok::unknown token. llvm-svn: 38749
* Simplify "raw lexing mode" even further. Now the preprocessor is only calledChris Lattner2006-07-201-7/+15
| | | | | | | into when a hard error is found. This simplifies logic and eliminates the need for the preprocessor to know about raw mode. llvm-svn: 38746
* Simplify identifier lookup in raw mode, implementing ↵Chris Lattner2006-07-201-0/+4
| | | | | | Preprocessor/macro_fn_lparen_scan2.c. llvm-svn: 38744
* Move LexingRawMode handling of file EOF out of the preprocessor into theChris Lattner2006-07-191-13/+22
| | | | | | | | lexer. This makes more logical sense and also unbreaks the case when the lexer hasn't been pushed onto the PP include stack. This is the case when pasting identifiers. This patch implements macro_paste_bcpl_comment.c. llvm-svn: 38736
* Make end-of-file handling much less recursive. This reduces the worst caseChris Lattner2006-07-181-5/+13
| | | | | | stack depth sampled by shark from ~34 to ~17 frames when preprocessing <iostream>. llvm-svn: 38726
* Lex the microsoft 'charize' extension.Chris Lattner2006-07-151-2/+10
| | | | llvm-svn: 38711
* Change Lexer::Stringify to not add ""'s around the string.Chris Lattner2006-07-151-5/+4
| | | | llvm-svn: 38708
* The lexer should not warn about stray characters, it should just returnChris Lattner2006-07-111-3/+2
| | | | | | tok::unknown tokens. This fixes test/Lexer/unknown-char.c llvm-svn: 38703
* Move Preprocessor::isNextPPTokenLParen to Lexer::isNextPPTokenLParen, whereChris Lattner2006-07-111-3/+34
| | | | | | it more rightly belongs. llvm-svn: 38702
* Change Preprocessor::SkippingContents into Lexer::LexingRawMode. Raw modeChris Lattner2006-07-111-7/+13
| | | | | | | | | | is an intra-lexer property, not a inter-lexer property, so it makes sense for it to be define here. It also makes no sense for macros, and allows us to define it more carefully in the header. While I'm at it, improve comments and structuring in Lexer.h llvm-svn: 38701
* Implement "lparen scanning" for lexer buffers, by making "skipping lexing"Chris Lattner2006-07-111-9/+14
| | | | | | | completely reversible. This implements tests 3/4 of test/Preprocessor/macro_fn_lparen_scan.c llvm-svn: 38699
* Add simple optimization: check for (and skip) spaces and tabs immediatelyChris Lattner2006-07-101-0/+9
| | | | | | | | before lexing a token. This speeds the common case where tokens are separated by small amount of whitespace. This makes a slight but reproducible positive effect lexing a preprocessed carbon.h. llvm-svn: 38691
* Start reading/validating the argument list for a function-like macro.Chris Lattner2006-07-081-13/+4
| | | | llvm-svn: 38681
OpenPOWER on IntegriCloud