From 83bc3d95b87e22bc0442e16ed9e109b7544d797b Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Fri, 19 Jan 2024 19:54:38 +0000 Subject: [PATCH] fixup! [clang][dataflow] Make cap on block visits configurable by caller. address comments --- .../Analysis/FlowSensitive/DataflowAnalysis.h | 22 +++++++------------ .../TypeErasedDataflowAnalysis.h | 2 +- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h index 6426fc1a3aff14..b95095d2184c0e 100644 --- a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h +++ b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h @@ -187,13 +187,11 @@ template struct DataflowAnalysisState { /// `PostVisitCFG` on each CFG element with the final analysis results at that /// program point. /// -/// `MaxBlockVisits` caps the number of block visits during analysis. It doesn't -/// distinguish between repeat visits to the same block and visits to distinct -/// blocks. This parameter is a backstop to prevent infintite loops, in the case -/// of bugs in the lattice and/or transfer functions that prevent the analysis -/// from converging. The default value is essentially arbitrary -- large enough -/// to accomodate what seems like any reasonable CFG, but still small enough to -/// limit the cost of hitting the limit. +/// `MaxBlockVisits` caps the number of block visits during analysis. See +/// `runTypeErasedDataflowAnalysis` for a full description. The default value is +/// essentially arbitrary -- large enough to accommodate what seems like any +/// reasonable CFG, but still small enough to limit the cost of hitting the +/// limit. template llvm::Expected>>> @@ -271,13 +269,9 @@ auto createAnalysis(ASTContext &ASTCtx, Environment &Env) /// - This limit is still low enough to keep runtimes acceptable (on typical /// machines) in cases where we hit the limit. /// -/// `MaxBlockVisits` caps the number of block visits during analysis. It doesn't -/// distinguish between repeat visits to the same block and visits to distinct -/// blocks. This parameter is a backstop to prevent infintite loops, in the case -/// of bugs in the lattice and/or transfer functions that prevent the analysis -/// from converging. The default value is essentially arbitrary -- large enough -/// to accomodate what seems like any reasonable CFG, but still small enough to -/// limit the cost of hitting the limit. +/// `MaxBlockVisits` caps the number of block visits during analysis. See +/// `runDataflowAnalysis` for a full description and explanation of the default +/// value. template llvm::Expected> diagnoseFunction( const FunctionDecl &FuncDecl, ASTContext &ASTCtx, diff --git a/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h b/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h index edc582ac938fa2..a0ca7440230b04 100644 --- a/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h +++ b/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h @@ -141,7 +141,7 @@ struct TypeErasedDataflowAnalysisState { /// /// `MaxBlockVisits` caps the number of block visits during analysis. It doesn't /// distinguish between repeat visits to the same block and visits to distinct -/// blocks. This parameter is a backstop to prevent infintite loops, in the case +/// blocks. This parameter is a backstop to prevent infinite loops, in the case /// of bugs in the lattice and/or transfer functions that prevent the analysis /// from converging. llvm::Expected>>