<html>
<head></head>
<body>
<p>Hi,</p>
<p>Yesterday I tested my tool with a progam containing preprocessor directives. It was the first time I had this possibility into account  and I had an stack dump when triying to obtain the file:</p>
<p>FullSourceLoc FullLocation = Context->getFullLoc(sourceLoc);<br/>
... <br/>
file = Context->getSourceManager().getFileEntryForID(FullLocation.getFileID())->getName();</p>
<p>Then, I added:</p>
<p>if(Context->getSourceManager().getSLocEntry(FullLocation.getFileID()).isExpansion()){<br />                    FullLocation = FullLocation.getExpansionLoc();<br />                    file= Context->getSourceManager()<br/>
                                           .getFileEntryForID(FullLocation.getFileID())->getName();<br />}<br/>
else{<br/>
...<br/>
}</p>
<p>And the result seemed ok. But when I tried to obtain again the file with:</p>
<p>Context->getSourceManager().getFileEntryForID(FullLocation.getFileID());</p>
<p>I had another stack dump. How do you handle these directives? There are so many methods... that I'm not able to find a solution because I cannot understand very well whay is an expansion, an SEntryLoc...</p>
<p>My intention is to make a change in the directive. For instance, in this directive:<br/>
#define delete( a )    {           <br />           a.release();                      <br />}<br/>
when the calling to the method release is found, my tool should include an argument in the method. </p>
<p>A doubt: when I make that change, it affects to every inkovation to the directive, isn't it? But, is there a way that the change only affects to a single directive invokation?</p>
<p>Thanks in advance,</p>
<p>Pedro.</p>
</body>
</html>