yangzhi0104 at sohu.com
2012-Jun-07 10:23 UTC
[LLVMdev] Is it possible to convert C++ code to C++/CX code via a plugin of clang?
Hello Guys,I am developing a plugin of clang and hope it can convert some C++ functions to C++/CX wrapper classes for WinRT system. If so, it would do a lot of work automatically.Now I have been somewhere. Using clang libraries, I could fetch the elements of C++ code for example, return type, function name, parameter list and others. Should I inherit "clang::Decl" to express C++/CX elements like Objective-C does?I think if I want to output C++/CX code using clang, I should inherit some classes in CodeGen. Should I do this? Or is it possible to be done in a plugin?Could you help me?Thank you,Jeffrey. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120607/84b4735b/attachment.html>
陳韋任 (Wei-Ren Chen)
2012-Jun-08 03:13 UTC
[LLVMdev] Is it possible to convert C++ code to C++/CX code via a plugin of clang?
CC'ed to clang ML. You can post clang question on clang ML. :-) On Thu, Jun 07, 2012 at 06:23:15PM +0800, yangzhi0104 at sohu.com wrote:> Hello Guys, > > I am developing a plugin of clang and hope it can convert some C++ functions to > C++/CX wrapper classes for WinRT system. If so, it would do a lot of work > automatically. > > Now I have been somewhere. Using clang libraries, I could fetch the elements of > C++ code for example, return type, function name, parameter list and others. > Should I inherit "clang::Decl" to express C++/CX elements like Objective-C > does? > > I think if I want to output C++/CX code using clang, I should inherit some > classes in CodeGen. Should I do this? Or is it possible to be done in a plugin? > > Could you help me? > > Thank you, > Jeffrey. >> _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj
Douglas Gregor
2012-Jun-08 04:28 UTC
[LLVMdev] [cfe-dev] Is it possible to convert C++ code to C++/CX code via a plugin of clang?
On Jun 7, 2012, at 8:13 PM, 陳韋任 (Wei-Ren Chen) wrote:> > CC'ed to clang ML. You can post clang question on clang ML. :-) > > On Thu, Jun 07, 2012 at 06:23:15PM +0800, yangzhi0104 at sohu.com wrote: >> Hello Guys, >> >> I am developing a plugin of clang and hope it can convert some C++ functions to >> C++/CX wrapper classes for WinRT system. If so, it would do a lot of work >> automatically. >> >> Now I have been somewhere. Using clang libraries, I could fetch the elements of >> C++ code for example, return type, function name, parameter list and others. >> Should I inherit "clang::Decl" to express C++/CX elements like Objective-C >> does? >> >> I think if I want to output C++/CX code using clang, I should inherit some >> classes in CodeGen. Should I do this? Or is it possible to be done in a plugin? >> >> Could you help me?It sounds like your goal is to take C++ code as an input and then to generate C++/CX. If so, you can do this with either a plugin or (better yet) with the tooling infrastructure. The various options are described here: http://clang.llvm.org/docs/Tooling.html Your best bet would be to use Clang as a source-to-source translation from C++ to C++/CX. That way, you don't have to extend Clang to actually represent C++/CX. Rather, you just emit the C++/CX source code (as text) and can hand that off to a C++/CX compiler. If your actual plan is to parse C++/CX in Clang, that cannot be done with a plugin or with tooling. You would need to write significant extensions to Clang's parser, AST, semantic analysis, and IR generation. - Doug
yangzhi0104 at sohu.com
2012-Jun-08 08:53 UTC
[LLVMdev] Is it possible to convert C++ code to C++/CX code via a plugin of clang?
Hello Wei-Ren,Thanks for your tips and could you give me some ideas about this question?I think I need to make a new AST to describe C++/CX code, then convert each node in C++ AST of clang, using "RecursiveASTVisitor", to corresponding node of C++/CX's AST. If so, I think the key is how to build the AST of C++/CX.What's your opinion?Thank you.Jeffrey. ----- 原文 ----- 发件人: 陳韋任 (Wei-Ren Chen) 主 题: Re: [LLVMdev] Is it possible to convert C++ code to C++/CX code via a plugin of clang?时 间: 2012年6月8日 11:13:44抄 送: llvmdev, cfe-dev at cs.uiuc.edu, CC'ed to clang ML. You can post clang question on clang ML. :-)On Thu, Jun 07, 2012 at 06:23:15PM +0800, yangzhi0104 at sohu.com wrote:> Hello Guys,> > I am developing a plugin of clang and hope it can convert some C++ functions to> C++/CX wrapper classes for WinRT system. If so, it would do a lot of work> automatically.> > Now I have been somewhere. Using clang libraries, I could fetch the elements of> C++ code for example, return type, function name, parameter list and others.> Should I inherit "clang::Decl" to express C++/CX elements like Objective-C> does?> > I think if I want to output C++/CX code using clang, I should inherit some> classes in CodeGen. Should I do this? Or is it possible to be done in a plugin?> > Could you help me?> > Thank you,> Jeffrey.> > _______________________________________________> LLVM Developers mailing list> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-- Wei-Ren Chen (陳韋任)Computer Systems Lab, Institute of Information Science,Academia Sinica, Taiwan (R.O.C.)Tel:886-2-2788-3799 #1667Homepage: http://people.cs.nctu.edu.tw/~chenwj -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120608/c3c475c4/attachment.html>
Seemingly Similar Threads
- [LLVMdev] Is it possible to convert C++ code to C++/CX code via a plugin of clang?
- Have you guys met an issue about "typeinfo & vtable"?
- Have you guys met an issue about "typeinfo & vtable"?
- [LLVMdev] [llvm-announce] Have you guys met an issue about "typeinfo & vtable"?
- [LLVMdev] Have you guys met this issue about "typeinfo" & "vtable" of ASTConsumer and PluginASTAction?