llvm-project/clang/tools/clang-format-vs/ClangFormat
Daniel Jasper 36e979af73 clang-format sort include use the source file name to determine the
"main include" that will be the 1st include (category 0).

Because the clang-format visual studio extension does not pass the file
name and use the standard input, sort include cannot find a "main
include":

Testing fix on llvm\tools\clang\lib\Format\Format.cpp:
Original file:
  #include "clang/Format/Format.h"
  ...
  #include "clang/Basic/SourceManager.h"
  #include "clang/Lex/Lexer.h"

Without fix, selecting the includes and running visual studio
clang-format:
  ...
  #include "clang/Basic/SourceManager.h"
  #include "clang/Format/Format.h"
  #include "clang/Lex/Lexer.h"

With fix, selecting the includes and running visual studio clang-format:
  #include "clang/Format/Format.h"
  ...
  #include "clang/Basic/SourceManager.h"
  #include "clang/Lex/Lexer.h"

Test 2 with main header not at the start:
Original file:
  ...
  #include "clang/Format/Format.h"
  #include "clang/Basic/SourceManager.h"
  #include "clang/Lex/Lexer.h"

Without fix, selecting the includes and running visual studio
clang-format:
  ...
  #include "clang/Basic/SourceManager.h"
  #include "clang/Format/Format.h"
  #include "clang/Lex/Lexer.h"

With fix, selecting the includes and running visual studio clang-format:
  #include "clang/Format/Format.h"
  ...
  #include "clang/Basic/SourceManager.h"
  #include "clang/Lex/Lexer.h"

Patch by Jean-Philippe Dufraigne, thank you.
Review: http://reviews.llvm.org/D16524

llvm-svn: 260378
2016-02-10 12:42:58 +00:00
..
Properties Added new options to ClangFormat VSIX package. 2015-10-19 10:08:35 +00:00
Resources Recreated the ClangFormat VSPackage with VS 2010. 2013-11-12 15:02:53 +00:00
ClangFormat.csproj Migrate clang-format-vs plugin project to VS 2013 2015-03-03 17:30:50 +00:00
ClangFormat.vsct Fix key bindings for VS 2010. 2013-11-12 15:25:18 +00:00
ClangFormatPackage.cs clang-format sort include use the source file name to determine the 2016-02-10 12:42:58 +00:00
GlobalSuppressions.cs
Guids.cs
PkgCmdID.cs
Resources.Designer.cs Migrate clang-format-vs plugin project to VS 2013 2015-03-03 17:30:50 +00:00
Resources.resx
VSPackage.resx