[cfe-dev] Add new AST node

Pisit Makpaisit haoremixman at gmail.com
Sat Jul 31 21:40:27 PDT 2010


Yes, OmpStmt inherit from Stmt and other omp stmt inherit from OmpStmt.

On Sun, Aug 1, 2010 at 10:12 AM, Sean Hunt <rideau3 at gmail.com> wrote:

>  On 07/31/2010 08:59 PM, Pisit Makpaisit wrote:
> > I want to add the AST node for OpenMP statement. I create OmpStmt class
> > that inherit from Stmt class and add the definition in StmtNodes.td as
> > follow
> >
> > def OmpStmt : Stmt<1>;
> > def OmpAtomicStmt : DStmt<OmpStmt>;
> > def OmpBarrierStmt : DStmt<OmpStmt>;
> > def OmpCriticalStmt : DStmt<OmpStmt>;
> > def OmpFlushStmt : DStmt<OmpStmt>;
> > def OmpMasterStmt : DStmt<OmpStmt>;
> > def OmpOrderedStmt : DStmt<OmpStmt>;
> > def OmpParallelStmt : DStmt<OmpStmt>;
> > def OmpForStmt : DStmt<OmpStmt>;
> > def OmpSectionsStmt : DStmt<OmpStmt>;
> > def OmpSectionStmt : DStmt<OmpStmt>;
> > def OmpSingleStmt : DStmt<OmpStmt>;
> > def OmpTaskStmt : DStmt<OmpStmt>;
> > def OmpTaskwaitStmt : DStmt<OmpStmt>;
> > def OmpThreadprivateStmt : DStmt<OmpStmt>;
> >
> > when I build project, it show error like
> >
> > In file included from
> >
> /home/remixman/Desktop/llvm/tools/clang/lib/AST/../../include/clang/AST/StmtVisitor.h:111,
> >                   from ASTImporter.cpp:21:
> >
> /home/remixman/Desktop/llvm/tools/clang/lib/AST/../../include/clang/AST/StmtNodes.inc:
> > In member function ‘RetTy clang::StmtVisitor<ImplClass,
> > RetTy>::Visit(clang::Stmt*) [with ImplClass =
> > <unnamed>::ASTNodeImporter, RetTy = clang::Stmt*]’:
> > ASTImporter.cpp:3045:   instantiated from here
> >
> /home/remixman/Desktop/llvm/tools/clang/lib/AST/../../include/clang/AST/StmtNodes.inc:617:
> > error: invalid static_cast from type ‘clang::Stmt*’ to type
> > ‘clang::OmpAtomicStmt*’
> >
> /home/remixman/Desktop/llvm/tools/clang/lib/AST/../../include/clang/AST/StmtNodes.inc:623:
> > error: invalid static_cast from type ‘clang::Stmt*’ to type
> > ‘clang::OmpBarrierStmt*’
> >
> /home/remixman/Desktop/llvm/tools/clang/lib/AST/../../include/clang/AST/StmtNodes.inc:629:
> > error: invalid static_cast from type ‘clang::Stmt*’ to type
> > ‘clang::OmpCriticalStmt*’
> >
> > OmpAtomicStmt and other OpenMP Stmt class is inherit from OmpStmt. Why
> > the error show that? How can I fixed?
>
> Did you make the OmpStmt class inherit from Stmt?
>
> Sean
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>



-- 
Remixman (Pisit Makpaisit)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100801/344f7024/attachment.html>


More information about the cfe-dev mailing list