From: Artem Dergachev Date: Tue, 25 Jun 2019 02:16:56 +0000 (+0000) Subject: [analyzer] exploded-graph-rewriter: Fix escaping for bitwise-or. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6b702c7e828916db802d3984fa2cada931feab98;p=clang [analyzer] exploded-graph-rewriter: Fix escaping for bitwise-or. '|' is a special character in graphviz, so it needs to be properly escaped and unescaped. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364269 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Analysis/exploded-graph-rewriter/escapes.c b/test/Analysis/exploded-graph-rewriter/escapes.c index bdf308513e..32a7713561 100644 --- a/test/Analysis/exploded-graph-rewriter/escapes.c +++ b/test/Analysis/exploded-graph-rewriter/escapes.c @@ -8,7 +8,7 @@ // FIXME: Substitution doesn't seem to work on Windows. // UNSUPPORTED: system-windows -void string_region_escapes() { +void escapes() { // CHECK: Store: // CHECK-SAME: foo0 // CHECK-SAME: &Element\{"foo",0 S64b,char\} @@ -16,4 +16,9 @@ void string_region_escapes() { // CHECK-SAME: "foo" // CHECK-SAME: &Element\{"foo",0 S64b,char\} const char *const foo = "foo"; + + // CHECK: BinaryOperator + // CHECK-SAME: 1 \| 2 + // CHECK-SAME: 3 S32b + int x = 1 | 2; } diff --git a/utils/analyzer/exploded-graph-rewriter.py b/utils/analyzer/exploded-graph-rewriter.py index 4aae72c0da..668b12110b 100755 --- a/utils/analyzer/exploded-graph-rewriter.py +++ b/utils/analyzer/exploded-graph-rewriter.py @@ -300,6 +300,7 @@ class ExplodedGraph(object): .replace('\\{', '{') \ .replace('\\}', '}') \ .replace('\\\\', '\\') \ + .replace('\\|', '|') \ .replace('\\<', '\\\\<') \ .replace('\\>', '\\\\>') \ .rstrip(',') @@ -329,7 +330,7 @@ class DotDumpVisitor(object): .replace('\\<', '<') .replace('\\>', '>') .replace('\\l', '
') - .replace('|', ''), end='') + .replace('|', '\\|'), end='') @staticmethod def _diff_plus_minus(is_added):