diff options
Diffstat (limited to 'polly/lib/Exchange/JSONExporter.cpp')
-rw-r--r-- | polly/lib/Exchange/JSONExporter.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/polly/lib/Exchange/JSONExporter.cpp b/polly/lib/Exchange/JSONExporter.cpp index b9dcaadb9a4..3cedb039685 100644 --- a/polly/lib/Exchange/JSONExporter.cpp +++ b/polly/lib/Exchange/JSONExporter.cpp @@ -16,6 +16,7 @@ #include "polly/Options.h" #include "polly/ScopInfo.h" #include "polly/ScopPass.h" +#include "polly/Support/ScopLocation.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/RegionInfo.h" @@ -90,9 +91,19 @@ void JSONExporter::printScop(raw_ostream &OS, Scop &S) const { S.print(OS); } Json::Value JSONExporter::getJSON(Scop &S) const { Json::Value root; + unsigned LineBegin, LineEnd; + std::string FileName; + + getDebugLocation(&S.getRegion(), LineBegin, LineEnd, FileName); + std::string Location; + if (LineBegin != (unsigned)-1) + Location = FileName + ":" + std::to_string(LineBegin) + "-" + + std::to_string(LineEnd); root["name"] = S.getRegion().getNameStr(); root["context"] = S.getContextStr(); + if (LineBegin != (unsigned)-1) + root["location"] = Location; root["statements"]; for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) { |