Author: ymandel Date: Mon Apr 29 09:57:40 2019 New Revision: 359468 URL: http://llvm.org/viewvc/llvm-project?rev=359468&view=rev Log: [LibTooling] Fix unneeded use of unique_ptr where shared_ptr is expected.
Summary: 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. Reviewers: sbenza Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61005 Modified: cfe/trunk/lib/Tooling/Refactoring/Stencil.cpp Modified: cfe/trunk/lib/Tooling/Refactoring/Stencil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Refactoring/Stencil.cpp?rev=359468&r1=359467&r2=359468&view=diff ============================================================================== --- cfe/trunk/lib/Tooling/Refactoring/Stencil.cpp (original) +++ cfe/trunk/lib/Tooling/Refactoring/Stencil.cpp Mon Apr 29 09:57:40 2019 @@ -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 @@ Stencil::eval(const MatchFinder::MatchRe } 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