<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 22 May 2017 at 15:22, Reid Kleckner via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="gmail-">On Mon, May 22, 2017 at 3:17 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="gmail-m_7493526741754995531gmail-h5"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">   // If the StrTok is "eod", then it wasn't present.  Otherwise, it must be a<br>
   // string followed by eod.<br>
-  if (StrTok.is(tok::eod))<br>
-    ; // ok<br>
-  else if (StrTok.isNot(tok::string_lite<wbr>ral)) {<br>
+  if (StrTok.is(tok::eod)) {<br>
+    // Treat this like "#line NN", which doesn't change file characteristics.<br>
+    FileKind = SourceMgr.getFileCharacteristi<wbr>c(DigitTok.getLocation());<br></blockquote><div><br></div></div></div><div>This change for "# <number>" handling makes sense (and I've checked and it matches GCC), but it looks like we don't have test coverage for either the old or new behavior. Can I interest you in adding some? :)</div></div></div></div></blockquote><div><br></div></span><div>We do have coverage for it, see test/Preprocessor/line-<wbr>directive.c:</div><div>"""</div><div><div># 192 "glomp.h" 3 // System header.</div><div>typedef int y;  // ok</div><div>typedef int y;  // ok</div><div><br></div><div>typedef int q;  // q is in system header.</div><div><br></div><div>#line 42 "blonk.h"  // doesn't change system headerness.</div><div><br></div><div>typedef int z;  // ok</div><div>typedef int z;  // ok</div><div><br></div><div># 97     // doesn't change system headerness.</div><div><div><br></div><div>typedef int z1;  // ok</div><div>typedef int z1;  // ok</div></div><div>"""</div></div><div><br></div><div>We were just getting similar behavior because of the code I removed that sends us to the #line directive handling when the filename isn't present.</div></div></div></div></blockquote><div><br></div><div>Ah, I see. It looks like, prior to your change, we got self-inconsistent results. "# <number>" worked properly when compiling (and we do have coverage for that, per the above test), but not when preprocessing (for which we don't have test coverage). So for instance, this input:</div><div><br></div><div># 1 "foo" 3</div><div># 2</div><div>x</div><div><br></div><div>preprocesses as</div><div><br></div><div><div># 1 "foo" 3</div><div># 2 "foo"</div><div>x</div></div><div><br></div><div>before your change and as</div><div><br></div><div><div><div># 1 "foo" 3</div><div># 2 "foo" 3</div><div>x</div></div></div><div><br></div><div>after your change.</div></div></div></div>