summaryrefslogtreecommitdiff
path: root/lib/Support/SourceMgr.cpp
Commit message (Collapse)AuthorAge
* SourceMgr diagnotics printing: fix a bug where printing a fixit for a sourceDmitri Gribenko2013-09-27
| | | | | | | | range that includes a tab character will cause out-of-bounds access to the fixit string. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191563 91177308-0d34-0410-b5e6-96231b3b80d8
* Make SourceMgr::PrintMessage() testable and add unit testsDmitri Gribenko2013-09-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191558 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix size_t -> uint warnings with MSVC 64-bit buildMatt Arsenault2013-07-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186736 91177308-0d34-0410-b5e6-96231b3b80d8
* Use only explicit bool conversion operatorsDavid Blaikie2013-05-15
| | | | | | | | | | | | | | | | | | | | | | | BitVector/SmallBitVector::reference::operator bool remain implicit since they model more exactly a bool, rather than something else that can be boolean tested. The most common (non-buggy) case are where such objects are used as return expressions in bool-returning functions or as boolean function arguments. In those cases I've used (& added if necessary) a named function to provide the equivalent (or sometimes negative, depending on convenient wording) test. One behavior change (YAMLParser) was made, though no test case is included as I'm not sure how to reach that code path. Essentially any comparison of llvm::yaml::document_iterators would be invalid if neither iterator was at the end. This helped uncover a couple of bugs in Clang - test cases provided for those in a separate commit along with similar changes to `operator bool` instances in Clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181868 91177308-0d34-0410-b5e6-96231b3b80d8
* Make helpers static. Add missing include so LLVMInitializeObjCARCOpts gets C ↵Benjamin Kramer2013-02-15
| | | | | | linkage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175264 91177308-0d34-0410-b5e6-96231b3b80d8
* SMDiagnostic: don't emit ranges if there are /any/ multibyte characters.Jordan Rose2013-01-11
| | | | | | | | | 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
* Add basic fix-its to SMDiagnostic.Jordan Rose2013-01-10
| | | | | | | | | | | | | 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
* Change SMRange to be half-open (exclusive end) instead of closed (inclusive)Jordan Rose2013-01-07
| | | | | | | | | | 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
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | 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
* SourceMgr: Use has_colors() instead of just is_displayed() before trying to useDaniel Dunbar2012-07-20
| | | | | | color. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160559 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't assume size_t is unsigned long long.Matt Beaumont-Gay2012-05-07
| | | | | | 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
* make SourceMgr tolerate empty SMLoc()'s better.Chris Lattner2012-05-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156260 91177308-0d34-0410-b5e6-96231b3b80d8
* reapply my patch, with a fix for an off-by-one error. Turned out to be a lotChris Lattner2012-05-05
| | | | | | | of work for a drive-by fix :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156246 91177308-0d34-0410-b5e6-96231b3b80d8
* revert my patches, which are causing problems.Chris Lattner2012-05-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156245 91177308-0d34-0410-b5e6-96231b3b80d8
* refactor some code to expose column numbers more and make diagnostic ↵Chris Lattner2012-05-05
| | | | | | printing slightly more efficient. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156243 91177308-0d34-0410-b5e6-96231b3b80d8
* SourceMgr: Colorize diagnostics.Benjamin Kramer2012-04-18
| | | | | | 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
* Removing unused default switch cases in switches over enums that already ↵David Blaikie2012-01-16
| | | | | | | | 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
* remove the dead 'ShowLine' argument from SMDiagnostic.Chris Lattner2011-10-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142108 91177308-0d34-0410-b5e6-96231b3b80d8
* Make SMDiagnostic a little more sane. Instead of passing around ↵Chris Lattner2011-10-16
| | | | | | | | | 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
* Enhance llvm::SourceMgr to support diagnostic ranges, the same way clang ↵Chris Lattner2011-10-16
| | | | | | | | | | | | | | | | | 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
* Add new -d option to tblgen. It writes a make(1)-style dependency file.Joerg Sonnenberger2011-06-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132395 91177308-0d34-0410-b5e6-96231b3b80d8
* MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> ↵Michael J. Spencer2010-12-16
| | | | | | via an out parm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121958 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix whitespace.Michael J. Spencer2010-12-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121382 91177308-0d34-0410-b5e6-96231b3b80d8
* Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with ↵Michael J. Spencer2010-12-09
| | | | | | error_code &ec. And fix clients. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121379 91177308-0d34-0410-b5e6-96231b3b80d8
* now that AsmPrinter::EmitInlineAsm is factored right, we can eliminate theChris Lattner2010-11-17
| | | | | | | | | 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
* Push twines deeper into SourceMgr's error handling methods.Benjamin Kramer2010-09-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114847 91177308-0d34-0410-b5e6-96231b3b80d8
* enhance SMDiagnostic to also maintain a pointer to the SourceMgr.Chris Lattner2010-04-06
| | | | | | | | 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
* give the SourceMgr object a cookie.Chris Lattner2010-04-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100504 91177308-0d34-0410-b5e6-96231b3b80d8
* Give llvm::SourceMgr the ability to have a client-specifiedChris Lattner2010-04-06
| | | | | | | diagnostic handler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100503 91177308-0d34-0410-b5e6-96231b3b80d8
* Make SMDiagnostic::Print a const method.Mikhail Glushenkov2010-01-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94672 91177308-0d34-0410-b5e6-96231b3b80d8
* Trailing whitespace.Mikhail Glushenkov2010-01-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94671 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid printing a spurious semicolon when there is no filename.Dan Gohman2010-01-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94071 91177308-0d34-0410-b5e6-96231b3b80d8
* SourceMgr: Add ShowLine argument to PrintMessage, to allow suppressing the ↵Daniel Dunbar2009-11-22
| | | | | | source line output. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89627 91177308-0d34-0410-b5e6-96231b3b80d8
* add a trivial line # cache to SourceMgr to make repeated queries toChris Lattner2009-08-11
| | | | | | | | FindLineNumber much faster when in sequence. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78693 91177308-0d34-0410-b5e6-96231b3b80d8
* switch the .ll parser to use SourceMgr.Chris Lattner2009-07-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74735 91177308-0d34-0410-b5e6-96231b3b80d8
* add an explicit class for holding llvm::SourceMgr diagnostics and useChris Lattner2009-07-02
| | | | | | | | | | | | | | | | | 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
* Normalize SourceMgr messages.Daniel Dunbar2009-06-30
| | | | | | | | | | | | | - 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
* rename SourceMgr::PrintError to PrintMessage.Chris Lattner2009-06-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73861 91177308-0d34-0410-b5e6-96231b3b80d8
* move include searching logic from TGLexer to SourceMgr.Chris Lattner2009-06-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73845 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename TGSourceMgr -> SourceMgr.Chris Lattner2009-06-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73844 91177308-0d34-0410-b5e6-96231b3b80d8
* rename TGLoc -> SMLoc.Chris Lattner2009-06-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73843 91177308-0d34-0410-b5e6-96231b3b80d8
* move TGSourceMgr class out of TableGen into libsupport.Chris Lattner2009-06-21
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73842 91177308-0d34-0410-b5e6-96231b3b80d8