summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2014-04-24 03:30:22 +0000
committerNico Weber <nicolasweber@gmx.de>2014-04-24 03:30:22 +0000
commit7c3ccb032ed31e73822908fd2ed9afbabe577a15 (patch)
tree7e8147d20eca93367ac674535c55867070e5027b /clang
parent7deebef65700c5dcdd9ac429742bf645478f8ac5 (diff)
downloadbcm5719-llvm-7c3ccb032ed31e73822908fd2ed9afbabe577a15.tar.gz
bcm5719-llvm-7c3ccb032ed31e73822908fd2ed9afbabe577a15.zip
Fix 3 test-only leaks found by LSan.
llvm-svn: 207068
Diffstat (limited to 'clang')
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersTest.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.h b/clang/unittests/ASTMatchers/ASTMatchersTest.h
index e224722e964..8e243cf0780 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.h
+++ b/clang/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.
OpenPOWER on IntegriCloud