summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/SourceMgr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* MIR Serialization: Connect the machine function analysis pass to the MIR parser.Alex Lorenz2015-06-151-22/+24
| | | | | | | | | | | | | | | | | | | | | This commit connects the machine function analysis pass (which creates machine functions) to the MIR parser, which will initialize the machine functions with the state from the MIR file and reconstruct the machine IR. This commit introduces a new interface called 'MachineFunctionInitializer', which can be used to provide custom initialization for the machine functions. This commit also introduces a new diagnostic class called 'DiagnosticInfoMIRParser' which is used for MIR parsing errors. This commit modifies the default diagnostic handling in LLVMContext - now the the diagnostics are printed directly into llvm::errs() so that the MIR parsing errors can be printed with colours. Reviewers: Justin Bogner Differential Revision: http://reviews.llvm.org/D9928 llvm-svn: 239753
* Purge unused includes throughout libSupport.Benjamin Kramer2015-03-231-2/+0
| | | | | | NFC. llvm-svn: 232976
* Remove unnecessary .c_str() when implicitly converting to TwineMatt Arsenault2014-11-061-2/+2
| | | | llvm-svn: 221422
* Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using ↵David Blaikie2014-08-211-6/+1
| | | | | | std::unique_ptr llvm-svn: 216223
* SourceMgr: consistently use 'unsigned' for the memory buffer ID typeDmitri Gribenko2014-07-091-3/+3
| | | | llvm-svn: 212595
* Update the MemoryBuffer API to use ErrorOr.Rafael Espindola2014-07-061-7/+9
| | | | llvm-svn: 212405
* SourceMgr: make valid buffer IDs start from oneAlp Toker2014-07-061-15/+16
| | | | | | | | | | Use 0 for the invalid buffer instead of -1/~0 and switch to unsigned representation to enable more idiomatic usage. Also introduce a trivial SourceMgr::getMainFileID() instead of hard-coding 0/1 to identify the main file. llvm-svn: 212398
* Use SourceMgr::getMemoryBuffer() in a couple of placesAlp Toker2014-06-251-2/+2
| | | | | | Cleanup only. llvm-svn: 211656
* Add an overload for SourceMgr::PrintMessage that takes an existing diagnostic.Jordan Rose2014-06-171-8/+11
| | | | llvm-svn: 211087
* Modernize doc comments for SourceMgr.Jordan Rose2014-06-171-12/+0
| | | | | | No functionality change. llvm-svn: 211086
* Remove system_error.h.Rafael Espindola2014-06-121-1/+1
| | | | | | | This is a minimal change to remove the header. I will remove the occurrences of "using std::error_code" in a followup patch. llvm-svn: 210803
* Fix hardcoded slash to native path seperator which was exposed from ↵Yaron Keren2014-05-161-1/+2
| | | | | | | | llvm::sys::path. http://reviews.llvm.org/D3687 llvm-svn: 208980
* [C++11] Replace some comparisons with 'nullptr' with simple boolean checks ↵Craig Topper2014-04-091-1/+1
| | | | | | to reduce verbosity. llvm-svn: 205829
* [C++11] Make use of 'nullptr' in the Support library.Craig Topper2014-04-071-2/+2
| | | | llvm-svn: 205697
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-2/+1
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* [C++11] Replace OwningPtr::take() with OwningPtr::release().Ahmed Charles2014-03-051-1/+1
| | | | llvm-svn: 202957
* SourceMgr diagnotics printing: fix a bug where printing a fixit for a sourceDmitri Gribenko2013-09-271-1/+1
| | | | | | | range that includes a tab character will cause out-of-bounds access to the fixit string. llvm-svn: 191563
* Make SourceMgr::PrintMessage() testable and add unit testsDmitri Gribenko2013-09-271-3/+8
| | | | llvm-svn: 191558
* Fix size_t -> uint warnings with MSVC 64-bit buildMatt Arsenault2013-07-201-3/+3
| | | | llvm-svn: 186736
* Use only explicit bool conversion operatorsDavid Blaikie2013-05-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 181868
* Make helpers static. Add missing include so LLVMInitializeObjCARCOpts gets C ↵Benjamin Kramer2013-02-151-2/+2
| | | | | | linkage. llvm-svn: 175264
* SMDiagnostic: don't emit ranges if there are /any/ multibyte characters.Jordan Rose2013-01-111-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. llvm-svn: 172164
* Add basic fix-its to SMDiagnostic.Jordan Rose2013-01-101-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. llvm-svn: 172086
* Change SMRange to be half-open (exclusive end) instead of closed (inclusive)Jordan Rose2013-01-071-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. llvm-svn: 171765
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-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. =] llvm-svn: 169131
* SourceMgr: Use has_colors() instead of just is_displayed() before trying to useDaniel Dunbar2012-07-201-2/+2
| | | | | | color. llvm-svn: 160559
* Don't assume size_t is unsigned long long.Matt Beaumont-Gay2012-05-071-3/+1
| | | | | | Fixes a -Woverflow warning from gcc when building for 32-bit platforms. llvm-svn: 156313
* make SourceMgr tolerate empty SMLoc()'s better.Chris Lattner2012-05-061-45/+54
| | | | llvm-svn: 156260
* reapply my patch, with a fix for an off-by-one error. Turned out to be a lotChris Lattner2012-05-051-12/+18
| | | | | | of work for a drive-by fix :) llvm-svn: 156246
* revert my patches, which are causing problems.Chris Lattner2012-05-051-18/+12
| | | | llvm-svn: 156245
* refactor some code to expose column numbers more and make diagnostic ↵Chris Lattner2012-05-051-12/+18
| | | | | | printing slightly more efficient. llvm-svn: 156243
* SourceMgr: Colorize diagnostics.Benjamin Kramer2012-04-181-7/+41
| | | | | | Same color scheme as clang uses. The colors are only enabled if the output is a tty. llvm-svn: 155035
* Removing unused default switch cases in switches over enums that already ↵David Blaikie2012-01-161-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) llvm-svn: 148262
* remove the dead 'ShowLine' argument from SMDiagnostic.Chris Lattner2011-10-161-11/+8
| | | | llvm-svn: 142108
* Make SMDiagnostic a little more sane. Instead of passing around ↵Chris Lattner2011-10-161-16/+22
| | | | | | | | note/warning/error as a string, pass it around as an enum. llvm-svn: 142107
* Enhance llvm::SourceMgr to support diagnostic ranges, the same way clang ↵Chris Lattner2011-10-161-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. llvm-svn: 142106
* Add new -d option to tblgen. It writes a make(1)-style dependency file.Joerg Sonnenberger2011-06-011-4/+6
| | | | llvm-svn: 132395
* MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> ↵Michael J. Spencer2010-12-161-4/+5
| | | | | | via an out parm. llvm-svn: 121958
* Fix whitespace.Michael J. Spencer2010-12-091-1/+1
| | | | llvm-svn: 121382
* Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with ↵Michael J. Spencer2010-12-091-3/+4
| | | | | | error_code &ec. And fix clients. llvm-svn: 121379
* now that AsmPrinter::EmitInlineAsm is factored right, we can eliminate theChris Lattner2010-11-171-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. llvm-svn: 119486
* Push twines deeper into SourceMgr's error handling methods.Benjamin Kramer2010-09-271-8/+8
| | | | llvm-svn: 114847
* enhance SMDiagnostic to also maintain a pointer to the SourceMgr.Chris Lattner2010-04-061-1/+1
| | | | | | | Add a simplified constructor for clients that don't have locations like "file not found" errors. llvm-svn: 100538
* give the SourceMgr object a cookie.Chris Lattner2010-04-061-1/+2
| | | | llvm-svn: 100504
* Give llvm::SourceMgr the ability to have a client-specifiedChris Lattner2010-04-061-1/+8
| | | | | | diagnostic handler. llvm-svn: 100503
* Make SMDiagnostic::Print a const method.Mikhail Glushenkov2010-01-271-1/+1
| | | | llvm-svn: 94672
* Trailing whitespace.Mikhail Glushenkov2010-01-271-19/+19
| | | | llvm-svn: 94671
* Avoid printing a spurious semicolon when there is no filename.Dan Gohman2010-01-211-9/+12
| | | | llvm-svn: 94071
* SourceMgr: Add ShowLine argument to PrintMessage, to allow suppressing the ↵Daniel Dunbar2009-11-221-16/+19
| | | | | | source line output. llvm-svn: 89627
* add a trivial line # cache to SourceMgr to make repeated queries toChris Lattner2009-08-111-0/+40
| | | | | | FindLineNumber much faster when in sequence. llvm-svn: 78693
OpenPOWER on IntegriCloud