summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/SourceManager.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* add an accessor.Chris Lattner2009-02-171-0/+9
| | | | llvm-svn: 64760
* add an accessor.Chris Lattner2009-02-171-0/+12
| | | | llvm-svn: 64758
* add a new SourceManager::getInstantiationRange helper method.Chris Lattner2009-02-151-0/+18
| | | | llvm-svn: 64606
* track "just a little more" location information for macro instantiations.Chris Lattner2009-02-151-7/+18
| | | | | | | | | | | | Now instead of just tracking the expansion history, also track the full range of the macro that got replaced. For object-like macros, this doesn't change anything. For _Pragma and function-like macros, this means we track the locations of the ')'. This is required for PR3579 because apparently GCC uses the line of the ')' of a function-like macro as the location to expand __LINE__ to. llvm-svn: 64601
* Fix the build on win32.Cedric Venet2009-02-141-0/+6
| | | | llvm-svn: 64556
* Implement handling of file entry/exit notifications from GNUChris Lattner2009-02-041-7/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | line markers, including maintenance of the virtual include stack. For something like this: # 42 "bar.c" 1 # 142 "bar2.c" 1 #warning zappa # 92 "bar.c" 2 #warning gonzo # 102 "foo.c" 2 #warning bonkta we now produce these three warnings: #1: In file included from foo.c:3: In file included from bar.c:42: bar2.c:143:2: warning: #warning zappa #warning zappa ^ #2: In file included from foo.c:3: bar.c:92:2: warning: #warning gonzo #warning gonzo ^ #3: foo.c:102:2: warning: #warning bonkta #warning bonkta ^ llvm-svn: 63722
* make getFileCharacteristic linetable aware. line markers that Chris Lattner2009-02-041-0/+32
| | | | | | play around with the 'is system header' bit now function correctly. llvm-svn: 63720
* propagate linemarker flags down into the the line table, currentlyChris Lattner2009-02-041-6/+87
| | | | | | ignoring include stack push/pop info though. llvm-svn: 63719
* replace gimpy linear search with svelte binary search ;-)Chris Lattner2009-02-041-7/+17
| | | | llvm-svn: 63717
* make my atrocious linear search at least search in the order that isChris Lattner2009-02-041-5/+4
| | | | | | more likely to hit. llvm-svn: 63714
* add commentChris Lattner2009-02-041-1/+1
| | | | llvm-svn: 63712
* add the difference in the line marker phys line number and theChris Lattner2009-02-041-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | query point to the returned presumed location. We now produce: foo.h:92:2: warning: #warning blarg! #warning blarg! ^ foo.h:93:2: warning: #warning blarg! #warning blarg! ^ foo.h:94:2: warning: #warning blarg! #warning blarg! ^ for: #line 92 "foo.h" #warning blarg! #warning blarg! #warning blarg! blarg indeed! llvm-svn: 63710
* add really really trivial #line support, where #line now makes every Chris Lattner2009-02-041-8/+54
| | | | | | | | | | | | | | | | | | | | location below it report as coming from the #line location. For example, with: #line 92 "foo.h" #warning blarg! #warning blarg! we now emit: foo.h:92:2: warning: #warning blarg! #warning blarg! ^ foo.h:92:2: warning: #warning blarg! #warning blarg! ^ llvm-svn: 63709
* lower the interface to getLineNumber like we did forChris Lattner2009-02-041-16/+23
| | | | | | | | getColumnNumber. This fixes a FIXME in SourceManager::getPresumedLoc because we now just decompose the sloc once. llvm-svn: 63701
* make SM::getColumnNumber take a predecomposed FileID/offset, whichChris Lattner2009-02-041-15/+19
| | | | | | | | makes it clear to clients that they have to pick an instantiation or spelling location before calling it and allows optimization based on that. llvm-svn: 63698
* build per-fid linetable entries.Chris Lattner2009-02-041-12/+39
| | | | llvm-svn: 63694
* more plumbing for #line propagation. Use happy bit #3 Chris Lattner2009-02-031-1/+21
| | | | | | out of FileInfo :) llvm-svn: 63672
* stub out basic #line handling calls.Chris Lattner2009-02-031-0/+9
| | | | llvm-svn: 63667
* reclaim my precious bit in FileInfo by ensuring that ContentCache objectsChris Lattner2009-02-031-7/+12
| | | | | | are 8-byte aligned. llvm-svn: 63630
* switch SourceManager from using an std::map and std::list of Chris Lattner2009-02-031-27/+42
| | | | | | | | | ContentCache objects to using a densemap and list, and allocating the ContentCache objects from a bump pointer. This does not speed up or slow down things substantially, but gives us control over their alignment. llvm-svn: 63628
* Introduce a new PresumedLoc class to represent the concept of a locationChris Lattner2009-01-271-8/+21
| | | | | | | | | | | | | | | | | | | as reported to the user and as manipulated by #line. This is what __FILE__, __INCLUDE_LEVEL__, diagnostics and other things should follow (but not dependency generation!). This patch also includes several cleanups along the way: - SourceLocation now has a dump method, and several other places that did similar things now use it. - I cleaned up some code in AnalysisConsumer, but it should probably be simplified further now that NamedDecl is better. - TextDiagnosticPrinter is now simplified and cleaned up a bit. This patch is a prerequisite for #line, but does not actually provide any #line functionality. llvm-svn: 63098
* make -print-stats print stats about the amount of the SLoc Chris Lattner2009-01-271-2/+3
| | | | | | | | | | | | | | | | | address space we used up. Some interesting data: For c99-intconst-1.c: 6912762 SLocEntry's allocated, 25592386B of Sloc address space used. For cocoa.h: 26469 SLocEntry's allocated, 10278752B of Sloc address space used. For carbon.h: 27364 SLocEntry's allocated, 12398141B of Sloc address space used. Clearly 2G of sloc address space should be enough for anyone?! llvm-svn: 63093
* now that everything properly handles multiply instantiatedChris Lattner2009-01-261-8/+0
| | | | | | | source locations, allow creation of them. We can now say that a token was instantiated here, then here, then here. llvm-svn: 63034
* make getInstantiationLoc and getSpellingLoc handle multiply instantiatedChris Lattner2009-01-261-0/+21
| | | | | | locations, and move the slow case out of line. No perf change on cocoa.h llvm-svn: 63033
* fix a negated conditional in getDecomposedInstantiationLocSlowCase,Chris Lattner2009-01-261-7/+13
| | | | | | | which I think is rdar://6527005, and make getDecomposedSpellingLocSlowCase handle nested spelling locations. llvm-svn: 63030
* start plumbing together the line table information. So far we justChris Lattner2009-01-261-0/+76
| | | | | | unique the Filenames in #line directives, assigning them UIDs. llvm-svn: 63010
* Lazily paging in file contents is a big win for PTH, strip out the oldChris Lattner2009-01-261-20/+2
| | | | | | testing code. llvm-svn: 63006
* Check in the long promised SourceLocation rewrite. This lays theChris Lattner2009-01-261-149/+226
| | | | | | | | | | ground work for implementing #line, and fixes the "out of macro ID's" problem. There is nothing particularly tricky about the code, other than the very performance sensitive SourceManager::getFileID() method. llvm-svn: 62978
* remove the public SourceManager::getContentCacheForLoc method.Chris Lattner2009-01-191-1/+4
| | | | llvm-svn: 62497
* SourceManager::getBufferData(SourceLocation) is dead, delete it.Chris Lattner2009-01-191-8/+2
| | | | llvm-svn: 62495
* some minor cleanups to SourceManager, and eliminate the Chris Lattner2009-01-191-1/+1
| | | | | | SourceManager::getBuffer(SourceLocation) method. llvm-svn: 62494
* Rename SourceLocation::getFileID to getChunkID, because it returnsChris Lattner2009-01-171-6/+6
| | | | | | | | the chunk ID not the file ID. This exposes problems in TextDiagnosticPrinter where it should have been using the canonical file ID but wasn't. Fix these along the way. llvm-svn: 62427
* this massive patch introduces a simple new abstraction: it makesChris Lattner2009-01-171-26/+35
| | | | | | | | | | | | | | | "FileID" a concept that is now enforced by the compiler's type checker instead of yet-another-random-unsigned floating around. This is an important distinction from the "FileID" currently tracked by SourceLocation. *That* FileID may refer to the start of a file or to a chunk within it. The new FileID *only* refers to the file (and its #include stack and eventually #line data), it cannot refer to a chunk. FileID is a completely opaque datatype to all clients, only SourceManager is allowed to poke and prod it. llvm-svn: 62407
* make "ContentCache::Buffer" mutable to avoid a const_cast.Chris Lattner2009-01-171-3/+1
| | | | llvm-svn: 62403
* more SourceLocation lexicon change: instead of referring to theChris Lattner2009-01-161-2/+2
| | | | | | "logical" location, refer to the "instantiation" location. llvm-svn: 62316
* rename "virtual location" of a macro to "instantiation location".Chris Lattner2009-01-161-3/+3
| | | | llvm-svn: 62315
* Change some terminology in SourceLocation: instead of referring to Chris Lattner2009-01-161-16/+16
| | | | | | | the "physical" location of tokens, refer to the "spelling" location. This is more concrete and useful, tokens aren't really physical objects! llvm-svn: 62309
* SourceManager: Implement "lazy" creation of MemBuffers for source files.Ted Kremenek2009-01-061-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | - Big Idea: Source files are now mmaped when ContentCache::getBuffer() is first called. While this doesn't change the functionality when lexing regular source files, it can result in source files not being paged in when using PTH. - Performance change: - No observable difference (-fsyntax-only/-Eonly) on Cocoa.h when doing regular source lexing. - No observable time difference (-fsyntax-only/-Eonly) on Cocoa.h when using PTH. We do observe, however, a reduction of 279K in memory mapped source code (3% reduction). The majority of pages from Cocoa.h (and friends) are still being pulled in, however, because any literal will cause Preprocessor::getSpelling() to be called (causing the source for the file to get pulled in). The next possible optimization is to cache literal strings in the PTH file to avoid the need for the original header sources entirely. - Right now there is a preprocessor directive to toggle between "lazy" and "eager" creation of MemBuffers. This is not permanent, and is there in the short term to just test additional optimizations. llvm-svn: 61827
* Misc changes to SourceManager::ContentCache:Ted Kremenek2009-01-061-8/+36
| | | | | | | | | | | | | | - 'Buffer' is now private and must be accessed via 'getBuffer()'. This paves the way for lazily mapping in source files on demand. - Added 'getSize()' (which gets the size of the content without necessarily accessing the MemBuffer) and 'getSizeBytesMapped()'. - Modifed SourceManager to use these new methods. This reduces the number of places that actually access the MemBuffer object for a file to those that actually look at the character data. These changes result in no performance change for -fsyntax-only on Cocoa.h. llvm-svn: 61782
* SourceManager::getLineNumber is logically const except for caching.Chris Lattner2008-11-181-1/+1
| | | | | | Use mutable to make it so. llvm-svn: 59498
* Rename Characteristic_t to CharacteristicKindChris Lattner2008-10-271-1/+1
| | | | llvm-svn: 58224
* whitespace and comment changes, to fix grammar and 80 col violationsNico Weber2008-09-291-4/+4
| | | | llvm-svn: 56776
* clean up a bunch of fixme's I added, by moving Chris Lattner2008-09-261-3/+3
| | | | | | DirectoryLookup::DirType into SourceManager.h llvm-svn: 56692
* Fix the rest of rdar://6243860 hopefully. This requires changing FileIDInfoChris Lattner2008-09-261-3/+3
| | | | | | | | | | | to whether the fileid is a 'extern c system header' in addition to whether it is a system header, most of this is spreading plumbing around. Once we have that, PPLexerChange bases its "file enter/exit" notifications to PPCallbacks to base the system header state on FileIDInfo instead of HeaderSearch. Finally, in Preprocessor::HandleIncludeDirective, mirror logic in GCC: the system headerness of a file being entered can be set due to the #includer or the #includee. llvm-svn: 56688
* * Remove isInSystemHeader() from DiagClient, move it to SourceManagerNico Weber2008-08-101-3/+5
| | | | | | | | | | | | | | | | * Move FormatError() from TextDiagnostic up to DiagClient, remove now empty class TextDiagnostic * Make DiagClient optional for Diagnostic This fixes the following problems: * -html-diags (and probably others) does now output the same set of warnings as console clang does * nothing crashes if one forgets to call setHeaderSearch() on TextDiagnostic * some code duplication is removed llvm-svn: 54620
* Update to match simplified llvm MemoryBuffer interfaces for files.Chris Lattner2008-04-011-2/+1
| | | | llvm-svn: 49042
* prune dead #includesChris Lattner2008-04-011-2/+0
| | | | llvm-svn: 49033
* MemoryBuffer::getFile got smarter, obviating the need for readfilefast.Chris Lattner2008-04-011-60/+3
| | | | | | | The new MemoryBuffer doesn't "leak" file descriptors and handles the small file case efficiently. llvm-svn: 49032
* Hack ReadFileFast() to raise the threshold of memory mapped files (from ↵Steve Naroff2008-03-311-1/+1
| | | | | | | | | | 4->12 pages). This is a temporary solution to avoid running out of file descriptors (which defaults to 256). Need to benchmark to understand the speed benefit. If the benefit is small, the simple solution is to avoid memory mapping files. If the benefit is significant, more thought is necessary. llvm-svn: 48991
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+574
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. llvm-svn: 48402
OpenPOWER on IntegriCloud