From karanbirs93 at gmail.com Tue Sep 16 06:10:50 2014 From: karanbirs93 at gmail.com (Karanbir Singh) Date: Tue, 16 Sep 2014 15:40:50 +0530 Subject: [GCC-XML] Setting relative path for included user defined header files in C++ code Message-ID: Hello gccxml -mailing-list, I am trying to parse a C++ file which includes many user defined header files. GCCXML is not able to read the location of header files included in the code. Is there a way I can change the base path which when appended with the path mentioned in "#include " lines written in the code gives the path of the directory containing the header files. I tried to work around this problem by specifying the paths of all the header files in a text file and then using the following command : --gccxml-gcc-options textfilename But this creates a problem in case there is a long chain of dependencies as I would have to specify the paths of files included in the header files as well. Is there a way to solve this problem? -------------- next part -------------- An HTML attachment was scrubbed... URL: From brad.king at kitware.com Tue Sep 16 10:24:25 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 16 Sep 2014 10:24:25 -0400 Subject: [GCC-XML] Setting relative path for included user defined header files in C++ code In-Reply-To: References: Message-ID: <54184819.5080006@kitware.com> On 09/16/2014 06:10 AM, Karanbir Singh wrote: > I am trying to parse a C++ file which includes many user defined header files. In this regard gccxml is just like a compiler: all include directories must be specified with -I options just as if you were trying to compile the source file. -Brad From karanbirs93 at gmail.com Wed Sep 17 05:56:45 2014 From: karanbirs93 at gmail.com (Karanbir Singh) Date: Wed, 17 Sep 2014 15:26:45 +0530 Subject: [GCC-XML] Setting relative path for included user defined header files in C++ code In-Reply-To: <54184819.5080006@kitware.com> References: <54184819.5080006@kitware.com> Message-ID: Thanks a lot Brad. I am facing two more issues. 1) gccxml seems to be parsing a lot of code which is not in the current C++ file. I guess it is parsing the included header files. Is there a way to avoid this? 2) I need to dump the function bodies to xml as well. Does the patch offered by Daniel J Lauk succesfully dump function bodies to xml? On Tue, Sep 16, 2014 at 7:54 PM, Brad King wrote: > On 09/16/2014 06:10 AM, Karanbir Singh wrote: > > I am trying to parse a C++ file which includes many user defined header > files. > > In this regard gccxml is just like a compiler: all include directories > must be specified with -I options just as if you were trying to compile > the source file. > > -Brad > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/gccxml > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brad.king at kitware.com Thu Sep 18 08:35:35 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 18 Sep 2014 08:35:35 -0400 Subject: [GCC-XML] Setting relative path for included user defined header files in C++ code In-Reply-To: References: <54184819.5080006@kitware.com> Message-ID: <541AD197.8060803@kitware.com> On 09/17/2014 05:56 AM, Karanbir Singh wrote: > Thanks a lot Brad. I am facing two more issues. > 1) gccxml seems to be parsing a lot of code which is not in > the current C++ file. I guess it is parsing the included > header files. Is there a way to avoid this? No. The parser *is* a compiler. It needs the full translation unit just like any other compiler. However, you can use -fxml-start=some_decl to dump only a subset of the parsed declarations to xml. > 2) I need to dump the function bodies to xml as well. This is not supported by gccxml. > Does the patch offered by Daniel J Lauk succesfully dump > function bodies to xml? Perhaps but it has not been maintained with the rest of gccxml so I do not know if it would still work. I suggest looking at Clang instead: http://clang.llvm.org/docs/Tooling.html -Brad From karanbirs93 at gmail.com Tue Sep 16 06:10:50 2014 From: karanbirs93 at gmail.com (Karanbir Singh) Date: Tue, 16 Sep 2014 15:40:50 +0530 Subject: [GCC-XML] Setting relative path for included user defined header files in C++ code Message-ID: Hello gccxml -mailing-list, I am trying to parse a C++ file which includes many user defined header files. GCCXML is not able to read the location of header files included in the code. Is there a way I can change the base path which when appended with the path mentioned in "#include " lines written in the code gives the path of the directory containing the header files. I tried to work around this problem by specifying the paths of all the header files in a text file and then using the following command : --gccxml-gcc-options textfilename But this creates a problem in case there is a long chain of dependencies as I would have to specify the paths of files included in the header files as well. Is there a way to solve this problem? -------------- next part -------------- An HTML attachment was scrubbed... URL: From brad.king at kitware.com Tue Sep 16 10:24:25 2014 From: brad.king at kitware.com (Brad King) Date: Tue, 16 Sep 2014 10:24:25 -0400 Subject: [GCC-XML] Setting relative path for included user defined header files in C++ code In-Reply-To: References: Message-ID: <54184819.5080006@kitware.com> On 09/16/2014 06:10 AM, Karanbir Singh wrote: > I am trying to parse a C++ file which includes many user defined header files. In this regard gccxml is just like a compiler: all include directories must be specified with -I options just as if you were trying to compile the source file. -Brad From karanbirs93 at gmail.com Wed Sep 17 05:56:45 2014 From: karanbirs93 at gmail.com (Karanbir Singh) Date: Wed, 17 Sep 2014 15:26:45 +0530 Subject: [GCC-XML] Setting relative path for included user defined header files in C++ code In-Reply-To: <54184819.5080006@kitware.com> References: <54184819.5080006@kitware.com> Message-ID: Thanks a lot Brad. I am facing two more issues. 1) gccxml seems to be parsing a lot of code which is not in the current C++ file. I guess it is parsing the included header files. Is there a way to avoid this? 2) I need to dump the function bodies to xml as well. Does the patch offered by Daniel J Lauk succesfully dump function bodies to xml? On Tue, Sep 16, 2014 at 7:54 PM, Brad King wrote: > On 09/16/2014 06:10 AM, Karanbir Singh wrote: > > I am trying to parse a C++ file which includes many user defined header > files. > > In this regard gccxml is just like a compiler: all include directories > must be specified with -I options just as if you were trying to compile > the source file. > > -Brad > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/gccxml > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brad.king at kitware.com Thu Sep 18 08:35:35 2014 From: brad.king at kitware.com (Brad King) Date: Thu, 18 Sep 2014 08:35:35 -0400 Subject: [GCC-XML] Setting relative path for included user defined header files in C++ code In-Reply-To: References: <54184819.5080006@kitware.com> Message-ID: <541AD197.8060803@kitware.com> On 09/17/2014 05:56 AM, Karanbir Singh wrote: > Thanks a lot Brad. I am facing two more issues. > 1) gccxml seems to be parsing a lot of code which is not in > the current C++ file. I guess it is parsing the included > header files. Is there a way to avoid this? No. The parser *is* a compiler. It needs the full translation unit just like any other compiler. However, you can use -fxml-start=some_decl to dump only a subset of the parsed declarations to xml. > 2) I need to dump the function bodies to xml as well. This is not supported by gccxml. > Does the patch offered by Daniel J Lauk succesfully dump > function bodies to xml? Perhaps but it has not been maintained with the rest of gccxml so I do not know if it would still work. I suggest looking at Clang instead: http://clang.llvm.org/docs/Tooling.html -Brad