summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/SourceManager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Minor cleanup to the code-completion-point logic suggested by Chris.Douglas Gregor2009-12-031-2/+1
| | | | llvm-svn: 90459
* Extend the source manager with the ability to override the contents ofDouglas Gregor2009-12-021-78/+28
| | | | | | | | | | files with the contents of an arbitrary memory buffer. Use this new functionality to drastically clean up the way in which we handle file truncation for code-completion: all of the truncation/completion logic is now encapsulated in the preprocessor where it belongs (<rdar://problem/7434737>). llvm-svn: 90300
* Eliminate the unnecessary FirstFID cache variable from the source manager's ↵Douglas Gregor2009-12-021-6/+27
| | | | | | ContentCache llvm-svn: 90294
* In SourceManager::isBeforeInTranslationUnit, if we are trying to compare two ↵Daniel Dunbar2009-12-011-24/+14
| | | | | | | | | | source locations with no common ancestor in the include stack, determine order by assuming memory buffers preceed files, and then that FileIDs are created in order. The later assumption is patently false, but this was already broken -- this situation is conceptually impossible, my feeling is we should fix SourceManager and friends to make it impossible in practice as well. However, we need to fix PR5662 and perhaps some other things involving memory buffers first. In the short term I'm pretty sure this is reliable. Chris, Argiris, is this going to break anything that wasn't already broken? llvm-svn: 90280
* pass the reason for failure up from MemoryBuffer and report itChris Lattner2009-12-011-2/+2
| | | | | | | | | | | | in diagnostics when we fail to open a file. This allows us to report things like: $ clang test.c -I. test.c:2:10: fatal error: error opening file './foo.h': Permission denied #include "foo.h" ^ llvm-svn: 90276
* Move DISABLE_INLINE to the front of the decl so MSVC can parse it. Patch by ↵Benjamin Kramer2009-11-141-2/+2
| | | | | | Amine Khaldi! llvm-svn: 88797
* pr5371 likely has nothing to do with this.Chris Lattner2009-11-031-1/+0
| | | | llvm-svn: 85862
* Add note to FIXME about PR5371.Edward O'Callaghan2009-11-021-0/+1
| | | | llvm-svn: 85825
* Replace the -code-completion-dump option with Douglas Gregor2009-09-221-2/+79
| | | | | | | | | | | -code-completion-at=filename:line:column which performs code completion at the specified location by truncating the file at that position and enabling code completion. This approach makes it possible to run multiple tests from a single test file, and gives a more natural command-line interface. llvm-svn: 82571
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-100/+100
| | | | llvm-svn: 81346
* API changes to match llvm ToT.Chris Lattner2009-08-231-0/+1
| | | | llvm-svn: 79868
* Replace cerr with errs().Benjamin Kramer2009-08-231-11/+9
| | | | llvm-svn: 79854
* Fix column checking for SourceManager::getLocation().Argyrios Kyrtzidis2009-06-251-1/+1
| | | | llvm-svn: 74194
* Fix warning when building w/o asserts.Daniel Dunbar2009-06-231-0/+1
| | | | llvm-svn: 74020
* Introduce SourceManager::ísBeforeInTranslationUnit() which can compare 2 ↵Argyrios Kyrtzidis2009-06-231-0/+100
| | | | | | source locations and determine which one comes before the other, relative to the translation unit. llvm-svn: 74014
* In SourceManager::createFileID missed setting ContentCache's FirstFID in ↵Argyrios Kyrtzidis2009-06-231-1/+4
| | | | | | another place. llvm-svn: 73931
* Slight modification to column checking inside SourceManager::getLocation().Argyrios Kyrtzidis2009-06-201-6/+6
| | | | llvm-svn: 73826
* Introduce SourceManager::getLocation() to get a source location out of a ↵Argyrios Kyrtzidis2009-06-201-1/+41
| | | | | | "file:line:column" triplet. llvm-svn: 73823
* Remove dead code: 'NewEntry' is not used.Zhongxing Xu2009-06-071-3/+0
| | | | llvm-svn: 73027
* Avoid potential out-of-bounds access in SourceManager::getLineNumber.Daniel Dunbar2009-05-181-1/+13
| | | | | | - Chris, please see added FIXMEs. llvm-svn: 72019
* Be more careful in our teardown of the PCHReader after deciding toDouglas Gregor2009-04-271-0/+16
| | | | | | ignore a PCH file. llvm-svn: 70251
* Load most of the source manager's information lazily from the PCHDouglas Gregor2009-04-271-4/+52
| | | | | | | | | | | | | | | | | | | file. In particular, only eagerly load source location entries for files and for the predefines buffer. Other buffers and macro-instantiation source location entries are loaded lazily. With the Cocoa-prefixed "Hello, World", we only load 815/26555 source location entities. This halves the amount of user time we spend in this "Hello, World" program with -fsyntax-only (down to .007s). This optimization is part 1 of 2 for the source manager. This eliminates most of the user time in loading a PCH file. We still spend too much time initialize File structures (especially in the calls to stat), so we need to either make the loading of source location entries for files lazy or import the stat cache from the PTH implementation. llvm-svn: 70196
* Remove the serialization code that predates precompiledDouglas Gregor2009-04-221-133/+1
| | | | | | | headers. Future approaches to (de-)serializing ASTs will be based on the PCH infrastructure. llvm-svn: 69828
* Include the SourceManager's line table in the PCH file. We can nowDouglas Gregor2009-04-131-0/+11
| | | | | | properly cope with #line directives in PCH files. llvm-svn: 68963
* Factor the internals of SourceManager (specially, LineTableInfo) into a ↵Douglas Gregor2009-04-131-96/+1
| | | | | | separate Internals header. No functionality change llvm-svn: 68960
* Resynchronize Decl/VarDecl serialization code with the structuresDouglas Gregor2009-04-021-2/+2
| | | | llvm-svn: 68346
* Clear all the linetable state in clear(), fixing problemsChris Lattner2009-03-111-0/+1
| | | | | | | with "clang t.i s.i" where the .i files contain line markers. rdar://6667812 llvm-svn: 66619
* 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
OpenPOWER on IntegriCloud