Add the shifted cursor position to XML output, so it can be used by editor integrations.
authorManuel Klimek <klimek@google.com>
Fri, 9 Jan 2015 10:03:47 +0000 (10:03 +0000)
committerManuel Klimek <klimek@google.com>
Fri, 9 Jan 2015 10:03:47 +0000 (10:03 +0000)
llvm-svn: 225516

clang/tools/clang-format/ClangFormat.cpp

index cacc51f..d44d407 100644 (file)
@@ -229,6 +229,10 @@ static bool format(StringRef FileName) {
   if (OutputXML) {
     llvm::outs()
         << "<?xml version='1.0'?>\n<replacements xml:space='preserve'>\n";
+    if (Cursor.getNumOccurrences() != 0)
+      llvm::outs() << "<cursor>"
+                   << tooling::shiftedCodePosition(Replaces, Cursor)
+                   << "</cursor>\n";
     for (tooling::Replacements::const_iterator I = Replaces.begin(),
                                                E = Replaces.end();
          I != E; ++I) {