diff options
author | Sam Estep <sam@samestep.com> | 2022-06-30 16:03:23 +0000 |
---|---|---|
committer | Sam Estep <sam@samestep.com> | 2022-06-30 16:03:33 +0000 |
commit | 1d83a16bd3faa1dfb6e8ed40c53d018dc03e2c81 (patch) | |
tree | 8b731ae445825b24ad32fee40479c0913a8d41e5 /clang/unittests | |
parent | 51d672946efdfacc06948cd46b51109b07ac12e5 (diff) | |
download | llvm-1d83a16bd3faa1dfb6e8ed40c53d018dc03e2c81.zip llvm-1d83a16bd3faa1dfb6e8ed40c53d018dc03e2c81.tar.gz llvm-1d83a16bd3faa1dfb6e8ed40c53d018dc03e2c81.tar.bz2 |
[clang][dataflow] Replace TEST_F with TEST where possible
Many of our tests are currently written using `TEST_F` where the test fixture class doesn't have any `SetUp` or `TearDown` methods, and just one helper method. In those cases, this patch deletes the class and pulls its method out into a standalone function, using `TEST` instead of `TEST_F`.
There are still a few test files leftover in `clang/unittests/Analysis/FlowSensitive/` that use `TEST_F`:
- `DataflowAnalysisContextTest.cpp` because the class contains a `Context` field which is used
- `DataflowEnvironmentTest.cpp` because the class contains an `Environment` field which is used
- `SolverTest.cpp` because the class contains a `Vals` field which is used
- `TypeErasedDataflowAnalysisTest.cpp` because there are several different classes which all share the same method name
Reviewed By: ymandel, sgatev
Differential Revision: https://reviews.llvm.org/D128924
Diffstat (limited to 'clang/unittests')
6 files changed, 223 insertions, 241 deletions
diff --git a/clang/unittests/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp b/clang/unittests/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp index a61d6dc..2be1405 100644 --- a/clang/unittests/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp @@ -128,31 +128,28 @@ private: Model M; }; -class ChromiumCheckModelTest : public ::testing::TestWithParam<std::string> { -protected: - template <typename Matcher> - void runDataflow(llvm::StringRef Code, Matcher Match) { - const tooling::FileContentMappings FileContents = { - {"check.h", ChromiumCheckHeader}, {"othercheck.h", OtherCheckHeader}}; - - ASSERT_THAT_ERROR( - test::checkDataflow<ModelAdaptorAnalysis<ChromiumCheckModel>>( - Code, "target", - [](ASTContext &C, Environment &) { - return ModelAdaptorAnalysis<ChromiumCheckModel>(C); - }, - [&Match]( - llvm::ArrayRef< - std::pair<std::string, DataflowAnalysisState<NoopLattice>>> - Results, - ASTContext &ASTCtx) { Match(Results, ASTCtx); }, - {"-fsyntax-only", "-fno-delayed-template-parsing", "-std=c++17"}, - FileContents), - llvm::Succeeded()); - } -}; +template <typename Matcher> +void runDataflow(llvm::StringRef Code, Matcher Match) { + const tooling::FileContentMappings FileContents = { + {"check.h", ChromiumCheckHeader}, {"othercheck.h", OtherCheckHeader}}; + + ASSERT_THAT_ERROR( + test::checkDataflow<ModelAdaptorAnalysis<ChromiumCheckModel>>( + Code, "target", + [](ASTContext &C, Environment &) { + return ModelAdaptorAnalysis<ChromiumCheckModel>(C); + }, + [&Match]( + llvm::ArrayRef< + std::pair<std::string, DataflowAnalysisState<NoopLattice>>> + Results, + ASTContext &ASTCtx) { Match(Results, ASTCtx); }, + {"-fsyntax-only", "-fno-delayed-template-parsing", "-std=c++17"}, + FileContents), + llvm::Succeeded()); +} -TEST_F(ChromiumCheckModelTest, CheckSuccessImpliesConditionHolds) { +TEST(ChromiumCheckModelTest, CheckSuccessImpliesConditionHolds) { auto Expectations = [](llvm::ArrayRef< std::pair<std::string, DataflowAnalysisState<NoopLattice>>> @@ -185,7 +182,7 @@ TEST_F(ChromiumCheckModelTest, CheckSuccessImpliesConditionHolds) { runDataflow(ReplacePattern(Code, "$check", "DPCHECK"), Expectations); } -TEST_F(ChromiumCheckModelTest, UnrelatedCheckIgnored) { +TEST(ChromiumCheckModelTest, UnrelatedCheckIgnored) { auto Expectations = [](llvm::ArrayRef< std::pair<std::string, DataflowAnalysisState<NoopLattice>>> diff --git a/clang/unittests/Analysis/FlowSensitive/MatchSwitchTest.cpp b/clang/unittests/Analysis/FlowSensitive/MatchSwitchTest.cpp index 9831976..bf8c2f5 100644 --- a/clang/unittests/Analysis/FlowSensitive/MatchSwitchTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/MatchSwitchTest.cpp @@ -123,25 +123,22 @@ public: } }; -class MatchSwitchTest : public ::testing::Test { -protected: - template <typename Matcher> - void RunDataflow(llvm::StringRef Code, Matcher Expectations) { - ASSERT_THAT_ERROR( - test::checkDataflow<TestAnalysis>( - Code, "fun", - [](ASTContext &C, Environment &) { return TestAnalysis(C); }, - [&Expectations]( - llvm::ArrayRef<std::pair< - std::string, DataflowAnalysisState<TestAnalysis::Lattice>>> - Results, - ASTContext &) { EXPECT_THAT(Results, Expectations); }, - {"-fsyntax-only", "-std=c++17"}), - llvm::Succeeded()); - } -}; +template <typename Matcher> +void RunDataflow(llvm::StringRef Code, Matcher Expectations) { + ASSERT_THAT_ERROR( + test::checkDataflow<TestAnalysis>( + Code, "fun", + [](ASTContext &C, Environment &) { return TestAnalysis(C); }, + [&Expectations]( + llvm::ArrayRef<std::pair< + std::string, DataflowAnalysisState<TestAnalysis::Lattice>>> + Results, + ASTContext &) { EXPECT_THAT(Results, Expectations); }, + {"-fsyntax-only", "-std=c++17"}), + llvm::Succeeded()); +} -TEST_F(MatchSwitchTest, JustX) { +TEST(MatchSwitchTest, JustX) { std::string Code = R"( void fun() { int X = 1; @@ -153,7 +150,7 @@ TEST_F(MatchSwitchTest, JustX) { UnorderedElementsAre(Pair("p", Holds(BooleanLattice(true))))); } -TEST_F(MatchSwitchTest, JustFoo) { +TEST(MatchSwitchTest, JustFoo) { std::string Code = R"( void Foo(); void fun() { @@ -165,7 +162,7 @@ TEST_F(MatchSwitchTest, JustFoo) { UnorderedElementsAre(Pair("p", Holds(BooleanLattice(false))))); } -TEST_F(MatchSwitchTest, XThenFoo) { +TEST(MatchSwitchTest, XThenFoo) { std::string Code = R"( void Foo(); void fun() { @@ -179,7 +176,7 @@ TEST_F(MatchSwitchTest, XThenFoo) { UnorderedElementsAre(Pair("p", Holds(BooleanLattice(false))))); } -TEST_F(MatchSwitchTest, FooThenX) { +TEST(MatchSwitchTest, FooThenX) { std::string Code = R"( void Foo(); void fun() { @@ -193,7 +190,7 @@ TEST_F(MatchSwitchTest, FooThenX) { UnorderedElementsAre(Pair("p", Holds(BooleanLattice(true))))); } -TEST_F(MatchSwitchTest, Neither) { +TEST(MatchSwitchTest, Neither) { std::string Code = R"( void Bar(); void fun(bool b) { @@ -205,7 +202,7 @@ TEST_F(MatchSwitchTest, Neither) { UnorderedElementsAre(Pair("p", Holds(BooleanLattice(false))))); } -TEST_F(MatchSwitchTest, ReturnNonVoid) { +TEST(MatchSwitchTest, ReturnNonVoid) { using namespace ast_matchers; auto Unit = diff --git a/clang/unittests/Analysis/FlowSensitive/MultiVarConstantPropagationTest.cpp b/clang/unittests/Analysis/FlowSensitive/MultiVarConstantPropagationTest.cpp index 05cd67e..2615fe4 100644 --- a/clang/unittests/Analysis/FlowSensitive/MultiVarConstantPropagationTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/MultiVarConstantPropagationTest.cpp @@ -206,28 +206,25 @@ MATCHER_P(HoldsCPLattice, m, return ExplainMatchResult(m, arg.Lattice, result_listener); } -class MultiVarConstantPropagationTest : public ::testing::Test { -protected: - template <typename Matcher> - void RunDataflow(llvm::StringRef Code, Matcher Expectations) { - ASSERT_THAT_ERROR( - test::checkDataflow<ConstantPropagationAnalysis>( - Code, "fun", - [](ASTContext &C, Environment &) { - return ConstantPropagationAnalysis(C); - }, - [&Expectations]( - llvm::ArrayRef<std::pair< - std::string, DataflowAnalysisState< - ConstantPropagationAnalysis::Lattice>>> - Results, - ASTContext &) { EXPECT_THAT(Results, Expectations); }, - {"-fsyntax-only", "-std=c++17"}), - llvm::Succeeded()); - } -}; +template <typename Matcher> +void RunDataflow(llvm::StringRef Code, Matcher Expectations) { + ASSERT_THAT_ERROR( + test::checkDataflow<ConstantPropagationAnalysis>( + Code, "fun", + [](ASTContext &C, Environment &) { + return ConstantPropagationAnalysis(C); + }, + [&Expectations]( + llvm::ArrayRef<std::pair< + std::string, + DataflowAnalysisState<ConstantPropagationAnalysis::Lattice>>> + Results, + ASTContext &) { EXPECT_THAT(Results, Expectations); }, + {"-fsyntax-only", "-std=c++17"}), + llvm::Succeeded()); +} -TEST_F(MultiVarConstantPropagationTest, JustInit) { +TEST(MultiVarConstantPropagationTest, JustInit) { std::string Code = R"( void fun() { int target = 1; @@ -239,7 +236,7 @@ TEST_F(MultiVarConstantPropagationTest, JustInit) { Var("target"), HasConstantVal(1))))))); } -TEST_F(MultiVarConstantPropagationTest, Assignment) { +TEST(MultiVarConstantPropagationTest, Assignment) { std::string Code = R"( void fun() { int target = 1; @@ -255,7 +252,7 @@ TEST_F(MultiVarConstantPropagationTest, Assignment) { Var("target"), HasConstantVal(2))))))); } -TEST_F(MultiVarConstantPropagationTest, AssignmentCall) { +TEST(MultiVarConstantPropagationTest, AssignmentCall) { std::string Code = R"( int g(); void fun() { @@ -269,7 +266,7 @@ TEST_F(MultiVarConstantPropagationTest, AssignmentCall) { Pair(Var("target"), Varies())))))); } -TEST_F(MultiVarConstantPropagationTest, AssignmentBinOp) { +TEST(MultiVarConstantPropagationTest, AssignmentBinOp) { std::string Code = R"( void fun() { int target; @@ -282,7 +279,7 @@ TEST_F(MultiVarConstantPropagationTest, AssignmentBinOp) { Var("target"), HasConstantVal(5))))))); } -TEST_F(MultiVarConstantPropagationTest, PlusAssignment) { +TEST(MultiVarConstantPropagationTest, PlusAssignment) { std::string Code = R"( void fun() { int target = 1; @@ -298,7 +295,7 @@ TEST_F(MultiVarConstantPropagationTest, PlusAssignment) { Pair(Var("target"), Varies())))))); } -TEST_F(MultiVarConstantPropagationTest, SameAssignmentInBranches) { +TEST(MultiVarConstantPropagationTest, SameAssignmentInBranches) { std::string Code = R"cc( void fun(bool b) { int target; @@ -327,7 +324,7 @@ TEST_F(MultiVarConstantPropagationTest, SameAssignmentInBranches) { } // Verifies that the analysis tracks multiple variables simultaneously. -TEST_F(MultiVarConstantPropagationTest, TwoVariables) { +TEST(MultiVarConstantPropagationTest, TwoVariables) { std::string Code = R"( void fun() { int target = 1; @@ -350,7 +347,7 @@ TEST_F(MultiVarConstantPropagationTest, TwoVariables) { Pair(Var("other"), HasConstantVal(2))))))); } -TEST_F(MultiVarConstantPropagationTest, TwoVariablesInBranches) { +TEST(MultiVarConstantPropagationTest, TwoVariablesInBranches) { std::string Code = R"cc( void fun(bool b) { int target; @@ -382,7 +379,7 @@ TEST_F(MultiVarConstantPropagationTest, TwoVariablesInBranches) { Pair(Var("other"), Varies())))))); } -TEST_F(MultiVarConstantPropagationTest, SameAssignmentInBranch) { +TEST(MultiVarConstantPropagationTest, SameAssignmentInBranch) { std::string Code = R"cc( void fun(bool b) { int target = 1; @@ -401,7 +398,7 @@ TEST_F(MultiVarConstantPropagationTest, SameAssignmentInBranch) { Var("target"), HasConstantVal(1))))))); } -TEST_F(MultiVarConstantPropagationTest, NewVarInBranch) { +TEST(MultiVarConstantPropagationTest, NewVarInBranch) { std::string Code = R"cc( void fun(bool b) { if (b) { @@ -428,7 +425,7 @@ TEST_F(MultiVarConstantPropagationTest, NewVarInBranch) { Var("target"), HasConstantVal(1))))))); } -TEST_F(MultiVarConstantPropagationTest, DifferentAssignmentInBranches) { +TEST(MultiVarConstantPropagationTest, DifferentAssignmentInBranches) { std::string Code = R"cc( void fun(bool b) { int target; @@ -455,7 +452,7 @@ TEST_F(MultiVarConstantPropagationTest, DifferentAssignmentInBranches) { Pair(Var("target"), Varies())))))); } -TEST_F(MultiVarConstantPropagationTest, DifferentAssignmentInBranch) { +TEST(MultiVarConstantPropagationTest, DifferentAssignmentInBranch) { std::string Code = R"cc( void fun(bool b) { int target = 1; diff --git a/clang/unittests/Analysis/FlowSensitive/SingleVarConstantPropagationTest.cpp b/clang/unittests/Analysis/FlowSensitive/SingleVarConstantPropagationTest.cpp index 6561385..3c95ead 100644 --- a/clang/unittests/Analysis/FlowSensitive/SingleVarConstantPropagationTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/SingleVarConstantPropagationTest.cpp @@ -184,28 +184,25 @@ MATCHER_P(HoldsCPLattice, m, return ExplainMatchResult(m, arg.Lattice, result_listener); } -class ConstantPropagationTest : public ::testing::Test { -protected: - template <typename Matcher> - void RunDataflow(llvm::StringRef Code, Matcher Expectations) { - ASSERT_THAT_ERROR( - test::checkDataflow<ConstantPropagationAnalysis>( - Code, "fun", - [](ASTContext &C, Environment &) { - return ConstantPropagationAnalysis(C); - }, - [&Expectations]( - llvm::ArrayRef<std::pair< - std::string, DataflowAnalysisState< - ConstantPropagationAnalysis::Lattice>>> - Results, - ASTContext &) { EXPECT_THAT(Results, Expectations); }, - {"-fsyntax-only", "-std=c++17"}), - llvm::Succeeded()); - } -}; +template <typename Matcher> +void RunDataflow(llvm::StringRef Code, Matcher Expectations) { + ASSERT_THAT_ERROR( + test::checkDataflow<ConstantPropagationAnalysis>( + Code, "fun", + [](ASTContext &C, Environment &) { + return ConstantPropagationAnalysis(C); + }, + [&Expectations]( + llvm::ArrayRef<std::pair< + std::string, DataflowAnalysisState< + ConstantPropagationAnalysis::Lattice>>> + Results, + ASTContext &) { EXPECT_THAT(Results, Expectations); }, + {"-fsyntax-only", "-std=c++17"}), + llvm::Succeeded()); +} -TEST_F(ConstantPropagationTest, JustInit) { +TEST(ConstantPropagationTest, JustInit) { std::string Code = R"( void fun() { int target = 1; @@ -217,7 +214,7 @@ TEST_F(ConstantPropagationTest, JustInit) { } // Verifies that the analysis tracks the last variable seen. -TEST_F(ConstantPropagationTest, TwoVariables) { +TEST(ConstantPropagationTest, TwoVariables) { std::string Code = R"( void fun() { int target = 1; @@ -234,7 +231,7 @@ TEST_F(ConstantPropagationTest, TwoVariables) { Pair("p3", HoldsCPLattice(HasConstantVal(3))))); } -TEST_F(ConstantPropagationTest, Assignment) { +TEST(ConstantPropagationTest, Assignment) { std::string Code = R"( void fun() { int target = 1; @@ -248,7 +245,7 @@ TEST_F(ConstantPropagationTest, Assignment) { Pair("p2", HoldsCPLattice(HasConstantVal(2))))); } -TEST_F(ConstantPropagationTest, AssignmentCall) { +TEST(ConstantPropagationTest, AssignmentCall) { std::string Code = R"( int g(); void fun() { @@ -260,7 +257,7 @@ TEST_F(ConstantPropagationTest, AssignmentCall) { RunDataflow(Code, UnorderedElementsAre(Pair("p", HoldsCPLattice(Varies())))); } -TEST_F(ConstantPropagationTest, AssignmentBinOp) { +TEST(ConstantPropagationTest, AssignmentBinOp) { std::string Code = R"( void fun() { int target; @@ -272,7 +269,7 @@ TEST_F(ConstantPropagationTest, AssignmentBinOp) { Code, UnorderedElementsAre(Pair("p", HoldsCPLattice(HasConstantVal(5))))); } -TEST_F(ConstantPropagationTest, PlusAssignment) { +TEST(ConstantPropagationTest, PlusAssignment) { std::string Code = R"( void fun() { int target = 1; @@ -286,7 +283,7 @@ TEST_F(ConstantPropagationTest, PlusAssignment) { Pair("p2", HoldsCPLattice(Varies())))); } -TEST_F(ConstantPropagationTest, SameAssignmentInBranches) { +TEST(ConstantPropagationTest, SameAssignmentInBranches) { std::string Code = R"cc( void fun(bool b) { int target; @@ -309,7 +306,7 @@ TEST_F(ConstantPropagationTest, SameAssignmentInBranches) { Pair("p2", HoldsCPLattice(HasConstantVal(2))))); } -TEST_F(ConstantPropagationTest, SameAssignmentInBranch) { +TEST(ConstantPropagationTest, SameAssignmentInBranch) { std::string Code = R"cc( void fun(bool b) { int target = 1; @@ -326,7 +323,7 @@ TEST_F(ConstantPropagationTest, SameAssignmentInBranch) { Pair("p2", HoldsCPLattice(HasConstantVal(1))))); } -TEST_F(ConstantPropagationTest, NewVarInBranch) { +TEST(ConstantPropagationTest, NewVarInBranch) { std::string Code = R"cc( void fun(bool b) { if (b) { @@ -349,7 +346,7 @@ TEST_F(ConstantPropagationTest, NewVarInBranch) { Pair("p4", HoldsCPLattice(HasConstantVal(1))))); } -TEST_F(ConstantPropagationTest, DifferentAssignmentInBranches) { +TEST(ConstantPropagationTest, DifferentAssignmentInBranches) { std::string Code = R"cc( void fun(bool b) { int target; @@ -372,7 +369,7 @@ TEST_F(ConstantPropagationTest, DifferentAssignmentInBranches) { Pair("p2", HoldsCPLattice(Varies())))); } -TEST_F(ConstantPropagationTest, DifferentAssignmentInBranch) { +TEST(ConstantPropagationTest, DifferentAssignmentInBranch) { std::string Code = R"cc( void fun(bool b) { int target = 1; diff --git a/clang/unittests/Analysis/FlowSensitive/TestingSupportTest.cpp b/clang/unittests/Analysis/FlowSensitive/TestingSupportTest.cpp index 9608790..537bd74 100644 --- a/clang/unittests/Analysis/FlowSensitive/TestingSupportTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/TestingSupportTest.cpp @@ -36,28 +36,25 @@ const FunctionDecl *findTargetFunc(ASTContext &Context, T FunctionMatcher) { return nullptr; } -class BuildStatementToAnnotationMappingTest : public ::testing::Test { -public: - void - runTest(llvm::StringRef Code, llvm::StringRef TargetName, - std::function<void(const llvm::DenseMap<const Stmt *, std::string> &)> - RunChecks) { - llvm::Annotations AnnotatedCode(Code); - auto Unit = tooling::buildASTFromCodeWithArgs( - AnnotatedCode.code(), {"-fsyntax-only", "-std=c++17"}); - auto &Context = Unit->getASTContext(); - const FunctionDecl *Func = findTargetFunc(Context, hasName(TargetName)); - ASSERT_NE(Func, nullptr); - - llvm::Expected<llvm::DenseMap<const Stmt *, std::string>> Mapping = - test::buildStatementToAnnotationMapping(Func, AnnotatedCode); - ASSERT_TRUE(static_cast<bool>(Mapping)); - - RunChecks(Mapping.get()); - } -}; +void runTest( + llvm::StringRef Code, llvm::StringRef TargetName, + std::function<void(const llvm::DenseMap<const Stmt *, std::string> &)> + RunChecks) { + llvm::Annotations AnnotatedCode(Code); + auto Unit = tooling::buildASTFromCodeWithArgs( + AnnotatedCode.code(), {"-fsyntax-only", "-std=c++17"}); + auto &Context = Unit->getASTContext(); + const FunctionDecl *Func = findTargetFunc(Context, hasName(TargetName)); + ASSERT_NE(Func, nullptr); + + llvm::Expected<llvm::DenseMap<const Stmt *, std::string>> Mapping = + test::buildStatementToAnnotationMapping(Func, AnnotatedCode); + ASSERT_TRUE(static_cast<bool>(Mapping)); + + RunChecks(Mapping.get()); +} -TEST_F(BuildStatementToAnnotationMappingTest, ReturnStmt) { +TEST(BuildStatementToAnnotationMappingTest, ReturnStmt) { runTest(R"( int target() { return 42; diff --git a/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp b/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp index 021f8a2..04710b1 100644 --- a/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp @@ -37,33 +37,30 @@ using ::testing::NotNull; using ::testing::Pair; using ::testing::SizeIs; -class TransferTest : public ::testing::Test { -protected: - template <typename Matcher> - void runDataflow(llvm::StringRef Code, Matcher Match, - LangStandard::Kind Std = LangStandard::lang_cxx17, - bool ApplyBuiltinTransfer = true, - llvm::StringRef TargetFun = "target") { - ASSERT_THAT_ERROR( - test::checkDataflow<NoopAnalysis>( - Code, TargetFun, - [ApplyBuiltinTransfer](ASTContext &C, Environment &) { - return NoopAnalysis(C, ApplyBuiltinTransfer); - }, - [&Match]( - llvm::ArrayRef< - std::pair<std::string, DataflowAnalysisState<NoopLattice>>> - Results, - ASTContext &ASTCtx) { Match(Results, ASTCtx); }, - {"-fsyntax-only", "-fno-delayed-template-parsing", - "-std=" + - std::string( - LangStandard::getLangStandardForKind(Std).getName())}), - llvm::Succeeded()); - } -}; +template <typename Matcher> +void runDataflow(llvm::StringRef Code, Matcher Match, + LangStandard::Kind Std = LangStandard::lang_cxx17, + bool ApplyBuiltinTransfer = true, + llvm::StringRef TargetFun = "target") { + ASSERT_THAT_ERROR( + test::checkDataflow<NoopAnalysis>( + Code, TargetFun, + [ApplyBuiltinTransfer](ASTContext &C, Environment &) { + return NoopAnalysis(C, ApplyBuiltinTransfer); + }, + [&Match]( + llvm::ArrayRef< + std::pair<std::string, DataflowAnalysisState<NoopLattice>>> + Results, + ASTContext &ASTCtx) { Match(Results, ASTCtx); }, + {"-fsyntax-only", "-fno-delayed-template-parsing", + "-std=" + + std::string( + LangStandard::getLangStandardForKind(Std).getName())}), + llvm::Succeeded()); +} -TEST_F(TransferTest, IntVarDeclNotTrackedWhenTransferDisabled) { +TEST(TransferTest, IntVarDeclNotTrackedWhenTransferDisabled) { std::string Code = R"( void target() { int Foo; @@ -88,7 +85,7 @@ TEST_F(TransferTest, IntVarDeclNotTrackedWhenTransferDisabled) { /*ApplyBuiltinTransfer=*/false); } -TEST_F(TransferTest, BoolVarDecl) { +TEST(TransferTest, BoolVarDecl) { std::string Code = R"( void target() { bool Foo; @@ -115,7 +112,7 @@ TEST_F(TransferTest, BoolVarDecl) { }); } -TEST_F(TransferTest, IntVarDecl) { +TEST(TransferTest, IntVarDecl) { std::string Code = R"( void target() { int Foo; @@ -142,7 +139,7 @@ TEST_F(TransferTest, IntVarDecl) { }); } -TEST_F(TransferTest, StructVarDecl) { +TEST(TransferTest, StructVarDecl) { std::string Code = R"( struct A { int Bar; @@ -188,7 +185,7 @@ TEST_F(TransferTest, StructVarDecl) { }); } -TEST_F(TransferTest, StructVarDeclWithInit) { +TEST(TransferTest, StructVarDeclWithInit) { std::string Code = R"( struct A { int Bar; @@ -236,7 +233,7 @@ TEST_F(TransferTest, StructVarDeclWithInit) { }); } -TEST_F(TransferTest, ClassVarDecl) { +TEST(TransferTest, ClassVarDecl) { std::string Code = R"( class A { int Bar; @@ -282,7 +279,7 @@ TEST_F(TransferTest, ClassVarDecl) { }); } -TEST_F(TransferTest, ReferenceVarDecl) { +TEST(TransferTest, ReferenceVarDecl) { std::string Code = R"( struct A {}; @@ -318,7 +315,7 @@ TEST_F(TransferTest, ReferenceVarDecl) { }); } -TEST_F(TransferTest, SelfReferentialReferenceVarDecl) { +TEST(TransferTest, SelfReferentialReferenceVarDecl) { std::string Code = R"( struct A; @@ -427,7 +424,7 @@ TEST_F(TransferTest, SelfReferentialReferenceVarDecl) { }); } -TEST_F(TransferTest, PointerVarDecl) { +TEST(TransferTest, PointerVarDecl) { std::string Code = R"( struct A {}; @@ -462,7 +459,7 @@ TEST_F(TransferTest, PointerVarDecl) { }); } -TEST_F(TransferTest, SelfReferentialPointerVarDecl) { +TEST(TransferTest, SelfReferentialPointerVarDecl) { std::string Code = R"( struct A; @@ -584,7 +581,7 @@ TEST_F(TransferTest, SelfReferentialPointerVarDecl) { }); } -TEST_F(TransferTest, MultipleVarsDecl) { +TEST(TransferTest, MultipleVarsDecl) { std::string Code = R"( void target() { int Foo, Bar; @@ -622,7 +619,7 @@ TEST_F(TransferTest, MultipleVarsDecl) { }); } -TEST_F(TransferTest, JoinVarDecl) { +TEST(TransferTest, JoinVarDecl) { std::string Code = R"( void target(bool B) { int Foo; @@ -677,7 +674,7 @@ TEST_F(TransferTest, JoinVarDecl) { }); } -TEST_F(TransferTest, BinaryOperatorAssign) { +TEST(TransferTest, BinaryOperatorAssign) { std::string Code = R"( void target() { int Foo; @@ -707,7 +704,7 @@ TEST_F(TransferTest, BinaryOperatorAssign) { }); } -TEST_F(TransferTest, VarDeclInitAssign) { +TEST(TransferTest, VarDeclInitAssign) { std::string Code = R"( void target() { int Foo; @@ -736,7 +733,7 @@ TEST_F(TransferTest, VarDeclInitAssign) { }); } -TEST_F(TransferTest, VarDeclInitAssignChained) { +TEST(TransferTest, VarDeclInitAssignChained) { std::string Code = R"( void target() { int Foo; @@ -770,7 +767,7 @@ TEST_F(TransferTest, VarDeclInitAssignChained) { }); } -TEST_F(TransferTest, VarDeclInitAssignPtrDeref) { +TEST(TransferTest, VarDeclInitAssignPtrDeref) { std::string Code = R"( void target() { int Foo; @@ -808,7 +805,7 @@ TEST_F(TransferTest, VarDeclInitAssignPtrDeref) { }); } -TEST_F(TransferTest, AssignToAndFromReference) { +TEST(TransferTest, AssignToAndFromReference) { std::string Code = R"( void target() { int Foo; @@ -860,7 +857,7 @@ TEST_F(TransferTest, AssignToAndFromReference) { }); } -TEST_F(TransferTest, MultipleParamDecls) { +TEST(TransferTest, MultipleParamDecls) { std::string Code = R"( void target(int Foo, int Bar) { (void)0; @@ -897,7 +894,7 @@ TEST_F(TransferTest, MultipleParamDecls) { }); } -TEST_F(TransferTest, StructParamDecl) { +TEST(TransferTest, StructParamDecl) { std::string Code = R"( struct A { int Bar; @@ -943,7 +940,7 @@ TEST_F(TransferTest, StructParamDecl) { }); } -TEST_F(TransferTest, ReferenceParamDecl) { +TEST(TransferTest, ReferenceParamDecl) { std::string Code = R"( struct A {}; @@ -979,7 +976,7 @@ TEST_F(TransferTest, ReferenceParamDecl) { }); } -TEST_F(TransferTest, PointerParamDecl) { +TEST(TransferTest, PointerParamDecl) { std::string Code = R"( struct A {}; @@ -1012,7 +1009,7 @@ TEST_F(TransferTest, PointerParamDecl) { }); } -TEST_F(TransferTest, StructMember) { +TEST(TransferTest, StructMember) { std::string Code = R"( struct A { int Bar; @@ -1059,7 +1056,7 @@ TEST_F(TransferTest, StructMember) { }); } -TEST_F(TransferTest, DerivedBaseMemberClass) { +TEST(TransferTest, DerivedBaseMemberClass) { std::string Code = R"( class A { int ADefault; @@ -1211,7 +1208,7 @@ static void derivedBaseMemberExpectations( EXPECT_EQ(Env.getValue(FooLoc.getChild(*BarDecl)), FooVal.getChild(*BarDecl)); } -TEST_F(TransferTest, DerivedBaseMemberStructDefault) { +TEST(TransferTest, DerivedBaseMemberStructDefault) { std::string Code = R"( struct A { int Bar; @@ -1227,7 +1224,7 @@ TEST_F(TransferTest, DerivedBaseMemberStructDefault) { runDataflow(Code, derivedBaseMemberExpectations); } -TEST_F(TransferTest, DerivedBaseMemberPrivateFriend) { +TEST(TransferTest, DerivedBaseMemberPrivateFriend) { // Include an access to `Foo.Bar` to verify the analysis doesn't crash on that // access. std::string Code = R"( @@ -1248,7 +1245,7 @@ TEST_F(TransferTest, DerivedBaseMemberPrivateFriend) { runDataflow(Code, derivedBaseMemberExpectations); } -TEST_F(TransferTest, ClassMember) { +TEST(TransferTest, ClassMember) { std::string Code = R"( class A { public: @@ -1296,7 +1293,7 @@ TEST_F(TransferTest, ClassMember) { }); } -TEST_F(TransferTest, BaseClassInitializer) { +TEST(TransferTest, BaseClassInitializer) { using ast_matchers::cxxConstructorDecl; using ast_matchers::hasName; using ast_matchers::ofClass; @@ -1339,7 +1336,7 @@ TEST_F(TransferTest, BaseClassInitializer) { llvm::Succeeded()); } -TEST_F(TransferTest, ReferenceMember) { +TEST(TransferTest, ReferenceMember) { std::string Code = R"( struct A { int &Bar; @@ -1388,7 +1385,7 @@ TEST_F(TransferTest, ReferenceMember) { }); } -TEST_F(TransferTest, StructThisMember) { +TEST(TransferTest, StructThisMember) { std::string Code = R"( struct A { int Bar; @@ -1464,7 +1461,7 @@ TEST_F(TransferTest, StructThisMember) { }); } -TEST_F(TransferTest, ClassThisMember) { +TEST(TransferTest, ClassThisMember) { std::string Code = R"( class A { int Bar; @@ -1540,7 +1537,7 @@ TEST_F(TransferTest, ClassThisMember) { }); } -TEST_F(TransferTest, StructThisInLambda) { +TEST(TransferTest, StructThisInLambda) { std::string ThisCaptureCode = R"( struct A { void frob() { @@ -1646,7 +1643,7 @@ TEST_F(TransferTest, StructThisInLambda) { LangStandard::lang_cxx17, /*ApplyBuiltinTransfer=*/true, "operator()"); } -TEST_F(TransferTest, ConstructorInitializer) { +TEST(TransferTest, ConstructorInitializer) { std::string Code = R"( struct target { int Bar; @@ -1681,7 +1678,7 @@ TEST_F(TransferTest, ConstructorInitializer) { }); } -TEST_F(TransferTest, DefaultInitializer) { +TEST(TransferTest, DefaultInitializer) { std::string Code = R"( struct target { int Bar; @@ -1717,7 +1714,7 @@ TEST_F(TransferTest, DefaultInitializer) { }); } -TEST_F(TransferTest, DefaultInitializerReference) { +TEST(TransferTest, DefaultInitializerReference) { std::string Code = R"( struct target { int &Bar; @@ -1756,7 +1753,7 @@ TEST_F(TransferTest, DefaultInitializerReference) { }); } -TEST_F(TransferTest, TemporaryObject) { +TEST(TransferTest, TemporaryObject) { std::string Code = R"( struct A { int Bar; @@ -1792,7 +1789,7 @@ TEST_F(TransferTest, TemporaryObject) { }); } -TEST_F(TransferTest, ElidableConstructor) { +TEST(TransferTest, ElidableConstructor) { // This test is effectively the same as TransferTest.TemporaryObject, but // the code is compiled as C++ 14. std::string Code = R"( @@ -1832,7 +1829,7 @@ TEST_F(TransferTest, ElidableConstructor) { LangStandard::lang_cxx14); } -TEST_F(TransferTest, AssignmentOperator) { +TEST(TransferTest, AssignmentOperator) { std::string Code = R"( struct A { int Baz; @@ -1896,7 +1893,7 @@ TEST_F(TransferTest, AssignmentOperator) { }); } -TEST_F(TransferTest, CopyConstructor) { +TEST(TransferTest, CopyConstructor) { std::string Code = R"( struct A { int Baz; @@ -1942,7 +1939,7 @@ TEST_F(TransferTest, CopyConstructor) { }); } -TEST_F(TransferTest, CopyConstructorWithParens) { +TEST(TransferTest, CopyConstructorWithParens) { std::string Code = R"( struct A { int Baz; @@ -1988,7 +1985,7 @@ TEST_F(TransferTest, CopyConstructorWithParens) { }); } -TEST_F(TransferTest, MoveConstructor) { +TEST(TransferTest, MoveConstructor) { std::string Code = R"( namespace std { @@ -2060,7 +2057,7 @@ TEST_F(TransferTest, MoveConstructor) { }); } -TEST_F(TransferTest, BindTemporary) { +TEST(TransferTest, BindTemporary) { std::string Code = R"( struct A { virtual ~A() = default; @@ -2098,7 +2095,7 @@ TEST_F(TransferTest, BindTemporary) { }); } -TEST_F(TransferTest, StaticCast) { +TEST(TransferTest, StaticCast) { std::string Code = R"( void target(int Foo) { int Bar = static_cast<int>(Foo); @@ -2127,7 +2124,7 @@ TEST_F(TransferTest, StaticCast) { }); } -TEST_F(TransferTest, IntegralCast) { +TEST(TransferTest, IntegralCast) { std::string Code = R"( void target(int Foo) { long Bar = Foo; @@ -2156,7 +2153,7 @@ TEST_F(TransferTest, IntegralCast) { }); } -TEST_F(TransferTest, IntegraltoBooleanCast) { +TEST(TransferTest, IntegraltoBooleanCast) { std::string Code = R"( void target(int Foo) { bool Bar = Foo; @@ -2184,7 +2181,7 @@ TEST_F(TransferTest, IntegraltoBooleanCast) { }); } -TEST_F(TransferTest, IntegralToBooleanCastFromBool) { +TEST(TransferTest, IntegralToBooleanCastFromBool) { std::string Code = R"( void target(bool Foo) { int Zab = Foo; @@ -2214,7 +2211,7 @@ TEST_F(TransferTest, IntegralToBooleanCastFromBool) { }); } -TEST_F(TransferTest, NullToPointerCast) { +TEST(TransferTest, NullToPointerCast) { std::string Code = R"( struct Baz {}; void target() { @@ -2273,7 +2270,7 @@ TEST_F(TransferTest, NullToPointerCast) { }); } -TEST_F(TransferTest, NullToMemberPointerCast) { +TEST(TransferTest, NullToMemberPointerCast) { std::string Code = R"( struct Foo {}; void target(Foo *Foo) { @@ -2301,7 +2298,7 @@ TEST_F(TransferTest, NullToMemberPointerCast) { }); } -TEST_F(TransferTest, AddrOfValue) { +TEST(TransferTest, AddrOfValue) { std::string Code = R"( void target() { int Foo; @@ -2331,7 +2328,7 @@ TEST_F(TransferTest, AddrOfValue) { }); } -TEST_F(TransferTest, AddrOfReference) { +TEST(TransferTest, AddrOfReference) { std::string Code = R"( void target(int *Foo) { int *Bar = &(*Foo); @@ -2360,7 +2357,7 @@ TEST_F(TransferTest, AddrOfReference) { }); } -TEST_F(TransferTest, DerefDependentPtr) { +TEST(TransferTest, DerefDependentPtr) { std::string Code = R"( template <typename T> void target(T *Foo) { @@ -2390,7 +2387,7 @@ TEST_F(TransferTest, DerefDependentPtr) { }); } -TEST_F(TransferTest, VarDeclInitAssignConditionalOperator) { +TEST(TransferTest, VarDeclInitAssignConditionalOperator) { std::string Code = R"( struct A {}; @@ -2430,7 +2427,7 @@ TEST_F(TransferTest, VarDeclInitAssignConditionalOperator) { }); } -TEST_F(TransferTest, VarDeclInDoWhile) { +TEST(TransferTest, VarDeclInDoWhile) { std::string Code = R"( void target(int *Foo) { do { @@ -2467,7 +2464,7 @@ TEST_F(TransferTest, VarDeclInDoWhile) { }); } -TEST_F(TransferTest, AggregateInitialization) { +TEST(TransferTest, AggregateInitialization) { std::string BracesCode = R"( struct A { int Foo; @@ -2554,7 +2551,7 @@ TEST_F(TransferTest, AggregateInitialization) { } } -TEST_F(TransferTest, AssignToUnionMember) { +TEST(TransferTest, AssignToUnionMember) { std::string Code = R"( union A { int Foo; @@ -2587,7 +2584,7 @@ TEST_F(TransferTest, AssignToUnionMember) { }); } -TEST_F(TransferTest, AssignFromBoolLiteral) { +TEST(TransferTest, AssignFromBoolLiteral) { std::string Code = R"( void target() { bool Foo = true; @@ -2622,7 +2619,7 @@ TEST_F(TransferTest, AssignFromBoolLiteral) { }); } -TEST_F(TransferTest, AssignFromCompositeBoolExpression) { +TEST(TransferTest, AssignFromCompositeBoolExpression) { { std::string Code = R"( void target(bool Foo, bool Bar, bool Qux) { @@ -2788,7 +2785,7 @@ TEST_F(TransferTest, AssignFromCompositeBoolExpression) { } } -TEST_F(TransferTest, AssignFromBoolNegation) { +TEST(TransferTest, AssignFromBoolNegation) { std::string Code = R"( void target() { bool Foo = true; @@ -2822,7 +2819,7 @@ TEST_F(TransferTest, AssignFromBoolNegation) { }); } -TEST_F(TransferTest, BuiltinExpect) { +TEST(TransferTest, BuiltinExpect) { std::string Code = R"( void target(long Foo) { long Bar = __builtin_expect(Foo, true); @@ -2851,7 +2848,7 @@ TEST_F(TransferTest, BuiltinExpect) { // `__builtin_expect` takes and returns a `long` argument, so other types // involve casts. This verifies that we identify the input and output in that // case. -TEST_F(TransferTest, BuiltinExpectBoolArg) { +TEST(TransferTest, BuiltinExpectBoolArg) { std::string Code = R"( void target(bool Foo) { bool Bar = __builtin_expect(Foo, true); @@ -2877,7 +2874,7 @@ TEST_F(TransferTest, BuiltinExpectBoolArg) { }); } -TEST_F(TransferTest, BuiltinUnreachable) { +TEST(TransferTest, BuiltinUnreachable) { std::string Code = R"( void target(bool Foo) { bool Bar = false; @@ -2911,7 +2908,7 @@ TEST_F(TransferTest, BuiltinUnreachable) { }); } -TEST_F(TransferTest, BuiltinTrap) { +TEST(TransferTest, BuiltinTrap) { std::string Code = R"( void target(bool Foo) { bool Bar = false; @@ -2944,7 +2941,7 @@ TEST_F(TransferTest, BuiltinTrap) { }); } -TEST_F(TransferTest, BuiltinDebugTrap) { +TEST(TransferTest, BuiltinDebugTrap) { std::string Code = R"( void target(bool Foo) { bool Bar = false; @@ -2976,7 +2973,7 @@ TEST_F(TransferTest, BuiltinDebugTrap) { }); } -TEST_F(TransferTest, StaticIntSingleVarDecl) { +TEST(TransferTest, StaticIntSingleVarDecl) { std::string Code = R"( void target() { static int Foo; @@ -3003,7 +3000,7 @@ TEST_F(TransferTest, StaticIntSingleVarDecl) { }); } -TEST_F(TransferTest, StaticIntGroupVarDecl) { +TEST(TransferTest, StaticIntGroupVarDecl) { std::string Code = R"( void target() { static int Foo, Bar; @@ -3043,7 +3040,7 @@ TEST_F(TransferTest, StaticIntGroupVarDecl) { }); } -TEST_F(TransferTest, GlobalIntVarDecl) { +TEST(TransferTest, GlobalIntVarDecl) { std::string Code = R"( static int Foo; @@ -3075,7 +3072,7 @@ TEST_F(TransferTest, GlobalIntVarDecl) { }); } -TEST_F(TransferTest, StaticMemberIntVarDecl) { +TEST(TransferTest, StaticMemberIntVarDecl) { std::string Code = R"( struct A { static int Foo; @@ -3109,7 +3106,7 @@ TEST_F(TransferTest, StaticMemberIntVarDecl) { }); } -TEST_F(TransferTest, StaticMemberRefVarDecl) { +TEST(TransferTest, StaticMemberRefVarDecl) { std::string Code = R"( struct A { static int &Foo; @@ -3143,7 +3140,7 @@ TEST_F(TransferTest, StaticMemberRefVarDecl) { }); } -TEST_F(TransferTest, AssignMemberBeforeCopy) { +TEST(TransferTest, AssignMemberBeforeCopy) { std::string Code = R"( struct A { int Foo; @@ -3187,7 +3184,7 @@ TEST_F(TransferTest, AssignMemberBeforeCopy) { }); } -TEST_F(TransferTest, BooleanEquality) { +TEST(TransferTest, BooleanEquality) { std::string Code = R"( void target(bool Bar) { bool Foo = true; @@ -3222,7 +3219,7 @@ TEST_F(TransferTest, BooleanEquality) { }); } -TEST_F(TransferTest, BooleanInequality) { +TEST(TransferTest, BooleanInequality) { std::string Code = R"( void target(bool Bar) { bool Foo = true; @@ -3257,7 +3254,7 @@ TEST_F(TransferTest, BooleanInequality) { }); } -TEST_F(TransferTest, CorrelatedBranches) { +TEST(TransferTest, CorrelatedBranches) { std::string Code = R"( void target(bool B, bool C) { if (B) { @@ -3311,7 +3308,7 @@ TEST_F(TransferTest, CorrelatedBranches) { }); } -TEST_F(TransferTest, LoopWithAssignmentConverges) { +TEST(TransferTest, LoopWithAssignmentConverges) { std::string Code = R"( bool &foo(); @@ -3344,7 +3341,7 @@ TEST_F(TransferTest, LoopWithAssignmentConverges) { }); } -TEST_F(TransferTest, LoopWithReferenceAssignmentConverges) { +TEST(TransferTest, LoopWithReferenceAssignmentConverges) { std::string Code = R"( bool &foo(); @@ -3378,7 +3375,7 @@ TEST_F(TransferTest, LoopWithReferenceAssignmentConverges) { }); } -TEST_F(TransferTest, LoopWithStructReferenceAssignmentConverges) { +TEST(TransferTest, LoopWithStructReferenceAssignmentConverges) { std::string Code = R"( struct Lookup { int x; @@ -3433,7 +3430,7 @@ TEST_F(TransferTest, LoopWithStructReferenceAssignmentConverges) { }); } -TEST_F(TransferTest, DoesNotCrashOnUnionThisExpr) { +TEST(TransferTest, DoesNotCrashOnUnionThisExpr) { std::string Code = R"( union Union { int A; @@ -3456,7 +3453,7 @@ TEST_F(TransferTest, DoesNotCrashOnUnionThisExpr) { LangStandard::lang_cxx17, /*ApplyBuiltinTransfer=*/true, "operator="); } -TEST_F(TransferTest, StructuredBindingAssignFromStructIntMembersToRefs) { +TEST(TransferTest, StructuredBindingAssignFromStructIntMembersToRefs) { std::string Code = R"( struct A { int Foo; @@ -3519,7 +3516,7 @@ TEST_F(TransferTest, StructuredBindingAssignFromStructIntMembersToRefs) { }); } -TEST_F(TransferTest, StructuredBindingAssignFromStructRefMembersToRefs) { +TEST(TransferTest, StructuredBindingAssignFromStructRefMembersToRefs) { std::string Code = R"( struct A { int &Foo; @@ -3581,7 +3578,7 @@ TEST_F(TransferTest, StructuredBindingAssignFromStructRefMembersToRefs) { }); } -TEST_F(TransferTest, StructuredBindingAssignFromStructIntMembersToInts) { +TEST(TransferTest, StructuredBindingAssignFromStructIntMembersToInts) { std::string Code = R"( struct A { int Foo; @@ -3644,7 +3641,7 @@ TEST_F(TransferTest, StructuredBindingAssignFromStructIntMembersToInts) { }); } -TEST_F(TransferTest, BinaryOperatorComma) { +TEST(TransferTest, BinaryOperatorComma) { std::string Code = R"( void target(int Foo, int Bar) { int &Baz = (Foo, Bar); @@ -3675,7 +3672,7 @@ TEST_F(TransferTest, BinaryOperatorComma) { }); } -TEST_F(TransferTest, IfStmtBranchExtendsFlowCondition) { +TEST(TransferTest, IfStmtBranchExtendsFlowCondition) { std::string Code = R"( void target(bool Foo) { if (Foo) { @@ -3710,7 +3707,7 @@ TEST_F(TransferTest, IfStmtBranchExtendsFlowCondition) { }); } -TEST_F(TransferTest, WhileStmtBranchExtendsFlowCondition) { +TEST(TransferTest, WhileStmtBranchExtendsFlowCondition) { std::string Code = R"( void target(bool Foo) { while (Foo) { @@ -3745,7 +3742,7 @@ TEST_F(TransferTest, WhileStmtBranchExtendsFlowCondition) { }); } -TEST_F(TransferTest, DoWhileStmtBranchExtendsFlowCondition) { +TEST(TransferTest, DoWhileStmtBranchExtendsFlowCondition) { std::string Code = R"( void target(bool Foo) { bool Bar = true; @@ -3792,7 +3789,7 @@ TEST_F(TransferTest, DoWhileStmtBranchExtendsFlowCondition) { }); } -TEST_F(TransferTest, ForStmtBranchExtendsFlowCondition) { +TEST(TransferTest, ForStmtBranchExtendsFlowCondition) { std::string Code = R"( void target(bool Foo) { for (; Foo;) { @@ -3827,7 +3824,7 @@ TEST_F(TransferTest, ForStmtBranchExtendsFlowCondition) { }); } -TEST_F(TransferTest, ForStmtBranchWithoutConditionDoesNotExtendFlowCondition) { +TEST(TransferTest, ForStmtBranchWithoutConditionDoesNotExtendFlowCondition) { std::string Code = R"( void target(bool Foo) { for (;;) { |