summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2015-09-17 13:31:25 +0000
committerAaron Ballman <aaron@aaronballman.com>2015-09-17 13:31:25 +0000
commitb9ea09c4451cb8f33ffd41d22b7dd10e8a68c5c8 (patch)
tree362e33db9c2d4fb7ab5fc96172386893a7d50b10 /clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp
parent512fb64765c7d61e89531b8ff697a85d815d9a13 (diff)
downloadbcm5719-llvm-b9ea09c4451cb8f33ffd41d22b7dd10e8a68c5c8.tar.gz
bcm5719-llvm-b9ea09c4451cb8f33ffd41d22b7dd10e8a68c5c8.zip
Refactors AST matching code to use the new AST matcher names. This patch correlates to r247885 which performs the AST matcher rename in Clang.
llvm-svn: 247886
Diffstat (limited to 'clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp b/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp
index a3b4515361f..c58c1dc7f18 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp
@@ -86,40 +86,42 @@ void RedundantStringCStrCheck::registerMatchers(
return;
Finder->addMatcher(
- constructExpr(
- hasDeclaration(methodDecl(hasName(StringConstructor))),
+ cxxConstructExpr(
+ hasDeclaration(cxxMethodDecl(hasName(StringConstructor))),
argumentCountIs(2),
// The first argument must have the form x.c_str() or p->c_str()
// where the method is string::c_str(). We can use the copy
// constructor of string instead (or the compiler might share
// the string object).
- hasArgument(
- 0, memberCallExpr(callee(memberExpr().bind("member")),
- callee(methodDecl(hasName(StringCStrMethod))),
- on(expr().bind("arg"))).bind("call")),
+ hasArgument(0, cxxMemberCallExpr(
+ callee(memberExpr().bind("member")),
+ callee(cxxMethodDecl(hasName(StringCStrMethod))),
+ on(expr().bind("arg")))
+ .bind("call")),
// The second argument is the alloc object which must not be
// present explicitly.
- hasArgument(1, defaultArgExpr())),
+ hasArgument(1, cxxDefaultArgExpr())),
this);
Finder->addMatcher(
- constructExpr(
+ cxxConstructExpr(
// Implicit constructors of these classes are overloaded
// wrt. string types and they internally make a StringRef
// referring to the argument. Passing a string directly to
// them is preferred to passing a char pointer.
hasDeclaration(
- methodDecl(anyOf(hasName("::llvm::StringRef::StringRef"),
- hasName("::llvm::Twine::Twine")))),
+ cxxMethodDecl(anyOf(hasName("::llvm::StringRef::StringRef"),
+ hasName("::llvm::Twine::Twine")))),
argumentCountIs(1),
// The only argument must have the form x.c_str() or p->c_str()
// where the method is string::c_str(). StringRef also has
// a constructor from string which is more efficient (avoids
// strlen), so we can construct StringRef from the string
// directly.
- hasArgument(
- 0, memberCallExpr(callee(memberExpr().bind("member")),
- callee(methodDecl(hasName(StringCStrMethod))),
- on(expr().bind("arg"))).bind("call"))),
+ hasArgument(0, cxxMemberCallExpr(
+ callee(memberExpr().bind("member")),
+ callee(cxxMethodDecl(hasName(StringCStrMethod))),
+ on(expr().bind("arg")))
+ .bind("call"))),
this);
}
OpenPOWER on IntegriCloud