diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp | 26 | 
1 files changed, 14 insertions, 12 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp index ade0085..e585dd1 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp @@ -81,41 +81,44 @@ AST_MATCHER(CXXMemberCallExpr, hasSameNumArgsAsDeclNumParams) {  AST_MATCHER(DeclRefExpr, hasExplicitTemplateArgs) {    return Node.hasExplicitTemplateArgs();  } +} // namespace  // Helper Matcher which applies the given QualType Matcher either directly or by  // resolving a pointer type to its pointee. Used to match v.push_back() as well  // as p->push_back(). -auto hasTypeOrPointeeType( +static auto hasTypeOrPointeeType(      const ast_matchers::internal::Matcher<QualType> &TypeMatcher) {    return anyOf(hasType(TypeMatcher),                 hasType(pointerType(pointee(TypeMatcher))));  }  // Matches if the node has canonical type matching any of the given names. -auto hasWantedType(llvm::ArrayRef<StringRef> TypeNames) { +static auto hasWantedType(llvm::ArrayRef<StringRef> TypeNames) {    return hasCanonicalType(hasDeclaration(cxxRecordDecl(hasAnyName(TypeNames))));  }  // Matches member call expressions of the named method on the listed container  // types. -auto cxxMemberCallExprOnContainer(StringRef MethodName, -                                  llvm::ArrayRef<StringRef> ContainerNames) { +static auto +cxxMemberCallExprOnContainer(StringRef MethodName, +                             llvm::ArrayRef<StringRef> ContainerNames) {    return cxxMemberCallExpr(        hasDeclaration(functionDecl(hasName(MethodName))),        on(hasTypeOrPointeeType(hasWantedType(ContainerNames))));  } -const auto DefaultContainersWithPushBack = +static const auto DefaultContainersWithPushBack =      "::std::vector; ::std::list; ::std::deque"; -const auto DefaultContainersWithPush = +static const auto DefaultContainersWithPush =      "::std::stack; ::std::queue; ::std::priority_queue"; -const auto DefaultContainersWithPushFront = +static const auto DefaultContainersWithPushFront =      "::std::forward_list; ::std::list; ::std::deque"; -const auto DefaultSmartPointers = +static const auto DefaultSmartPointers =      "::std::shared_ptr; ::std::unique_ptr; ::std::auto_ptr; ::std::weak_ptr"; -const auto DefaultTupleTypes = "::std::pair; ::std::tuple"; -const auto DefaultTupleMakeFunctions = "::std::make_pair; ::std::make_tuple"; -const auto DefaultEmplacyFunctions = +static const auto DefaultTupleTypes = "::std::pair; ::std::tuple"; +static const auto DefaultTupleMakeFunctions = +    "::std::make_pair; ::std::make_tuple"; +static const auto DefaultEmplacyFunctions =      "vector::emplace_back; vector::emplace;"      "deque::emplace; deque::emplace_front; deque::emplace_back;"      "forward_list::emplace_after; forward_list::emplace_front;" @@ -129,7 +132,6 @@ const auto DefaultEmplacyFunctions =      "unordered_multiset::emplace; unordered_multiset::emplace_hint;"      "unordered_multimap::emplace; unordered_multimap::emplace_hint;"      "stack::emplace; queue::emplace; priority_queue::emplace"; -} // namespace  UseEmplaceCheck::UseEmplaceCheck(StringRef Name, ClangTidyContext *Context)      : ClangTidyCheck(Name, Context), IgnoreImplicitConstructors(Options.get(  | 
