forked from OSchip/llvm-project
Change AST matcher names to conform with the new naming.
llvm-svn: 162539
This commit is contained in:
parent
bd3d76d90c
commit
98e00797cd
|
@ -191,8 +191,8 @@ int main(int argc, const char **argv) {
|
||||||
ast_matchers::MatchFinder Finder;
|
ast_matchers::MatchFinder Finder;
|
||||||
FixCStrCall Callback(&Tool.getReplacements());
|
FixCStrCall Callback(&Tool.getReplacements());
|
||||||
Finder.addMatcher(
|
Finder.addMatcher(
|
||||||
constructorCall(
|
constructExpr(
|
||||||
hasDeclaration(method(hasName(StringConstructor))),
|
hasDeclaration(methodDecl(hasName(StringConstructor))),
|
||||||
argumentCountIs(2),
|
argumentCountIs(2),
|
||||||
// The first argument must have the form x.c_str() or p->c_str()
|
// 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
|
// where the method is string::c_str(). We can use the copy
|
||||||
|
@ -200,23 +200,23 @@ int main(int argc, const char **argv) {
|
||||||
// the string object).
|
// the string object).
|
||||||
hasArgument(
|
hasArgument(
|
||||||
0,
|
0,
|
||||||
id("call", memberCall(
|
id("call", memberCallExpr(
|
||||||
callee(id("member", memberExpression())),
|
callee(id("member", memberExpr())),
|
||||||
callee(method(hasName(StringCStrMethod))),
|
callee(methodDecl(hasName(StringCStrMethod))),
|
||||||
on(id("arg", expression()))))),
|
on(id("arg", expr()))))),
|
||||||
// The second argument is the alloc object which must not be
|
// The second argument is the alloc object which must not be
|
||||||
// present explicitly.
|
// present explicitly.
|
||||||
hasArgument(
|
hasArgument(
|
||||||
1,
|
1,
|
||||||
defaultArgument())),
|
defaultArgExpr())),
|
||||||
&Callback);
|
&Callback);
|
||||||
Finder.addMatcher(
|
Finder.addMatcher(
|
||||||
constructorCall(
|
constructExpr(
|
||||||
// Implicit constructors of these classes are overloaded
|
// Implicit constructors of these classes are overloaded
|
||||||
// wrt. string types and they internally make a StringRef
|
// wrt. string types and they internally make a StringRef
|
||||||
// referring to the argument. Passing a string directly to
|
// referring to the argument. Passing a string directly to
|
||||||
// them is preferred to passing a char pointer.
|
// them is preferred to passing a char pointer.
|
||||||
hasDeclaration(method(anyOf(
|
hasDeclaration(methodDecl(anyOf(
|
||||||
hasName("::llvm::StringRef::StringRef"),
|
hasName("::llvm::StringRef::StringRef"),
|
||||||
hasName("::llvm::Twine::Twine")))),
|
hasName("::llvm::Twine::Twine")))),
|
||||||
argumentCountIs(1),
|
argumentCountIs(1),
|
||||||
|
@ -227,10 +227,10 @@ int main(int argc, const char **argv) {
|
||||||
// directly.
|
// directly.
|
||||||
hasArgument(
|
hasArgument(
|
||||||
0,
|
0,
|
||||||
id("call", memberCall(
|
id("call", memberCallExpr(
|
||||||
callee(id("member", memberExpression())),
|
callee(id("member", memberExpr())),
|
||||||
callee(method(hasName(StringCStrMethod))),
|
callee(methodDecl(hasName(StringCStrMethod))),
|
||||||
on(id("arg", expression())))))),
|
on(id("arg", expr())))))),
|
||||||
&Callback);
|
&Callback);
|
||||||
return Tool.run(newFrontendActionFactory(&Finder));
|
return Tool.run(newFrontendActionFactory(&Finder));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue