diff options
author | Daniel Jasper <djasper@google.com> | 2012-10-01 13:40:41 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2012-10-01 13:40:41 +0000 |
commit | 31f7c08a0d2b140bf31a08894d1948649de53c15 (patch) | |
tree | 2af101527ec81be26e28acaa67dd4d02e5dff38c /unittests/ASTMatchers/ASTMatchersTest.h | |
parent | 3dd82f7f01a9ba995bea3027a934df85850cab58 (diff) | |
download | clang-31f7c08a0d2b140bf31a08894d1948649de53c15.tar.gz clang-31f7c08a0d2b140bf31a08894d1948649de53c15.tar.bz2 clang-31f7c08a0d2b140bf31a08894d1948649de53c15.tar.xz |
Add matchers for selected C++11 features.
Patch by Gábor Horváth.
Review: http://llvm-reviews.chandlerc.com/D46
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164943 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ASTMatchers/ASTMatchersTest.h')
-rw-r--r-- | unittests/ASTMatchers/ASTMatchersTest.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/unittests/ASTMatchers/ASTMatchersTest.h b/unittests/ASTMatchers/ASTMatchersTest.h index 6d872e8ea9..01a7c51016 100644 --- a/unittests/ASTMatchers/ASTMatchersTest.h +++ b/unittests/ASTMatchers/ASTMatchersTest.h @@ -51,13 +51,14 @@ private: template <typename T> testing::AssertionResult matchesConditionally(const std::string &Code, const T &AMatcher, - bool ExpectMatch) { + bool ExpectMatch, + llvm::StringRef CompileArg) { bool Found = false; MatchFinder Finder; Finder.addMatcher(AMatcher, new VerifyMatch(0, &Found)); OwningPtr<FrontendActionFactory> Factory(newFrontendActionFactory(&Finder)); // Some tests use typeof, which is a gnu extension. - std::vector<std::string> Args(1, "-std=gnu++98"); + std::vector<std::string> Args(1, CompileArg); if (!runToolOnCodeWithArgs(Factory->create(), Code, Args)) { return testing::AssertionFailure() << "Parsing error in \"" << Code << "\""; } @@ -73,13 +74,13 @@ testing::AssertionResult matchesConditionally(const std::string &Code, template <typename T> testing::AssertionResult matches(const std::string &Code, const T &AMatcher) { - return matchesConditionally(Code, AMatcher, true); + return matchesConditionally(Code, AMatcher, true, "-std=c++11"); } template <typename T> testing::AssertionResult notMatches(const std::string &Code, const T &AMatcher) { - return matchesConditionally(Code, AMatcher, false); + return matchesConditionally(Code, AMatcher, false, "-std=c++11"); } template <typename T> |