[llvm] r266749 - IR: Use Optional instead of unique_ptr for debug info ODR type map, NFC

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 09:06:50 PDT 2016


Author: dexonsmith
Date: Tue Apr 19 11:06:50 2016
New Revision: 266749

URL: http://llvm.org/viewvc/llvm-project?rev=266749&view=rev
Log:
IR: Use Optional instead of unique_ptr for debug info ODR type map, NFC

Save a level of malloc indirection.

Modified:
    llvm/trunk/lib/IR/LLVMContext.cpp
    llvm/trunk/lib/IR/LLVMContextImpl.h

Modified: llvm/trunk/lib/IR/LLVMContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContext.cpp?rev=266749&r1=266748&r2=266749&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContext.cpp (original)
+++ llvm/trunk/lib/IR/LLVMContext.cpp Tue Apr 19 11:06:50 2016
@@ -317,8 +317,7 @@ void LLVMContext::enableDebugTypeODRUniq
   if (pImpl->DITypeMap)
     return;
 
-  pImpl->DITypeMap =
-      llvm::make_unique<DenseMap<const MDString *, DICompositeType *>>();
+  pImpl->DITypeMap.emplace();
 }
 
 void LLVMContext::disableDebugTypeODRUniquing() { pImpl->DITypeMap.reset(); }

Modified: llvm/trunk/lib/IR/LLVMContextImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContextImpl.h?rev=266749&r1=266748&r2=266749&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContextImpl.h (original)
+++ llvm/trunk/lib/IR/LLVMContextImpl.h Tue Apr 19 11:06:50 2016
@@ -1022,7 +1022,7 @@ public:
 #include "llvm/IR/Metadata.def"
 
   // Optional map for looking up composite types by identifier.
-  std::unique_ptr<DenseMap<const MDString *, DICompositeType *>> DITypeMap;
+  Optional<DenseMap<const MDString *, DICompositeType *>> DITypeMap;
 
   // MDNodes may be uniqued or not uniqued.  When they're not uniqued, they
   // aren't in the MDNodeSet, but they're still shared between objects, so no




More information about the llvm-commits mailing list