[llvm-commits] [llvm] r46833 - in /llvm/trunk: include/llvm/ADT/FoldingSet.h lib/Support/FoldingSet.cpp

Chris Lattner clattner at apple.com
Fri Feb 8 18:33:25 PST 2008


On Feb 8, 2008, at 6:07 PM, Ted Kremenek wrote:

> I'm wondering if we need to keep on adding specialized "Add" methods
> to FoldingSet.
>
> For example, APInt already has a "Profile" method for adding its
> profile to a FoldingSetNodeID, and APFloat could easily have a Profile
> method added to it.  Now that FoldingSet uses FoldingSetTrait<> to
> profile its contained elements, perhaps we can just include a single
> "Add" member template to FoldingSetNodeID that uses the
> FoldingSetTrait<> to profile a generic item.  When people want to
> include profiling support for a datatype, they need only specialize
> FoldingSetTrait<> (if the datatype doesn't already have a Profile
> method).  This avoids bloat in the API for FoldingSetNodeID.  If
> anyone else thinks this is a good idea, I'll go ahead and make the
> change.

That sounds great to me.  I'd rather have various classes know about  
foldingset than having foldingset know about all classes,

-Chris



More information about the llvm-commits mailing list