Commit Graph

150 Commits

Author SHA1 Message Date
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