[PATCH] Correctly check for the main file in the presence of line markers
richard at metafoo.co.uk
Wed Aug 21 14:53:31 PDT 2013
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
+ /// 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.
On Wed, Aug 21, 2013 at 2:23 PM, Eli Friedman <eli.friedman at gmail.com>wrote:
> On Thu, Aug 15, 2013 at 3:08 PM, Eli Friedman <eli.friedman at gmail.com>wrote:
>> On Fri, Aug 9, 2013 at 9:33 PM, Eli Friedman <eli.friedman at gmail.com>wrote:
>>> On Mon, Jul 29, 2013 at 6:33 PM, Eli Friedman <eli.friedman at gmail.com>
>>> > Patch attached. Basically, the idea is that even if a SourceLocation
>>> > is technically in the main file, we might want to treat it differently
>>> > in the presence of line markers. I added
>>> > SourceManager::isPresumedFromMainFile to check this.
>>> > I'm particularly looking for suggestions about the name of the method;
>>> > having isFromMainFile and isPresumedFromMainFile seems very confusing,
>>> > but I don't really have any better ideas.
>>> > -Eli
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-commits