<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Alright, final update.  Thanks to some fantastic help on #llvm, I believe this is fixed.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Stephen: You may have to do some shenanigans to fix your local stuff, but the monorepo and another repo both seem to work.  Sorry for this everyone :/<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></a></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Stephen Hines [mailto:srhines@google.com]
<br>
<b>Sent:</b> Thursday, August 24, 2017 3:18 PM<br>
<b>To:</b> Keane, Erich <erich.keane@intel.com><br>
<b>Cc:</b> cfe-commits <cfe-commits@lists.llvm.org><br>
<b>Subject:</b> Re: r311683 - [Preprocessor] Correct internal token parsing of newline characters in CRLF<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">This change seems to have broken the git mirrors, as I can no longer check out clang without having a merge conflict as git alters the line endings. Setting core.autocrlf to false doesn't help either. Does anyone have any idea how to fix
 this svn <-> git issue?<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Steve<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Thu, Aug 24, 2017 at 11:36 AM, Erich Keane via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">Author: erichkeane<br>
Date: Thu Aug 24 11:36:07 2017<br>
New Revision: 311683<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=311683&view=rev" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=311683&view=rev</a><br>
Log:<br>
[Preprocessor] Correct internal token parsing of newline characters in CRLF<br>
<br>
Discovered due to a goofy git setup, the test system-headerline-directive.c<br>
(and a few others) failed because the token-consumption will consume only the<br>
'\r' in CRLF, making the preprocessor's printed value give the wrong line number<br>
when returning from an include. For example:<br>
<br>
(line 1):#include <noline.h>\r\n<br>
<br>
The "file exit" code causes the printer to try to print the 'returned to the<br>
main file' line. It looks up what the current line number is. However, since the<br>
current 'token' is the '\n' (since only the \r was consumed), it will give the<br>
line number as '1", not '2'. This results in a few failed tests, but more<br>
importantly, results in error messages being incorrect when compiling a<br>
previously preprocessed file.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D37079" target="_blank">
https://reviews.llvm.org/D37079</a><br>
<br>
Added:<br>
    cfe/trunk/test/Frontend/.gitattributes<br>
    cfe/trunk/test/Frontend/system-header-line-directive-ms-lineendings.c   (with props)<br>
Modified:<br>
    cfe/trunk/lib/Lex/Lexer.cpp<br>
<br>
Modified: cfe/trunk/lib/Lex/Lexer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=311683&r1=311682&r2=311683&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=311683&r1=311682&r2=311683&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Lex/Lexer.cpp (original)<br>
+++ cfe/trunk/lib/Lex/Lexer.cpp Thu Aug 24 11:36:07 2017<br>
@@ -3073,6 +3073,8 @@ LexNextToken:<br>
<br>
   case '\n':<br>
   case '\r':<br>
+    if (CurPtr[0] != Char && (CurPtr[0] == '\n' || CurPtr[0] == '\r'))<br>
+      Char = getAndAdvanceChar(CurPtr, Result);<br>
     // If we are inside a preprocessor directive and we see the end of line,<br>
     // we know we are done with the directive, so return an EOD token.<br>
     if (ParsingPreprocessorDirective) {<br>
<br>
Added: cfe/trunk/test/Frontend/.gitattributes<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/.gitattributes?rev=311683&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/.gitattributes?rev=311683&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/Frontend/.gitattributes (added)<br>
+++ cfe/trunk/test/Frontend/.gitattributes Thu Aug 24 11:36:07 2017<br>
@@ -0,0 +1,2 @@<br>
+# Below test validates crlf line endings, so it should stay crlf.<br>
+system-header-line-directive-ms-lineendings.c text eol=crlf<br>
<br>
Added: cfe/trunk/test/Frontend/system-header-line-directive-ms-lineendings.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/system-header-line-directive-ms-lineendings.c?rev=311683&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/system-header-line-directive-ms-lineendings.c?rev=311683&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/Frontend/system-header-line-directive-ms-lineendings.c (added)<br>
+++ cfe/trunk/test/Frontend/system-header-line-directive-ms-lineendings.c Thu Aug 24 11:36:07 2017<br>
@@ -0,0 +1,21 @@<br>
+// RUN: %clang_cc1 %s -E -o - -I %S/Inputs -isystem %S/Inputs/SystemHeaderPrefix | FileCheck %s<br>
+#include <noline.h><br>
+#include <line-directive-in-system.h><br>
+<br>
+#include "line-directive.h"<br>
+<br>
+// This tests that the line numbers for the current file are correctly outputted<br>
+// for the include-file-completed test case.<br>
+<br>
+// CHECK: # 1 "{{.*}}system-header-line-directive-ms-lineendings.c" 2<br>
+// CHECK: # 1 "{{.*}}noline.h" 1 3<br>
+// CHECK: foo();<br>
+// CHECK: # 3 "{{.*}}system-header-line-directive-ms-lineendings.c" 2<br>
+// CHECK: # 1 "{{.*}}line-directive-in-system.h" 1 3<br>
+//      The "3" below indicates that "foo.h" is considered a system header.<br>
+// CHECK: # 1 "foo.h" 3<br>
+// CHECK: foo();<br>
+// CHECK: # 4 "{{.*}}system-header-line-directive-ms-lineendings.c" 2<br>
+// CHECK: # 1 "{{.*}}line-directive.h" 1<br>
+// CHECK: # 10 "foo.h"{{$}}<br>
+// CHECK: # 6 "{{.*}}system-header-line-directive-ms-lineendings.c" 2<br>
<br>
Propchange: cfe/trunk/test/Frontend/system-header-line-directive-ms-lineendings.c<br>
------------------------------------------------------------------------------<br>
    svn:eol-style = CRLF<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>