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

via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 26 09:24:56 PST 2024


Author: Haojian Wu
Date: 2024-02-26T18:24:53+01:00
New Revision: be024307075c37f057fd51d4de0e9c2443b51686

URL: https://github.com/llvm/llvm-project/commit/be024307075c37f057fd51d4de0e9c2443b51686
DIFF: https://github.com/llvm/llvm-project/commit/be024307075c37f057fd51d4de0e9c2443b51686.diff

LOG: Thread safety analysis: provide printSCFG definition. (#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.

Added: 
    

Modified: 
    clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
    clang/lib/Analysis/ThreadSafetyCommon.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h b/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
index 13e37ac2b56b64..7bdb9052e57e74 100644
--- a/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
+++ b/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
@@ -527,8 +527,10 @@ class SExprBuilder {
   BlockInfo *CurrentBlockInfo = nullptr;
 };
 
+#ifndef NDEBUG
 // Dump an SCFG to llvm::errs().
 void printSCFG(CFGWalker &Walker);
+#endif // NDEBUG
 
 } // namespace threadSafety
 } // namespace clang

diff  --git a/clang/lib/Analysis/ThreadSafetyCommon.cpp b/clang/lib/Analysis/ThreadSafetyCommon.cpp
index 2fe0f85897c3bc..33f1f466df2444 100644
--- a/clang/lib/Analysis/ThreadSafetyCommon.cpp
+++ b/clang/lib/Analysis/ThreadSafetyCommon.cpp
@@ -995,7 +995,7 @@ void SExprBuilder::exitCFG(const CFGBlock *Last) {
   IncompleteArgs.clear();
 }
 
-/*
+#ifndef NDEBUG
 namespace {
 
 class TILPrinter :
@@ -1016,4 +1016,4 @@ void printSCFG(CFGWalker &Walker) {
 
 } // namespace threadSafety
 } // namespace clang
-*/
+#endif // NDEBUG


        


More information about the cfe-commits mailing list