OSDN Git Service

IR: Use Optional instead of unique_ptr for Metadata map in ValueMap, NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 19 Apr 2016 16:17:48 +0000 (16:17 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 19 Apr 2016 16:17:48 +0000 (16:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266751 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/ValueMap.h

index 23781db..043e813 100644 (file)
@@ -85,7 +85,7 @@ class ValueMap {
   typedef DenseMap<const Metadata *, TrackingMDRef> MDMapT;
   typedef typename Config::ExtraData ExtraData;
   MapT Map;
-  std::unique_ptr<MDMapT> MDMap;
+  Optional<MDMapT> MDMap;
   ExtraData Data;
 
   bool MayMapMetadata = true;
@@ -106,7 +106,7 @@ public:
   bool hasMD() const { return bool(MDMap); }
   MDMapT &MD() {
     if (!MDMap)
-      MDMap.reset(new MDMapT);
+      MDMap.emplace();
     return *MDMap;
   }