summaryrefslogtreecommitdiff
path: root/lib/Support/SourceMgr.cpp
AgeCommit message (Collapse)AuthorFilesLines
2013-02-15Make helpers static. Add missing include so LLVMInitializeObjCARCOpts gets C ↵Benjamin Kramer1-2/+2
linkage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175264 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-11SMDiagnostic: don't emit ranges if there are /any/ multibyte characters.Jordan Rose1-9/+12
Right now, only OS X has a way to determine the column width of a string (PR14910). Until we have a good way to deal with this, we just won't print carets, source ranges, or fixits for SMDiagnostic if the source line has multibyte characters in it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172164 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-10Add basic fix-its to SMDiagnostic.Jordan Rose1-32/+158
Like Clang's FixItHint, SMFixIt represents an insertion, replacement, or removal of source text. One or more fix-its can be emitted as part of a diagnostic, and will be printed below the source range line to show the user how they can fix their code. Currently, the only client of SMFixIt is clang-tblgen; thus, the tests for this behavior live in clang/test/TableGen/tg-fixits.td. If/when SMFixIt is adopted within LLVM itself, those tests should be moved to the LLVM suite. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172086 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07Change SMRange to be half-open (exclusive end) instead of closed (inclusive)Jordan Rose1-1/+1
This is necessary not only for representing empty ranges, but for handling multibyte characters in the input. (If the end pointer in a range refers to a multibyte character, should it point to the beginning or the end of the character in a char array?) Some of the code in the asm parsers was already assuming this anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171765 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03Use the new script to sort the includes of every file under lib.Chandler Carruth1-2/+2
Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20SourceMgr: Use has_colors() instead of just is_displayed() before trying to useDaniel Dunbar1-2/+2
color. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160559 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-07Don't assume size_t is unsigned long long.Matt Beaumont-Gay1-3/+1
Fixes a -Woverflow warning from gcc when building for 32-bit platforms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156313 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-06make SourceMgr tolerate empty SMLoc()'s better.Chris Lattner1-45/+54
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156260 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-05reapply my patch, with a fix for an off-by-one error. Turned out to be a lotChris Lattner1-12/+18
of work for a drive-by fix :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156246 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-05revert my patches, which are causing problems.Chris Lattner1-18/+12
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156245 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-05refactor some code to expose column numbers more and make diagnostic ↵Chris Lattner1-12/+18
printing slightly more efficient. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156243 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-18SourceMgr: Colorize diagnostics.Benjamin Kramer1-7/+41
Same color scheme as clang uses. The colors are only enabled if the output is a tty. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155035 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-16Removing unused default switch cases in switches over enums that already ↵David Blaikie1-1/+0
account for all enumeration values explicitly. (This time I believe I've checked all the -Wreturn-type warnings from GCC & added the couple of llvm_unreachables necessary to silence them. If I've missed any, I'll happily fix them as soon as I know about them) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148262 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-16remove the dead 'ShowLine' argument from SMDiagnostic.Chris Lattner1-11/+8
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142108 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-16Make SMDiagnostic a little more sane. Instead of passing around ↵Chris Lattner1-16/+22
note/warning/error as a string, pass it around as an enum. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142107 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-16Enhance llvm::SourceMgr to support diagnostic ranges, the same way clang ↵Chris Lattner1-21/+100
does. Enhance the X86 asmparser to produce ranges in the one case that was annoying me, for example: test.s:10:15: error: invalid operand for instruction movl 0(%rax), 0(%edx) ^~~~~~~ It should be straight-forward to enhance filecheck, tblgen, and/or the .ll parser to use ranges where appropriate if someone is interested. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142106 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-01Add new -d option to tblgen. It writes a make(1)-style dependency file.Joerg Sonnenberger1-4/+6
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132395 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> ↵Michael J. Spencer1-4/+5
via an out parm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121958 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09Fix whitespace.Michael J. Spencer1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121382 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with ↵Michael J. Spencer1-3/+4
error_code &ec. And fix clients. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121379 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17now that AsmPrinter::EmitInlineAsm is factored right, we can eliminate theChris Lattner1-2/+1
cookie argument to the SourceMgr diagnostic stuff. This cleanly separates LLVMContext's inlineasm handler from the sourcemgr error handling definition, increasing type safety and cleaning things up. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119486 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27Push twines deeper into SourceMgr's error handling methods.Benjamin Kramer1-8/+8
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114847 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06enhance SMDiagnostic to also maintain a pointer to the SourceMgr.Chris Lattner1-1/+1
Add a simplified constructor for clients that don't have locations like "file not found" errors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100538 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06give the SourceMgr object a cookie.Chris Lattner1-1/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100504 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06Give llvm::SourceMgr the ability to have a client-specifiedChris Lattner1-1/+8
diagnostic handler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100503 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27Make SMDiagnostic::Print a const method.Mikhail Glushenkov1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94672 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27Trailing whitespace.Mikhail Glushenkov1-19/+19
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94671 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21Avoid printing a spurious semicolon when there is no filename.Dan Gohman1-9/+12
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94071 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22SourceMgr: Add ShowLine argument to PrintMessage, to allow suppressing the ↵Daniel Dunbar1-16/+19
source line output. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89627 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11add a trivial line # cache to SourceMgr to make repeated queries toChris Lattner1-0/+40
FindLineNumber much faster when in sequence. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78693 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02switch the .ll parser to use SourceMgr.Chris Lattner1-10/+21
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74735 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02add an explicit class for holding llvm::SourceMgr diagnostics and useChris Lattner1-19/+52
it to print them. This gives us column numbers in the diag line. Before: t.s:4: error: unexpected token in argument list mov %eax %edx ^ now: t.s:4:11: error: unexpected token in argument list mov %eax %edx ^ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74732 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30Normalize SourceMgr messages.Daniel Dunbar1-3/+7
- Don't print "Parsing" in front of every message. - Take additional "type" argument which is prepended to the message (with ": ") if given. - Update clients to print errors (warnings) as: <filename>:<line number>: error(warning): ... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74489 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21rename SourceMgr::PrintError to PrintMessage.Chris Lattner1-6/+6
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73861 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21move include searching logic from TGLexer to SourceMgr.Chris Lattner1-0/+20
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73845 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21Rename TGSourceMgr -> SourceMgr.Chris Lattner1-5/+5
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73844 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21rename TGLoc -> SMLoc.Chris Lattner1-6/+6
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73843 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21move TGSourceMgr class out of TableGen into libsupport.Chris Lattner1-0/+107
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73842 91177308-0d34-0410-b5e6-96231b3b80d8