r364269 - [analyzer] exploded-graph-rewriter: Fix escaping for bitwise-or.

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 24 19:16:57 PDT 2019


Author: dergachev
Date: Mon Jun 24 19:16:56 2019
New Revision: 364269

URL: http://llvm.org/viewvc/llvm-project?rev=364269&view=rev
Log:
[analyzer] exploded-graph-rewriter: Fix escaping for bitwise-or.

'|' is a special character in graphviz, so it needs to be properly
escaped and unescaped.

Modified:
    cfe/trunk/test/Analysis/exploded-graph-rewriter/escapes.c
    cfe/trunk/utils/analyzer/exploded-graph-rewriter.py

Modified: cfe/trunk/test/Analysis/exploded-graph-rewriter/escapes.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/exploded-graph-rewriter/escapes.c?rev=364269&r1=364268&r2=364269&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/exploded-graph-rewriter/escapes.c (original)
+++ cfe/trunk/test/Analysis/exploded-graph-rewriter/escapes.c Mon Jun 24 19:16:56 2019
@@ -8,7 +8,7 @@
 // FIXME: Substitution doesn't seem to work on Windows.
 // UNSUPPORTED: system-windows
 
-void string_region_escapes() {
+void escapes() {
   // CHECK: <td align="left"><b>Store: </b></td>
   // CHECK-SAME: <td align="left">foo</td><td align="left">0</td>
   // CHECK-SAME: <td align="left">&Element\{"foo",0 S64b,char\}</td>
@@ -16,4 +16,9 @@ void string_region_escapes() {
   // CHECK-SAME: <td align="left">"foo"</td>
   // CHECK-SAME: <td align="left">&Element\{"foo",0 S64b,char\}</td>
   const char *const foo = "foo";
+
+  // CHECK: <font color="cyan3">BinaryOperator</font>
+  // CHECK-SAME: <td align="left">1 \| 2</td>
+  // CHECK-SAME: <td align="left">3 S32b</td>
+  int x = 1 | 2;
 }

Modified: cfe/trunk/utils/analyzer/exploded-graph-rewriter.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/exploded-graph-rewriter.py?rev=364269&r1=364268&r2=364269&view=diff
==============================================================================
--- cfe/trunk/utils/analyzer/exploded-graph-rewriter.py (original)
+++ cfe/trunk/utils/analyzer/exploded-graph-rewriter.py Mon Jun 24 19:16:56 2019
@@ -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', '<br />')
-               .replace('|', ''), end='')
+               .replace('|', '\\|'), end='')
 
     @staticmethod
     def _diff_plus_minus(is_added):




More information about the cfe-commits mailing list