diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2016-07-21 15:06:51 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2016-07-21 15:06:51 +0000 |
| commit | 018b6d4ee4652b95515a288e0e9fe1bdf5035d0e (patch) | |
| tree | 4606a46b679868c4583322c875b2f1f8ffb16f44 /clang/lib/ASTMatchers | |
| parent | 3f1edd7e0c05f59d4f6588ce4b6f4660ca0e628c (diff) | |
| download | bcm5719-llvm-018b6d4ee4652b95515a288e0e9fe1bdf5035d0e.tar.gz bcm5719-llvm-018b6d4ee4652b95515a288e0e9fe1bdf5035d0e.zip | |
Move some IntrusiveRefCntPtrs instead of copying.
No functionality change intended.
llvm-svn: 276292
Diffstat (limited to 'clang/lib/ASTMatchers')
| -rw-r--r-- | clang/lib/ASTMatchers/ASTMatchersInternal.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp index 107052ef1de..f0bfbf9e32d 100644 --- a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp +++ b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp @@ -72,10 +72,10 @@ private: }; class IdDynMatcher : public DynMatcherInterface { - public: +public: IdDynMatcher(StringRef ID, - const IntrusiveRefCntPtr<DynMatcherInterface> &InnerMatcher) - : ID(ID), InnerMatcher(InnerMatcher) {} + IntrusiveRefCntPtr<DynMatcherInterface> InnerMatcher) + : ID(ID), InnerMatcher(std::move(InnerMatcher)) {} bool dynMatches(const ast_type_traits::DynTypedNode &DynNode, ASTMatchFinder *Finder, @@ -85,7 +85,7 @@ class IdDynMatcher : public DynMatcherInterface { return Result; } - private: +private: const std::string ID; const IntrusiveRefCntPtr<DynMatcherInterface> InnerMatcher; }; @@ -210,8 +210,9 @@ bool DynTypedMatcher::matchesNoKindCheck( llvm::Optional<DynTypedMatcher> DynTypedMatcher::tryBind(StringRef ID) const { if (!AllowBind) return llvm::None; auto Result = *this; - Result.Implementation = new IdDynMatcher(ID, Result.Implementation); - return Result; + Result.Implementation = + new IdDynMatcher(ID, std::move(Result.Implementation)); + return std::move(Result); } bool DynTypedMatcher::canConvertTo(ast_type_traits::ASTNodeKind To) const { |

