Commit Graph

221 Commits

Author SHA1 Message Date
Chris Lattner 09e3cdf9ef Split the -E mode printer out to a separate .cpp file.
llvm-svn: 38658
2006-07-04 19:04:05 +00:00
Chris Lattner 062a0d620b stub out built-in macros.
llvm-svn: 38644
2006-07-04 04:50:29 +00:00
Chris Lattner 01d66cc891 Implement #ident and #sccs
llvm-svn: 38643
2006-07-03 22:16:27 +00:00
Chris Lattner 3ae68307ac Print tokens using the logical location. This implements
test/Preprocessor/_Pragma-dependency.c

llvm-svn: 38642
2006-07-03 06:28:56 +00:00
Chris Lattner cbd6d3e0ed Implement -Wunused-macros functionality, currently always enabled.
llvm-svn: 38631
2006-07-03 05:16:39 +00:00
Chris Lattner d1236047a9 Correctly stringify emitted #line directives in -E mode.
llvm-svn: 38623
2006-07-03 01:12:52 +00:00
Chris Lattner 5599d5f6b8 Fix test/Preprocessor/pragma_unknown.c
llvm-svn: 38612
2006-07-02 21:50:38 +00:00
Chris Lattner f6fd68add5 Fix Preprocessor/macro_expandloc2.c
llvm-svn: 38579
2006-06-26 01:48:23 +00:00
Chris Lattner 2a92f7ec2d Implement -P mode.
llvm-svn: 38571
2006-06-25 04:40:07 +00:00
Chris Lattner 5c683767ff Print out unknown pragmas in -E mode.
llvm-svn: 38570
2006-06-25 04:36:50 +00:00
Chris Lattner 55a60954f9 Implement #pragma GCC system_header
llvm-svn: 38569
2006-06-25 04:20:34 +00:00
Chris Lattner 4da3a353b6 Fix off-by-two error printing diagnostics
llvm-svn: 38565
2006-06-24 21:29:50 +00:00
Chris Lattner c899718274 Track which headers are system and non-C++-clean-system headers. Use this
information to print the 3/4 flags correctly on #line directives emitted
in -E mode.

llvm-svn: 38562
2006-06-22 05:52:16 +00:00
Chris Lattner 0c885f5581 Improve #line emission in -E mode to include file entry/exits. This is
still pretty hacky because it doesn't compute the 3/4 markers correctly.

llvm-svn: 38561
2006-06-21 06:50:18 +00:00
Chris Lattner d12ad77e40 Add really early support for emitting # line directives, and emitting the
right number of newlines between tokens when needed.  This reduces the
delta of the gcc -E output from 12198 differences to 6764.  It still needs
to emit filenames on #line directives, track filename switches, and track
entry/exit of include files.

llvm-svn: 38559
2006-06-21 03:49:01 +00:00
Chris Lattner 50b497e072 Rename LexerToken::getSourceLocation -> getLocation
llvm-svn: 38553
2006-06-18 16:32:35 +00:00
Chris Lattner d01e291332 Make a fundamental change to the way we represent the location of LexerToken's.
Now, instead of keeping a pointer to the start of the token in memory, we keep the
start of the token as a SourceLocation node.  This means that each LexerToken knows
the full include stack it was created with, and means that the LexerToken isn't
reliant on a "CurLexer" member to be around (lexer tokens would previously go out of
scope when their lexers were deallocated).

This simplifies several things, and forces good cleanup elsewhere.  Now the
Preprocessor is the one that knows how to dump tokens/macros and is the one that
knows how to get the spelling of a token (it has all the context).

llvm-svn: 38551
2006-06-18 16:22:51 +00:00
Chris Lattner 7e0dd2b11f Fix a fixme by passing language options into LexerToken::dump, instead of
relying on TheLexer.

llvm-svn: 38549
2006-06-18 07:44:41 +00:00
Chris Lattner 33ce7283ee Change the token representation to take a Start and Length instead of a
Start/End pointer.

llvm-svn: 38548
2006-06-18 07:35:33 +00:00
Chris Lattner cb28334ea4 Remove manual conditional error handling code.
llvm-svn: 38540
2006-06-18 06:48:37 +00:00
Chris Lattner 22eb972f38 Initial checkin of c-language parser
llvm-svn: 38539
2006-06-18 05:43:12 +00:00