This revision was automatically updated to reflect the committed changes.
Closed by commit rG5ce7050f701c: [analyzer] Allow exploded graph dumps in 
release builds (authored by steakhal).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124442/new/

https://reviews.llvm.org/D124442

Files:
  clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
  clang/test/Analysis/dump_egraph.c
  clang/test/Analysis/dump_egraph.cpp
  clang/test/Analysis/exploded-graph-rewriter/dynamic_types.cpp
  clang/test/Analysis/exploded-graph-rewriter/escapes.c
  
clang/test/Analysis/exploded-graph-rewriter/initializers_under_construction.cpp
  clang/test/Analysis/exploded-graph-rewriter/l_name_starts_with_l.cpp
  clang/test/Analysis/exploded-graph-rewriter/macros.c
  clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp
  clang/test/Analysis/exploded-graph-rewriter/win_path_forbidden_chars.cpp

Index: clang/test/Analysis/exploded-graph-rewriter/win_path_forbidden_chars.cpp
===================================================================
--- clang/test/Analysis/exploded-graph-rewriter/win_path_forbidden_chars.cpp
+++ clang/test/Analysis/exploded-graph-rewriter/win_path_forbidden_chars.cpp
@@ -3,7 +3,6 @@
 // RUN:                     -analyzer-checker=core \
 // RUN:                     -analyzer-dump-egraph=%t.dot %s
 // RUN: %exploded_graph_rewriter --verbose %t.dot 2>&1 | FileCheck %s
-// REQUIRES: asserts
 // UNSUPPORTED: !windows
 
 // Angle brackets shall not be presented in the field `file`,
Index: clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp
===================================================================
--- clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp
+++ clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp
@@ -4,7 +4,6 @@
 // RUN:                     -analyzer-checker=core \
 // RUN:                     -analyzer-dump-egraph=%t.dot %s
 // RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
-// REQUIRES: asserts
 
 struct S {
   S() {}
Index: clang/test/Analysis/exploded-graph-rewriter/macros.c
===================================================================
--- clang/test/Analysis/exploded-graph-rewriter/macros.c
+++ clang/test/Analysis/exploded-graph-rewriter/macros.c
@@ -11,7 +11,6 @@
 // RUN:                     -analyzer-checker=core \
 // RUN:                     -analyzer-dump-egraph=%t.dot %s
 // RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
-// REQUIRES: asserts
 
 // CHECK: macros.c:<b>3</b>:<b>10</b>
 // CHECK-SAME: <font color="royalblue1">
Index: clang/test/Analysis/exploded-graph-rewriter/l_name_starts_with_l.cpp
===================================================================
--- clang/test/Analysis/exploded-graph-rewriter/l_name_starts_with_l.cpp
+++ clang/test/Analysis/exploded-graph-rewriter/l_name_starts_with_l.cpp
@@ -4,7 +4,6 @@
 // RUN:                     -analyzer-checker=core \
 // RUN:                     -analyzer-dump-egraph=%t.dot %s
 // RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
-// REQUIRES: asserts
 
 void test1() {
   // Here __FILE__ macros produces a string with `\` delimiters on Windows
Index: clang/test/Analysis/exploded-graph-rewriter/initializers_under_construction.cpp
===================================================================
--- clang/test/Analysis/exploded-graph-rewriter/initializers_under_construction.cpp
+++ clang/test/Analysis/exploded-graph-rewriter/initializers_under_construction.cpp
@@ -3,7 +3,6 @@
 // RUN:                     -analyzer-checker=core \
 // RUN:                     -analyzer-dump-egraph=%t.dot %s
 // RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
-// REQUIRES: asserts
 
 struct A {
   A() {}
Index: clang/test/Analysis/exploded-graph-rewriter/escapes.c
===================================================================
--- clang/test/Analysis/exploded-graph-rewriter/escapes.c
+++ clang/test/Analysis/exploded-graph-rewriter/escapes.c
@@ -3,7 +3,6 @@
 // RUN:                     -analyzer-checker=core \
 // RUN:                     -analyzer-dump-egraph=%t.dot %s
 // RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
-// REQUIRES: asserts
 
 void escapes(void) {
   // CHECK: <td align="left"><b>Store: </b> <font color="gray">(0x{{[0-9a-f]*}})</font></td>
Index: clang/test/Analysis/exploded-graph-rewriter/dynamic_types.cpp
===================================================================
--- clang/test/Analysis/exploded-graph-rewriter/dynamic_types.cpp
+++ clang/test/Analysis/exploded-graph-rewriter/dynamic_types.cpp
@@ -3,7 +3,6 @@
 // RUN:                     -analyzer-checker=core \
 // RUN:                     -analyzer-dump-egraph=%t.dot %s
 // RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
-// REQUIRES: asserts
 
 struct S {};
 
Index: clang/test/Analysis/dump_egraph.cpp
===================================================================
--- clang/test/Analysis/dump_egraph.cpp
+++ clang/test/Analysis/dump_egraph.cpp
@@ -1,6 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-dump-egraph=%t.dot %s
 // RUN: cat %t.dot | FileCheck %s
-// REQUIRES: asserts
 
 struct S {
   ~S();
@@ -20,7 +19,7 @@
 
 // CHECK: \"location_context\": \"#0 Call\", \"calling\": \"foo\", \"location\": null, \"items\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"stmt_id\": {{[0-9]+}}, \"kind\": \"construct into local variable\", \"argument_index\": null, \"pretty\": \"T t;\", \"value\": \"&t\"
 
-// CHECK: \"location_context\": \"#0 Call\", \"calling\": \"T::T\", \"location\": \{ \"line\": 16, \"column\": 5, \"file\": \"{{.*}}dump_egraph.cpp\" \}, \"items\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"init_id\": {{[0-9]+}}, \"kind\": \"construct into member variable\", \"argument_index\": null, \"pretty\": \"s\", \"value\": \"&t.s\"
+// CHECK: \"location_context\": \"#0 Call\", \"calling\": \"T::T\", \"location\": \{ \"line\": 15, \"column\": 5, \"file\": \"{{.*}}dump_egraph.cpp\" \}, \"items\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"init_id\": {{[0-9]+}}, \"kind\": \"construct into member variable\", \"argument_index\": null, \"pretty\": \"s\", \"value\": \"&t.s\"
 
 // CHECK: \"cluster\": \"t\", \"pointer\": \"{{0x[0-9a-f]+}}\", \"items\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"kind\": \"Default\", \"offset\": 0, \"value\": \"conj_$2\{int, LC5, no stmt, #1\}\"
 
Index: clang/test/Analysis/dump_egraph.c
===================================================================
--- clang/test/Analysis/dump_egraph.c
+++ clang/test/Analysis/dump_egraph.c
@@ -7,8 +7,6 @@
 // RUN:  -trim-egraph %s
 // RUN: cat %t.dot | FileCheck %s
 
-// REQUIRES: asserts
-
 int getJ(void);
 
 int foo(void) {
@@ -29,7 +27,7 @@
 // CHECK-SAME: \{ \"kind\": \"Statement\", \"stmt_kind\": \"IntegerLiteral\",
 // CHECK-SAME:    \"stmt_id\": {{[0-9]*}}, \"pointer\": \"0x{{[0-9a-f]*}}\",
 // CHECK-SAME:    \"pretty\": \"0\", \"location\": \{
-// CHECK-SAME:        \"line\": 15, \"column\": 12, \"file\":
+// CHECK-SAME:        \"line\": 13, \"column\": 12, \"file\":
 // CHECK-SAME:    \}, \"stmt_point_kind\": \"PreStmtPurgeDeadSymbols\",
 // CHECK-SAME:    \"tag\": \"ExprEngine : Clean Node\", \"node_id\": 3,
 // CHECK-SAME:    \"is_sink\": 0, \"has_report\": 0
@@ -37,13 +35,13 @@
 // CHECK-SAME: \{ \"kind\": \"Statement\", \"stmt_kind\": \"IntegerLiteral\",
 // CHECK-SAME:    \"stmt_id\": {{[0-9]*}}, \"pointer\": \"0x{{[0-9a-f]*}}\",
 // CHECK-SAME:    \"pretty\": \"0\", \"location\": \{
-// CHECK-SAME:        \"line\": 15, \"column\": 12, \"file\":
+// CHECK-SAME:        \"line\": 13, \"column\": 12, \"file\":
 // CHECK-SAME:    \}, \"stmt_point_kind\": \"PostStmt\", \"tag\": null,
 // CHECK-SAME:    \"node_id\": 4, \"is_sink\": 0, \"has_report\": 0
 // CHECK-SAME: \}
 // CHECK-SAME: ]
 
-// CHECK: \"pretty\": \"*x\", \"location\": \{ \"line\": 18, \"column\": 10, \"file\": \"{{(.+)}}dump_egraph.c\" \}
+// CHECK: \"pretty\": \"*x\", \"location\": \{ \"line\": 16, \"column\": 10, \"file\": \"{{(.+)}}dump_egraph.c\" \}
 
 // CHECK: \"pretty\": \"'\\\\x13'\"
 
Index: clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -3119,7 +3119,6 @@
 // Visualization.
 //===----------------------------------------------------------------------===//
 
-#ifndef NDEBUG
 namespace llvm {
 
 template<>
@@ -3217,29 +3216,18 @@
 };
 
 } // namespace llvm
-#endif
 
 void ExprEngine::ViewGraph(bool trim) {
-#ifndef NDEBUG
   std::string Filename = DumpGraph(trim);
   llvm::DisplayGraph(Filename, false, llvm::GraphProgram::DOT);
-#else
-  llvm::errs() << "Warning: viewing graph requires assertions" << "\n";
-#endif
 }
 
-
-void ExprEngine::ViewGraph(ArrayRef<const ExplodedNode*> Nodes) {
-#ifndef NDEBUG
+void ExprEngine::ViewGraph(ArrayRef<const ExplodedNode *> Nodes) {
   std::string Filename = DumpGraph(Nodes);
   llvm::DisplayGraph(Filename, false, llvm::GraphProgram::DOT);
-#else
-  llvm::errs() << "Warning: viewing graph requires assertions" << "\n";
-#endif
 }
 
 std::string ExprEngine::DumpGraph(bool trim, StringRef Filename) {
-#ifndef NDEBUG
   if (trim) {
     std::vector<const ExplodedNode *> Src;
 
@@ -3254,35 +3242,26 @@
       Src.push_back(N);
     }
     return DumpGraph(Src, Filename);
-  } else {
-    return llvm::WriteGraph(&G, "ExprEngine", /*ShortNames=*/false,
-                            /*Title=*/"Exploded Graph",
-                            /*Filename=*/std::string(Filename));
   }
-#else
-  llvm::errs() << "Warning: dumping graph requires assertions" << "\n";
-  return "";
-#endif
+
+  return llvm::WriteGraph(&G, "ExprEngine", /*ShortNames=*/false,
+                          /*Title=*/"Exploded Graph",
+                          /*Filename=*/std::string(Filename));
 }
 
-std::string ExprEngine::DumpGraph(ArrayRef<const ExplodedNode*> Nodes,
+std::string ExprEngine::DumpGraph(ArrayRef<const ExplodedNode *> Nodes,
                                   StringRef Filename) {
-#ifndef NDEBUG
   std::unique_ptr<ExplodedGraph> TrimmedG(G.trim(Nodes));
 
   if (!TrimmedG.get()) {
     llvm::errs() << "warning: Trimmed ExplodedGraph is empty.\n";
     return "";
-  } else {
-    return llvm::WriteGraph(TrimmedG.get(), "TrimmedExprEngine",
-                            /*ShortNames=*/false,
-                            /*Title=*/"Trimmed Exploded Graph",
-                            /*Filename=*/std::string(Filename));
-  }
-#else
-  llvm::errs() << "Warning: dumping graph requires assertions" << "\n";
-  return "";
-#endif
+  }
+
+  return llvm::WriteGraph(TrimmedG.get(), "TrimmedExprEngine",
+                          /*ShortNames=*/false,
+                          /*Title=*/"Trimmed Exploded Graph",
+                          /*Filename=*/std::string(Filename));
 }
 
 void *ProgramStateTrait<ReplayWithoutInlining>::GDMIndex() {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to