summaryrefslogtreecommitdiffstats
path: root/unittests/Tooling/TestVisitor.h
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Tooling/TestVisitor.h')
-rw-r--r--unittests/Tooling/TestVisitor.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/unittests/Tooling/TestVisitor.h b/unittests/Tooling/TestVisitor.h
index ce3246a..ec751c3 100644
--- a/unittests/Tooling/TestVisitor.h
+++ b/unittests/Tooling/TestVisitor.h
@@ -31,7 +31,7 @@ namespace clang {
/// This is a drop-in replacement for RecursiveASTVisitor itself, with the
/// additional capability of running it over a snippet of code.
///
-/// Visits template instantiations (but not implicit code) by default.
+/// Visits template instantiations and implicit code by default.
template <typename T>
class TestVisitor : public RecursiveASTVisitor<T> {
public:
@@ -39,14 +39,15 @@ public:
virtual ~TestVisitor() { }
- enum Language { Lang_C, Lang_CXX };
+ enum Language { Lang_C, Lang_CXX98, Lang_CXX11, Lang_CXX=Lang_CXX98 };
/// \brief Runs the current AST visitor over the given code.
bool runOver(StringRef Code, Language L = Lang_CXX) {
std::vector<std::string> Args;
switch (L) {
case Lang_C: Args.push_back("-std=c99"); break;
- case Lang_CXX: Args.push_back("-std=c++98"); break;
+ case Lang_CXX98: Args.push_back("-std=c++98"); break;
+ case Lang_CXX11: Args.push_back("-std=c++11"); break;
}
return tooling::runToolOnCodeWithArgs(CreateTestAction(), Code, Args);
}
@@ -55,6 +56,10 @@ public:
return true;
}
+ bool shouldVisitImplicitCode() const {
+ return true;
+ }
+
protected:
virtual ASTFrontendAction* CreateTestAction() {
return new TestAction(this);
OpenPOWER on IntegriCloud