[clang] Thread safety analysis: provide printSCFG definition. (PR #80277)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 1 03:45:02 PST 2024


https://github.com/hokein created https://github.com/llvm/llvm-project/pull/80277

I called this function when investigating the issue (https://github.com/llvm/llvm-project/issues/78131), and I was surprised to see the definition is commented out.

I think it makes sense to provide the definition even though the implementation is not stable.

>From bb1a8f86e0b9ce3748af03625757d20900e053fc Mon Sep 17 00:00:00 2001
From: Haojian Wu <hokein.wu at gmail.com>
Date: Thu, 1 Feb 2024 12:41:29 +0100
Subject: [PATCH] Thread safety analysis: provide printSCFG definition.

I'm calling this function when investigating the issue (https://github.com/llvm/llvm-project/issues/78131), and I'm
surprised to see the definition is commented out.

I think it makes sense to provide the definition even though the
implementation is not stable.
---
 clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h | 1 +
 clang/lib/Analysis/ThreadSafetyCommon.cpp                  | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h b/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
index 13e37ac2b56b6..4edd3374dd61b 100644
--- a/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
+++ b/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
@@ -528,6 +528,7 @@ class SExprBuilder {
 };
 
 // Dump an SCFG to llvm::errs().
+// The implementation is not stable, and used for debugging only.
 void printSCFG(CFGWalker &Walker);
 
 } // namespace threadSafety
diff --git a/clang/lib/Analysis/ThreadSafetyCommon.cpp b/clang/lib/Analysis/ThreadSafetyCommon.cpp
index 2fe0f85897c3b..fc5b7d3b6f197 100644
--- a/clang/lib/Analysis/ThreadSafetyCommon.cpp
+++ b/clang/lib/Analysis/ThreadSafetyCommon.cpp
@@ -995,7 +995,6 @@ void SExprBuilder::exitCFG(const CFGBlock *Last) {
   IncompleteArgs.clear();
 }
 
-/*
 namespace {
 
 class TILPrinter :
@@ -1016,4 +1015,3 @@ void printSCFG(CFGWalker &Walker) {
 
 } // namespace threadSafety
 } // namespace clang
-*/



More information about the cfe-commits mailing list