[PATCH] [yaml2obj] Initial ELF section support.
Sean Silva
silvas at purdue.edu
Wed Jun 12 17:27:24 PDT 2013
================
Comment at: tools/yaml2obj/yaml2elf.cpp:47-50
@@ +46,6 @@
+ unsigned addString(StringRef S) {
+ StringMapEntry<unsigned> &Entry = StringIndices.GetOrCreateValue(S);
+ unsigned &I = Entry.getValue();
+ if (I != 0)
+ return I;
+ I = Buf.size();
----------------
GetOrCreateValue() default initializes the object that `I` refers to here if `S` is not present in the map. IIRC this means it will be zero'd on creation, but I'd like a second opinion.
If `I` is just a garbage value, then I will need to change the strategy used to determine if `S` was already present in the map (e.g. using 2 lookups like in yaml2coff.cpp).
http://llvm-reviews.chandlerc.com/D969
More information about the llvm-commits
mailing list