Commit Graph

39 Commits

Author SHA1 Message Date
Chris Lattner 69c7ee2d51 allow getTokenName to work for keywords.
llvm-svn: 39243
2006-12-04 07:45:05 +00:00
Chris Lattner cf6bc66421 silence some warnings when asserts are disabled.
llvm-svn: 39127
2006-11-05 07:59:08 +00:00
Chris Lattner 9c59bdace4 simplify logic, eliminate a copy of string data.
llvm-svn: 39086
2006-10-30 04:34:28 +00:00
Chris Lattner 2f4a89a5e8 Switch the FileManager::FileEntries map over to using a CStringMap. This
speeds up preprocessing Cocoa.h 16% (from 0.99 to 0.85s).

llvm-svn: 39085
2006-10-30 03:55:17 +00:00
Chris Lattner 43fd42e4d9 Wean LookupSubframeworkHeader off std::strings, use the new SmallString
class instead.  SmallString allows to code to avoid hitting malloc in
the normal case (or will, when some other stuff is converted over).

llvm-svn: 39084
2006-10-30 03:40:58 +00:00
Chris Lattner a85cbe28a0 Avoid storing a directory name in both the DirEntries map keys and in the
UniqueDirs value.  Instead, just have the UniqueDirs value contain a pointer
to the key in the DirEntries map.

llvm-svn: 39083
2006-10-30 03:11:40 +00:00
Chris Lattner af65375944 Switch DirEntries over to using a CStringMap. This speeds it up
'clang -Eonly INPUTS/Cocoa_h.m' by about 4%.

llvm-svn: 39082
2006-10-30 03:06:54 +00:00
Chris Lattner 8b1e848a04 Avoid some mallocs, and avoid leaking some memory, by making the
UniqueDirs/UniqueFiles maps own the memory for the FileEntry and DirEntries.

llvm-svn: 39081
2006-10-30 02:45:16 +00:00
Chris Lattner 480434865d change FileEntry::getName to return a const char*.
llvm-svn: 39065
2006-10-27 05:12:36 +00:00
Chris Lattner 05646c7f0e Fix these to allow clang to be in any dir.
llvm-svn: 39055
2006-10-26 04:56:55 +00:00
Chris Lattner b19f796e97 llvm has no EH by default, no need for these flags.
llvm-svn: 39047
2006-10-25 05:09:05 +00:00
Chris Lattner 2a904d0aba Add assertions for out-of-fileid error case
llvm-svn: 39028
2006-10-22 06:33:42 +00:00
Chris Lattner 0b9bdd9a74 Use read to open small files so we don't run out of file descriptors as easily.
llvm-svn: 39027
2006-10-20 06:53:51 +00:00
Chris Lattner 2194ddc83d Add new TargetInfo hooks for getting the set of target-specific #defines.
llvm-svn: 38979
2006-10-14 18:32:26 +00:00
Chris Lattner 1e27fe165c Add new TargetInfo class to clang.
llvm-svn: 38971
2006-10-14 07:06:20 +00:00
Chris Lattner 051df7bfc4 Make this work with llvm cvs
llvm-svn: 38952
2006-08-27 07:12:21 +00:00
Chris Lattner 7fa8c889e2 Add a single-entry cache for macro instantation locations. This significantly
reduces the number of FileID's made and tracked.

llvm-svn: 38752
2006-07-20 06:48:52 +00:00
Chris Lattner 81500bc3ae cleanups, add some code for instrumenting stat
llvm-svn: 38728
2006-07-19 03:40:07 +00:00
Chris Lattner 351050bcf5 Add a check that the physloc for a macro instantiation is not another macro.
llvm-svn: 38722
2006-07-16 18:05:08 +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 d3a15f7f4e Add a fast-path in getSpelling for identifiers.
llvm-svn: 38672
2006-07-04 23:01:03 +00:00
Chris Lattner d5da3ea58d This matters for -E.
llvm-svn: 38664
2006-07-04 21:11:41 +00:00
Chris Lattner 040a4ab71e Compile without rtti or exceptions.
llvm-svn: 38629
2006-07-03 05:01:42 +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 4c37a8c353 Eliminate SourceManager::createFileIDForMacroExp, inlining it into its single use.
llvm-svn: 38599
2006-06-30 06:15:08 +00:00
Chris Lattner 7d6a4f6746 Expose a useful helper method.
llvm-svn: 38596
2006-06-30 06:10:08 +00:00
Chris Lattner 2dffd2b445 Factor logical line lookup better.
llvm-svn: 38594
2006-06-29 16:44:08 +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 ec43eaf07a Add a new SourceBuffer::getNewMemBuffer method.
llvm-svn: 38587
2006-06-28 06:35:31 +00:00
Chris Lattner f6fd68add5 Fix Preprocessor/macro_expandloc2.c
llvm-svn: 38579
2006-06-26 01:48:23 +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 269c232e67 implement #pragma GCC dependency
llvm-svn: 38574
2006-06-25 06:23:00 +00:00
Chris Lattner 9a13bde643 Implement a new SourceManager::getSourceName method
llvm-svn: 38560
2006-06-21 04:57:09 +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 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 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