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

110 Commits

Author SHA1 Message Date
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
c9ea10a63b Resubmit "Improve StringMap iterator support."
The issue was trying to advance past the end of the iterator
when computing the end() iterator.

llvm-svn: 298461
2017-03-21 23:45:03 +00:00
Zachary Turner
5a93187aed Revert "Improve StringMap iterator support."
This is causing crashes in clang, so reverting until the problem
is figured out.

llvm-svn: 298440
2017-03-21 21:23:57 +00:00
Zachary Turner
7f3c5a6c6d Fix clang errors caused by StringMap iterator changes.
llvm-svn: 298437
2017-03-21 20:41:51 +00:00
Zachary Turner
86fa3b92a2 Improve StringMap iterator support.
StringMap's iterators did not support LLVM's
iterator_facade_base, which made it unusable in various
STL algorithms or with some of our range adapters.
This patch makes both StringMapConstIterator as well as
StringMapIterator support iterator_facade_base.

With this in place, it is easy to make an iterator adapter
that iterates over only keys, and whose value_type is
StringRef.  So I add StringMapKeyIterator as well, and
provide the method StringMap::keys() that returns a
range that can be iterated.

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

llvm-svn: 298436
2017-03-21 20:27:36 +00:00
Eugene Zelenko
becb428e09 [ADT] Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes.
Differential revision: https://reviews.llvm.org/D27001

llvm-svn: 287725
2016-11-23 00:30:24 +00:00
Benjamin Kramer
7999e6045a Retire llvm::alignOf in favor of C++11 alignof.
No functionality change intended.

llvm-svn: 284733
2016-10-20 15:02:18 +00:00
Benjamin Kramer
750272d02a Rename StringMap::emplace_second to try_emplace.
Coincidentally this function maps to the C++17 try_emplace. Rename it
for consistentcy with C++17 std::map. NFC.

llvm-svn: 276276
2016-07-21 13:37:48 +00:00
Mehdi Amini
70b295014e Remove some unneeded headers and replace some headers with forward class declarations (NFC)
Differential Revision: http://reviews.llvm.org/D19154

Patch by Eugene Kosov <claprix@yandex.ru>

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266524
2016-04-16 07:51:28 +00:00
Benjamin Kramer
aebef745f3 [ADT] Make StringMap's tombstone aligned.
This avoids undefined behavior when casting pointers to it. Also make
sure that we don't cast to a derived StringMapEntry before checking for
tombstone, as that may have different alignment requirements.

llvm-svn: 265145
2016-04-01 15:51:51 +00:00
Hal Finkel
66a0968e06 Add a copy constructor to StringMap
There is code under review that requires StringMap to have a copy constructor,
and this makes StringMap more consistent with our other containers (like
DenseMap) that have copy constructors.

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

llvm-svn: 264906
2016-03-30 19:54:56 +00:00
Mehdi Amini
b571577686 Fix perfect forwarding for StringMap
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 264391
2016-03-25 07:11:31 +00:00
Mehdi Amini
7f6c7f0a20 Query the StringMap only once when creating MDString (NFC)
Summary:
Loading IR with debug info improves MDString::get() from 19ms to 10ms.
This is a rework of D16597 with adding an "emplace" method on the StringMap
to avoid requiring the MDString move ctor to be public.

Reviewers: dexonsmith

Subscribers: llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 264386
2016-03-25 05:58:04 +00:00
Mehdi Amini
aad049fea9 Adjust initial size in StringMap constructor to guarantee no grow()
Summary:
StringMap ctor accepts an initialize size, but expect it to be
rounded to the next power of 2. The ctor can handle that directly
instead of expecting clients to round it. Also, since the map will
resize itself when 75% full, take this into account an initialize
a larger initial size to avoid any growth.

Reviewers: dblaikie

Subscribers: llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 264385
2016-03-25 05:57:57 +00:00
Mehdi Amini
cc356f2508 StringMap: reserve appropriate size when initializing from an initializer list
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 264383
2016-03-25 05:57:47 +00:00
David Blaikie
0483eddbd1 [llvm-dwp] Initial partial prototype
This just concatenates the common DWP sections without doing any of the
fancy DWP things like:

1) update str_offsets
2) deduplicating strings
3) merging/creating cu/tu_index

Patches for these will follow shortly.

(also not sure about target triple/object file type for this tool - do I
really need a whole triple just to write an object file that contains
purely static/hardcoded bytes in each section? & I guess I should just
pick it based on the first input, maybe, rather than hardcoding for now
- but we only produce .dwo on ELF platforms with objcopy for now anyway)

llvm-svn: 254355
2015-12-01 00:48:39 +00:00
NAKAMURA Takumi
1b224b5ec5 Reformat headers in ADT and Support partially.
Note, I didn't reformat entirely, but partially where I touched in previous commits.

llvm-svn: 244432
2015-08-10 04:22:36 +00:00
NAKAMURA Takumi
c1197d9021 Whitespace.
llvm-svn: 244431
2015-08-10 04:22:09 +00:00
NAKAMURA Takumi
b93b06ef3e Reformat linebreaks.
llvm-svn: 244430
2015-08-10 04:21:43 +00:00
Chandler Carruth
00fe915b47 [UB] Fix another place where we would pass a null pointer to memcpy.
This too was found by UBSan. Down to 35 failures for me.

llvm-svn: 243932
2015-08-04 00:53:01 +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
Aaron Ballman
0b45511a2e Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for requiring the macro. NFC; LLVM edition.
llvm-svn: 229340
2015-02-15 22:54:22 +00:00
Duncan P. N. Exon Smith
7e245a07bf ADT: Remove GetStringMapEntryFromValue()
It relies on undefined behaviour, since `StringMapEntry<>` is not
a standard layout type.  There are no users anyway.

llvm-svn: 223439
2014-12-05 01:41:36 +00:00
Alexey Samsonov
9a74f7acf6 Revert "Fix UBSan report in StringMap implementation."
This reverts commit r223402. Some bots fail with -Winvalid-offsetof
warning.

llvm-svn: 223407
2014-12-04 23:00:50 +00:00
Alexey Samsonov
117e0306b1 Fix UBSan report in StringMap implementation.
Use offsetof() instead of a member access within null pointer.

llvm-svn: 223402
2014-12-04 22:45:31 +00:00
David Blaikie
7499cbae4c Remove StringMap::GetOrCreateValue in favor of StringMap::insert
Having two ways to do this doesn't seem terribly helpful and
consistently using the insert version (which we already has) seems like
it'll make the code easier to understand to anyone working with standard
data structures. (I also updated many references to the Entry's
key and value to use first() and second instead of getKey{Data,Length,}
and get/setValue - for similar consistency)

Also removes the GetOrCreateValue functions so there's less surface area
to StringMap to fix/improve/change/accommodate move semantics, etc.

llvm-svn: 222319
2014-11-19 05:49:42 +00:00
David Blaikie
5d50f1a98a StringMap: Test and finish off supporting perfectly forwarded values in StringMap operations.
Followup to r221946.

llvm-svn: 221958
2014-11-14 00:41:46 +00:00
Duncan P. N. Exon Smith
4858dd34c9 ADT: Use perfect forwarding in StringMapEntry::Create()
Now you can pass references into constructors.

llvm-svn: 221946
2014-11-13 23:23:02 +00:00
David Blaikie
a2e836b256 Recommit 211309 (StringMap::insert), reverted in 211328 due to issues with private, but non-deleted, move members.
Certain versions of GCC (~4.7) couldn't handle the SFINAE on access
control, but with "= delete" (hidden behind a macro for portability)
this issue is worked around/addressed.

Patch by Agustín Bergé

llvm-svn: 211525
2014-06-23 18:28:53 +00:00
Rafael Espindola
b39185a826 Revert "Add StringMap::insert(pair) consistent with the standard associative container concept."
This reverts commit r211309.

It looks like it broke some bots:

http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/15563/steps/compile/logs/stdio

llvm-svn: 211328
2014-06-20 00:23:03 +00:00
David Blaikie
f14625fbd8 Add StringMap::insert(pair) consistent with the standard associative container concept.
Patch by Agustín Bergé.

llvm-svn: 211309
2014-06-19 20:08:56 +00:00
Craig Topper
f86daf85d1 Convert StringMapEntry::Create to use StringRef instead of start/end pointers. Simpliies all in tree call sites. No functional change.
llvm-svn: 210638
2014-06-11 05:35:56 +00:00
David Blaikie
336fe9979c Missed formatting
llvm-svn: 208362
2014-05-08 21:53:33 +00:00
David Blaikie
428752c172 StringMap: Move assignment and move construction.
llvm-svn: 208361
2014-05-08 21:52:29 +00:00
David Blaikie
42c5e629bc StringMap: Replace faux-copyability with faux-movability, which is sufficient.
This behavior was added to support StringMaps of StringMaps, default +
move construction are sufficient for this.

Real move construction support coming soon (& probably copy construction
too).

llvm-svn: 208360
2014-05-08 21:52:26 +00:00
David Blaikie
02c16a31fb StringMap support for move-only values.
llvm-svn: 208359
2014-05-08 21:52:23 +00:00
Benjamin Kramer
9f60ddfce4 Allocator: Remove ReferenceAdder hack.
This was a workaround for compilers that had issues with reference
collapsing.

llvm-svn: 206612
2014-04-18 14:54:51 +00:00
Chandler Carruth
619c0ee539 [Allocator] Pass the size to the deallocation function. This, on some
allocation libraries, may allow more efficient allocation and
deallocation. It at least makes the interface implementable by the JIT
memory manager.

However, this highlights problematic overloading between the void* and
the T* deallocation functions. I'm looking into a better way to do this,
but as it happens, it comes up rarely in the codebase.

llvm-svn: 206265
2014-04-15 08:59:52 +00:00
Craig Topper
ee78063a54 [C++11] Make use of 'nullptr' in the Support library.
llvm-svn: 205697
2014-04-07 04:17:22 +00:00
Pete Cooper
ecaf9d531b When destroying a StringMap, just iterate over the map and destroy the contained elements. Don't reset them back to 0 as their values aren't needed any more. This results in ~StringMap() being mostly empty for POD types in BumpPtrAllocators
llvm-svn: 204204
2014-03-19 00:23:30 +00:00
Eli Bendersky
8867d787ef Remove outdated & incorrect part of comment.
This comment was copied over from another class in r34170, where it made sense.

llvm-svn: 200697
2014-02-03 14:33:51 +00:00
David Blaikie
05d9569f03 Remove StringMapEntryInitializer support.
It was never specialized so let's just remove that unused
configurability and always do the default.

llvm-svn: 198374
2014-01-02 23:28:39 +00:00
Yaron Keren
22d81b823e The count() function for STL datatypes returns unsigned, even
where it's only bool-like 1/0 result like std::set.count(). 

Some of the LLVM ADT already return unsigned count(), while
others return bool count().

This patch modifies SmallPtrSet, SmallSet, SparseSet count()
to return unsigned instead of bool:

 1 instead of true
 0 instead of false

More ADT to follow. 

llvm-svn: 197879
2013-12-22 12:04:23 +00:00
Chris Lattner
65e3f520d4 Disable the StringMapEntry copy constructor, to make sure we
reject things like: "for (auto Entry : SomeStringMap)".  Previously
this would copy the value but not the tail allocated string data
(the key).

llvm-svn: 182713
2013-05-25 22:28:22 +00:00
Reid Kleckner
bd18c96e9c Remove unneeded call to a base default ctor
llvm-svn: 182503
2013-05-22 19:07:26 +00:00
Reid Kleckner
206b977507 Fix StringMapIterator compile errors for non-MSVC compilers.
llvm-svn: 182493
2013-05-22 17:32:15 +00:00
Reid Kleckner
d552e7cd95 [Support] Add StringMap::swap() and a default ctor for iterators
This makes StringMap<> more compatible with std::map<std::string, ...>.

Differential Revision: http://llvm-reviews.chandlerc.com/D842

llvm-svn: 182487
2013-05-22 17:10:11 +00:00
Pedro Artigas
c2a923e628 Clear the whole table including the tombstones, since the tombstone count will
be set to zero that is what it was intended. Should improve performance of 
the data structure when clear is invoked frequently (both compile time and
memory usage).

llvm-svn: 175799
2013-02-21 21:32:00 +00:00
Argyrios Kyrtzidis
a1949388a1 [ADT/StringMap] Follow-up to r172455, use the correct constructor for setting the InitialSize,
previously it was calling the "StringMapImpl(unsigned itemSize)" constructor.

llvm-svn: 172500
2013-01-15 01:58:45 +00:00