Chris Lattner
4cca5ba7da
Allow the buffer start/end positions to be optionally specified. Make sure
...
to use them instead of the current buffer start/end when computing diagnostics.
llvm-svn: 38603
2006-07-02 20:05:54 +00:00
Chris Lattner
847e0e4552
Implement __TIMESTAMP__
...
llvm-svn: 38602
2006-07-01 23:49:16 +00:00
Chris Lattner
c1283b90a0
Implement __INCLUDE_LEVEL__ and __BASE_FILE__
...
llvm-svn: 38601
2006-07-01 23:16:30 +00:00
Chris Lattner
630b33c39e
Implement __FILE__
...
llvm-svn: 38600
2006-07-01 22:46:53 +00:00
Chris Lattner
4c37a8c353
Eliminate SourceManager::createFileIDForMacroExp, inlining it into its single use.
...
llvm-svn: 38599
2006-06-30 06:15:08 +00:00
Chris Lattner
7d1b0062d2
Use a new helper to do this much more simply.
...
llvm-svn: 38598
2006-06-30 06:14:45 +00:00
Chris Lattner
c673f905d8
Implement the __TIME__ and __DATE__ builtin macros.
...
llvm-svn: 38597
2006-06-30 06:10:41 +00:00
Chris Lattner
7d6a4f6746
Expose a useful helper method.
...
llvm-svn: 38596
2006-06-30 06:10:08 +00:00
Chris Lattner
098dfc5e7e
Expose a new form of the getToken method.
...
llvm-svn: 38595
2006-06-30 06:09:36 +00:00
Chris Lattner
2dffd2b445
Factor logical line lookup better.
...
llvm-svn: 38594
2006-06-29 16:44:08 +00:00
Chris Lattner
f378f9a08f
Fix the predicate to be more strict
...
llvm-svn: 38593
2006-06-29 16:43:46 +00:00
Chris Lattner
677e3a202c
new testcase
...
llvm-svn: 38592
2006-06-29 16:25:13 +00:00
Chris Lattner
4fb517bea8
Give tokens from the scratch buffer correct source locations.
...
llvm-svn: 38591
2006-06-29 06:34:53 +00:00
Chris Lattner
dc9f9bf80e
Due to generated tokens expanded by macros, there can be multiple MacroExpansion fileid's, loop over them until we get to something real.
...
llvm-svn: 38590
2006-06-29 06:33:42 +00:00
Chris Lattner
0b8cfc2e69
Implement the __LINE__ builtin macro.
...
llvm-svn: 38589
2006-06-28 06:49:17 +00:00
Chris Lattner
3690f1513a
Initial implementation of the ScratchBuffer class.
...
llvm-svn: 38588
2006-06-28 06:48:36 +00:00
Chris Lattner
ec43eaf07a
Add a new SourceBuffer::getNewMemBuffer method.
...
llvm-svn: 38587
2006-06-28 06:35:31 +00:00
Chris Lattner
677757a2c0
Remove dead variables.
...
Add initial support for builtin macros, including warning if they are defined or undefined.
Register __LINE__ as a builtin macro.
llvm-svn: 38586
2006-06-28 05:26:32 +00:00
Chris Lattner
274690ce76
Reindent comments.
...
llvm-svn: 38585
2006-06-28 05:25:35 +00:00
Chris Lattner
78d6734b34
Remove dead variable.
...
llvm-svn: 38584
2006-06-28 05:02:28 +00:00
Chris Lattner
f373a4af56
Refactor HandleIdentifier to pull macro expansion into its own method.
...
llvm-svn: 38583
2006-06-26 06:16:29 +00:00
Chris Lattner
e9a5e18e47
remove some obsolete comments
...
llvm-svn: 38582
2006-06-26 06:08:38 +00:00
Chris Lattner
f4449e5da3
Allow expansion to single token identifiers if they are not macros
...
llvm-svn: 38581
2006-06-26 04:55:25 +00:00
Chris Lattner
67b07cb6fe
Implement Preprocessor/macro_expandloc.c by giving the optimized macro
...
expansion case a correct source location.
llvm-svn: 38580
2006-06-26 02:03:42 +00:00
Chris Lattner
f6fd68add5
Fix Preprocessor/macro_expandloc2.c
...
llvm-svn: 38579
2006-06-26 01:48:23 +00:00
Chris Lattner
236ed5200b
Add a note
...
llvm-svn: 38578
2006-06-26 01:36:29 +00:00
Chris Lattner
685730f964
To not treat macro invocation locations as part of the include stack
...
when reporting a diagnostic.
llvm-svn: 38577
2006-06-26 01:36:22 +00:00
Chris Lattner
64f7bd0e6e
New testcase
...
llvm-svn: 38576
2006-06-26 01:26:26 +00:00
Chris Lattner
0a401cca91
new testcase
...
llvm-svn: 38575
2006-06-26 01:25:11 +00:00
Chris Lattner
269c232e67
implement #pragma GCC dependency
...
llvm-svn: 38574
2006-06-25 06:23:00 +00:00
Chris Lattner
ba6df9122f
Fix Preprocessor/poison_expansion.c
...
llvm-svn: 38573
2006-06-25 05:41:00 +00:00
Chris Lattner
36f0003d16
New testcases
...
llvm-svn: 38572
2006-06-25 05:40:49 +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
1786217e0b
Finish implementation of #pragma once. Implement #pragma GCC poison.
...
llvm-svn: 38568
2006-06-24 22:12:56 +00:00
Chris Lattner
d2b9b89b92
Remove some inadvertently commited stuff
...
llvm-svn: 38567
2006-06-24 21:33:04 +00:00
Chris Lattner
b876183219
implement the pragma handling infrastructure. The only pragma so far is
...
#pragma once, and it is not completely implemented.
llvm-svn: 38566
2006-06-24 21:31:03 +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
e60165fdb5
increase the performance of skipping (#if 0) by optimizing lookup of directive names.
...
llvm-svn: 38564
2006-06-22 06:36:29 +00:00
Chris Lattner
40931927af
Speed up directive matching by not using getSpelling(), and not copying std::strings
...
around.
llvm-svn: 38563
2006-06-22 06:14:04 +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
9a13bde643
Implement a new SourceManager::getSourceName method
...
llvm-svn: 38560
2006-06-21 04:57:09 +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
bb893c3d67
Update SourceManager::getLineNumber to return the correct line # for macro
...
instantiations.
llvm-svn: 38558
2006-06-21 03:27:29 +00:00
Chris Lattner
30709b038d
Implement a new type of FileID: FileIDInfo::MacroExpansion. For tokens that
...
came from a macro expansion, this allows us to keep track of both where the
character data came from and where the logical position of the token is (at
the expansion site). This implements Preprocessor/indent_macro.c, and
reduces the number of cpp iostream -E diffs vs GCC from 2589 to 2297.
llvm-svn: 38557
2006-06-21 03:01:55 +00:00
Chris Lattner
5f4b1ff9fd
Modify SourceManager to make way for future macro locations and #line support
...
no functionality change yet
llvm-svn: 38556
2006-06-20 05:02:40 +00:00
Chris Lattner
c5a00067ac
Simplify some code
...
llvm-svn: 38555
2006-06-18 16:41:01 +00:00
Chris Lattner
8bb4edb236
remove an extraneous method
...
llvm-svn: 38554
2006-06-18 16:37:30 +00:00
Chris Lattner
50b497e072
Rename LexerToken::getSourceLocation -> getLocation
...
llvm-svn: 38553
2006-06-18 16:32:35 +00:00
Chris Lattner
5b4876807a
Move the LexerToken definition out to LexerToken.h
...
llvm-svn: 38552
2006-06-18 16:28:59 +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
de0b7f6a31
Add a bunch more forward looking notes
...
llvm-svn: 38550
2006-06-18 14:03:39 +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
504f2ebb8b
Add missing return
...
llvm-svn: 38547
2006-06-18 07:19:54 +00:00
Chris Lattner
6d45fe842e
utility file
...
llvm-svn: 38546
2006-06-18 07:18:04 +00:00
Chris Lattner
4322e2201b
new testcase
...
llvm-svn: 38545
2006-06-18 07:16:30 +00:00
Chris Lattner
1500881bd9
new testcase
...
llvm-svn: 38544
2006-06-18 07:00:07 +00:00
Chris Lattner
1f5830546a
Make a method a static function
...
llvm-svn: 38543
2006-06-18 06:53:56 +00:00
Chris Lattner
e33e16cbaa
-E output mostly implemented
...
llvm-svn: 38542
2006-06-18 06:53:45 +00:00
Chris Lattner
7966aafd9b
Simplify an API
...
llvm-svn: 38541
2006-06-18 06:50:36 +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
Chris Lattner
31eef321bf
Initial checkin of testsuite
...
llvm-svn: 38538
2006-06-18 05:42:02 +00:00
Reid Spencer
147d7d9d7d
Add a comment to indicate what this file is for.
...
llvm-svn: 38533
2007-07-11 08:00:56 +00:00
Reid Spencer
51dddfe824
Add ModuleInfo.txt for the cfe module.
...
llvm-svn: 38532
2007-07-11 07:46:26 +00:00