<div dir="ltr"><div>Hello<br></div>          I am currently working on a task that i 
named Reversing the Stages of Compilation. I saw a task on the GSOC GNU 
Compiler Collection on <a href="http://gcc.gnu.org/wiki/SummerOfCode" target="_blank">http://gcc.gnu.org/wiki/SummerOfCode</a>
 under the topic other projects and i decided to work on that because i 
have an algorithm for that. But my main problem now is having the 
working copy of GCC, i don't know where the implementation of the cpp ( 
for preprocessing), -S option in GCC (converting preprocessed file to 
assembly), As (gcc's portable tool for creating machine language from 
assembly program) and ld (linking). At each of these level, they have 
their code representation and i intern to reverse this levels back to 
their original source code representation. </div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 20, 2014 at 8:08 PM,  <span dir="ltr"><<a href="mailto:cfe-dev-request@cs.uiuc.edu" target="_blank">cfe-dev-request@cs.uiuc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send cfe-dev mailing list submissions to<br>
        <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:cfe-dev-request@cs.uiuc.edu">cfe-dev-request@cs.uiuc.edu</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:cfe-dev-owner@cs.uiuc.edu">cfe-dev-owner@cs.uiuc.edu</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of cfe-dev digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Template matching question (Michael Steinberg)<br>
   2. Re: Template matching question (David Blaikie)<br>
   3. Re: Question about ASTMatchers (Richard)<br>
   4. Re: Question about ASTMatchers (Christian Schafmeister)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Thu, 20 Feb 2014 17:19:16 +0100<br>
From: Michael Steinberg <<a href="mailto:michael.steinberg@tu-clausthal.de">michael.steinberg@tu-clausthal.de</a>><br>
To: <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
Subject: [cfe-dev] Template matching question<br>
Message-ID: <<a href="mailto:53062B04.9090306@tu-clausthal.de">53062B04.9090306@tu-clausthal.de</a>><br>
Content-Type: text/plain; charset=ISO-8859-15<br>
<br>
Hello,<br>
there is an interesting (for me) problem with luabind that you might be<br>
able to answer.<br>
<br>
Considering the template:<br>
<br>
template< typename T ><br>
void deduce( T (*)(), ... ) {}<br>
<br>
template< typename T ><br>
void deduce( T f, SomeType g ) {}<br>
<br>
...more overloads...<br>
<br>
and the function:<br>
<br>
void foo() {<br>
   throw some();<br>
}<br>
<br>
deduce( foo );<br>
<br>
clang 3.2 seems to add an implicit attribute "noreturn" (I assume that<br>
is because clang detected the function will never return). This<br>
attribute seems to rule out the given first overload of function<br>
template "deduce", which would otherwise be responsible to match the<br>
given function's signature and consequently fails on the second<br>
overload. Is that legal? Or maybe the mismatch is caused by another reason?<br>
<br>
Kind regards,<br>
Michael<br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Thu, 20 Feb 2014 10:18:13 -0800<br>
From: David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>><br>
To: Michael Steinberg <<a href="mailto:michael.steinberg@tu-clausthal.de">michael.steinberg@tu-clausthal.de</a>><br>
Cc: cfe-dev Developers <<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a>><br>
Subject: Re: [cfe-dev] Template matching question<br>
Message-ID:<br>
        <<a href="mailto:CAENS6Ev02%2B2pKvcftX1T4R9%2BNpQbfddfPMHg0EOY91QzGbXoyQ@mail.gmail.com">CAENS6Ev02+2pKvcftX1T4R9+NpQbfddfPMHg0EOY91QzGbXoyQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Could you provide a standalone example of the problem? And include a log<br>
showing the file contents, the compiler version, the full command used to<br>
compile the source as well as all the output (error messages, etc)?<br>
<br>
My attempts to reproduce this with ToT Clang seem to have failed -<br>
something similar to what you described compiles without error.<br>
<br>
<br>
On Thu, Feb 20, 2014 at 8:19 AM, Michael Steinberg <<br>
<a href="mailto:michael.steinberg@tu-clausthal.de">michael.steinberg@tu-clausthal.de</a>> wrote:<br>
<br>
> Hello,<br>
> there is an interesting (for me) problem with luabind that you might be<br>
> able to answer.<br>
><br>
> Considering the template:<br>
><br>
> template< typename T ><br>
> void deduce( T (*)(), ... ) {}<br>
><br>
> template< typename T ><br>
> void deduce( T f, SomeType g ) {}<br>
><br>
> ...more overloads...<br>
><br>
> and the function:<br>
><br>
> void foo() {<br>
>    throw some();<br>
> }<br>
><br>
> deduce( foo );<br>
><br>
> clang 3.2 seems to add an implicit attribute "noreturn" (I assume that<br>
> is because clang detected the function will never return). This<br>
> attribute seems to rule out the given first overload of function<br>
> template "deduce", which would otherwise be responsible to match the<br>
> given function's signature and consequently fails on the second<br>
> overload. Is that legal? Or maybe the mismatch is caused by another reason?<br>
><br>
> Kind regards,<br>
> Michael<br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.cs.uiuc.edu/pipermail/cfe-dev/attachments/20140220/86b923b5/attachment-0001.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/cfe-dev/attachments/20140220/86b923b5/attachment-0001.html</a>><br>

<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Thu, 20 Feb 2014 12:08:24 -0700<br>
From: Richard <<a href="mailto:legalize@xmission.com">legalize@xmission.com</a>><br>
To: <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
Subject: Re: [cfe-dev] Question about ASTMatchers<br>
Message-ID: <<a href="mailto:E1WGYyu-0003pv-VQ@shell.xmission.com">E1WGYyu-0003pv-VQ@shell.xmission.com</a>><br>
<br>
<br>
In article <CAOsfVvmovo0mC4dX=<a href="mailto:7Q9dWEno2BK6V6NiMxbkg0Nz9t%2BRUSjCg@mail.gmail.com">7Q9dWEno2BK6V6NiMxbkg0Nz9t+RUSjCg@mail.gmail.com</a>>,<br>
    Manuel Klimek <<a href="mailto:klimek@google.com">klimek@google.com</a>> writes:<br>
<br>
> You might want to take a look at clang-query, which helps with<br>
> experimenting with matchers quickly (no compile needed, it uses the dynamic<br>
> matchers).<br>
<br>
Is there documentation on this?  I couldn't find anything except some<br>
comments on the commit message.<br>
--<br>
"The Direct3D Graphics Pipeline" free book <<a href="http://tinyurl.com/d3d-pipeline" target="_blank">http://tinyurl.com/d3d-pipeline</a>><br>
     The Computer Graphics Museum <<a href="http://ComputerGraphicsMuseum.org" target="_blank">http://ComputerGraphicsMuseum.org</a>><br>
         The Terminals Wiki <<a href="http://terminals.classiccmp.org" target="_blank">http://terminals.classiccmp.org</a>><br>
  Legalize Adulthood! (my blog) <<a href="http://LegalizeAdulthood.wordpress.com" target="_blank">http://LegalizeAdulthood.wordpress.com</a>><br>
<br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Thu, 20 Feb 2014 11:08:47 -0800<br>
From: Christian Schafmeister <<a href="mailto:chris.schaf@verizon.net">chris.schaf@verizon.net</a>><br>
To: Manuel Klimek <<a href="mailto:klimek@google.com">klimek@google.com</a>><br>
Cc: clang-dev Developers <<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a>><br>
Subject: Re: [cfe-dev] Question about ASTMatchers<br>
Message-ID: <<a href="mailto:4194C2BC-5625-4216-A8CD-96BC3EE04AA7@verizon.net">4194C2BC-5625-4216-A8CD-96BC3EE04AA7@verizon.net</a>><br>
Content-Type: text/plain; charset="windows-1252"<br>
<br>
I?m creating AST Matchers to match recordDecls and varDecls and match the types for the varDecls to recordDecls.<br>
In many cases the varDecls are instantiating template classes and some of the template classes are specialized.<br>
<br>
If I use this matcher:<br>
recordDecl(isTemplateInstantiation(), isSameOrDerivedFrom(recordDecl(hasName("BAR")))).bind(?WHOLE?)    ?> FOO<A> node<br>
or<br>
recordDecl(isExplicitTemplateSpecialization(), isSameOrDerivedFrom(recordDecl(hasName("BAR")))).bind(?WHOLE?)   ?> FOO<int> node<br>
<br>
How do I get the full name of the nodes that match and are bound to ?WHOLE??<br>
<br>
node.getName() ?>  ?FOO? not ?FOO<A>?  or ?FOO<int>"<br>
<br>
<br>
<br>
Here is the sample code:<br>
<br>
#include <stdio.h><br>
#include <core/foundation.h><br>
#include <core/object.h><br>
#include <core/holder.h><br>
<br>
namespace asttooling {<br>
<br>
    class BAR {};<br>
<br>
    template<typename T> class FOO : public BAR {};<br>
    class A {};<br>
<br>
    template<> class FOO<int> : public BAR {};<br>
<br>
    void tinyFunc()<br>
    {<br>
        FOO<A> xa;<br>
        FOO<int> xi;<br>
        printf("Hi there, this is tinyFunc @%p %p\n", &xa, &xi);<br>
    }<br>
<br>
};<br>
<br>
<br>
Christian Schafmeister<br>
<a href="mailto:chris.schaf@verizon.net">chris.schaf@verizon.net</a><br>
<br>
<br>
On Feb 20, 2014, at 6:56 AM, Manuel Klimek <<a href="mailto:klimek@google.com">klimek@google.com</a>> wrote:<br>
<br>
><br>
> On Thu, Feb 20, 2014 at 3:49 PM, Christian Schafmeister <<a href="mailto:chris.schaf@verizon.net">chris.schaf@verizon.net</a>> wrote:<br>
> Manuel,<br>
><br>
> I completely missed those predicates - thank you!<br>
><br>
> How do I get the full name of an instantiated template recordDecl?<br>
><br>
> As in:<br>
> template <class T> class X;<br>
> class A;<br>
><br>
> X<A> xa;<br>
><br>
> If a varDecl(?) matches on xa - how do I get the "X<A>? name?<br>
><br>
> Do you want to "get" it or "match" it. Assuming you want to "get" it, you'd say something like varDecl(hasType(qualType().bind("t"))) (untested ;), and then in the callback extract the QualType and call getAsString() on it.<br>

><br>
><br>
> Best,<br>
><br>
> .Chris.<br>
> Christian Schafmeister<br>
> <a href="mailto:chris.schaf@verizon.net">chris.schaf@verizon.net</a><br>
><br>
><br>
> On Feb 20, 2014, at 12:53 AM, Manuel Klimek <<a href="mailto:klimek@google.com">klimek@google.com</a>> wrote:<br>
><br>
>> hasAncestor(decl(anyOf(recordDecl(<br>
>>   isTemplateInstantiation()),<br>
>>   functionDecl(isTemplateInstantiation()))<br>
>><br>
>> should do what you want.<br>
>><br>
>><br>
>> On Wed, Feb 19, 2014 at 11:01 PM, Christian Schafmeister <<a href="mailto:chris.schaf@verizon.net">chris.schaf@verizon.net</a>> wrote:<br>
>><br>
>> If I match a varDecl() that is in a method of a template class I get a match for the template and instantiated templates<br>
>> - is there a way to tell the difference by matching some difference in the ancestors of the varDecl node?<br>
>><br>
>> I get a match for the translate::from_object<T> a0(*args);  varDecl in the method activate (see below) that has this type:<br>
>> from_object<type-parameter-0-0, struct std::__1::integral_constant<_Bool, true> ><br>
>><br>
>> I also get a match that I think is from the instantiation TestFunctoid<int> j(?test?) in tinyFunc - it has this type: "struct translate::from_object<int, std::true_type>"<br>
>><br>
>> There is a clear difference in the name - but I was looking for something that didn?t feel like a hack.<br>
>><br>
>> Are there differences in the AST class node for TestFunctoid when it is a template class vs when it is an instantiated template class?<br>
>><br>
>><br>
>><br>
>> #include <stdio.h><br>
>> #include <core/foundation.h><br>
>> #include <core/object.h><br>
>> #include <core/holder.h><br>
>><br>
>> namespace asttooling {<br>
>><br>
>><br>
>>     template<typename T><br>
>>     class TestFunctoid : public core::Functoid {<br>
>>     public:<br>
>><br>
>>         TestFunctoid(const string& name) : core::Functoid(name) {};<br>
>>         core::T_mv activate( core::const_ActivationFrame_spREF closedOverFrame, int numArgs, ArgArray args )<br>
>>         {<br>
>>             translate::from_object<T> a0(*args);<br>
>>             printf( "Address of a0= %p\n", &a0);<br>
>>             return Values0<core::T_O>();<br>
>>         }<br>
>>     };<br>
>><br>
>><br>
>><br>
>>     void tinyFunc()<br>
>>     {<br>
>>         TestFunctoid<int> j("test");<br>
>>         TinyStruct x(10);<br>
>>         tinyFunc(x);<br>
>>         printf("Hi there, this is tinyFunc\n");<br>
>>     }<br>
>><br>
>> };<br>
>><br>
>> Christian Schafmeister<br>
>> Associate Professor<br>
>> Chemistry Department<br>
>> Temple University<br>
>><br>
>><br>
><br>
><br>
<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.cs.uiuc.edu/pipermail/cfe-dev/attachments/20140220/f74fb801/attachment.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/cfe-dev/attachments/20140220/f74fb801/attachment.html</a>><br>

<br>
------------------------------<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br>
<br>
End of cfe-dev Digest, Vol 80, Issue 85<br>
***************************************<br>
</blockquote></div><br></div>