[cfe-users] add method to a existing class and save to source file

Jonas Toth via cfe-users cfe-users at lists.llvm.org
Fri May 4 23:24:50 PDT 2018


This is a question relating clang-refactor i guess. Maybe ask on cfe-dev
since its development specific.


Am 05.05.2018 um 02:22 schrieb ? ?? via cfe-users:
> Dear Clang users:      
>       I have a class named  classA  in a.h and a.cpp file. it have
> some methods, I want to add a new method definition to a.h and add new
> method body after last method use clang . How to do it ? 
>       I know the  RecursiveASTVisitor::VisitCXXRecordDecl(...) can
> visit CXXRecordDecl and CXXMethodDecl , Rewriter  be used to write
> code . but how to create new method definition and body to a.h and a.cpp?
>
> //a.h file
> classA {
> protected:
>      int filed;
>  public:
>      void method1();
>      void method2();
>                                     //insert a new method
> }
>
> //a.cpp file
>
> void classA::method1()
> {
>         ..........
> }
>
> void classA::method2()
> {
>        ...........
> }
>
>                                // inset new method body
>
>
> Yours truly
>
> Robert
>
> ------------------------------------------------------------------------
> licux6 at hotmail.com
>
>
> _______________________________________________
> cfe-users mailing list
> cfe-users at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20180505/3308ed91/attachment.html>


More information about the cfe-users mailing list