]> granicus.if.org Git - clang/commitdiff
analyzer plist: For PathDiagnosticControlFlowPieces, now output an array of
authorTed Kremenek <kremenek@apple.com>
Fri, 27 Mar 2009 15:53:20 +0000 (15:53 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 27 Mar 2009 15:53:20 +0000 (15:53 +0000)
start-end points, where start and end are source ranges.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67847 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/PlistDiagnostics.cpp

index 9087a94232249675c207e1081f7ac65d637086c7..ba3c1f16055115a420d975a11e8ecbb530ff0bd1 100644 (file)
@@ -108,12 +108,33 @@ static void ReportControlFlow(llvm::raw_ostream& o,
   
   Indent(o, indent) << "<key>kind</key><string>control</string>\n";
   
+  // FIXME: Eventually remove (DEPRECATED)
   // Output the start and end locations.
   Indent(o, indent) << "<key>start</key>\n";
   EmitLocation(o, SM, P.getStartLocation(), FM, indent);
   Indent(o, indent) << "<key>end</key>\n";
   EmitLocation(o, SM, P.getEndLocation(), FM, indent);
   
+  // Emit edges.
+  Indent(o, indent) << "<key>edges</key>\n";
+  ++indent;
+  Indent(o, indent) << "<array>\n";
+  ++indent;
+  for (PathDiagnosticControlFlowPiece::const_iterator I=P.begin(), E=P.end();
+       I!=E; ++I) {
+    Indent(o, indent) << "<dict>\n";
+    ++indent;
+    Indent(o, indent) << "<key>start</key>\n";
+    EmitRange(o, SM, I->getStart().asRange(), FM, indent+1);
+    Indent(o, indent) << "<key>end</key>\n";
+    EmitRange(o, SM, I->getEnd().asRange(), FM, indent+1);
+    --indent;
+    Indent(o, indent) << "</dict>\n";
+  }
+  --indent;
+  Indent(o, indent) << "</array>\n";
+  --indent;
+  
   // Output any helper text.
   const std::string& s = P.getString();
   if (!s.empty()) {