r342790 - Thread safety analysis: Make printSCFG compile again [NFC]

Aaron Puchert via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 21 16:46:36 PDT 2018


Author: aaronpuchert
Date: Fri Sep 21 16:46:35 2018
New Revision: 342790

URL: http://llvm.org/viewvc/llvm-project?rev=342790&view=rev
Log:
Thread safety analysis: Make printSCFG compile again [NFC]

Not used productively, so no observable functional change.

Note that printSCFG doesn't yet work reliably, it seems to crash
sometimes.

Modified:
    cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTraverse.h
    cfe/trunk/lib/Analysis/ThreadSafety.cpp
    cfe/trunk/lib/Analysis/ThreadSafetyCommon.cpp

Modified: cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTraverse.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTraverse.h?rev=342790&r1=342789&r2=342790&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTraverse.h (original)
+++ cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTraverse.h Fri Sep 21 16:46:35 2018
@@ -785,7 +785,26 @@ protected:
   void printCast(const Cast *E, StreamType &SS) {
     if (!CStyle) {
       SS << "cast[";
-      SS << E->castOpcode();
+      switch (E->castOpcode()) {
+      case CAST_none:
+        SS << "none";
+        break;
+      case CAST_extendNum:
+        SS << "extendNum";
+        break;
+      case CAST_truncNum:
+        SS << "truncNum";
+        break;
+      case CAST_toFloat:
+        SS << "toFloat";
+        break;
+      case CAST_toInt:
+        SS << "toInt";
+        break;
+      case CAST_objToPtr:
+        SS << "objToPtr";
+        break;
+      }
       SS << "](";
       self()->printSExpr(E->expr(), SS, Prec_Unary);
       SS << ")";

Modified: cfe/trunk/lib/Analysis/ThreadSafety.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ThreadSafety.cpp?rev=342790&r1=342789&r2=342790&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ThreadSafety.cpp (original)
+++ cfe/trunk/lib/Analysis/ThreadSafety.cpp Fri Sep 21 16:46:35 2018
@@ -64,13 +64,6 @@ using namespace threadSafety;
 // Key method definition
 ThreadSafetyHandler::~ThreadSafetyHandler() = default;
 
-namespace {
-
-class TILPrinter :
-    public til::PrettyPrinter<TILPrinter, llvm::raw_ostream> {};
-
-} // namespace
-
 /// Issue a warning about an invalid lock expression
 static void warnInvalidLock(ThreadSafetyHandler &Handler,
                             const Expr *MutexExp, const NamedDecl *D,

Modified: cfe/trunk/lib/Analysis/ThreadSafetyCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ThreadSafetyCommon.cpp?rev=342790&r1=342789&r2=342790&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ThreadSafetyCommon.cpp (original)
+++ cfe/trunk/lib/Analysis/ThreadSafetyCommon.cpp Fri Sep 21 16:46:35 2018
@@ -944,6 +944,16 @@ void SExprBuilder::exitCFG(const CFGBloc
 }
 
 /*
+namespace {
+
+class TILPrinter :
+    public til::PrettyPrinter<TILPrinter, llvm::raw_ostream> {};
+
+} // namespace
+
+namespace clang {
+namespace threadSafety {
+
 void printSCFG(CFGWalker &Walker) {
   llvm::BumpPtrAllocator Bpa;
   til::MemRegionRef Arena(&Bpa);
@@ -951,4 +961,7 @@ void printSCFG(CFGWalker &Walker) {
   til::SCFG *Scfg = SxBuilder.buildCFG(Walker);
   TILPrinter::print(Scfg, llvm::errs());
 }
+
+} // namespace threadSafety
+} // namespace clang
 */




More information about the cfe-commits mailing list