Commit Graph

111 Commits

Author SHA1 Message Date
Chris Lattner 25e0d54a0e Move keyword setup from the preprocessor into the IdentifierTable class.
llvm-svn: 39014
2006-10-18 06:07:05 +00:00
Chris Lattner 9f547a4fdd Fix regression in my last commit
llvm-svn: 39013
2006-10-18 06:06:41 +00:00
Chris Lattner 59a9ebdb17 refactor header searching stuff out of the main Preprocessor object into
it's own HeaderSearch object.  This makes Preprocessor simpler and easier
to understand.

llvm-svn: 39012
2006-10-18 05:34:33 +00:00
Chris Lattner 8fd6ee1f2f silence warning
llvm-svn: 39009
2006-10-18 04:02:50 +00:00
Chris Lattner 04d1f3f75f track whether DirectoryLookup dirs are framework dirs.
llvm-svn: 39006
2006-10-17 06:20:32 +00:00
Chris Lattner ff43821d53 Implement -std, -x, -ObjC and -ObjC++ options.
llvm-svn: 39004
2006-10-17 05:16:26 +00:00
Chris Lattner 2dacc3ff2e Changes through out the parser and actions/ast interface to return top-level
declarations through the asm streamer.  For a testcase like:

int G;
int H, I, *J;
int func() {}

'clang -parse-print-ast' prints:

Read top-level decl: G
Read top-level decl: H
Read top-level decl: I
Read top-level decl: J
Read top-level decl: func

llvm-svn: 38992
2006-10-16 00:33:54 +00:00
Chris Lattner 9c837537ad Sink target-specific #define info into the target descriptions. Add x86-32/64 and ppc64.
llvm-svn: 38987
2006-10-15 01:05:46 +00:00
Chris Lattner 2ba425ea95 Get target-specific #defines from TargetInfo.
llvm-svn: 38985
2006-10-14 19:54:37 +00:00
Chris Lattner 1f5ad11409 Implement TargetInfo hooks for #defines
llvm-svn: 38978
2006-10-14 18:32:12 +00:00
Chris Lattner 02dffbda3b Write up TargetInfo so that use of wchar_t strings results in a warning if
used in a target set where the size is not identical.

llvm-svn: 38975
2006-10-14 07:50:21 +00:00
Chris Lattner 5ba61f0e10 Add Targets.cpp, which implements the -arch command line option in terms of
TargetInfo.

llvm-svn: 38972
2006-10-14 07:39:34 +00:00
Chris Lattner 8c76f87810 change default mode
llvm-svn: 38966
2006-10-06 05:56:09 +00:00
Chris Lattner 65de4b6a6d make this a bit nicer
llvm-svn: 38963
2006-10-06 05:40:30 +00:00
Chris Lattner a81fb94997 build in a new dir
llvm-svn: 38955
2006-10-06 04:15:06 +00:00
Chris Lattner 9b6d4cb90e Add (basic) expression AST representation capabilities for int/fp/binops/condexpr.
Add callbacks for same.
Add "full locinfo" mode.

llvm-svn: 38939
2006-08-23 05:17:46 +00:00
Chris Lattner 73709eda2b Stub out the ASTStreamer
llvm-svn: 38935
2006-08-17 06:28:25 +00:00
Chris Lattner 3e7bd4ed44 Start adding support for printing out parser callbacks and adding ast building
llvm-svn: 38933
2006-08-17 05:51:27 +00:00
Chris Lattner a5534f96dc Stub out the EmptyAction class.
llvm-svn: 38914
2006-08-14 00:38:06 +00:00
Chris Lattner 685ed1e9ee Rename Parse/ParserActions.h -> Parse/Action.h
llvm-svn: 38913
2006-08-14 00:22:04 +00:00
Chris Lattner c1a8937d8f Make ParseTranslationUnit prime the lexer lookahead
llvm-svn: 38911
2006-08-14 00:15:40 +00:00
Chris Lattner 203ed032e2 Count the number of diagnostics emitted.
llvm-svn: 38905
2006-08-13 22:25:42 +00:00
Chris Lattner eecc5b53ae Add a -fsyntax-only argument
llvm-svn: 38827
2006-08-06 18:29:56 +00:00
Chris Lattner 0bb5f835e4 initial support for parsing, right now just ;'s at the top level, but this
adds most simple scaffolding.

llvm-svn: 38802
2006-07-31 01:59:18 +00:00
Chris Lattner 4beb0381ed Trigraphs are not enabled in -fpreprocessed mode.
llvm-svn: 38796
2006-07-29 17:50:10 +00:00
Chris Lattner cd028fc1f6 Fix -E mode to enter the main file *after* -E mode configures the preprocessor.
llvm-svn: 38784
2006-07-29 06:35:08 +00:00
Chris Lattner 457fc15bc5 Implement comment saving mode: the -C and -CC options.
llvm-svn: 38783
2006-07-29 06:30:25 +00:00
Chris Lattner 331ad778b0 Implement paste avoidance, implementing Preprocessor/output_paste_avoid.c
llvm-svn: 38767
2006-07-28 06:56:01 +00:00
Chris Lattner ecc39e9325 Change Lexer::Stringify to not add ""'s around the string.
llvm-svn: 38708
2006-07-15 05:23:31 +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 67c3848e4e Cleanup some obsolete comments.
llvm-svn: 38673
2006-07-04 23:24:26 +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 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 73b6a2f62d Match GCC behavior better in -P mode.
llvm-svn: 38663
2006-07-04 19:40:52 +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 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