[cfe-dev] Get location of #pragma

Douglas Gregor dgregor at apple.com
Fri Jun 15 10:11:05 PDT 2012


On Jun 14, 2012, at 4:44 AM, Daniel Powell wrote:

> Hi,
> 
> I'm writing a code re-writer involving the use of pragmas. I have my PragmaHandler and every other bit working fine, but when I try to replace the pragma statement it only replaces the parts after the #pragma keyword. HandlePragma provides a SourceLocation to the token after #pragma, but not the keyword itself. Is there any way, preferably from within the PragmaHandler, that I can get a SourceLocation to the #pragma keyword?

HandlePragma should take a SourceRange that covers the '#pragma' or '_Pragma', so that this information is available to the pragma handlers. It should be a fairly simple change to Clang; would you like to contribute a patch for it?

	- Doug



More information about the cfe-dev mailing list