On Mon, May 22, 2017 at 3:17 PM, Richard Smith <rich...@metafoo.co.uk>
wrote:

>    // If the StrTok is "eod", then it wasn't present.  Otherwise, it must
>> be a
>>    // string followed by eod.
>> -  if (StrTok.is(tok::eod))
>> -    ; // ok
>> -  else if (StrTok.isNot(tok::string_literal)) {
>> +  if (StrTok.is(tok::eod)) {
>> +    // Treat this like "#line NN", which doesn't change file
>> characteristics.
>> +    FileKind = SourceMgr.getFileCharacteristic(DigitTok.getLocation());
>>
>
> 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? :)
>

We do have coverage for it, see test/Preprocessor/line-directive.c:
"""
# 192 "glomp.h" 3 // System header.
typedef int y;  // ok
typedef int y;  // ok

typedef int q;  // q is in system header.

#line 42 "blonk.h"  // doesn't change system headerness.

typedef int z;  // ok
typedef int z;  // ok

# 97     // doesn't change system headerness.

typedef int z1;  // ok
typedef int z1;  // ok
"""

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.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to