[cfe-dev] Indexer Library and type references....

dan chap dchapiesky at yahoo.com
Tue Sep 15 10:51:06 PDT 2009



--- On Mon, 9/14/09, Chris Lattner <clattner at apple.com> wrote:

From: Chris Lattner <clattner at apple.com>
Subject: Re: [cfe-dev] Indexer Library and type references....
To: "dan chap" <dchapiesky at yahoo.com>
Cc: cfe-dev at cs.uiuc.edu
Date: Monday, September 14, 2009, 7:43 PM

On Sep 14, 2009, at 1:48 PM, dan chap wrote:Also, can someone explain the subtle differences between a Source Location and an Instantiation Location as in:
SourceLocation Loc = D->getLocation();
Loc = SM->getInstantiationLoc(Loc);

Some details are here:http://clang.llvm.org/docs/InternalsManual.html#SourceLocation
-Chris

"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)."

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....

Thanks.
Daniel









      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090915/79e52789/attachment.html>


More information about the cfe-dev mailing list