summaryrefslogtreecommitdiffstats
path: root/clang/Basic/SourceManager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Added newline to end of file.Ted Kremenek2007-12-101-1/+1
| | | | llvm-svn: 44797
* Removed dependence on including iostream (use llvm/Support/Streams.h instead).Ted Kremenek2007-12-051-9/+9
| | | | llvm-svn: 44635
* Renamed SourceManager::Read to SourceManager::CreateAndRegister.Ted Kremenek2007-12-051-7/+18
| | | | | | | Now sourcemanager deserializer automatically self-registers itself with the deserializer. llvm-svn: 44591
* Implemented initial serialization support for SourceManager.Ted Kremenek2007-12-051-36/+118
| | | | llvm-svn: 44590
* Implemented serialization of SrcMgr::ContentCache.Ted Kremenek2007-12-041-0/+54
| | | | llvm-svn: 44578
* rename getInstantiationLoc to match the scheme of isPhysicalLoc.Chris Lattner2007-11-091-1/+1
| | | | llvm-svn: 43969
* change source location to have two bits for macros, trackingChris Lattner2007-11-091-2/+2
| | | | | | | whether the location is the start and/or end of an expansion. These are currently not set or used by anything. llvm-svn: 43968
* Updated a comment to hopefully silence a Lattner warning.Ted Kremenek2007-10-311-2/+2
| | | | llvm-svn: 43562
* Updated some comments.Ted Kremenek2007-10-301-5/+8
| | | | | | | | Disabled assignments for ContentCache. Copy-ctor for ContentCache now has an assertion preventing it to be copied from an object that already has an allocated buffer. llvm-svn: 43526
* Removed SrcMgr::FileInfo and SrcMgr::InfoRec and replaced them with aTed Kremenek2007-10-301-53/+42
| | | | | | | single class: ContentCache. This simplifies the logic in SourceManager and makes the ownership of MemoryBuffers clearer. llvm-svn: 43518
* Unbreak mingw32. Maybe there should be something like libClandSystem? :)Anton Korobeynikov2007-10-161-1/+1
| | | | llvm-svn: 43029
* Push the rewriting APIs along. Build a trivial client that replaces tabsChris Lattner2007-10-111-0/+7
| | | | | | | with x's for now. The APIs are all unimplemented, so it doesn't do anything yet! :) llvm-svn: 42868
* Removed clang solution file for VC++, which didn't work properly because of ↵Hartmut Kaiser2007-09-121-1/+2
| | | | | | | | hard coded paths in the llvm project files. Changed windows detection to use LLVM pp constant. llvm-svn: 41878
* Add #ifdefs to make the source portable to windows. Patch contributedChris Lattner2007-09-031-1/+9
| | | | | | by Hartmut Kaiser! llvm-svn: 41684
* constify a method.Chris Lattner2007-08-301-1/+1
| | | | llvm-svn: 41600
* Fix a bug in my previous commitChris Lattner2007-08-021-1/+1
| | | | llvm-svn: 40719
* Increase the macro id cache to look up several recent entries, not just the ↵Chris Lattner2007-08-021-11/+14
| | | | | | | | | | | | | | | | | | | last one. This is important in insane cases like the one dannyb sent me recently: #define F0(a) void a(){} #define F1(a) F0(a##0) F0(a##1) F0(a##2) F0(a##3) F0(a##4) F0(a##5) F0(a##6) F0(a##7) #define F2(a) F1(a##0) F1(a##1) F1(a##2) F1(a##3) F1(a##4) F1(a##5) F1(a##6) F1(a##7) #define F3(a) F2(a##0) F2(a##1) F2(a##2) F2(a##3) F2(a##4) F2(a##5) F2(a##6) F2(a##7) #define F4(a) F3(a##0) F3(a##1) F3(a##2) F3(a##3) F3(a##4) F3(a##5) F3(a##6) F3(a##7) #define F5(a) F4(a##0) F4(a##1) F4(a##2) F4(a##3) F4(a##4) F4(a##5) F4(a##6) F4(a##7) #define F6(a) F5(a##0) F5(a##1) F5(a##2) F5(a##3) F5(a##4) F5(a##5) F5(a##6) F5(a##7) F6(f) cpp is great. :) llvm-svn: 40715
* Use a smallstring instead of an std::string in FileChanged to avoid some ↵Chris Lattner2007-07-241-1/+1
| | | | | | | | malloc traffic. This speeds up -E on xalancbmk by 2.4% llvm-svn: 40461
* check in an experiment that didn't work out, to allow for future investigation.Chris Lattner2007-07-241-5/+27
| | | | llvm-svn: 40460
* Add a cache to SourceManager to accellerate line # lookup. This is aChris Lattner2007-07-241-51/+96
| | | | | | | | | | | bottleneck for -E computation, because every token that starts a line needs to determine *which* line it is on (so -E mode can insert the appropriate vertical whitespace). This optimization improves this common case where it is striding through the line # table. This speeds up -E on xalancbmk by 3.2% llvm-svn: 40459
* Add support for reusing macroid's with negative physical loc deltas. ThisChris Lattner2007-07-211-4/+3
| | | | | | keeps the MacroInfo table more compact. llvm-svn: 40281
* remove some old cruftChris Lattner2007-07-201-27/+1
| | | | llvm-svn: 40111
* improve comments, implement a trivial single-entry cache in Chris Lattner2007-07-201-2/+21
| | | | | | | | | SourceManager::getInstantiationLoc. With this change, every token expanded from a macro doesn't get its own MacroID. :) This reduces # macro IDs in carbon.h from 16805 to 9197 llvm-svn: 40108
* Reimplement SourceLocation. Instead of having a Chris Lattner2007-07-201-54/+20
| | | | | | | | | | | | | | | | | fileid/offset pair, it now contains a bit discriminating between mapped locations and file locations. This separates the tables for macros and files in SourceManager, and allows better separation of concepts in the rest of the compiler. This allows us to have *many* macro instantiations before running out of 'addressing space'. This is also more efficient, because testing whether something is a macro expansion is now a bit test instead of a table lookup (which also used to require having a srcmgr around, now it doesn't). This is fully functional, but there are several refinements and optimizations left. llvm-svn: 40103
* Make octal constant lexing use AdvanceToTokenCharacter to give moreChris Lattner2007-07-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | accurate diagnostics. For test/Lexer/comments.c we now emit: int x = 000000080; /* expected-error {{invalid digit}} */ ^ constants.c:7:4: error: invalid digit '8' in octal constant 00080; /* expected-error {{invalid digit}} */ ^ The last line is due to an escaped newline. The full line looks like: int y = 0000\ 00080; /* expected-error {{invalid digit}} */ Previously, we emitted: constants.c:4:9: error: invalid digit '8' in octal constant int x = 000000080; /* expected-error {{invalid digit}} */ ^ constants.c:6:9: error: invalid digit '8' in octal constant int y = 0000\ ^ which isn't too bad, but the new way is better for the user, regardless of whether there is an escaped newline or not. All the other lexer-related diagnostics should switch over to using AdvanceToTokenCharacter where appropriate. Help wanted :). This implements test/Lexer/constants.c. llvm-svn: 39906
* Change SourceManager::getInstantiationLoc to take virtual locations, doing itsChris Lattner2007-07-151-4/+5
| | | | | | virtual->physical mapping explicitly. llvm-svn: 39867
* add missing headerGabor Greif2007-07-121-0/+2
| | | | | | (needed on Solaris) llvm-svn: 39781
* Finally bite the bullet and make the major change: split the clang namespaceChris Lattner2007-06-151-1/+1
| | | | | | | | | | | | | out of the llvm namespace. This makes the clang namespace be a sibling of llvm instead of being a child. The good thing about this is that it makes many things unambiguous. The bad things is that many things in the llvm namespace (notably data structures like smallvector) now require an llvm:: qualifier. IMO, libsystem and libsupport should be split out of llvm into their own namespace in the future, which will fix this issue. llvm-svn: 39659
* Adjust to change in MemoryBuffer interfaceChris Lattner2007-05-061-1/+1
| | | | llvm-svn: 39434
* Remove the clang::SourceBuffer class, switch to the llvm::MemoryBuffer class.Chris Lattner2007-04-291-11/+11
| | | | llvm-svn: 39426
* Refactor the SourceBuffer code so that it is safe to move to the LLVMChris Lattner2007-04-291-1/+53
| | | | | | | support library, where it can be used by other LLVM clients. There are some ugly fixme's in the short-term. llvm-svn: 39425
* minor cleanupsChris Lattner2007-04-291-7/+2
| | | | llvm-svn: 39424
* Add assertions for out-of-fileid error caseChris Lattner2006-10-221-0/+4
| | | | llvm-svn: 39028
* Add a single-entry cache for macro instantation locations. This significantlyChris Lattner2006-07-201-5/+18
| | | | | | reduces the number of FileID's made and tracked. llvm-svn: 38752
* Add a check that the physloc for a macro instantiation is not another macro.Chris Lattner2006-07-161-0/+4
| | | | llvm-svn: 38722
* Add a fast-path in getSpelling for identifiers.Chris Lattner2006-07-041-5/+7
| | | | llvm-svn: 38672
* This matters for -E.Chris Lattner2006-07-041-1/+1
| | | | llvm-svn: 38664
* Tolerate conditions where there is no line #Chris Lattner2006-07-021-1/+3
| | | | llvm-svn: 38604
* Eliminate SourceManager::createFileIDForMacroExp, inlining it into its ↵Chris Lattner2006-06-301-16/+8
| | | | | | single use. llvm-svn: 38599
* Expose a useful helper method.Chris Lattner2006-06-301-0/+14
| | | | llvm-svn: 38596
* Factor logical line lookup better.Chris Lattner2006-06-291-28/+7
| | | | llvm-svn: 38594
* Due to generated tokens expanded by macros, there can be multiple ↵Chris Lattner2006-06-291-6/+9
| | | | | | MacroExpansion fileid's, loop over them until we get to something real. llvm-svn: 38590
* Fix Preprocessor/macro_expandloc2.cChris Lattner2006-06-261-0/+17
| | | | llvm-svn: 38579
* To not treat macro invocation locations as part of the include stackChris Lattner2006-06-261-0/+12
| | | | | | when reporting a diagnostic. llvm-svn: 38577
* Implement a new SourceManager::getSourceName methodChris Lattner2006-06-211-10/+28
| | | | llvm-svn: 38560
* Update SourceManager::getLineNumber to return the correct line # for macroChris Lattner2006-06-211-1/+10
| | | | | | instantiations. llvm-svn: 38558
* Implement a new type of FileID: FileIDInfo::MacroExpansion. For tokens thatChris Lattner2006-06-211-2/+32
| | | | | | | | | 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
* Modify SourceManager to make way for future macro locations and #line supportChris Lattner2006-06-201-4/+5
| | | | | | no functionality change yet llvm-svn: 38556
* Make a fundamental change to the way we represent the location of LexerToken's.Chris Lattner2006-06-181-0/+10
| | | | | | | | | | | | | | 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
* Initial checkin of c-language parserChris Lattner2006-06-181-0/+213
llvm-svn: 38539
OpenPOWER on IntegriCloud