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

80 Commits

Author SHA1 Message Date
Pavel Labath
161831a8b5 Fix build breakage caused by r306096
It seems some targets don't have std::strtof and friends. Hopefully,
dropping the std:: will be fine, as that's what the compiler recommends.

llvm-svn: 306098
2017-06-23 13:13:06 +00:00
Pavel Labath
6ae76b0966 [ADT] Add llvm::to_float
Summary:
The function matches the interface of llvm::to_integer, but as we are
calling out to a C library function, I let it take a Twine argument, so
we can avoid a string copy at least in some cases.

I add a test and replace a couple of existing uses of strtod with this
function.

Reviewers: zturner

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D34518

llvm-svn: 306096
2017-06-23 12:55:02 +00:00
Zachary Turner
b29f3388f1 [StringExtras] overload toHex for ArrayRef<uint8_t>
llvm-svn: 305411
2017-06-14 20:11:46 +00:00
Chandler Carruth
eb66b33867 Sort the remaining #include lines in include/... and lib/....
I did this a long time ago with a janky python script, but now
clang-format has built-in support for this. I fed clang-format every
line with a #include and let it re-sort things according to the precise
LLVM rules for include ordering baked into clang-format these days.

I've reverted a number of files where the results of sorting includes
isn't healthy. Either places where we have legacy code relying on
particular include ordering (where possible, I'll fix these separately)
or where we have particular formatting around #include lines that
I didn't want to disturb in this patch.

This patch is *entirely* mechanical. If you get merge conflicts or
anything, just ignore the changes in this patch and run clang-format
over your #include lines in the files.

Sorry for any noise here, but it is important to keep these things
stable. I was seeing an increasing number of patches with irrelevant
re-ordering of #include lines because clang-format was used. This patch
at least isolates that churn, makes it easy to skip when resolving
conflicts, and gets us to a clean baseline (again).

llvm-svn: 304787
2017-06-06 11:49:48 +00:00
Eugene Zelenko
58646d492d [ADT] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
llvm-svn: 303221
2017-05-16 23:10:25 +00:00
Zachary Turner
ccd91ee2f4 [StringExtras] Add llvm::to_integer.
This is a very thin wrapper around StringRef::getAsInteger.
It serves three purposes.

1) It allows a cleaner syntax when you have something other than
   a StringRef - for example, a std::string or an llvm::SmallString.
   Previously, in this case you would have to write something like:
      StringRef(MyStr).getAsInteger(0, Result)
   by explicitly constructing a temporary StringRef.  This can be
   done implicitly however with the new function by just writing:
      to_integer(MyStr, ...).
2) Correcting the travesty that is getAsInteger's return value.
   This function returns true on success, and false on failure.
   While this may cause confusion with people familiar with the
   getAsInteger API, there seems to be widespread agreement that
   the return semantics of getAsInteger was a mistake.
3) It allows the Radix to be deduced as a default argument by
   putting it last in the parameter list.  Most uses of getAsInteger
   pass 0 for the first argument.  With this syntax it can just be
   omitted.

llvm-svn: 303011
2017-05-14 17:11:05 +00:00
Rui Ueyama
f21b94f83c Revert r301487: Replace HashString algorithm with xxHash64
This reverts commit r301487 to make buildbots green.

llvm-svn: 301491
2017-04-26 23:15:10 +00:00
Rui Ueyama
7cdb7b7867 Replace HashString algorithm with xxHash64
The previous algorithm processed one character at a time, which is very
painful on a modern CPU. Replace it with xxHash64, which both already
exists in the codebase and is fairly fast.

Patch from Scott Smith!

Differential Revision: https://reviews.llvm.org/D32509

llvm-svn: 301487
2017-04-26 22:45:04 +00:00
Zachary Turner
dee43336b2 [StringExtras] Add a fromHex to complement toHex.
We already have a function toHex that will convert a string like
"\xFF\xFF" to the string "FFFF", but we do not have one that goes
the other way - i.e. to convert a textual string representing a
sequence of hexadecimal characters into the corresponding actual
bytes.  This patch adds such a function.

llvm-svn: 301356
2017-04-25 20:21:35 +00:00
Kristof Beyls
cdec0a522a Revert "Make naming in Host.h in line with coding standards."
This reverts r299062, which caused build failures on Windows.
It also reverts the attempts to fix the windows builds in r299064 and r299065.
The introduction of namespace llvm::sys::detail makes MSVC, and seemingly also
mingw, complain about ambiguity with the existing namespace llvm::detail.
E.g.:
C:\b\slave\sanitizer-windows\llvm\include\llvm/Support/MathExtras.h(184): error C2872: 'detail': ambiguous symbol
C:\b\slave\sanitizer-windows\llvm\include\llvm/Support/PointerLikeTypeTraits.h(31): note: could be 'llvm::detail'
C:\b\slave\sanitizer-windows\llvm\include\llvm/Support/Host.h(80): note: or       'llvm::sys::detail'

In r299064 and r299065 I tried to fix these ambiguities, based on the errors
reported in the log files. It seems however that the build stops early when
this kind of error is encountered, and many build-then-fix-iterations on
Windows may be needed to fix this. Therefore reverting r299062 for now to
get the build working again on Windows.

llvm-svn: 299066
2017-03-30 11:06:25 +00:00
Kristof Beyls
749f177bc6 Attempt to fix the Windows builds by using llvm::detail::... instead of detail::...
llvm-svn: 299064
2017-03-30 10:14:40 +00:00
Zachary Turner
928a5380bb [ADT] Add a version of llvm::join() that takes a range.
llvm-svn: 298427
2017-03-21 19:35:05 +00:00
Zachary Turner
a5137ef9a9 Add llvm::join_items to StringExtras.
llvm::join_items is similar to llvm::join, which produces a string
by concatenating a sequence of values together separated by a
given separator.  But it differs in that the arguments to
llvm::join() are same-type members of a container, whereas the
arguments to llvm::join_items are arbitrary types passed into
a variadic template.  The only requirement on parameters to
llvm::join_items (including for the separator themselves) is
that they be implicitly convertible to std::string or have
an overload of std::string::operator+

Differential Revision: https://reviews.llvm.org/D24880

llvm-svn: 282502
2016-09-27 16:37:30 +00:00
Honggyu Kim
4993c81205 [IR] Properly handle escape characters in Attribute::getAsString()
If an attribute name has special characters such as '\01', it is not
properly printed in LLVM assembly language format.  Since the format
expects the special characters are printed as it is, it has to contain
escape characters to make it printable.

Before:
  attributes #0 = { ... "counting-function"="^A__gnu_mcount_nc" ...

After:
  attributes #0 = { ... "counting-function"="\01__gnu_mcount_nc" ...

Reviewers: hfinkel, rengolin, rjmccall, compnerd

Subscribers: nemanjai, mcrosier, hans, shenhan, majnemer, llvm-commits

Differential Revision: https://reviews.llvm.org/D23792

llvm-svn: 280357
2016-09-01 11:44:06 +00:00
Mehdi Amini
f5346020b9 ThinLTO: add module caching handling.
Differential Revision: http://reviews.llvm.org/D18494

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266959
2016-04-21 05:54:23 +00:00
Mehdi Amini
d4b845cb1f Revert "ThinLTO: add module caching handling."
This reverts commit r265214, unintentionally commited.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 265216
2016-04-02 05:08:18 +00:00
Mehdi Amini
0df8de9a1a ThinLTO: add module caching handling.
Reviewers: tejohnson

Subscribers: llvm-commits, joker.eph

Differential Revision: http://reviews.llvm.org/D18494

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 265214
2016-04-02 05:07:08 +00:00
Craig Topper
548b47cf16 Remove utostr_32 as it has no uses anymore.
llvm-svn: 259331
2016-01-31 20:00:26 +00:00
Craig Topper
9c91186b26 Merge utohex_buffer into utohexstr, it's only caller. Also change utohexstr to use the std::string constructor that takes a start and end pointer. This saves a call to strlen. NFC
llvm-svn: 259329
2016-01-31 20:00:22 +00:00
Craig Topper
10624d8809 Use std::end instead of repeating buffer sizes.
llvm-svn: 259312
2016-01-31 01:12:35 +00:00
Alexander Kornienko
f993659b8f Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)
Apparently, the style needs to be agreed upon first.

llvm-svn: 240390
2015-06-23 09:49:53 +00:00
Alexander Kornienko
40cb19d802 Fixed/added namespace ending comments using clang-tidy. NFC
The patch is generated using this command:

tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
  -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
  llvm/lib/


Thanks to Eugene Kosov for the original patch!

llvm-svn: 240137
2015-06-19 15:57:42 +00:00
David Majnemer
722301be0e ADT: Surface LowerCase argument for utohexstr
The underlying function. utohex_buffer, already supports an argument for
deciding if the hex characters should be upper or lower case.  Expose an
identical argument for utohexstr.

llvm-svn: 212991
2014-07-14 21:56:54 +00:00
Matt Arsenault
d6c8f3df9a Fix uint -> size_t conversion warning.
This warning is disabled for the LLVM build,
but external users of the header can still
run into this.

Patch by Ke Bai

llvm-svn: 206629
2014-04-18 18:08:31 +00:00
Alp Toker
06df538b11 Move true/false StringRef helper to StringExtras
StringRef is a low-level data wrapper that shouldn't know about language
strings like 'true' and 'false' whereas StringExtras is just the place for
higher-level utilities.

llvm-svn: 200188
2014-01-27 04:07:36 +00:00
Chandler Carruth
87f14b4eec Re-sort all of the includes with ./utils/sort_includes.py so that
subsequent changes are easier to review. About to fix some layering
issues, and wanted to separate out the necessary churn.

Also comment and sink the include of "Windows.h" in three .inc files to
match the usage in Memory.inc.

llvm-svn: 198685
2014-01-07 11:48:04 +00:00
Joerg Sonnenberger
d6a76ffd81 Add a Python-like join function to merge a list of strings with a
separator between each two elements.

llvm-svn: 189846
2013-09-03 20:43:54 +00:00
Jordan Rose
4de2cdf763 Add llvm::hexDigitValue to convert single characters to hex.
This is duplicated in a couple places in the codebase. Adopt this in APFloat.

llvm-svn: 172851
2013-01-18 21:45:30 +00:00
Chandler Carruth
ca305491f6 Sort the #include lines for the include/... tree with the script.
AKA: Recompile *ALL* the source code!

This one went much better. No manual edits here. I spot-checked for
silliness and grep-checked for really broken edits and everything seemed
good. It all still compiles. Yell if you see something that looks goofy.

llvm-svn: 169133
2012-12-03 17:02:12 +00:00
Jordan Rose
322d2a4afc Add llvm::getOrdinalSuffix to get the appropriate -st, -nd, -rd, -th suffix.
Used by clang to print parameter indexes.

llvm-svn: 164440
2012-09-22 01:24:21 +00:00
Dmitri Gribenko
aee81e7cae Fix Doxygen issues:
* wrap code blocks in \code ... \endcode;
* refer to parameter names in paragraphs correctly (\arg is not what most
  people want -- it starts a new paragraph).

llvm-svn: 163790
2012-09-13 12:34:29 +00:00
Will Dietz
8dd05d2536 Fix HashString's Bernstein hash to use unsigned chars, as is usually done.
Changes the hash result for strings containing characters
with values >= 128, such as UTF8 strings (not normal ASCII).

Changed mostly so we match other implementations.

llvm-svn: 162882
2012-08-30 00:30:21 +00:00
Benjamin Kramer
01e4003c0f Move ftostr into its last user (cppbackend) and simplify it a bit.
New code should use raw_ostream.

llvm-svn: 153326
2012-03-23 11:26:29 +00:00
Benjamin Kramer
c597902ecc Replace (Lower|Upper)caseString in favor of StringRef's newest methods.
llvm-svn: 143891
2011-11-06 20:37:06 +00:00
David Greene
5927323d9c Add a std::string Wrapper for TableGen
Create a std::string wrapper for use as a DenseMap key.  DenseMap is
not safe in generate with strings, so this wrapper indicates that only
strings guaranteed not to have certain values should be used in the
DenseMap.

llvm-svn: 136481
2011-07-29 19:06:58 +00:00
Jay Foad
c146569beb Remove unused STL header includes.
llvm-svn: 130068
2011-04-23 19:53:52 +00:00
Chris Lattner
0304b82f80 Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129558
2011-04-15 05:18:47 +00:00
Michael J. Spencer
d5ec932c3a Merge System into Support.
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Daniel Dunbar
05a18ee325 Add an optional LowerCase argument to hexdigit().
llvm-svn: 120213
2010-11-27 13:19:46 +00:00
Benjamin Kramer
adc8df5270 utostr isn't going away too soon, try to make it slightly smaller.
llvm-svn: 100977
2010-04-11 19:00:03 +00:00
Benjamin Kramer
400ab557d3 Remove unused string functions.
llvm-svn: 93183
2010-01-11 20:33:12 +00:00
Benjamin Kramer
45e333ea95 Add StrInStrNoCase, a StringRef version of CStrInCStrNoCase.
llvm-svn: 93174
2010-01-11 19:45:18 +00:00
Benjamin Kramer
7ec2a31f14 Turns out llvm-gcc still uses SplitString with a vector. Add it back until I
have a fix.

llvm-svn: 93163
2010-01-11 18:44:35 +00:00
Benjamin Kramer
cdbc36f961 Reimplement getToken and SplitString as "StringRef helper functions"
- getToken is modeled after StringRef::split but it can split on multiple
  separator chars and skips leading seperators.
- SplitString is a StringRef::split variant for more than 2 elements with the
  same behaviour as getToken.

llvm-svn: 93161
2010-01-11 18:03:24 +00:00
Chandler Carruth
766362c707 Move DataTypes.h to include/llvm/System, update all users. This breaks the last
direct inclusion edge from System to Support.

llvm-svn: 85086
2009-10-26 01:35:46 +00:00
Daniel Dunbar
b67b5bb0b1 Move UnescapeString to a static function for its sole client; its inefficient and broken.
llvm-svn: 84358
2009-10-17 20:43:42 +00:00
Daniel Dunbar
d537c7d394 Remove llvm::EscapeString, raw_ostream::write_escaped is much faster.
llvm-svn: 84357
2009-10-17 20:43:29 +00:00
Daniel Dunbar
0107265e33 Move StringMap's string has function into StringExtras.h
llvm-svn: 84344
2009-10-17 18:21:06 +00:00
Daniel Dunbar
3db25114f0 Remove itohexstr, which only had one user.
llvm-svn: 77613
2009-07-30 18:18:54 +00:00
Ted Kremenek
17e17c7b44 Add version of StringsEqualNoCase that takes two null-terminated C-strings and compares up to 'len' characters. I tend to screw up string comparison functions, so anyone who is interested please review this\!
llvm-svn: 65236
2009-02-21 18:25:30 +00:00