Commit Graph

60 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 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 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 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 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 01d66cc891 Implement #ident and #sccs
llvm-svn: 38643
2006-07-03 22:16:27 +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 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 13044d942d Implement -Wunused-macros functionality.
llvm-svn: 38632
2006-07-03 05:16:44 +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 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 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 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 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 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 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 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 c673f905d8 Implement the __TIME__ and __DATE__ builtin macros.
llvm-svn: 38597
2006-06-30 06:10:41 +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 0b8cfc2e69 Implement the __LINE__ builtin macro.
llvm-svn: 38589
2006-06-28 06:49:17 +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 f373a4af56 Refactor HandleIdentifier to pull macro expansion into its own method.
llvm-svn: 38583
2006-06-26 06:16:29 +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 236ed5200b Add a note
llvm-svn: 38578
2006-06-26 01:36:29 +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 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 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 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