This is an archive of the discontinued LLVM Phabricator instance.

Refactor StringMap.h, splitting StringMapEntry out to its own header.
ClosedPublic

Authored by lattner on Apr 11 2020, 10:33 PM.

Details

Summary

StringMapEntry.h can have lower dependencies, than StringMap.h, which
is useful for public headers that want to expose inline methods on
StringMapEntry<> but don't need to expose all of StringMap.h. One
example of this is mlir's Identifier.h, another example is the existing
LLVM StringPool.h.

StringPool also could use a cleanup, I'll deal with that in a follow-on
patch.

Diff Detail

Event Timeline

lattner created this revision.Apr 11 2020, 10:33 PM
rriddle accepted this revision.Apr 11 2020, 10:59 PM

This justification for this split seems along the same lines as the split of DenseMap/DenseMapInfo, so LGTM.

llvm/include/llvm/ADT/StringMapEntry.h
50

nit: E -> entry here and InitVals -> initVals above.

This revision is now accepted and ready to land.Apr 11 2020, 10:59 PM
ekatz added a subscriber: ekatz.Apr 12 2020, 12:48 AM

The variables naming convention is inconsistent.
LLVM is using CamelCase while MLIR is using camelBack.
I know there have been some discussions regarding changing LLVM to use camelBack for variables as well, but I am not sure if there was any conclusion...

lattner updated this revision to Diff 256859.Apr 12 2020, 8:23 AM

fix casing in a couple places I missed

lattner marked an inline comment as done.Apr 12 2020, 8:24 AM

Good catch, thanks River.

Ehud, we have generally agreed we should move this direction, the question is how best to stage in the changes without breaking history pervasively. This is a new file, so that issue doesn't apply.

This revision was automatically updated to reflect the committed changes.