From: Yitzhak Mandelbaum Date: Mon, 29 Apr 2019 16:57:40 +0000 (+0000) Subject: [LibTooling] Fix unneeded use of unique_ptr where shared_ptr is expected. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b95334e6d4479448c926ca826a813714324eb18c;p=clang [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359468 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Tooling/Refactoring/Stencil.cpp b/lib/Tooling/Refactoring/Stencil.cpp index adc26ca653..8fe589b098 100644 --- a/lib/Tooling/Refactoring/Stencil.cpp +++ b/lib/Tooling/Refactoring/Stencil.cpp @@ -16,6 +16,7 @@ #include "clang/Tooling/Refactoring/SourceCode.h" #include "llvm/Support/Errc.h" #include +#include #include using namespace clang; @@ -183,17 +184,17 @@ Stencil::eval(const MatchFinder::MatchResult &Match) const { } StencilPart stencil::text(StringRef Text) { - return StencilPart(llvm::make_unique(Text)); + return StencilPart(std::make_shared(Text)); } StencilPart stencil::node(StringRef Id) { - return StencilPart(llvm::make_unique(Id, SemiAssociation::Inferred)); + return StencilPart(std::make_shared(Id, SemiAssociation::Inferred)); } StencilPart stencil::sNode(StringRef Id) { - return StencilPart(llvm::make_unique(Id, SemiAssociation::Always)); + return StencilPart(std::make_shared(Id, SemiAssociation::Always)); } StencilPart stencil::dPrint(StringRef Id) { - return StencilPart(llvm::make_unique(Id)); + return StencilPart(std::make_shared(Id)); }