X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FADT%2FValueMap.h;h=f7560681097812cc2d1da1fe99cf84039785f01a;hp=98e437732584f1ffac2b5e1dfd55d06ed8dd3721;hb=bcc23933695e1cec4e7dcd2e2b8bde0ef3c298c9;hpb=6ccfc507dc1f7ad8c8964193a2407264ca644f0d diff --git a/include/llvm/ADT/ValueMap.h b/include/llvm/ADT/ValueMap.h index 98e43773258..f7560681097 100644 --- a/include/llvm/ADT/ValueMap.h +++ b/include/llvm/ADT/ValueMap.h @@ -87,7 +87,12 @@ public: typedef ValueT mapped_type; typedef std::pair value_type; - ValueMap(const ValueMap& Other) : Map(Other.Map), Data(Other.Data) {} + ValueMap(const ValueMap& Other) : Map(Other.Map), Data(Other.Data) { + // Each ValueMapCVH key contains a pointer to the containing ValueMap. + // The keys in the new map need to point to the new map, not Other. + for (typename MapT::iterator I = Map.begin(), E = Map.end(); I != E; ++I) + I->first.Map = this; + } explicit ValueMap(unsigned NumInitBuckets = 64) : Map(NumInitBuckets), Data() {}