[llvm-commits] [polly] r163466 - /polly/trunk/lib/Analysis/ScopGraphPrinter.cpp
Tobias Grosser
grosser at fim.uni-passau.de
Sat Sep 8 01:31:55 PDT 2012
Author: grosser
Date: Sat Sep 8 03:31:55 2012
New Revision: 163466
URL: http://llvm.org/viewvc/llvm-project?rev=163466&view=rev
Log:
ScopGraphPrinter: Escape error message
Otherwise a '"' in the error message, yields an invalid .dot file.
Modified:
polly/trunk/lib/Analysis/ScopGraphPrinter.cpp
Modified: polly/trunk/lib/Analysis/ScopGraphPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopGraphPrinter.cpp?rev=163466&r1=163465&r2=163466&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopGraphPrinter.cpp (original)
+++ polly/trunk/lib/Analysis/ScopGraphPrinter.cpp Sat Sep 8 03:31:55 2012
@@ -101,6 +101,21 @@
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 @@
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)) {
More information about the llvm-commits
mailing list