[PATCH] Enhance PPCallbacks::Defined callback to provide SourceRange

Thompson, John John_Thompson at playstation.sony.com
Thu Jul 18 15:55:30 PDT 2013


Thanks for looking at it, Argyrios.

> Why do you need a SourceRange, can't you just use the location of the identifier from the token parameter ?

I thought it would be cleaner to have the preprocessor pass it along, rather than crawling the source or approximating it.  But if avoiding changes to the preprocessor is preferred, I'll go that route, since I don't need the exact range, just something unique.

-John

From: Argyrios Kyrtzidis [mailto:akyrtzi at gmail.com]
Sent: Thursday, July 18, 2013 3:16 PM
To: Thompson, John
Cc: cfe-commits@; Sean Silva
Subject: Re: [PATCH] Enhance PPCallbacks::Defined callback to provide SourceRange

On Jul 18, 2013, at 1:09 PM, Thompson, John <John_Thompson at playstation.sony.com<mailto:John_Thompson at playstation.sony.com>> wrote:


In modularize, it turns out I need the SourceRange for the "defined()" expression.

Why do you need a SourceRange, can't you just use the location of the identifier from the token parameter ?



The enclosed patch addresses this, making it more like the MacroExpands callback.

MacroExpands needs a source range due to function macro expansions.


Thanks.

-John

<ppcallbacks2.patch>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130718/c9e937f1/attachment.html>


More information about the cfe-commits mailing list