diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 | 
| commit | 06d4ba388873e6d1cfa9cd715a8935ecc8cd2097 (patch) | |
| tree | 3eb853da77d46cc77c4b017525a422f9ddb1385b /tools/clang-format/ClangFormat.cpp | |
| parent | 30d791273d07fac9c0c1641a0731191bca6e8606 (diff) | |
Diffstat (limited to 'tools/clang-format/ClangFormat.cpp')
| -rw-r--r-- | tools/clang-format/ClangFormat.cpp | 12 | 
1 files changed, 7 insertions, 5 deletions
| diff --git a/tools/clang-format/ClangFormat.cpp b/tools/clang-format/ClangFormat.cpp index cebb2757d4da..d44d407aa86c 100644 --- a/tools/clang-format/ClangFormat.cpp +++ b/tools/clang-format/ClangFormat.cpp @@ -19,9 +19,9 @@  #include "clang/Basic/SourceManager.h"  #include "clang/Basic/Version.h"  #include "clang/Format/Format.h" -#include "clang/Lex/Lexer.h"  #include "clang/Rewrite/Core/Rewriter.h"  #include "llvm/ADT/StringMap.h" +#include "llvm/Support/CommandLine.h"  #include "llvm/Support/Debug.h"  #include "llvm/Support/FileSystem.h"  #include "llvm/Support/Signals.h" @@ -76,7 +76,7 @@ static cl::opt<std::string>  AssumeFilename("assume-filename",                 cl::desc("When reading from stdin, clang-format assumes this\n"                          "filename to look for a style config file (with\n" -                        "-style=file)."), +                        "-style=file) and to determine the language."),                 cl::cat(ClangFormatCategory));  static cl::opt<bool> Inplace("i", @@ -225,12 +225,14 @@ static bool format(StringRef FileName) {    FormatStyle FormatStyle = getStyle(        Style, (FileName == "-") ? AssumeFilename : FileName, FallbackStyle); -  Lexer Lex(ID, Sources.getBuffer(ID), Sources, -            getFormattingLangOpts(FormatStyle.Standard)); -  tooling::Replacements Replaces = reformat(FormatStyle, Lex, Sources, Ranges); +  tooling::Replacements Replaces = reformat(FormatStyle, Sources, ID, Ranges);    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) { | 
