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

93 Commits

Author SHA1 Message Date
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
Argyrios Kyrtzidis
4c74fb34b5 [ADT/StringMap] Add a constructor in StringMap that accepts both an
initial size and an allocator.

llvm-svn: 172455
2013-01-14 19:41:09 +00:00
Eli Bendersky
2f9c935bb0 Cleanup comment and formatting
llvm-svn: 170398
2012-12-18 00:53:36 +00:00
Benjamin Kramer
b9eb9d651b Make StringMap's copy ctor non-explicit.
Without this gcc doesn't allow us to put a StringMap into a
std::map. Works with clang though.

llvm-svn: 154737
2012-04-14 09:04:57 +00:00
Chris Lattner
cfea666af2 Various public StringMap methods take or return "MapEntryTy", make it public.
llvm-svn: 148732
2012-01-23 21:42:52 +00:00
Benjamin Kramer
15f1af87d2 StringMap.find never points to an empty bucket or tombstone, skip the check.
llvm-svn: 147546
2012-01-04 20:45:14 +00:00
Benjamin Kramer
77f9c9f719 Switch StringMap from an array of structures to a structure of arrays.
- -25% memory usage of the main table on x86_64 (was wasted in struct padding).
- no significant performance change.

llvm-svn: 147294
2011-12-27 20:35:07 +00:00
Chris Lattner
5bf752bcf4 The key of a StringMap can contain nul's in it, so having first() return
const char* doesn't make sense.  Have it return StringRef instead.

llvm-svn: 135167
2011-07-14 18:31:43 +00:00
Jay Foad
6015684974 Remove deprecated forms of StringMap::GetOrCreateValue().
llvm-svn: 133517
2011-06-21 15:37:05 +00:00
Chris Lattner
a9ee8489df use the MapEntryTy typedef instead of writing it out long form,
add some fixme's about methods that should be removed.

Merged from type-system-rewrite.

llvm-svn: 133504
2011-06-21 06:22:33 +00:00
Jay Foad
c146569beb Remove unused STL header includes.
llvm-svn: 130068
2011-04-23 19:53:52 +00:00
Jakob Stoklund Olesen
37134e568d Reset StringMap's NumTombstones on clears and rehashes.
StringMap was not properly updating NumTombstones after a clear or rehash.

This was not fatal until now because the table was growing faster than
NumTombstones could, but with the previous change of preventing infinite
growth of the table the invariant (NumItems + NumTombstones <= NumBuckets)
stopped being observed, causing infinite loops in certain situations.

Patch by José Fonseca!

llvm-svn: 128567
2011-03-30 18:32:51 +00:00
Jakob Stoklund Olesen
0daa5f56cb Prevent infinite growth of SmallMap instances.
Rehash but don't grow when full of tombstones.

Patch by José Fonseca!

llvm-svn: 128565
2011-03-30 18:32:44 +00:00
Chris Lattner
85f8315219 Enhance ScopedHashTable to allow it to take an allocator argument.
llvm-svn: 122721
2011-01-03 01:29:37 +00:00
Frits van Bommel
da0d866809 Test commit: Fix two -Asserts mode warnings in StringMap.h.
llvm-svn: 119907
2010-11-20 18:37:24 +00:00
Chris Lattner
ee8dea6453 Rename alignof -> alignOf to avoid irritating C++'0x compilers,
PR8423, patch by nobled.

llvm-svn: 117774
2010-10-30 05:14:01 +00:00
Mikhail Glushenkov
637b2871f8 Trailing whitespace.
llvm-svn: 114432
2010-09-21 14:59:34 +00:00
Chris Lattner
6c6f196725 fix this to work with allocators that have reference type with compilers
that diagnose invalid references to references.

llvm-svn: 113078
2010-09-04 18:45:02 +00:00