diff options
author | Yitzhak Mandelbaum <yitzhakm@google.com> | 2019-04-29 16:57:40 +0000 |
---|---|---|
committer | Yitzhak Mandelbaum <yitzhakm@google.com> | 2019-04-29 16:57:40 +0000 |
commit | 6a8a0a611413cfe4d135650cf1fe71fece8788aa (patch) | |
tree | 0d02837e2c9c494df87220a04ccb5c6b4c464570 /clang/lib/Tooling/Refactoring/Stencil.cpp | |
parent | 864cf8e2745808ed409e52b783bf0bffcc8dde7b (diff) | |
download | bcm5719-llvm-6a8a0a611413cfe4d135650cf1fe71fece8788aa.tar.gz bcm5719-llvm-6a8a0a611413cfe4d135650cf1fe71fece8788aa.zip |
[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
llvm-svn: 359468
Diffstat (limited to 'clang/lib/Tooling/Refactoring/Stencil.cpp')
-rw-r--r-- | clang/lib/Tooling/Refactoring/Stencil.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Tooling/Refactoring/Stencil.cpp b/clang/lib/Tooling/Refactoring/Stencil.cpp index adc26ca653f..8fe589b0985 100644 --- a/clang/lib/Tooling/Refactoring/Stencil.cpp +++ b/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 @@ Stencil::eval(const MatchFinder::MatchResult &Match) const { } 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)); } |