diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/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 Nodes) { -#ifndef NDEBUG +void ExprEngine::ViewGraph(ArrayRef 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 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 Nodes, +std::string ExprEngine::DumpGraph(ArrayRef Nodes, StringRef Filename) { -#ifndef NDEBUG std::unique_ptr 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::GDMIndex() { diff --git a/clang/test/Analysis/dump_egraph.c b/clang/test/Analysis/dump_egraph.c --- a/clang/test/Analysis/dump_egraph.c +++ b/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'\" diff --git a/clang/test/Analysis/dump_egraph.cpp b/clang/test/Analysis/dump_egraph.cpp --- a/clang/test/Analysis/dump_egraph.cpp +++ b/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        \{ \"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        \{ \"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        \{ \"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        \{ \"kind\": \"Default\", \"offset\": 0, \"value\": \"conj_$2\{int, LC5, no stmt, #1\}\" diff --git a/clang/test/Analysis/exploded-graph-rewriter/dynamic_types.cpp b/clang/test/Analysis/exploded-graph-rewriter/dynamic_types.cpp --- a/clang/test/Analysis/exploded-graph-rewriter/dynamic_types.cpp +++ b/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 {}; diff --git a/clang/test/Analysis/exploded-graph-rewriter/escapes.c b/clang/test/Analysis/exploded-graph-rewriter/escapes.c --- a/clang/test/Analysis/exploded-graph-rewriter/escapes.c +++ b/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: Store: (0x{{[0-9a-f]*}}) diff --git a/clang/test/Analysis/exploded-graph-rewriter/initializers_under_construction.cpp b/clang/test/Analysis/exploded-graph-rewriter/initializers_under_construction.cpp --- a/clang/test/Analysis/exploded-graph-rewriter/initializers_under_construction.cpp +++ b/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() {} diff --git a/clang/test/Analysis/exploded-graph-rewriter/l_name_starts_with_l.cpp b/clang/test/Analysis/exploded-graph-rewriter/l_name_starts_with_l.cpp --- a/clang/test/Analysis/exploded-graph-rewriter/l_name_starts_with_l.cpp +++ b/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 diff --git a/clang/test/Analysis/exploded-graph-rewriter/macros.c b/clang/test/Analysis/exploded-graph-rewriter/macros.c --- a/clang/test/Analysis/exploded-graph-rewriter/macros.c +++ b/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:3:10 // CHECK-SAME: diff --git a/clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp b/clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp --- a/clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp +++ b/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() {} diff --git a/clang/test/Analysis/exploded-graph-rewriter/win_path_forbidden_chars.cpp b/clang/test/Analysis/exploded-graph-rewriter/win_path_forbidden_chars.cpp --- a/clang/test/Analysis/exploded-graph-rewriter/win_path_forbidden_chars.cpp +++ b/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`,