<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><br><br>--- On <b>Mon, 9/14/09, Chris Lattner <i><clattner@apple.com></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Chris Lattner <clattner@apple.com><br>Subject: Re: [cfe-dev] Indexer Library and type references....<br>To: "dan chap" <dchapiesky@yahoo.com><br>Cc: cfe-dev@cs.uiuc.edu<br>Date: Monday, September 14, 2009, 7:43 PM<br><br><div id="yiv1024885200"><div><div>On Sep 14, 2009, at 1:48 PM, dan chap wrote:</div><blockquote type="cite"><table style="" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit; -x-system-font: none;" valign="top">Also, can someone explain the
 subtle differences between a Source Location and an Instantiation Location as in:<br><pre><span style="font-family: courier,monaco,monospace,sans-serif;">SourceLocation Loc = D->getLocation();</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;">Loc = SM->getInstantiationLoc(Loc);</span><br></pre></td></tr></tbody></table></blockquote></div><br><div>Some details are here:</div><div><a rel="nofollow" target="_blank" href="http://clang.llvm.org/docs/InternalsManual.html#SourceLocation">http://clang.llvm.org/docs/InternalsManual.html#SourceLocation</a></div><div><br></div><div>-Chris<br></div></div></blockquote><br><span style="font-family: times new roman,new york,times,serif; font-style: italic;">"In practice, the SourceLocation works together with the SourceManager class
to encode two pieces of information about a location: it's spelling location
and it's instantiation location.  For most tokens, these will be the same.  However,
for a macro expansion (or tokens that came from a _Pragma directive) these will
describe the location of the characters corresponding to the token and the
location where the token was used (i.e. the macro instantiation point or the 
location of the _Pragma itself).</span>"<br style="font-family: times new roman,new york,times,serif; font-style: italic;"><br>So for someone, who might be working on rewriting code and was building a list of references, it would appear as if a number of duplicate references existed using simply the SourceLocation.   This is fine for the rewriting bit, but for statistics on the actual number of references, etc..., the instantiation location provides the uniqueness needed....<br><br>Thanks.<br>Daniel<br><br><br><br><br><br><div id="yiv1024885200"><div><br></div></div></td></tr></table><br>