Static Value-Flow Analysis
Loading...
Searching...
No Matches
Functions
SVF::DOT Namespace Reference

Functions

std::string EscapeStr (const std::string &Label)
 

Function Documentation

◆ EscapeStr()

std::string SVF::DOT::EscapeStr ( const std::string &  Label)

Definition at line 12 of file GraphWriter.cpp.

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}
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74