summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/SourceManager.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Workaround a really serious caching bug in ↵Ted Kremenek2010-05-061-0/+5
| | | | | | | | | | SourceManager::isBeforeInTranslationUnit() where the method will sometimes return different results for the same input SourceLocations. I haven't unraveled this method completely yet, so this truly is a workaround until a better fix comes along. llvm-svn: 103143
* change FullSourceLoc to have a *const* SourceManager&, eliminatingChris Lattner2010-04-201-4/+1
| | | | | | a const_cast. llvm-svn: 101940
* push some source location information down through the compiler,Chris Lattner2010-04-201-20/+32
| | | | | | | | into ContentCache::getBuffer. This allows it to produce diagnostics on the broken #include line instead of without a location. llvm-svn: 101939
* enhance sourcemgr to detect various UTF BOM's and emit a fatal errorChris Lattner2010-04-201-0/+35
| | | | | | | | | about it instead of producing tons of garbage from the lexer. It would be even better for sourcemgr to dynamically transcode (e.g. from UTF16 -> UTF8). llvm-svn: 101924
* Disable diag::err_file_modified on Win32 completely, until someone cares to fixDaniel Dunbar2010-04-101-10/+12
| | | | | | | it. PR6812. - This is another attempt at silencing annoying buildbot failures. llvm-svn: 100914
* On Windows, disable the modification-time check for files used inDouglas Gregor2010-04-091-5/+11
| | | | | | | | precompiled headers and/or when reading the contents of the file into memory. These checks seem to be causing spurious regression-test failures on Windows. llvm-svn: 100866
* Introduce the notion of a single "delayed" diagnostic into theDouglas Gregor2010-03-221-3/+14
| | | | | | | | | | | | Diagnostic subsystem, which is used in the rare case where we find a serious problem (i.e., an inconsistency in the file system) while we're busy formatting another diagnostic. In this case, the delayed diagnostic will be emitted after we're done with the other diagnostic. This is only to be used for fatal conditions detected at very inconvenient times, where we can neither stop the current diagnostic in flight nor can we suppress the second error. llvm-svn: 99175
* Keep track of the size/modification time of each file source-locationDouglas Gregor2010-03-211-2/+1
| | | | | | | entry in a precompiled header, so that we can detect modified files even when we miss in the stat cache. llvm-svn: 99149
* Fix a longstanding (but previously unknown) bug in the lazyDouglas Gregor2010-03-191-1/+1
| | | | | | | | | | | | | deserialization of precompiled headers, where the deserialization of the source location entry for a buffer (e.g., macro instantiation scratch space) would overwrite a one-element FileID cache in the source manager. When tickled at the wrong time, we would return the wrong decomposed source location and eventually cause c-index-test to crash. Found by dumb luck. It's amazing this hasn't shown up before. llvm-svn: 98940
* Check the inode in addition to size and modification time to determineDouglas Gregor2010-03-171-3/+5
| | | | | | whether a file has changed since it was originally read. llvm-svn: 98726
* Use a simple diagnostic (file modified) when we detect that a file hasDouglas Gregor2010-03-171-10/+4
| | | | | | | changed, rather than trying to point out how it changed. The "why" doesn't matter. llvm-svn: 98725
* Teach SourceManager's content cache to keep track of whether itsDouglas Gregor2010-03-161-21/+24
| | | | | | | | | buffer was invalid when it was created, and use that bit to always set the "Invalid" flag according to whether the buffer is invalid. This ensures that all accesses to an invalid buffer are marked invalid, improving recovery. llvm-svn: 98690
* Audit all getBuffer() callers (for both the FullSourceLoc andDouglas Gregor2010-03-161-7/+6
| | | | | | | SourceManager versions), updating those callers that need to recover gracefully from failure. llvm-svn: 98665
* Let SourceManager::getBufferData return StringRef instead of a pair of two ↵Benjamin Kramer2010-03-161-5/+3
| | | | | | const char*. llvm-svn: 98630
* Introduce optional "Invalid" parameters to routines that invoke theDouglas Gregor2010-03-161-25/+57
| | | | | | | | | | | | | SourceManager's getBuffer() and, therefore, could fail, along with Preprocessor::getSpelling(). Use the Invalid parameters in the literal parsers (string, floating point, integral, character) to make them robust against errors that stem from, e.g., PCH files that are not consistent with the underlying file system. I still need to audit every use caller to all of these routines, to determine which ones need specific handling of error conditions. llvm-svn: 98608
* Use SourceManager's Diagnostic object for all file-reading errors,Douglas Gregor2010-03-161-90/+33
| | | | | | simplifying the SourceManager interfaces somewhat. llvm-svn: 98598
* Give SourceManager a Diagnostic object with which to report errors,Douglas Gregor2010-03-161-13/+12
| | | | | | and start simplifying the interfaces in SourceManager that can fail. llvm-svn: 98594
* Add some <cstdio> includes to unbreak the buildbotsDouglas Gregor2010-03-151-0/+1
| | | | llvm-svn: 98591
* Introduce a new BufferResult class to act as the return type ofDouglas Gregor2010-03-151-11/+104
| | | | | | | | | | | | | | SourceManager's getBuffer() (and similar) operations. This abstract can be used to force callers to cope with errors in getBuffer(), such as missing files and changed files. Fix a bunch of callers to use the new interface. Add some very basic checks for file consistency (file size, modification time) into ContentCache::getBuffer(), although these checks don't help much until we've updated the main callers (e.g., SourceManager::getSpelling()). llvm-svn: 98585
* Fix -Wsign-compare warning reported by clang++.Ted Kremenek2010-03-101-1/+2
| | | | llvm-svn: 98170
* Robustify SourceManager::getLocation(), so that it returns anDouglas Gregor2010-02-271-14/+18
| | | | | | | | | end-of-line source location when given a column number beyond the length of the line, or an end-of-file source location when given a line number beyond the length of the file. Previously, we would return an invalid location. llvm-svn: 97299
* fix a bug in SourceManager::getInstantiationLocSlowCase, whereChris Lattner2010-02-121-3/+7
| | | | | | | | | | | we'd add an offset from the spelling location space to the instantiation location, which doesn't make sense and would lead up to the text diagnostics crashing when presented with non-sensical locations. This fixes rdar://7597492, a crash on 255.vortex. llvm-svn: 96004
* Add a pretty horrible hack to prevent clang from crashing with inconsistent PCHDaniel Dunbar2009-12-061-2/+18
| | | | | | | | | | | | | files. - The issue is that PCH uses a stat cache, which may reference files which have been deleted or moved. In such cases ContentCache::getBuffer was returning 0 but most clients are incapable of dealing with this (i.e., they don't). For the time being, resolve this issue by just making up some invalid file contents and. Eventually we should detect that we are in an inconsistent situation and error out with a nice message that the PCH is out of date. llvm-svn: 90699
* 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
OpenPOWER on IntegriCloud