I considered using a map off to the side keyed on replacements but it seemed
like such monstrous overhead when the obvious thing to do was to deduplicate
the objects in place. As @klimek is fond of reminding me, in MLOC code bases,
the collection of replacements can be huge. Duplicating it just to serve as the
keys of a context map seemed too much. As long as there was a simple interface
for the type it wouldn't be a big deal to templatize deduplicate(). As noted,
using T==Replacement requires no extra work by the user.
As an example of extra data, the serialized Replacement file format currently
allows for an optional 'Context' field which a producer can use to store
anything to describe the context from which the replacements were created. The
migrator uses this this field to record the main source file so it can appear
in conflict reports. We'd like to associate the context info with every
Replacement so currently I create a structure that looks like:
struct ReplacementWithContext {
Replacement R;
std::string Context;
}
It's a vector of these that I want deduplicate to sort so the Context remains
associated with the Replacement.
http://llvm-reviews.chandlerc.com/D1415
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits