diff options
author | Nico Weber <nicolasweber@gmx.de> | 2014-04-24 03:30:22 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2014-04-24 03:30:22 +0000 |
commit | 0917027c31fc75fcc54609a386a273bc69c92ff3 (patch) | |
tree | e89aa20ea420a072cf17866645bc46c357257d03 | |
parent | 0877ff482dd0e183ceed04a7f392f2dbbd216e32 (diff) | |
download | clang-0917027c31fc75fcc54609a386a273bc69c92ff3.tar.gz clang-0917027c31fc75fcc54609a386a273bc69c92ff3.tar.bz2 clang-0917027c31fc75fcc54609a386a273bc69c92ff3.tar.xz |
Fix 3 test-only leaks found by LSan.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207068 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | unittests/ASTMatchers/ASTMatchersTest.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/unittests/ASTMatchers/ASTMatchersTest.h b/unittests/ASTMatchers/ASTMatchersTest.h index e224722e96..8e243cf078 100644 --- a/unittests/ASTMatchers/ASTMatchersTest.h +++ b/unittests/ASTMatchers/ASTMatchersTest.h @@ -64,8 +64,10 @@ testing::AssertionResult matchesConditionally(const std::string &Code, llvm::StringRef CompileArg) { bool Found = false, DynamicFound = false; MatchFinder Finder; - Finder.addMatcher(AMatcher, new VerifyMatch(0, &Found)); - if (!Finder.addDynamicMatcher(AMatcher, new VerifyMatch(0, &DynamicFound))) + VerifyMatch VerifyFound(0, &Found); + Finder.addMatcher(AMatcher, &VerifyFound); + VerifyMatch VerifyDynamicFound(0, &DynamicFound); + if (!Finder.addDynamicMatcher(AMatcher, &VerifyDynamicFound)) return testing::AssertionFailure() << "Could not add dynamic matcher"; std::unique_ptr<FrontendActionFactory> Factory( newFrontendActionFactory(&Finder)); @@ -109,8 +111,8 @@ matchAndVerifyResultConditionally(const std::string &Code, const T &AMatcher, std::unique_ptr<BoundNodesCallback> ScopedVerifier(FindResultVerifier); bool VerifiedResult = false; MatchFinder Finder; - Finder.addMatcher( - AMatcher, new VerifyMatch(FindResultVerifier, &VerifiedResult)); + VerifyMatch VerifyVerifiedResult(FindResultVerifier, &VerifiedResult); + Finder.addMatcher(AMatcher, &VerifyVerifiedResult); std::unique_ptr<FrontendActionFactory> Factory( newFrontendActionFactory(&Finder)); // Some tests use typeof, which is a gnu extension. |