How to implement new pragma within clang

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to implement new pragma within clang

Xin Wang via cfe-dev
 
Hello,
 
I'm trying to fix, redesign, current implementation of the following pragma.
 
#pragma map(identifier, "new name")
 
The pragma can appear before or after 'identifier' is defined.
The current implementation works only on simple identifiers in global scope. 
 
I need to fix the cases when 'identifier' is a nested specifier. For example:
::i or ns::i, where ns is a namespace or a class. The 'identifier' can be an object or function with external linkage. It can also be a function with  optionally specified parameters to distinguish overloaded functions.
 
The 'identifier' should be lookup first at the point of the pragma and if not resolved once again at the end of compilation and let the back-end know its new name. 
 
Are there any similar pragmas which can help me out? Any advice you can offer is appreciated.
 
 
 


Regards, ______________________________________
Zbigniew Sarbinowski (Zibi) C++ FE development
IBM z Systems Software, IBM Systems Unit
8200 Warden Ave. Markham ON, L6G 1C7
C2/712/8200/MKM Tel: 905-413-6071


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to implement new pragma within clang

Xin Wang via cfe-dev

Hi,


take a look at the PragmaHandler class. You can find an example here:


https://clang.llvm.org/docs/ClangPlugins.html


Marcel

Zbigniew Sarbinowski via cfe-dev <[hidden email]> hat am 26. Juni 2017 um 18:25 geschrieben:

 
Hello,
 
I'm trying to fix, redesign, current implementation of the following pragma.
 
#pragma map(identifier, "new name")
 
The pragma can appear before or after 'identifier' is defined.
The current implementation works only on simple identifiers in global scope. 
 
I need to fix the cases when 'identifier' is a nested specifier. For example:
::i or ns::i, where ns is a namespace or a class. The 'identifier' can be an object or function with external linkage. It can also be a function with  optionally specified parameters to distinguish overloaded functions.
 
The 'identifier' should be lookup first at the point of the pragma and if not resolved once again at the end of compilation and let the back-end know its new name. 
 
Are there any similar pragmas which can help me out? Any advice you can offer is appreciated.
 
 
 


Regards, ______________________________________
Zbigniew Sarbinowski (Zibi) C++ FE development
IBM z Systems Software, IBM Systems Unit
8200 Warden Ave. Markham ON, L6G 1C7
C2/712/8200/MKM Tel: 905-413-6071

_______________________________________________ cfe-dev mailing list [hidden email] http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to implement new pragma within clang

Xin Wang via cfe-dev
In reply to this post by Xin Wang via cfe-dev
On 26 June 2017 at 09:25, Zbigniew Sarbinowski via cfe-dev <[hidden email]> wrote:
 
Hello,
 
I'm trying to fix, redesign, current implementation of the following pragma.
 
#pragma map(identifier, "new name")
 
The pragma can appear before or after 'identifier' is defined.
The current implementation works only on simple identifiers in global scope. 
 
I need to fix the cases when 'identifier' is a nested specifier. For example:
::i or ns::i, where ns is a namespace or a class. The 'identifier' can be an object or function with external linkage. It can also be a function with  optionally specified parameters to distinguish overloaded functions.
 
The 'identifier' should be lookup first at the point of the pragma and if not resolved once again at the end of compilation and let the back-end know its new name. 
 
Are there any similar pragmas which can help me out? Any advice you can offer is appreciated.

This sounds quite similar to the existing "#pragma redefine_extname" (except for the C++ support); you could look at that for inspiration.
 
Regards, ______________________________________
Zbigniew Sarbinowski (Zibi) C++ FE development
IBM z Systems Software, IBM Systems Unit
8200 Warden Ave. Markham ON, L6G 1C7
C2/712/8200/MKM Tel: <a href="tel:(905)%20413-6071" value="+19054136071" target="_blank">905-413-6071


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...