ymandel created this revision. ymandel added a reviewer: sbenza. Herald added a project: clang.
This fixes a few places in the Stencil implementation where a unique_ptr is created at a callsite that expects shared_ptr. Since the former implicitly converts to the latter, the code compiles and runs correctly as is. But, there's no reason to involve unique_ptr -- the current code was leftover from a previous version in which unique_ptr was the expected type. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D61005 Files: clang/lib/Tooling/Refactoring/Stencil.cpp Index: clang/lib/Tooling/Refactoring/Stencil.cpp =================================================================== --- clang/lib/Tooling/Refactoring/Stencil.cpp +++ clang/lib/Tooling/Refactoring/Stencil.cpp @@ -16,6 +16,7 @@ #include "clang/Tooling/Refactoring/SourceCode.h" #include "llvm/Support/Errc.h" #include <atomic> +#include <memory> #include <string> using namespace clang; @@ -183,17 +184,17 @@ } StencilPart stencil::text(StringRef Text) { - return StencilPart(llvm::make_unique<RawText>(Text)); + return StencilPart(std::make_shared<RawText>(Text)); } StencilPart stencil::node(StringRef Id) { - return StencilPart(llvm::make_unique<NodeRef>(Id, SemiAssociation::Inferred)); + return StencilPart(std::make_shared<NodeRef>(Id, SemiAssociation::Inferred)); } StencilPart stencil::sNode(StringRef Id) { - return StencilPart(llvm::make_unique<NodeRef>(Id, SemiAssociation::Always)); + return StencilPart(std::make_shared<NodeRef>(Id, SemiAssociation::Always)); } StencilPart stencil::dPrint(StringRef Id) { - return StencilPart(llvm::make_unique<DebugPrintNodeOp>(Id)); + return StencilPart(std::make_shared<DebugPrintNodeOp>(Id)); }
Index: clang/lib/Tooling/Refactoring/Stencil.cpp =================================================================== --- clang/lib/Tooling/Refactoring/Stencil.cpp +++ clang/lib/Tooling/Refactoring/Stencil.cpp @@ -16,6 +16,7 @@ #include "clang/Tooling/Refactoring/SourceCode.h" #include "llvm/Support/Errc.h" #include <atomic> +#include <memory> #include <string> using namespace clang; @@ -183,17 +184,17 @@ } StencilPart stencil::text(StringRef Text) { - return StencilPart(llvm::make_unique<RawText>(Text)); + return StencilPart(std::make_shared<RawText>(Text)); } StencilPart stencil::node(StringRef Id) { - return StencilPart(llvm::make_unique<NodeRef>(Id, SemiAssociation::Inferred)); + return StencilPart(std::make_shared<NodeRef>(Id, SemiAssociation::Inferred)); } StencilPart stencil::sNode(StringRef Id) { - return StencilPart(llvm::make_unique<NodeRef>(Id, SemiAssociation::Always)); + return StencilPart(std::make_shared<NodeRef>(Id, SemiAssociation::Always)); } StencilPart stencil::dPrint(StringRef Id) { - return StencilPart(llvm::make_unique<DebugPrintNodeOp>(Id)); + return StencilPart(std::make_shared<DebugPrintNodeOp>(Id)); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits