[cfe-users] uniquely identifying names

2016-08-26 Thread folkert via cfe-users
Hi,

The Sun java compiler allows you to (from java) walk the AST and
investigate it. Each token is stored in an object. Each object has a
hash() method which uniquely identifies it.

Now I was wondering: can I do so with the LLVM tooling as well? I could
of course if I want to identify e.g. a function name just pick the line-
and column number and maybe include the function name itself as well but
that would constantly change when lines are added and/or removed.

Any suggestions?


regards,

Folkert van Heusden

-- 
-
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


Re: [cfe-users] uniquely identifying names

2016-08-26 Thread David Blaikie via cfe-users
There's no structural identity of code in Clang that I know of - I know
someone's building a tool for doing structural similarity for things like
plagiarism detection (I think there are some patches on the clang mailing
list).

But if you only need identity within a single process, the pointer value of
the pointer to any AST construct is a unique identity you can use.

(line/file/column isn't sufficiently unique - you could have a file that is
included under different macro situations and each time it defines a
different function, but all those functions would appear to be defined on
the same line/file of that included file - or a macro that defines multiple
functions - both can be resolved by looking at the more complete location
information (including macro locations, etc))

On Fri, Aug 26, 2016 at 5:11 AM folkert via cfe-users <
cfe-users@lists.llvm.org> wrote:

> Hi,
>
> The Sun java compiler allows you to (from java) walk the AST and
> investigate it. Each token is stored in an object. Each object has a
> hash() method which uniquely identifies it.
>
> Now I was wondering: can I do so with the LLVM tooling as well? I could
> of course if I want to identify e.g. a function name just pick the line-
> and column number and maybe include the function name itself as well but
> that would constantly change when lines are added and/or removed.
>
> Any suggestions?
>
>
> regards,
>
> Folkert van Heusden
>
> --
> -
> Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
> ___
> cfe-users mailing list
> cfe-users@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


Re: [cfe-users] uniquely identifying names

2016-08-26 Thread Anna Zaks via cfe-users

> On Aug 26, 2016, at 8:33 AM, David Blaikie via cfe-users 
>  wrote:
> 
> There's no structural identity of code in Clang that I know of - I know 
> someone's building a tool for doing structural similarity for things like 
> plagiarism detection (I think there are some patches on the clang mailing 
> list).
> 

+ Raphael, who is the GSoC student currently working on a similar problem. 
Raphael is upstreaming his patches into the clang static analyzer.

> But if you only need identity within a single process, the pointer value of 
> the pointer to any AST construct is a unique identity you can use.
> 
> (line/file/column isn't sufficiently unique - you could have a file that is 
> included under different macro situations and each time it defines a 
> different function, but all those functions would appear to be defined on the 
> same line/file of that included file - or a macro that defines multiple 
> functions - both can be resolved by looking at the more complete location 
> information (including macro locations, etc))
> 
> On Fri, Aug 26, 2016 at 5:11 AM folkert via cfe-users 
> mailto:cfe-users@lists.llvm.org>> wrote:
> Hi,
> 
> The Sun java compiler allows you to (from java) walk the AST and
> investigate it. Each token is stored in an object. Each object has a
> hash() method which uniquely identifies it.
> 
> Now I was wondering: can I do so with the LLVM tooling as well? I could
> of course if I want to identify e.g. a function name just pick the line-
> and column number and maybe include the function name itself as well but
> that would constantly change when lines are added and/or removed.
> 
> Any suggestions?
> 
> 
> regards,
> 
> Folkert van Heusden
> 
> --
> -
> Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com 
> 
> ___
> cfe-users mailing list
> cfe-users@lists.llvm.org 
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users 
> 
> ___
> cfe-users mailing list
> cfe-users@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users