[PATCH] Correctly check for the main file in the presence of line markers
richard at metafoo.co.uk
Wed Aug 21 17:11:05 PDT 2013
On Wed, Aug 21, 2013 at 5:00 PM, Eli Friedman <eli.friedman at gmail.com>wrote:
> On Wed, Aug 21, 2013 at 2:53 PM, Richard Smith <richard at metafoo.co.uk>wrote:
>> I think isPresumedFromMainFile should be the more common choice, so maybe
>> should have the more obvious name. Perhaps call the new mechanism
>> isFromMainFile and rename the existing mechanism to isWrittenInMainFile?
>> I'm still not overjoyed with those names.
>> FWIW, all calls of isFromMainFile in lib/StaticAnalyzer look like they
>> should be using the new mechanism, for consistency when handling
>> preprocessed source. [That only leaves the calls in lib/Rewrite and
>> VerifyDiagnosticConsumer (both of which should stay as-is), and the one
>> caller of isInPrimaryFile that you didn't change (which seems reasonable to
>> switch over, assuming the #include_next implementation can cope with
>> presumed locations).]
>> + /// whether it came from a file other than the main file. This is
>> + // from isFromMainFile() because it takes line marker directives into
>> + // account.
>> /// not // here :-)
>> The testing seems a little light.
> Do you have any suggestions for tests? I'm not sure adding a test for
> every user of isMainFile is productive.
If you can find the existing tests for some of these features, maybe add
another RUN: line with
%clang_cc1 -E %s -o - | %clang_cc1 -
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-commits