[clang-tools-extra] r338796 - [clang-doc] Fix unique_ptr error on bots

Julie Hockett via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 2 17:40:11 PDT 2018


Author: juliehockett
Date: Thu Aug  2 17:40:11 2018
New Revision: 338796

URL: http://llvm.org/viewvc/llvm-project?rev=338796&view=rev
Log:
[clang-doc] Fix unique_ptr error on bots

Explicitly return the base unique_ptr type, as some of the older
compilers on the bots don't support full C++11.

Differential Revision: https://reviews.llvm.org/D50208

Modified:
    clang-tools-extra/trunk/clang-doc/Serialize.cpp

Modified: clang-tools-extra/trunk/clang-doc/Serialize.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/Serialize.cpp?rev=338796&r1=338795&r2=338796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-doc/Serialize.cpp (original)
+++ clang-tools-extra/trunk/clang-doc/Serialize.cpp Thu Aug  2 17:40:11 2018
@@ -329,7 +329,7 @@ std::unique_ptr<Info> emitInfo(const Nam
     return nullptr;
   auto I = llvm::make_unique<NamespaceInfo>();
   populateInfo(*I, D, FC);
-  return I;
+  return std::unique_ptr<Info>{std::move(I)};
 }
 
 std::unique_ptr<Info> emitInfo(const RecordDecl *D, const FullComment *FC,
@@ -343,7 +343,7 @@ std::unique_ptr<Info> emitInfo(const Rec
   parseFields(*I, D, PublicOnly);
   if (const auto *C = dyn_cast<CXXRecordDecl>(D))
     parseBases(*I, C);
-  return I;
+  return std::unique_ptr<Info>{std::move(I)};
 }
 
 std::unique_ptr<Info> emitInfo(const FunctionDecl *D, const FullComment *FC,
@@ -362,7 +362,7 @@ std::unique_ptr<Info> emitInfo(const Fun
   else
     I->USR = SymbolID();
   I->ChildFunctions.push_back(std::move(Func));
-  return I;
+  return std::unique_ptr<Info>{std::move(I)};
 }
 
 std::unique_ptr<Info> emitInfo(const CXXMethodDecl *D, const FullComment *FC,
@@ -383,7 +383,7 @@ std::unique_ptr<Info> emitInfo(const CXX
   auto I = llvm::make_unique<RecordInfo>();
   I->USR = ParentUSR;
   I->ChildFunctions.push_back(std::move(Func));
-  return I;
+  return std::unique_ptr<Info>{std::move(I)};
 }
 
 std::unique_ptr<Info> emitInfo(const EnumDecl *D, const FullComment *FC,
@@ -400,18 +400,16 @@ std::unique_ptr<Info> emitInfo(const Enu
   if (!Enum.Namespace.empty()) {
     switch (Enum.Namespace[0].RefType) {
     case InfoType::IT_namespace: {
-      std::unique_ptr<Info> IPtr = llvm::make_unique<NamespaceInfo>();
-      NamespaceInfo *I = static_cast<NamespaceInfo *>(IPtr.get());
+      auto I = llvm::make_unique<NamespaceInfo>();
       I->USR = Enum.Namespace[0].USR;
       I->ChildEnums.push_back(std::move(Enum));
-      return IPtr;
+      return std::unique_ptr<Info>{std::move(I)};
     }
     case InfoType::IT_record: {
-      std::unique_ptr<Info> IPtr = llvm::make_unique<RecordInfo>();
-      RecordInfo *I = static_cast<RecordInfo *>(IPtr.get());
+      auto I = llvm::make_unique<RecordInfo>();
       I->USR = Enum.Namespace[0].USR;
       I->ChildEnums.push_back(std::move(Enum));
-      return IPtr;
+      return std::unique_ptr<Info>{std::move(I)};
     }
     default:
       break;
@@ -422,7 +420,7 @@ std::unique_ptr<Info> emitInfo(const Enu
   auto I = llvm::make_unique<NamespaceInfo>();
   I->USR = SymbolID();
   I->ChildEnums.push_back(std::move(Enum));
-  return I;
+  return std::unique_ptr<Info>{std::move(I)};
 }
 
 } // namespace serialize




More information about the cfe-commits mailing list