1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

45 Commits

Author SHA1 Message Date
Craig Topper
ee78063a54 [C++11] Make use of 'nullptr' in the Support library.
llvm-svn: 205697
2014-04-07 04:17:22 +00:00
Ahmed Charles
52ce0c101e Replace OwningPtr<T> with std::unique_ptr<T>.
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
2014-03-06 05:51:42 +00:00
Ahmed Charles
4a96a15754 [C++11] Replace OwningPtr::take() with OwningPtr::release().
llvm-svn: 202957
2014-03-05 10:19:29 +00:00
Dmitri Gribenko
9c747f2fbc SourceMgr diagnotics printing: fix a bug where printing a fixit for a source
range that includes a tab character will cause out-of-bounds access to the
fixit string.

llvm-svn: 191563
2013-09-27 21:24:36 +00:00
Dmitri Gribenko
eee7bbf1df Make SourceMgr::PrintMessage() testable and add unit tests
llvm-svn: 191558
2013-09-27 21:09:25 +00:00
Matt Arsenault
2dbfab3c32 Fix size_t -> uint warnings with MSVC 64-bit build
llvm-svn: 186736
2013-07-20 00:20:10 +00:00
David Blaikie
898763a097 Use only explicit bool conversion operators
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
2013-05-15 07:36:59 +00:00
Benjamin Kramer
e11f88e804 Make helpers static. Add missing include so LLVMInitializeObjCARCOpts gets C linkage.
llvm-svn: 175264
2013-02-15 12:30:38 +00:00
Jordan Rose
0d7f7a8ee4 SMDiagnostic: don't emit ranges if there are /any/ multibyte characters.
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
2013-01-11 02:37:55 +00:00
Jordan Rose
f60c0018f0 Add basic fix-its to SMDiagnostic.
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
2013-01-10 18:50:15 +00:00
Jordan Rose
c95190a559 Change SMRange to be half-open (exclusive end) instead of closed (inclusive)
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
2013-01-07 19:00:49 +00:00
Chandler Carruth
a490793037 Use the new script to sort the includes of every file under lib.
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
2012-12-03 16:50:05 +00:00
Daniel Dunbar
2e8b52dffd SourceMgr: Use has_colors() instead of just is_displayed() before trying to use
color.

llvm-svn: 160559
2012-07-20 18:29:44 +00:00
Matt Beaumont-Gay
ee7706f1a3 Don't assume size_t is unsigned long long.
Fixes a -Woverflow warning from gcc when building for 32-bit platforms.

llvm-svn: 156313
2012-05-07 18:12:42 +00:00
Chris Lattner
d4a526b3cc make SourceMgr tolerate empty SMLoc()'s better.
llvm-svn: 156260
2012-05-06 16:20:49 +00:00
Chris Lattner
cf8284517f reapply my patch, with a fix for an off-by-one error. Turned out to be a lot
of work for a drive-by fix :)

llvm-svn: 156246
2012-05-05 22:17:32 +00:00
Chris Lattner
206bf447c0 revert my patches, which are causing problems.
llvm-svn: 156245
2012-05-05 22:11:04 +00:00
Chris Lattner
4c8c651c04 refactor some code to expose column numbers more and make diagnostic printing slightly more efficient.
llvm-svn: 156243
2012-05-05 21:39:51 +00:00
Benjamin Kramer
a6185ae07f SourceMgr: Colorize diagnostics.
Same color scheme as clang uses. The colors are only enabled if the output is a tty.

llvm-svn: 155035
2012-04-18 19:04:15 +00:00
David Blaikie
067ad0b263 Removing unused default switch cases in switches over enums that already 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
2012-01-16 23:24:27 +00:00
Chris Lattner
0ab0d49640 remove the dead 'ShowLine' argument from SMDiagnostic.
llvm-svn: 142108
2011-10-16 05:47:55 +00:00
Chris Lattner
391d90c9a6 Make SMDiagnostic a little more sane. Instead of passing around note/warning/error as a
string, pass it around as an enum.

llvm-svn: 142107
2011-10-16 05:43:57 +00:00
Chris Lattner
321335142c Enhance llvm::SourceMgr to support diagnostic ranges, the same way clang 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
2011-10-16 04:47:35 +00:00
Joerg Sonnenberger
ffa79cb359 Add new -d option to tblgen. It writes a make(1)-style dependency file.
llvm-svn: 132395
2011-06-01 13:10:15 +00:00
Michael J. Spencer
86f6a9ac6e MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm.
llvm-svn: 121958
2010-12-16 03:29:14 +00:00
Michael J. Spencer
95b8bf9f67 Fix whitespace.
llvm-svn: 121382
2010-12-09 17:37:32 +00:00
Michael J. Spencer
15483143ec Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients.
llvm-svn: 121379
2010-12-09 17:36:48 +00:00
Chris Lattner
99b8654169 now that AsmPrinter::EmitInlineAsm is factored right, we can eliminate the
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
2010-11-17 08:13:01 +00:00
Benjamin Kramer
cd6c025b08 Push twines deeper into SourceMgr's error handling methods.
llvm-svn: 114847
2010-09-27 17:42:11 +00:00
Chris Lattner
c83a42075b enhance SMDiagnostic to also maintain a pointer to the SourceMgr.
Add a simplified constructor for clients that don't have locations
like "file not found" errors.

llvm-svn: 100538
2010-04-06 18:06:18 +00:00
Chris Lattner
48d30a3011 give the SourceMgr object a cookie.
llvm-svn: 100504
2010-04-06 00:33:43 +00:00
Chris Lattner
117d05ca0e Give llvm::SourceMgr the ability to have a client-specified
diagnostic handler.

llvm-svn: 100503
2010-04-06 00:26:48 +00:00
Mikhail Glushenkov
5d02574734 Make SMDiagnostic::Print a const method.
llvm-svn: 94672
2010-01-27 10:13:28 +00:00
Mikhail Glushenkov
a5a618a417 Trailing whitespace.
llvm-svn: 94671
2010-01-27 10:13:11 +00:00
Dan Gohman
2d3e1be372 Avoid printing a spurious semicolon when there is no filename.
llvm-svn: 94071
2010-01-21 10:13:27 +00:00
Daniel Dunbar
11a4dce179 SourceMgr: Add ShowLine argument to PrintMessage, to allow suppressing the source line output.
llvm-svn: 89627
2009-11-22 22:08:00 +00:00
Chris Lattner
be69fa08b6 add a trivial line # cache to SourceMgr to make repeated queries to
FindLineNumber much faster when in sequence.

llvm-svn: 78693
2009-08-11 17:49:14 +00:00
Chris Lattner
d49e5380ec switch the .ll parser to use SourceMgr.
llvm-svn: 74735
2009-07-02 23:08:13 +00:00
Chris Lattner
1e3e84eb39 add an explicit class for holding llvm::SourceMgr diagnostics and use
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
          ^

llvm-svn: 74732
2009-07-02 22:24:20 +00:00
Daniel Dunbar
5bec168037 Normalize SourceMgr messages.
- 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): ...

llvm-svn: 74489
2009-06-30 00:49:23 +00:00
Chris Lattner
dd95ab3ca9 rename SourceMgr::PrintError to PrintMessage.
llvm-svn: 73861
2009-06-21 21:22:11 +00:00
Chris Lattner
c865ea76a6 move include searching logic from TGLexer to SourceMgr.
llvm-svn: 73845
2009-06-21 05:06:04 +00:00
Chris Lattner
5b9a2d79c0 Rename TGSourceMgr -> SourceMgr.
llvm-svn: 73844
2009-06-21 03:41:50 +00:00
Chris Lattner
4ff2620742 rename TGLoc -> SMLoc.
llvm-svn: 73843
2009-06-21 03:39:35 +00:00
Chris Lattner
4ed87b8790 move TGSourceMgr class out of TableGen into libsupport.
llvm-svn: 73842
2009-06-21 03:36:54 +00:00