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
Chris Lattner
ab2419e712
give StringMap a new ctor which allows you to initialize it
...
with an existing allocator. The interesting use case of this
is that it allows "StringMap<whatever, BumpPtrAllocator&>" for
when you want to allocate out of a preexisting bump pointer
allocator owned by someone else.
llvm-svn: 109213
2010-07-23 03:29:59 +00:00
Chris Lattner
93b617fac4
Add a method to get a StringMapEntry from a pointer to the string
...
data it contains (similar to GetStringMapEntryFromValue).
Patch by Greg Clayton!
llvm-svn: 99371
2010-03-24 00:53:27 +00:00
Daniel Dunbar
4daaf9d3f4
Pass StringRef by value.
...
llvm-svn: 86251
2009-11-06 10:58:06 +00:00
Daniel Dunbar
b5adc13728
Convert StringMap to using StringRef for its APIs.
...
- Yay for '-'s and simplifications!
- I kept StringMap::GetOrCreateValue for compatibility purposes, this can
eventually go away. Likewise the StringMapEntry Create functions still follow
the old style.
- NIFC.
llvm-svn: 76888
2009-07-23 18:17:34 +00:00
Jay Foad
16d48d2595
Use v.data() instead of &v[0] when SmallVector v might be empty.
...
llvm-svn: 72210
2009-05-21 09:52:38 +00:00
Daniel Dunbar
a3c65dba44
Add StringMap::lookup.
...
llvm-svn: 66750
2009-03-12 01:16:06 +00:00
Chris Lattner
49498bdff4
fix a pretty serious bug in StringMap where GetOrCreate(strstart,strend, z)
...
would not set new values to Z.
llvm-svn: 63707
2009-02-04 01:54:10 +00:00
Bill Wendling
71f808dfa2
* Don't explicitly cast "0" to "void*". This doesn't work well with specialized
...
StringMapEntryInitializer classes. Leave it for the compiler to figure out what
the type is and what "0" should be transformed into.
* Un-disable the unit tests which test the StringMapEntryInitializer class.
llvm-svn: 61922
2009-01-08 08:26:46 +00:00
Misha Brukman
4044287626
* Added unittests for StringMap
...
* Fixed but in StringMap::clear()
* Removed trailing whitespace
Original patch by Talin.
llvm-svn: 61914
2009-01-08 04:48:20 +00:00
Ted Kremenek
d0f8118dc1
Add typedef to StringMapEntry.
...
llvm-svn: 60134
2008-11-27 00:17:25 +00:00
Chris Lattner
441571cc05
optimize StringMap::clear
...
llvm-svn: 53009
2008-07-02 05:30:45 +00:00
Chris Lattner
06545d1c4a
Add a new (simple) StringMap::clear method, patch by Pratik
...
Solanki!
llvm-svn: 53008
2008-07-02 05:26:32 +00:00
Bill Wendling
36ebc296c1
Remove warnings about shadowed and unused variables.
...
llvm-svn: 52791
2008-06-26 18:11:45 +00:00
Dan Gohman
d1ec941698
Pass std::string by reference. Thanks Chris!
...
llvm-svn: 52678
2008-06-24 16:40:22 +00:00
Dan Gohman
54b67be86a
Add methods to StringMap to erase entries by key.
...
llvm-svn: 52640
2008-06-23 21:07:03 +00:00
Evan Cheng
d9353009b7
Fix more -Wshorten-64-to-32 warnings.
...
llvm-svn: 50659
2008-05-05 18:30:58 +00:00
Anton Korobeynikov
b1576212e7
Don't dereference an invalid pointer if string is empty.
...
llvm-svn: 46781
2008-02-05 23:34:40 +00:00
Anton Korobeynikov
1cc154d068
Add convenient std::string helpers to StringMap. Patch by Mikhail Glushenkov!
...
llvm-svn: 46625
2008-01-31 23:02:33 +00:00
Anton Korobeynikov
91b7d99e8a
Reapply the patch with fix.
...
llvm-svn: 46615
2008-01-31 17:43:25 +00:00
Chris Lattner
87c2925656
revert anton's recent stringmap patch, which breaks clang.
...
llvm-svn: 46614
2008-01-31 17:24:51 +00:00
Anton Korobeynikov
55998b56a0
Make StringMap to be more STL'ish. Patch by Mikhail Glushenkov!
...
llvm-svn: 46612
2008-01-31 12:30:40 +00:00
Anton Korobeynikov
45e5afd820
Whitespace cleanup
...
llvm-svn: 46611
2008-01-31 12:10:41 +00:00
Chris Lattner
e0b1ee937a
Don't attribute in file headers anymore. See llvmdev for the
...
discussion of this change. Boy are my fingers tired. ;-)
llvm-svn: 45411
2007-12-29 19:59:42 +00:00
Dan Gohman
80af3e255d
Add explicit keywords, and fix a minor typo that they uncovered.
...
llvm-svn: 45034
2007-12-14 15:41:34 +00:00
Chris Lattner
2190758012
Pass the whole StringMapEntry into StringMapEntryInitializer::Initialize.
...
llvm-svn: 44432
2007-11-29 06:14:41 +00:00
Chris Lattner
5d29c4130c
provide an optional API to allow datatypes in a stringmap to be *gasp*
...
initialized with a value if they want, by specializing the
StringMapEntryInitializer class.
llvm-svn: 44430
2007-11-29 06:04:41 +00:00
Dan Gohman
760d574313
Add explicit keywords.
...
llvm-svn: 44234
2007-11-19 15:30:20 +00:00
Ted Kremenek
24219dc48a
Minor cosmetic cleanups in the calculation of alignments for
...
StringMapEntry objects. No functionality change.
llvm-svn: 43097
2007-10-17 22:09:45 +00:00
Ted Kremenek
307fa3bed5
Updated StringMap to use llvm::AlignOf to compute the alignment of map
...
entries.
llvm-svn: 43089
2007-10-17 21:13:50 +00:00
Chris Lattner
18867ab274
don't use intptr_t without including it.
...
llvm-svn: 42921
2007-10-12 18:16:23 +00:00
Chris Lattner
e80faf3036
Make this compute the correct offset, handling alignment of the element
...
pointer correctly.
llvm-svn: 42918
2007-10-12 17:49:52 +00:00
Chris Lattner
c013b7f395
Add a helper useful when mapping from a map element to its hash node.
...
llvm-svn: 42480
2007-09-30 08:31:46 +00:00
Chris Lattner
06bdb78751
Disable the string map copy ctor and assignment operators,
...
they don't do the right thing.
Implement StringMap::erase.
Fix a nasty bug in the default ctor.
llvm-svn: 40395
2007-07-22 20:08:01 +00:00
Chris Lattner
8a4ca643dd
use calloc instead of new/memset, it is more efficient
...
llvm-svn: 35644
2007-04-04 00:44:31 +00:00
Chris Lattner
dbf6a79a71
Extend StringMap to support being initialized as completely empty. When
...
initialized this way, they do not do a malloc to allocate their buckets.
llvm-svn: 35642
2007-04-04 00:29:37 +00:00