]> granicus.if.org Git - clang/commit
-frewrite-includes: Normalize line endings to match the main source file
authorReid Kleckner <reid@kleckner.net>
Fri, 5 Sep 2014 16:49:50 +0000 (16:49 +0000)
committerReid Kleckner <reid@kleckner.net>
Fri, 5 Sep 2014 16:49:50 +0000 (16:49 +0000)
commitb306e0b5b64be1185dda6e52da0e29ef7a0138e6
tree85c22ba2ca538353e061815f3f859dadf85220ae
parent3e4e598ffcd331d5d5fb2a16f3add247773b2537
-frewrite-includes: Normalize line endings to match the main source file

It is very common to include headers with DOS-style line endings, such
as windows.h, from source files with Unix-style line endings.
Previously, we would end up with mixed line endings and #endifs that
appeared to be on the same line:

  #if 0 /* expanded by -frewrite-includes */
  #include <windows.h>^M#endif /* expanded by -frewrite-includes */

Clang treats either of \r or \n as a line ending character, so this is
purely a cosmetic issue.

This has no automated test because most Unix tools on Windows will
implictly convert CRLF to LF when reading files, making it very hard to
detect line ending mismatches. FileCheck doesn't understand {{\r}}
either.

Fixes PR20552.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217259 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Frontend/Rewrite/InclusionRewriter.cpp