<br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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?<br>
</blockquote></div><div><br>Happy to. Just to check, you are suggesting I modify the current HandlePragma method to have the following prototype?<br>virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, Token &FirstToken, SourceLocation IntroducerLoc) = 0;<br>
</div></div></blockquote><div><br>Sorry, make that:<br>virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind
Introducer, Token &FirstToken, SourceRange IntroducerRange) = 0;<br><br>Cheers,<br><br>Dan<br><br><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="gmail_quote"><div>
</div></div><br>With the three types of pragma supported (#pragma, _Pragma and __Pragma) their locations only appear available when the preprocessor first discovers the token (HandleDirective, Handle_Pragma and HandleMicrosoft__pragma respectively), and is lost by the time HandlePragmaDirective is called so it's probably best to pass the location from those places to HandlePragmaDirective and onwards.<br>
<br>_Pragma and __Pragma are easy, they each have PragmaLoc pointing to the keyword. However, by the time #pragma is fully discovered it only has a location pointing to "pragma" not "#pragma". I could use the getLocWithOffset(-1) method, or catch it at the start of the HandleDirective method, which do you think is best?<br>
<br>I'll have to update the existing PragmaHandlers too.<br><br>Does all this sound sane? First time someone's asked me to contribute something specific back to open source. :-D<div class="HOEnZb"><div class="h5">
<br><br>Cheers,<br><br>Dan<br clear="all">
<br>-- <br>--------<br>Daniel Powell<br><a href="mailto:divot.powell@googlemail.com" target="_blank">divot.powell@googlemail.com</a><br><a href="http://tinyurl.com/powelld" target="_blank">http://tinyurl.com/powelld</a><br>
<br>The University of Edinburgh<br>Institute for Computer Systems Architecture<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>--------<br>Daniel Powell<br><a href="mailto:divot.powell@googlemail.com" target="_blank">divot.powell@googlemail.com</a><br><a href="http://tinyurl.com/powelld" target="_blank">http://tinyurl.com/powelld</a><br>
<br>The University of Edinburgh<br>Institute for Computer Systems Architecture<br>