[PATCH] D158848: [clang][dataflow] Support range-for loops in fixpoint algorithm.
This revision was automatically updated to reflect the committed changes. Closed by commit rG824b13659130: [clang][dataflow] Support range-for loops in fixpoint algorithm. (authored by ymandel). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158848/new/ https://reviews.llvm.org/D158848 Files: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp Index: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp === --- clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp +++ clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp @@ -1612,4 +1612,21 @@ }); } + +TEST_F(TopTest, ForRangeStmtConverges) { + std::string Code = R"( +void target(bool Foo) { + int Ints[10]; + bool B = false; + for (int I : Ints) +B = true; +} + )"; + runDataflow(Code, + [](const llvm::StringMap> &, + const AnalysisOutputs &) { +// No additional expectations. We're only checking that the +// analysis converged. + }); +} } // namespace Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp === --- clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -21,6 +21,7 @@ #include "clang/AST/ASTDumper.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/OperationKinds.h" +#include "clang/AST/StmtCXX.h" #include "clang/AST/StmtVisitor.h" #include "clang/Analysis/Analyses/PostOrderCFGView.h" #include "clang/Analysis/CFG.h" @@ -58,6 +59,7 @@ case Stmt::WhileStmtClass: case Stmt::DoStmtClass: case Stmt::ForStmtClass: + case Stmt::CXXForRangeStmtClass: return true; default: return false; @@ -108,6 +110,12 @@ return {nullptr, false}; } + TerminatorVisitorRetTy VisitCXXForRangeStmt(const CXXForRangeStmt *) { +// Don't do anything special for CXXForRangeStmt, because the condition +// (being implicitly generated) isn't visible from the loop body. +return {nullptr, false}; + } + TerminatorVisitorRetTy VisitBinaryOperator(const BinaryOperator *S) { assert(S->getOpcode() == BO_LAnd || S->getOpcode() == BO_LOr); auto *LHS = S->getLHS(); Index: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp === --- clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp +++ clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp @@ -1612,4 +1612,21 @@ }); } + +TEST_F(TopTest, ForRangeStmtConverges) { + std::string Code = R"( +void target(bool Foo) { + int Ints[10]; + bool B = false; + for (int I : Ints) +B = true; +} + )"; + runDataflow(Code, + [](const llvm::StringMap> &, + const AnalysisOutputs &) { +// No additional expectations. We're only checking that the +// analysis converged. + }); +} } // namespace Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp === --- clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -21,6 +21,7 @@ #include "clang/AST/ASTDumper.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/OperationKinds.h" +#include "clang/AST/StmtCXX.h" #include "clang/AST/StmtVisitor.h" #include "clang/Analysis/Analyses/PostOrderCFGView.h" #include "clang/Analysis/CFG.h" @@ -58,6 +59,7 @@ case Stmt::WhileStmtClass: case Stmt::DoStmtClass: case Stmt::ForStmtClass: + case Stmt::CXXForRangeStmtClass: return true; default: return false; @@ -108,6 +110,12 @@ return {nullptr, false}; } + TerminatorVisitorRetTy VisitCXXForRangeStmt(const CXXForRangeStmt *) { +// Don't do anything special for CXXForRangeStmt, because the condition +// (being implicitly generated) isn't visible from the loop body. +return {nullptr, false}; + } + TerminatorVisitorRetTy VisitBinaryOperator(const BinaryOperator *S) { assert(S->getOpcode() == BO_LAnd || S->getOpcode() == BO_LOr); auto *LHS = S->getLHS(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D158848: [clang][dataflow] Support range-for loops in fixpoint algorithm.
ymandel updated this revision to Diff 553958. ymandel added a comment. clang-format Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158848/new/ https://reviews.llvm.org/D158848 Files: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp Index: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp === --- clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp +++ clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp @@ -1612,4 +1612,21 @@ }); } + +TEST_F(TopTest, ForRangeStmtConverges) { + std::string Code = R"( +void target(bool Foo) { + int Ints[10]; + bool B = false; + for (int I : Ints) +B = true; +} + )"; + runDataflow(Code, + [](const llvm::StringMap> &, + const AnalysisOutputs &) { +// No additional expectations. We're only checking that the +// analysis converged. + }); +} } // namespace Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp === --- clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -21,6 +21,7 @@ #include "clang/AST/ASTDumper.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/OperationKinds.h" +#include "clang/AST/StmtCXX.h" #include "clang/AST/StmtVisitor.h" #include "clang/Analysis/Analyses/PostOrderCFGView.h" #include "clang/Analysis/CFG.h" @@ -58,6 +59,7 @@ case Stmt::WhileStmtClass: case Stmt::DoStmtClass: case Stmt::ForStmtClass: + case Stmt::CXXForRangeStmtClass: return true; default: return false; @@ -108,6 +110,12 @@ return {nullptr, false}; } + TerminatorVisitorRetTy VisitCXXForRangeStmt(const CXXForRangeStmt *) { +// Don't do anything special for CXXForRangeStmt, because the condition +// (being implicitly generated) isn't visible from the loop body. +return {nullptr, false}; + } + TerminatorVisitorRetTy VisitBinaryOperator(const BinaryOperator *S) { assert(S->getOpcode() == BO_LAnd || S->getOpcode() == BO_LOr); auto *LHS = S->getLHS(); Index: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp === --- clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp +++ clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp @@ -1612,4 +1612,21 @@ }); } + +TEST_F(TopTest, ForRangeStmtConverges) { + std::string Code = R"( +void target(bool Foo) { + int Ints[10]; + bool B = false; + for (int I : Ints) +B = true; +} + )"; + runDataflow(Code, + [](const llvm::StringMap> &, + const AnalysisOutputs &) { +// No additional expectations. We're only checking that the +// analysis converged. + }); +} } // namespace Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp === --- clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -21,6 +21,7 @@ #include "clang/AST/ASTDumper.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/OperationKinds.h" +#include "clang/AST/StmtCXX.h" #include "clang/AST/StmtVisitor.h" #include "clang/Analysis/Analyses/PostOrderCFGView.h" #include "clang/Analysis/CFG.h" @@ -58,6 +59,7 @@ case Stmt::WhileStmtClass: case Stmt::DoStmtClass: case Stmt::ForStmtClass: + case Stmt::CXXForRangeStmtClass: return true; default: return false; @@ -108,6 +110,12 @@ return {nullptr, false}; } + TerminatorVisitorRetTy VisitCXXForRangeStmt(const CXXForRangeStmt *) { +// Don't do anything special for CXXForRangeStmt, because the condition +// (being implicitly generated) isn't visible from the loop body. +return {nullptr, false}; + } + TerminatorVisitorRetTy VisitBinaryOperator(const BinaryOperator *S) { assert(S->getOpcode() == BO_LAnd || S->getOpcode() == BO_LOr); auto *LHS = S->getLHS(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D158848: [clang][dataflow] Support range-for loops in fixpoint algorithm.
ymandel added inline comments. Comment at: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp:1631 + const AnalysisOutputs &) { +EXPECT_THAT(Results.keys(), UnorderedElementsAre("after_loop")); + }); mboehme wrote: > Is this check (and the `(void)0` with the `[[after_loop]` annotation) > actually needed? > > IIUC, the condition we want to test is that the analysis converges. The fact > that it produces a `Results` entry for `[[after_loop]]` is really more a > check of the testing infrastructure rather than the analysis itself? Correct. I thought it would be useful to include some expectations, but those are really quite independent, so I've removed them. We could go further and call `runAnalysis` instead of `runDataflow`, but I prefer the latter for consistency (in terms of build args and the like) with the other tests in this suite. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158848/new/ https://reviews.llvm.org/D158848 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D158848: [clang][dataflow] Support range-for loops in fixpoint algorithm.
ymandel updated this revision to Diff 553929. ymandel marked 2 inline comments as done. ymandel added a comment. address review comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158848/new/ https://reviews.llvm.org/D158848 Files: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp Index: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp === --- clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp +++ clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp @@ -1612,4 +1612,21 @@ }); } + +TEST_F(TopTest, ForRangeStmtConverges) { + std::string Code = R"( +void target(bool Foo) { + int Ints[10]; + bool B = false; + for (int I : Ints) +B = true; +} + )"; + runDataflow(Code, + [](const llvm::StringMap> &, + const AnalysisOutputs &) { +// No additional expectations. We're only checking that the +// analysis converged. + }); +} } // namespace Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp === --- clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -21,6 +21,7 @@ #include "clang/AST/ASTDumper.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/OperationKinds.h" +#include "clang/AST/StmtCXX.h" #include "clang/AST/StmtVisitor.h" #include "clang/Analysis/Analyses/PostOrderCFGView.h" #include "clang/Analysis/CFG.h" @@ -58,6 +59,7 @@ case Stmt::WhileStmtClass: case Stmt::DoStmtClass: case Stmt::ForStmtClass: + case Stmt::CXXForRangeStmtClass: return true; default: return false; @@ -108,6 +110,12 @@ return {nullptr, false}; } + TerminatorVisitorRetTy VisitCXXForRangeStmt(const CXXForRangeStmt*) { +// Don't do anything special for CXXForRangeStmt, because the condition +// (being implicitly generated) isn't visible from the loop body. +return {nullptr, false}; + } + TerminatorVisitorRetTy VisitBinaryOperator(const BinaryOperator *S) { assert(S->getOpcode() == BO_LAnd || S->getOpcode() == BO_LOr); auto *LHS = S->getLHS(); Index: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp === --- clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp +++ clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp @@ -1612,4 +1612,21 @@ }); } + +TEST_F(TopTest, ForRangeStmtConverges) { + std::string Code = R"( +void target(bool Foo) { + int Ints[10]; + bool B = false; + for (int I : Ints) +B = true; +} + )"; + runDataflow(Code, + [](const llvm::StringMap> &, + const AnalysisOutputs &) { +// No additional expectations. We're only checking that the +// analysis converged. + }); +} } // namespace Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp === --- clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -21,6 +21,7 @@ #include "clang/AST/ASTDumper.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/OperationKinds.h" +#include "clang/AST/StmtCXX.h" #include "clang/AST/StmtVisitor.h" #include "clang/Analysis/Analyses/PostOrderCFGView.h" #include "clang/Analysis/CFG.h" @@ -58,6 +59,7 @@ case Stmt::WhileStmtClass: case Stmt::DoStmtClass: case Stmt::ForStmtClass: + case Stmt::CXXForRangeStmtClass: return true; default: return false; @@ -108,6 +110,12 @@ return {nullptr, false}; } + TerminatorVisitorRetTy VisitCXXForRangeStmt(const CXXForRangeStmt*) { +// Don't do anything special for CXXForRangeStmt, because the condition +// (being implicitly generated) isn't visible from the loop body. +return {nullptr, false}; + } + TerminatorVisitorRetTy VisitBinaryOperator(const BinaryOperator *S) { assert(S->getOpcode() == BO_LAnd || S->getOpcode() == BO_LOr); auto *LHS = S->getLHS(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D158848: [clang][dataflow] Support range-for loops in fixpoint algorithm.
mboehme accepted this revision. mboehme added inline comments. Comment at: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:113 + // Don't do anything special for CXXForRangeStmt, because the condition (being + // implicitly generated) isn't visible from the loop body. + Making this purely a comment might risk getting it attached to the wrong method. Consider adding an empty `VisitCXXForRangeStmt()`, which would make the "do nothing" behavior explicit in code? Comment at: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp:1631 + const AnalysisOutputs &) { +EXPECT_THAT(Results.keys(), UnorderedElementsAre("after_loop")); + }); Is this check (and the `(void)0` with the `[[after_loop]` annotation) actually needed? IIUC, the condition we want to test is that the analysis converges. The fact that it produces a `Results` entry for `[[after_loop]]` is really more a check of the testing infrastructure rather than the analysis itself? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158848/new/ https://reviews.llvm.org/D158848 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D158848: [clang][dataflow] Support range-for loops in fixpoint algorithm.
ymandel updated this revision to Diff 553505. ymandel added a comment. fix test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158848/new/ https://reviews.llvm.org/D158848 Files: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp Index: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp === --- clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp +++ clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp @@ -1612,4 +1612,23 @@ }); } + +TEST_F(TopTest, ForRangeStmtConverges) { + std::string Code = R"( +void target(bool Foo) { + int Ints[10]; + bool B = false; + for (int I : Ints) +B = true; + (void)0; + // [[after_loop]] +} + )"; + runDataflow( + Code, + [](const llvm::StringMap> , + const AnalysisOutputs &) { +EXPECT_THAT(Results.keys(), UnorderedElementsAre("after_loop")); + }); +} } // namespace Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp === --- clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -58,6 +58,7 @@ case Stmt::WhileStmtClass: case Stmt::DoStmtClass: case Stmt::ForStmtClass: + case Stmt::CXXForRangeStmtClass: return true; default: return false; @@ -108,6 +109,9 @@ return {nullptr, false}; } + // Don't do anything special for CXXForRangeStmt, because the condition (being + // implicitly generated) isn't visible from the loop body. + TerminatorVisitorRetTy VisitBinaryOperator(const BinaryOperator *S) { assert(S->getOpcode() == BO_LAnd || S->getOpcode() == BO_LOr); auto *LHS = S->getLHS(); Index: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp === --- clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp +++ clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp @@ -1612,4 +1612,23 @@ }); } + +TEST_F(TopTest, ForRangeStmtConverges) { + std::string Code = R"( +void target(bool Foo) { + int Ints[10]; + bool B = false; + for (int I : Ints) +B = true; + (void)0; + // [[after_loop]] +} + )"; + runDataflow( + Code, + [](const llvm::StringMap> , + const AnalysisOutputs &) { +EXPECT_THAT(Results.keys(), UnorderedElementsAre("after_loop")); + }); +} } // namespace Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp === --- clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -58,6 +58,7 @@ case Stmt::WhileStmtClass: case Stmt::DoStmtClass: case Stmt::ForStmtClass: + case Stmt::CXXForRangeStmtClass: return true; default: return false; @@ -108,6 +109,9 @@ return {nullptr, false}; } + // Don't do anything special for CXXForRangeStmt, because the condition (being + // implicitly generated) isn't visible from the loop body. + TerminatorVisitorRetTy VisitBinaryOperator(const BinaryOperator *S) { assert(S->getOpcode() == BO_LAnd || S->getOpcode() == BO_LOr); auto *LHS = S->getLHS(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D158848: [clang][dataflow] Support range-for loops in fixpoint algorithm.
ymandel created this revision. ymandel added reviewers: mboehme, xazax.hun. Herald added a subscriber: martong. Herald added a reviewer: NoQ. Herald added a project: All. ymandel requested review of this revision. Herald added a project: clang. Adds support for recognizing range-for loops in the main algorithm for computing the model fixpoint. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D158848 Files: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp Index: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp === --- clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp +++ clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp @@ -1612,4 +1612,24 @@ }); } + +TEST_F(TopTest, ForRangeStmtConverges) { + std::string Code = R"( +void target(bool Foo) { + int Ints[10]; + bool B = false; + for (int I : Ints) +B = true; + (void)0; + // [[after_loop]] +} + )"; + runDataflow( + Code, + [](const llvm::StringMap> , + const AnalysisOutputs &) { +EXPECT_THAT(Results.keys(), +UnorderedElementsAre("loop_body", "after_loop")); + }); +} } // namespace Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp === --- clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -58,6 +58,7 @@ case Stmt::WhileStmtClass: case Stmt::DoStmtClass: case Stmt::ForStmtClass: + case Stmt::CXXForRangeStmtClass: return true; default: return false; @@ -108,6 +109,9 @@ return {nullptr, false}; } + // Don't do anything special for CXXForRangeStmt, because the condition (being + // implicitly generated) isn't visible from the loop body. + TerminatorVisitorRetTy VisitBinaryOperator(const BinaryOperator *S) { assert(S->getOpcode() == BO_LAnd || S->getOpcode() == BO_LOr); auto *LHS = S->getLHS(); Index: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp === --- clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp +++ clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp @@ -1612,4 +1612,24 @@ }); } + +TEST_F(TopTest, ForRangeStmtConverges) { + std::string Code = R"( +void target(bool Foo) { + int Ints[10]; + bool B = false; + for (int I : Ints) +B = true; + (void)0; + // [[after_loop]] +} + )"; + runDataflow( + Code, + [](const llvm::StringMap> , + const AnalysisOutputs &) { +EXPECT_THAT(Results.keys(), +UnorderedElementsAre("loop_body", "after_loop")); + }); +} } // namespace Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp === --- clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -58,6 +58,7 @@ case Stmt::WhileStmtClass: case Stmt::DoStmtClass: case Stmt::ForStmtClass: + case Stmt::CXXForRangeStmtClass: return true; default: return false; @@ -108,6 +109,9 @@ return {nullptr, false}; } + // Don't do anything special for CXXForRangeStmt, because the condition (being + // implicitly generated) isn't visible from the loop body. + TerminatorVisitorRetTy VisitBinaryOperator(const BinaryOperator *S) { assert(S->getOpcode() == BO_LAnd || S->getOpcode() == BO_LOr); auto *LHS = S->getLHS(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits