Commit Graph

503 Commits

Author SHA1 Message Date
Douglas Gregor 51c2351d30 Fix a longstanding (but previously unknown) bug in the lazy
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
2010-03-19 06:12:06 +00:00
Douglas Gregor 22fde23b6e Check the inode in addition to size and modification time to determine
whether a file has changed since it was originally read.

llvm-svn: 98726
2010-03-17 15:33:06 +00:00
Douglas Gregor 6597f59506 Use a simple diagnostic (file modified) when we detect that a file has
changed, rather than trying to point out how it changed. The "why"
doesn't matter.

llvm-svn: 98725
2010-03-17 15:30:15 +00:00
Douglas Gregor 82752ec843 Teach SourceManager's content cache to keep track of whether its
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
2010-03-16 22:53:51 +00:00
Douglas Gregor a71b9d0678 Update get*LineNumber() and get*ColumnNumber() functions to pass the
Invalid bit through; there are no safety-critical callers of these
functions.

llvm-svn: 98674
2010-03-16 20:53:17 +00:00
Douglas Gregor 42fe858cd6 Audit all callers of SourceManager::getCharacterData(); update some of
them to recover more gracefully on failure.

llvm-svn: 98672
2010-03-16 20:46:42 +00:00
Douglas Gregor 4fb7fbef3b Audit all getBuffer() callers (for both the FullSourceLoc and
SourceManager versions), updating those callers that need to recover
gracefully from failure.

llvm-svn: 98665
2010-03-16 20:01:30 +00:00
Benjamin Kramer 0ca3c62078 Switch another function to StringRef instead of char pointer pairs.
llvm-svn: 98631
2010-03-16 14:48:07 +00:00
Benjamin Kramer eb92dc0b09 Let SourceManager::getBufferData return StringRef instead of a pair of two const char*.
llvm-svn: 98630
2010-03-16 14:14:31 +00:00
Douglas Gregor 7bda4b8310 Introduce optional "Invalid" parameters to routines that invoke the
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
2010-03-16 05:20:39 +00:00
Douglas Gregor 874cc62876 Use SourceManager's Diagnostic object for all file-reading errors,
simplifying the SourceManager interfaces somewhat.

llvm-svn: 98598
2010-03-16 00:35:39 +00:00
Douglas Gregor e0fbb83b8b Give SourceManager a Diagnostic object with which to report errors,
and start simplifying the interfaces in SourceManager that can fail.

llvm-svn: 98594
2010-03-16 00:06:06 +00:00
Douglas Gregor 0adf3182b0 Add some <cstdio> includes to unbreak the buildbots
llvm-svn: 98591
2010-03-15 23:33:37 +00:00
Douglas Gregor 802b77601e Introduce a new BufferResult class to act as the return type of
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
2010-03-15 22:54:52 +00:00
Kovarththanan Rajaratnam 00682a48f4 Reintroduce r98340 and r98341 now without copy/paste errors.
Thanks to Ben for pointing this out.

llvm-svn: 98345
2010-03-12 11:27:37 +00:00
Kovarththanan Rajaratnam e604f14c96 Back out r98340 abd r98341
llvm-svn: 98344
2010-03-12 11:00:51 +00:00
Nuno Lopes 4cbc8bd1bc fix PR6584: __SSE3__ not defined with -mss3
llvm-svn: 98342
2010-03-12 10:20:09 +00:00
Kovarththanan Rajaratnam f1aa69d103 Switch parameter order for consistency (no functionality change)
llvm-svn: 98341
2010-03-12 10:17:07 +00:00
Kovarththanan Rajaratnam e2acea7c53 Add keywords using StringRef
llvm-svn: 98340
2010-03-12 10:14:26 +00:00
Ted Kremenek 4a26524050 Fix -Wsign-compare warning reported by clang++.
llvm-svn: 98170
2010-03-10 18:22:38 +00:00
Chris Lattner 5178f56255 add mblaze target support, patch by Wesley Peck!
llvm-svn: 97890
2010-03-06 21:21:27 +00:00
Benjamin Kramer d4870700ad Make sure the raw_string_ostream gets flushed so we don't accidentally return an empty string.
llvm-svn: 97809
2010-03-05 15:39:20 +00:00
Chris Lattner 09797543bd add TCE target support, patch by Pekka J!
llvm-svn: 97746
2010-03-04 21:07:38 +00:00
Eric Christopher cfeceffa27 Add in disabled case as well.
llvm-svn: 97716
2010-03-04 02:31:44 +00:00
Eric Christopher 399ffa55d2 Add in -msse4.1 and -msse4.2 options and continuing a rather
hacky solution for translating.  Expanded on comment explaining
the hack a bit.

llvm-svn: 97714
2010-03-04 02:26:37 +00:00
Chris Lattner 5cc15e058b add framework for ARM builtins, Patch by Edmund Grimley Evans!
llvm-svn: 97656
2010-03-03 19:03:45 +00:00
Ted Kremenek c9ef64ff67 Use SVN_REVISION, not SVN_VERSION.
llvm-svn: 97625
2010-03-03 01:30:39 +00:00
Ted Kremenek 47307292f1 Make getClangRevision() check that SVN_VERSION is an empty string
(even if it is defined).  This fixes the issue of this function
returning '0' when SVN_VERSION is defined to be "".

Fixes: <rdar://problem/7663667>
llvm-svn: 97620
2010-03-03 01:02:48 +00:00
Eric Christopher 0b26a616eb Add in some more MIPS command line options.
Patch by Oleksandr Tymoshenko!

llvm-svn: 97544
2010-03-02 02:41:08 +00:00
Douglas Gregor b8b9f28e24 Robustify SourceManager::getLocation(), so that it returns an
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
2010-02-27 02:42:25 +00:00
Douglas Gregor 70127c1dcf Use a little binary header in serialized diagnostics to help the deserializer skip over noise in the stream
llvm-svn: 96641
2010-02-19 00:40:40 +00:00
Douglas Gregor 1e21cc7d19 Re-apply my diagnostics-capture patch for CIndex, with some tweaks to
try to address the msvc failures.

llvm-svn: 96624
2010-02-18 23:07:20 +00:00
Douglas Gregor 33cdd81064 Rework how CIndex handles diagnostics. Rather than using a callback,
we attach diagnostics to translation units and code-completion
results, so they can be queried at any time.

To facilitate this, the new StoredDiagnostic class stores a diagnostic
in a serializable/deserializable form, and ASTUnit knows how to
capture diagnostics in this stored form. CIndex's CXDiagnostic is a
thin wrapper around StoredDiagnostic, providing a C interface to
stored or de-serialized diagnostics.

I've XFAIL'd one test case temporarily, because currently we end up
storing diagnostics in an ASTUnit that's never returned to the user
(because it contains errors). I'll introduce a temporary fix for this
soon; the real fix will be to allow us to return and query invalid ASTs.

llvm-svn: 96592
2010-02-18 18:08:43 +00:00
Chris Lattner db5c16bc9c add freebsd/ppc[64] support, patch by Nathan Whitehorn, PR6318
llvm-svn: 96362
2010-02-16 18:14:57 +00:00
Sanjiv Gupta ecd2600c52 Re-applying 96173. Looks like finally I got the test case right.
llvm-svn: 96321
2010-02-16 03:37:11 +00:00
Sanjiv Gupta 9d23f93d52 reverting back 96242 as it still causes a test failure.
llvm-svn: 96244
2010-02-15 18:02:12 +00:00
Sanjiv Gupta af56d377f1 Re-applying 96173 with corresponding changes in test.
llvm-svn: 96242
2010-02-15 17:19:13 +00:00
Chris Lattner d0413848cc temporarily revert 96173, it is causing test failures.
llvm-svn: 96176
2010-02-14 18:38:38 +00:00
Sanjiv Gupta 1ef8cdd29b renamed pic16 specifiic macros.
llvm-svn: 96173
2010-02-14 18:20:18 +00:00
Ted Kremenek 8bd0929d41 Fix bug I introduced with assinging a temporary to a StringRef.
llvm-svn: 96041
2010-02-12 23:31:14 +00:00
Ted Kremenek a3e657064b Make the following functions thread-safe but having them return an std::string that is reconstructed
every time they are called:

getClangRevision()
getClangFullRepositoryVersion()
getClangFullVersion()

llvm-svn: 96033
2010-02-12 22:54:40 +00:00
Chris Lattner 5647d3192c fix a bug in SourceManager::getInstantiationLocSlowCase, where
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
2010-02-12 19:31:35 +00:00
John McCall be089fa86b Suppress warnings if their instantiation location is in a system header, not
their spelling location.  This prevents warnings from being swallowed just
because the caret is on the first parenthesis in, say, NULL.

This is an experiment;  the risk is that there might be a substantial number
of system headers which #define symbols to expressions which inherently cause
warnings.  My theory is that that's rare enough that it can be worked
around case-by-case, and that producing useful warnings around NULL is worth 
it.  But I'm willing to accept that I might be empirically wrong.

llvm-svn: 95870
2010-02-11 10:04:29 +00:00
Daniel Dunbar 3241d400c8 Switch to using -fsjlj-exceptions instead of hard-coding it. Notably, this fixes
calls to the UnwindResumeOrRethrow function for C++/Obj-C exception handling,
for Darwin ARM.

llvm-svn: 95787
2010-02-10 18:49:11 +00:00
John Thompson 2233460de6 First stage of adding AltiVec support
llvm-svn: 95335
2010-02-05 00:12:22 +00:00
Chris Lattner 5b5d2db3f6 Don't explicitly force utf strings into the __TEXT,__ustring
by setting the section of the generated global.  This is an
optimization done by the code generator, and the code being
removed didn't handle the case when the string contained an
embedded nul (which the code generator does correctly 
handle).  This is rdar://7589850

llvm-svn: 95003
2010-02-01 20:59:08 +00:00
Benjamin Kramer 31a68e70a5 Simplify FreeBSD version parsing.
llvm-svn: 94919
2010-01-30 19:55:01 +00:00
Anders Carlsson c7c5baa482 Yay for more StringRefs.
llvm-svn: 94917
2010-01-30 19:12:25 +00:00
Anders Carlsson 0b0a122fde StringRef-ize the TargetInfo::ConstraintInfo constructor.
llvm-svn: 94916
2010-01-30 18:33:31 +00:00
Benjamin Kramer a87bdb793e We don't need to place 0 in the URL string now that we return a StringRef.
- URL can go into read only memory now.
- Compilers will fold away all the strstr calls.

llvm-svn: 94887
2010-01-30 14:01:39 +00:00