Static Value-Flow Analysis
Loading...
Searching...
No Matches
GraphWriter.cpp
Go to the documentation of this file.
1//===- GraphWriter.cpp - Implements GraphWriter support routines ----------===//
2//
3// From the LLVM Project with some modifications, under the Apache License v2.0
4// with LLVM Exceptions. See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7
9
10#include <string>
11
12std::string SVF::DOT::EscapeStr(const std::string &Label)
13{
14 std::string Str(Label);
15 for (unsigned i = 0; i != Str.length(); ++i)
16 switch (Str[i])
17 {
18 case '\n':
19 Str.insert(Str.begin()+i, '\\'); // Escape character...
20 ++i;
21 Str[i] = 'n';
22 break;
23 case '\t':
24 Str.insert(Str.begin()+i, ' '); // Convert to two spaces
25 ++i;
26 Str[i] = ' ';
27 break;
28 case '\\':
29 if (i+1 != Str.length())
30 switch (Str[i+1])
31 {
32 case 'l':
33 continue; // don't disturb \l
34 case '|':
35 case '{':
36 case '}':
37 Str.erase(Str.begin()+i);
38 continue;
39 default:
40 break;
41 }
42 case '{':
43 case '}':
44 case '<':
45 case '>':
46 case '|':
47 case '"':
48 Str.insert(Str.begin()+i, '\\'); // Escape character...
49 ++i; // don't infinite loop
50 break;
51 }
52 return Str;
53}
std::string EscapeStr(const std::string &Label)
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74