Commit d0bbec5c authored by Karel Král's avatar Karel Král Committed by Commit Bot

Fix empty_string tool

Use the newer LibTooling API (bind instead of id).  Fix
empty_string/tests for use with tools/clang/scripts/test_tool.py

Bug: 1111787
Change-Id: I8cdd62f05afd9f41cc3eec22d638d39d39c32ef9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2343065Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Karel Král <karelkral@google.com>
Cr-Commit-Position: refs/heads/master@{#796307}
parent 3de3d0e0
......@@ -80,12 +80,12 @@ class EmptyStringConverter {
};
void EmptyStringConverter::SetupMatchers(MatchFinder* match_finder) {
const clang::ast_matchers::StatementMatcher& constructor_call = id(
"call",
const clang::ast_matchers::StatementMatcher& constructor_call =
cxxConstructExpr(
hasDeclaration(cxxMethodDecl(ofClass(hasName("std::basic_string")))),
argumentCountIs(2), hasArgument(0, id("literal", stringLiteral())),
hasArgument(1, cxxDefaultArgExpr())));
argumentCountIs(2), hasArgument(0, stringLiteral().bind("literal")),
hasArgument(1, cxxDefaultArgExpr()))
.bind("call");
// Note that expr(has()) in the matcher is significant; the Clang AST wraps
// calls to the std::string constructor with exprWithCleanups nodes. Without
......
==== BEGIN EDITS ====
r:::test-actual.cc:::438:::4:::
r:::test-actual.cc:::521:::4:::
r:::test-actual.cc:::685:::5:::
r:::test-actual.cc:::721:::5:::
r:::test-actual.cc:::728:::5:::
r:::test-actual.cc:::766:::5:::
r:::test-actual.cc:::1028:::2:::std::string()
r:::test-actual.cc:::1032:::2:::std::string()
r:::test-actual.cc:::1067:::2:::
r:::test-actual.cc:::1084:::2:::
r:::test-actual.cc:::1280:::3:::std::wstring()
r:::test-actual.cc:::1285:::3:::std::wstring()
r:::test-actual.cc:::1326:::3:::
r:::test-actual.cc:::1345:::3:::
==== END EDITS ====
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment