diff options
| author | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-09-08 08:31:55 +0000 |
|---|---|---|
| committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-09-08 08:31:55 +0000 |
| commit | 0b5a1959f4878a8b7b46fc947c78d6fcdb74260a (patch) | |
| tree | 5943737179abbc9bf85408771a47b4ac37233b32 /polly/lib/Analysis/ScopGraphPrinter.cpp | |
| parent | 26b1388293a98a2e193f45ac13b683122c2d67bd (diff) | |
| download | bcm5719-llvm-0b5a1959f4878a8b7b46fc947c78d6fcdb74260a.tar.gz bcm5719-llvm-0b5a1959f4878a8b7b46fc947c78d6fcdb74260a.zip | |
ScopGraphPrinter: Escape error message
Otherwise a '"' in the error message, yields an invalid .dot file.
llvm-svn: 163466
Diffstat (limited to 'polly/lib/Analysis/ScopGraphPrinter.cpp')
| -rw-r--r-- | polly/lib/Analysis/ScopGraphPrinter.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/polly/lib/Analysis/ScopGraphPrinter.cpp b/polly/lib/Analysis/ScopGraphPrinter.cpp index dab3f677531..02308dfa43a 100644 --- a/polly/lib/Analysis/ScopGraphPrinter.cpp +++ b/polly/lib/Analysis/ScopGraphPrinter.cpp @@ -101,6 +101,21 @@ struct DOTGraphTraits<ScopDetection*> : public DOTGraphTraits<RegionNode*> { return DOTGraphTraits<RegionNode*> ::getNodeLabel(Node, SD->getRI()->getTopLevelRegion()); } + + static std::string escapeString(std::string String) { + std::string Escaped; + + for (std::string::iterator SI = String.begin(), SE = String.end(); + SI != SE; ++SI) { + + if (*SI == '"') + Escaped += '\\'; + + Escaped += *SI; + } + return Escaped; + } + // Print the cluster of the subregions. This groups the single basic blocks // and adds a different background color for each group. static void printRegionCluster(const ScopDetection *SD, const Region *R, @@ -108,6 +123,7 @@ struct DOTGraphTraits<ScopDetection*> : public DOTGraphTraits<RegionNode*> { O.indent(2 * depth) << "subgraph cluster_" << static_cast<const void*>(R) << " {\n"; std::string ErrorMessage = SD->regionIsInvalidBecause(R); + ErrorMessage = escapeString(ErrorMessage); O.indent(2 * (depth + 1)) << "label = \"" << ErrorMessage << "\";\n"; if (SD->isMaxRegionInScop(*R)) { |

