Hi Bewoayia, I think you would have more luck asking your question at cfe-dev, in my understanding very few people read cfe-users.
George > On Mar 7, 2018, at 1:49 AM, Bewoayia Kebianyor via cfe-users > <cfe-users@lists.llvm.org> wrote: > > Hi, > > can anyone help in providing clarification to this query? > > I am new to Clang, LLVM and have some questions regarding attaching comments > to the clang AST. I would like to parse a C/C++ file and get preceeding > comments to variable declarations and attach these to the AST. The comments > are annotations of model objects in the source code. I need to get the source > location for certain actions in the model based on these comments. > > So far I can visit the VarDecl, statements using the ASTRecursive visitor. I > have read several tutorials and searched, but could not find any straight > forward way of reading the comments and attaching it to the AST node. I also > noticed that the getRawCommentForDeclNoCache(VarDecl) is always null. From > one of the tutorials it was mentioned that the option -fparse-all-comments > must be passed to clang inorder to have non-doxygen style of comments. > > Can someone please provide me with more clarification on this? Why do I > always get nullptr for getRawCommentForDeclNoCache(VarDecl). Where to pass > this option. > > Thanks inadvance, > > Bewoayia > > -----"cfe-users" <cfe-users-boun...@lists.llvm.org> schrieb: ----- > An: cfe-users@lists.llvm.org > Von: Bewoayia Kebianyor via cfe-users > Gesendet von: "cfe-users" > Datum: 28.02.2018 14:36 > Betreff: [cfe-users] Reading and Attaching Comments to CLANG AST > > Hello, > > I am new to Clang, LLVM and have some questions regarding attaching comments > to the clang AST. I would like to parse a C/C++ file and get preceeding > comments to variable declarations and attach these to the AST. The comments > are annotations of model objects in the source code. I need to get the source > location for certain actions in the model based on these comments. > > So far I can visit the VarDecl, statements using the ASTRecursive visitor. I > have read several tutorials and searched, but could not find any straight > forward way of reading the comments and attaching it to the AST node. I also > noticed that the getRawCommentForDeclNoCache(VarDecl) is always null. From > one of the tutorials it was mentioned that the option -fparse-all-comments > must be passed to clang inorder to have non-doxygen style of comments. > > Can someone please provide me with more clarification on this? Why do I > always get nullptr for getRawCommentForDeclNoCache(VarDecl). Where to pass > this option. > > Thanks inadvance, > > Bewoayia > > _______________________________________________ > cfe-users mailing list > cfe-users@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users > _______________________________________________ > cfe-users mailing list > cfe-users@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users _______________________________________________ cfe-users mailing list cfe-users@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users