[PATCH] D50208: [clang-doc] Fix unique_ptr error on bots

Julie Hockett via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 2 17:01:06 PDT 2018


juliehockett created this revision.
juliehockett added reviewers: ioeric, lebedev.ri, jakehehrlich, leonardchan.
juliehockett added a project: clang-tools-extra.

Explicitly declare the return unique_ptr instead of using auto type deduction, as some of the bots' older compilers don't support some C++11 type deduction features.


https://reviews.llvm.org/D50208

Files:
  clang-tools-extra/clang-doc/Serialize.cpp


Index: clang-tools-extra/clang-doc/Serialize.cpp
===================================================================
--- clang-tools-extra/clang-doc/Serialize.cpp
+++ clang-tools-extra/clang-doc/Serialize.cpp
@@ -327,23 +327,25 @@
   if (PublicOnly && ((D->isAnonymousNamespace()) ||
                      !isPublic(D->getAccess(), D->getLinkageInternal())))
     return nullptr;
-  auto I = llvm::make_unique<NamespaceInfo>();
+  std::unique_ptr<Info> IPtr = llvm::make_unique<NamespaceInfo>();
+  NamespaceInfo *I = static_cast<NamespaceInfo *>(IPtr.get());
   populateInfo(*I, D, FC);
-  return I;
+  return IPtr;
 }
 
 std::unique_ptr<Info> emitInfo(const RecordDecl *D, const FullComment *FC,
                                int LineNumber, llvm::StringRef File,
                                bool PublicOnly) {
   if (PublicOnly && !isPublic(D->getAccess(), D->getLinkageInternal()))
     return nullptr;
-  auto I = llvm::make_unique<RecordInfo>();
+  std::unique_ptr<Info> IPtr = llvm::make_unique<RecordInfo>();
+  RecordInfo *I = static_cast<RecordInfo *>(IPtr.get());
   populateSymbolInfo(*I, D, FC, LineNumber, File);
   I->TagType = D->getTagKind();
   parseFields(*I, D, PublicOnly);
   if (const auto *C = dyn_cast<CXXRecordDecl>(D))
     parseBases(*I, C);
-  return I;
+  return IPtr;
 }
 
 std::unique_ptr<Info> emitInfo(const FunctionDecl *D, const FullComment *FC,
@@ -356,13 +358,14 @@
   Func.Access = clang::AccessSpecifier::AS_none;
 
   // Wrap in enclosing scope
-  auto I = llvm::make_unique<NamespaceInfo>();
+  std::unique_ptr<Info> IPtr = llvm::make_unique<NamespaceInfo>();
+  NamespaceInfo *I = static_cast<NamespaceInfo *>(IPtr.get());
   if (!Func.Namespace.empty())
     I->USR = Func.Namespace[0].USR;
   else
     I->USR = SymbolID();
   I->ChildFunctions.push_back(std::move(Func));
-  return I;
+  return IPtr;
 }
 
 std::unique_ptr<Info> emitInfo(const CXXMethodDecl *D, const FullComment *FC,
@@ -380,10 +383,11 @@
   Func.Access = D->getAccess();
 
   // Wrap in enclosing scope
-  auto I = llvm::make_unique<RecordInfo>();
+  std::unique_ptr<Info> IPtr = llvm::make_unique<RecordInfo>();
+  RecordInfo *I = static_cast<RecordInfo *>(IPtr.get());
   I->USR = ParentUSR;
   I->ChildFunctions.push_back(std::move(Func));
-  return I;
+  return IPtr;
 }
 
 std::unique_ptr<Info> emitInfo(const EnumDecl *D, const FullComment *FC,
@@ -419,10 +423,11 @@
   }
 
   // Put in global namespace
-  auto I = llvm::make_unique<NamespaceInfo>();
+  std::unique_ptr<Info> IPtr = llvm::make_unique<NamespaceInfo>();
+  NamespaceInfo *I = static_cast<NamespaceInfo *>(IPtr.get());
   I->USR = SymbolID();
   I->ChildEnums.push_back(std::move(Enum));
-  return I;
+  return IPtr;
 }
 
 } // namespace serialize


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50208.158865.patch
Type: text/x-patch
Size: 2740 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180803/3a2a4354/attachment.bin>


More information about the cfe-commits mailing list