Commit Graph

12864 Commits

Author SHA1 Message Date
Chris Lattner d8aee0e81b Implement "lparen scanning" for lexer buffers, by making "skipping lexing"
completely reversible.  This implements tests 3/4 of
test/Preprocessor/macro_fn_lparen_scan.c

llvm-svn: 38699
2006-07-11 05:04:55 +00:00
Chris Lattner b63d9de243 new tests
llvm-svn: 38698
2006-07-11 05:03:43 +00:00
Chris Lattner a12dd15b56 ext-warn on empty macro arguments if in pre-c99 mode
llvm-svn: 38697
2006-07-11 04:09:02 +00:00
Chris Lattner 370c135dce improve comment
llvm-svn: 38696
2006-07-11 04:03:32 +00:00
Chris Lattner 2acdac4200 Implement scanning-for-( more correctly. This implements
test/Preprocessor/macro_fn_lparen_scan.c, but is not yet complete.

llvm-svn: 38695
2006-07-11 04:02:48 +00:00
Chris Lattner afe603fa7d Implement scanning-for-( more correctly. This implements
test/Preprocessor/macro_fn_lparen_scan.c, but is not yet complete.

Add some FIXME's about missing diagnostics on empty macro args.  Improve some
comments.

llvm-svn: 38694
2006-07-11 04:02:46 +00:00
Chris Lattner 53ede2a826 new testcase
llvm-svn: 38693
2006-07-11 04:00:23 +00:00
Chris Lattner db878cde8e Add an interesting observation :)
llvm-svn: 38692
2006-07-10 06:34:50 +00:00
Chris Lattner eb54b5973e Add simple optimization: check for (and skip) spaces and tabs immediately
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
2006-07-10 06:34:27 +00:00
Chris Lattner 03f83485bd Only do an expensive walk over the entire identifier table if the diagnostic
that needs it is enabled.

llvm-svn: 38690
2006-07-10 06:16:26 +00:00
Chris Lattner d0a96ba38a Add a simple but useful optimization for identifier lookup. Each time we
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
2006-07-10 06:10:51 +00:00
Chris Lattner 9e220173e6 add some notes about MS extensions
llvm-svn: 38688
2006-07-10 02:49:22 +00:00
Chris Lattner 3ce1d1aac9 Trivially expand macros like:
#define ENOMEMORYFORYOU ENOMEMORYFORYOU

llvm-svn: 38687
2006-07-09 01:00:18 +00:00
Chris Lattner c239583433 Make trivial expansion detection more aggressive. Trivially expand macros
like:  #define IS_BLAH() 1

llvm-svn: 38686
2006-07-09 00:57:04 +00:00
Chris Lattner 7818605f83 Read, remember, and validate the arguments provided the a function-style
macro invocation.

llvm-svn: 38685
2006-07-09 00:45:31 +00:00
Chris Lattner 8eede3e6c0 Remove pointless comments.
llvm-svn: 38684
2006-07-08 23:24:05 +00:00
Chris Lattner 815a1f97f6 Diagnose C99 6.10.3.2p1
llvm-svn: 38683
2006-07-08 20:48:04 +00:00
Chris Lattner 6e0d42c6f8 Add identifiers for macro arguments to MacroInfo, check for duplicates,
enhance macro equality testing to verify argument lists match.

llvm-svn: 38682
2006-07-08 20:32:52 +00:00
Chris Lattner cefc768f5b Start reading/validating the argument list for a function-like macro.
llvm-svn: 38681
2006-07-08 08:28:12 +00:00
Chris Lattner 21284dfdd1 Implement checking for macro equality, C99 6.10.3.2
llvm-svn: 38680
2006-07-08 07:16:08 +00:00
Chris Lattner e8eef3207b add infrastructure for warning if redef'd macro bodies differ, but don't
fully implement it.

Fix warning on #define __LINE__ to warn about redefinition, not #undef.

llvm-svn: 38679
2006-07-08 07:01:00 +00:00
Chris Lattner 8ff7199e4b Warn about __VA_ARGS__ when used outside of a macro expansion
llvm-svn: 38678
2006-07-06 05:17:39 +00:00
Chris Lattner bff18d5649 Diagnose erroneous macro definitions where a ## operator is at the start/end of the macro
llvm-svn: 38677
2006-07-06 04:49:18 +00:00
Chris Lattner ae41157ee5 Implement support for arbitrarily mapping non-error diagnostics to be either
ignored, warned about, or error'd.  Use this to implement the -Wunused_macros
command line option.

llvm-svn: 38676
2006-07-05 00:55:08 +00:00
Chris Lattner ecbf7b4bb0 add newline to end of file
llvm-svn: 38675
2006-07-05 00:08:00 +00:00
Chris Lattner 27746e476a Fix Preprocessor/macro_space.c, which failed because the ! token had
identifier info incorrectly set.

llvm-svn: 38674
2006-07-05 00:07:54 +00:00
Chris Lattner 67c3848e4e Cleanup some obsolete comments.
llvm-svn: 38673
2006-07-04 23:24:26 +00:00
Chris Lattner d3a15f7f4e Add a fast-path in getSpelling for identifiers.
llvm-svn: 38672
2006-07-04 23:01:03 +00:00
Chris Lattner ef9eae1c44 Change the Preprocessor::getSpelling interface to let it be zero-copy in
the common case.

llvm-svn: 38671
2006-07-04 22:33:12 +00:00
Chris Lattner a3f827e0a6 add a comment explaining why this is written funny
llvm-svn: 38670
2006-07-04 22:22:45 +00:00
Chris Lattner f46be6cb02 Switch to using unix "write" when available, instead of stdio. This speeds up
-E -P mode by 10% (i.e. takes away almost all i/o time).

llvm-svn: 38669
2006-07-04 22:19:33 +00:00
Chris Lattner 728b4dc26a improve comments
llvm-svn: 38668
2006-07-04 21:28:37 +00:00
Chris Lattner ff3f5f4b77 fix compile error
llvm-svn: 38667
2006-07-04 21:25:59 +00:00
Chris Lattner 03cbe1fc02 Minor code cleanup
llvm-svn: 38666
2006-07-04 21:24:33 +00:00
Chris Lattner 3338ba87d5 Make -P mode faster and closer to GCC output by not emitting newlines at all.
This allows the SourceManager to not compute line number information for each buffer.

llvm-svn: 38665
2006-07-04 21:19:39 +00:00
Chris Lattner d5da3ea58d This matters for -E.
llvm-svn: 38664
2006-07-04 21:11:41 +00:00
Chris Lattner 73b6a2f62d Match GCC behavior better in -P mode.
llvm-svn: 38663
2006-07-04 19:40:52 +00:00
Chris Lattner 3451f7da35 initial checkin of xcode project that I've been using for a while
llvm-svn: 38662
2006-07-04 19:30:23 +00:00
Chris Lattner ecc6fc583f add a place for random notes.
llvm-svn: 38661
2006-07-04 19:29:50 +00:00
Chris Lattner deb3701c23 Switch from using iostreams to using stdio for -E mode output. This speeds
up clang -E iostream by 30%.

llvm-svn: 38660
2006-07-04 19:24:06 +00:00
Chris Lattner 5de858cbdd minor cleanup
llvm-svn: 38659
2006-07-04 19:04:44 +00:00
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 5f084fd5fc Add newline at end of file
llvm-svn: 38657
2006-07-04 19:03:36 +00:00
Chris Lattner 08e0035668 ignore cruft
llvm-svn: 38656
2006-07-04 19:03:05 +00:00
Chris Lattner 0e1cf1f588 Fix indentation
llvm-svn: 38655
2006-07-04 18:53:52 +00:00
Chris Lattner b9d90f709e Detect expressions semantically equivalent to !defined(X) for the multiple-include
optimization.

llvm-svn: 38654
2006-07-04 18:32:03 +00:00
Chris Lattner 3153ed6bc4 This is implemented.
llvm-svn: 38653
2006-07-04 18:31:48 +00:00
Chris Lattner e3519cc948 Change EvaluateValue/EvaluateDirectiveSubExpr to be static functions in
PPExpressions.cpp instead of methods.

llvm-svn: 38652
2006-07-04 18:11:39 +00:00
Chris Lattner 8096542744 refactor code a little, no functionality change
llvm-svn: 38651
2006-07-04 18:03:19 +00:00
Chris Lattner c79f6fb108 Rename IdentifierTokenInfo -> IdentifierInfo.
llvm-svn: 38650
2006-07-04 17:53:21 +00:00
Chris Lattner a8654ca2cf Eliminate MultipleIncludeOpt::ReadDirective and all calls to it. Any directives
that are lexed are made up of tokens, so the calls are just ugly and redundant.

Hook up the MIOpt for the #if case.  PPCExpressions doesn't currently implement
the hook though, so we still don't handle #if !defined(X) with the MIOpt.

llvm-svn: 38649
2006-07-04 17:42:08 +00:00
Chris Lattner 1f62777508 update
llvm-svn: 38648
2006-07-04 17:34:01 +00:00
Chris Lattner 3665f161ca Implement the multiple-include file optimization.
llvm-svn: 38647
2006-07-04 07:26:10 +00:00
Chris Lattner 371ac8a9b7 Implement the automaton for recognizing files with controlling macros.
llvm-svn: 38646
2006-07-04 07:11:10 +00:00
Chris Lattner d7dfa57efd cleanup fixme's
llvm-svn: 38645
2006-07-04 04:50:35 +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 1c9c0d0749 new testcase
llvm-svn: 38641
2006-07-03 06:28:30 +00:00
Chris Lattner b085f937a0 The location of a _Pragma expanded token is the location of the string, not the
_Pragma token

llvm-svn: 38640
2006-07-03 06:10:36 +00:00
Chris Lattner d7de629c32 Move a method inline
llvm-svn: 38639
2006-07-03 06:05:41 +00:00
Chris Lattner a78a97e82f #ifdef X, #ifndef X, and #if defined(X) all mark X as used.
llvm-svn: 38638
2006-07-03 05:42:18 +00:00
Chris Lattner bd07659488 Move a PragmaNamespace method out of line, add class comment for PragmaNamespace.
llvm-svn: 38637
2006-07-03 05:34:49 +00:00
Chris Lattner 2e1553070e Move a PragmaNamespace method out of line.
llvm-svn: 38636
2006-07-03 05:34:41 +00:00
Chris Lattner 83913dde23 remove dead var
llvm-svn: 38635
2006-07-03 05:31:31 +00:00
Chris Lattner f88c53a02f Fix test/Preprocessor/_Pragma-syshdr2.c.
llvm-svn: 38634
2006-07-03 05:26:05 +00:00
Chris Lattner 45197e935c new testcase
llvm-svn: 38633
2006-07-03 05:25:52 +00:00
Chris Lattner 13044d942d Implement -Wunused-macros functionality.
llvm-svn: 38632
2006-07-03 05:16:44 +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 4ec473f871 Add support to track the real top-level file.
llvm-svn: 38630
2006-07-03 05:16:05 +00:00
Chris Lattner 040a4ab71e Compile without rtti or exceptions.
llvm-svn: 38629
2006-07-03 05:01:42 +00:00
Chris Lattner 91cbf11c10 Add a new IdentifierVisitor class and a new IdentifierTable::VisitIdentifiers
method to support iteration over all identifiers.

llvm-svn: 38628
2006-07-03 04:28:52 +00:00
Chris Lattner 44f8a66bcc Fix test/Preprocessor/macro_defined.c, factor some code.
llvm-svn: 38627
2006-07-03 01:27:27 +00:00
Chris Lattner d94adee36d new testcase
llvm-svn: 38626
2006-07-03 01:26:39 +00:00
Chris Lattner aaf09115c4 Implement a FIXME: reject '#define defined'.
llvm-svn: 38625
2006-07-03 01:17:59 +00:00
Chris Lattner e3e81ea8aa Refactor some code into a new Lexer::Stringify method.
llvm-svn: 38624
2006-07-03 01:13:26 +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 0766e592ce Implement a FIXME: correctly stringify filenames generated by __LINE__.
llvm-svn: 38622
2006-07-03 01:07:01 +00:00
Chris Lattner 4d5e1a72f4 Classify fixme's
llvm-svn: 38621
2006-07-03 01:01:29 +00:00
Chris Lattner 505c547b8e Cleanup fixme comments
llvm-svn: 38620
2006-07-03 00:55:48 +00:00
Chris Lattner 98a5312478 Give tokens expanded from _Pragma directives correct source locations.
This implements test/Preprocessor/_Pragma-location.c

llvm-svn: 38619
2006-07-02 23:00:20 +00:00
Chris Lattner e55e11ad04 new testcase
llvm-svn: 38618
2006-07-02 22:59:48 +00:00
Chris Lattner a37664b3fb Move a virtual method out-of-line
llvm-svn: 38617
2006-07-02 22:45:51 +00:00
Chris Lattner b694ba7b40 Move some Pragma-related methods from Preprocessor.cpp to Pragma.cpp
llvm-svn: 38616
2006-07-02 22:41:36 +00:00
Chris Lattner 1840e491dc Remove Lexer::BufferStart, an unneeded instance var.
llvm-svn: 38615
2006-07-02 22:30:01 +00:00
Chris Lattner 8bbfe46475 Fix Preprocessor/_Pragma-physloc.c, by making sure that the returned location
of the token is relative to the start of the buffer, not relative to the start
position of the lexer.

llvm-svn: 38614
2006-07-02 22:27:49 +00:00
Chris Lattner 20fc36c416 new testcase
llvm-svn: 38613
2006-07-02 22:27:09 +00:00
Chris Lattner 5599d5f6b8 Fix test/Preprocessor/pragma_unknown.c
llvm-svn: 38612
2006-07-02 21:50:38 +00:00
Chris Lattner a7e7e2b92d new testcase
llvm-svn: 38611
2006-07-02 21:50:31 +00:00
Chris Lattner e4af3ac6b4 Fix some minor issues with _Pragma
llvm-svn: 38610
2006-07-02 21:32:47 +00:00
Chris Lattner ecfeafe3ba Fix some minor bugs handling _Pragma, including
test/Preprocessor/_Pragma_syshdr.c

llvm-svn: 38609
2006-07-02 21:26:45 +00:00
Chris Lattner d6178a6870 new testcase
llvm-svn: 38608
2006-07-02 21:23:03 +00:00
Chris Lattner ef0dbae5ab remove dead ivar
llvm-svn: 38607
2006-07-02 21:17:13 +00:00
Chris Lattner 69772b026e Implement the _Pragma-style of pragma handling, implementing
test/Preprocessor/_Pragma-poison.c.

This unifies the MacroStack and IncludeStack together into IncludeMacroStack.

llvm-svn: 38606
2006-07-02 20:34:39 +00:00
Chris Lattner 0acd4fee90 new testcase
llvm-svn: 38605
2006-07-02 20:31:44 +00:00
Chris Lattner a85a9d2db3 Tolerate conditions where there is no line #
llvm-svn: 38604
2006-07-02 20:07:52 +00:00
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