r225516 - Add the shifted cursor position to XML output, so it can be used by editor integrations.

Manuel Klimek klimek at google.com
Fri Jan 9 02:03:47 PST 2015


Author: klimek
Date: Fri Jan  9 04:03:47 2015
New Revision: 225516

URL: http://llvm.org/viewvc/llvm-project?rev=225516&view=rev
Log:
Add the shifted cursor position to XML output, so it can be used by editor integrations.

Modified:
    cfe/trunk/tools/clang-format/ClangFormat.cpp

Modified: cfe/trunk/tools/clang-format/ClangFormat.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/ClangFormat.cpp?rev=225516&r1=225515&r2=225516&view=diff
==============================================================================
--- cfe/trunk/tools/clang-format/ClangFormat.cpp (original)
+++ cfe/trunk/tools/clang-format/ClangFormat.cpp Fri Jan  9 04:03:47 2015
@@ -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) {





More information about the cfe-commits mailing list