================
@@ -28,24 +28,46 @@
#include "llvm/Support/TimeProfiler.h"
#include <memory>
+#undef DEBUG_TYPE
+#define DEBUG_TYPE "lifetime-safety"
+
namespace clang::lifetimes {
namespace internal {
LifetimeSafetyAnalysis::LifetimeSafetyAnalysis(AnalysisDeclContext &AC,
- LifetimeSafetyReporter
*Reporter)
- : AC(AC), Reporter(Reporter) {}
+ LifetimeSafetyReporter
*Reporter,
+ uint32_t CfgBlocknumThreshold)
+ : CfgBlocknumThreshold(CfgBlocknumThreshold), AC(AC), Reporter(Reporter) {
+ FactMgr.setBlockNumThreshold(CfgBlocknumThreshold);
+}
+
+bool LifetimeSafetyAnalysis::shouldBailOutCFGPreFactGeneration(const CFG& Cfg)
const {
+ if ((CfgBlocknumThreshold > 0) &&
+ (Cfg.getNumBlockIDs() > CfgBlocknumThreshold)) {
+ LLVM_DEBUG(llvm::dbgs()
+ << "Aborting Lifetime Safety analysis for current CFG as it has
"
+ "blocks exceeding the thresold. Number of blocks: "
+ << Cfg.getNumBlockIDs() << "\n");
----------------
usx95 wrote:
Suggestion:
`LifetimeSafety: Skipping function <FN_NAME> due to large CFG: <count> blocks
(threshold: <threshold>)`
See `FactManager::dump()` for function name extraction.
https://github.com/llvm/llvm-project/pull/170444
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits