parsing of c++ template definitions in separate files

Raimar Sandner lists at 404not-found.de
Sun May 6 11:25:42 BST 2012


Hi,

actually this was my fault, I think I accidentally sent it twice, sorry.

Anyway, thank you all for the replies and suggestions, I think I understand 
now how this should be handled.

Best regards
Raimar

On Sunday 06 May 2012 12:17:36 Sven Brauch wrote:
> I'm sorry, something went wrong with the mail, and I just received it
> again. Ignore my previous message. :)
> 
> 2012/5/6 Sven Brauch <svenbrauch at googlemail.com>:
> > Hello there,
> > 
> > I think we already had that question, didn't we? I don't think it's
> > possible, unless you are willing to add special #if IN_IDE_PARSER
> > #endif statements where you include the header files. Otherwise, it's
> > not possible with the current version of kdevelop (nor do I know of
> > any feature allowing this being worked on).
> > 
> > Greetings,
> > Sven
> > 
> > 2012/4/24 Raimar Sandner <lists at 404not-found.de>:
> >> Hi,
> >> 
> >> I'm working with a project where most template definitions are in
> >> separate *.tpp files. A minimal example follows:
> >> 
> >> --------------------------------------------------------
> >> The file main.cpp:
> >> --------------------------------------------------------
> >> #include "foo.h"
> >> 
> >> int main(int argc, char **argv) {
> >>  Foo<1> f;
> >> }
> >> --------------------------------------------------------
> >> The file foo.h:
> >> --------------------------------------------------------
> >> #ifndef FOO_H
> >> #define FOO_H
> >> 
> >> template<int R>
> >> struct Foo
> >> {
> >>  void bar();
> >> };
> >> #include "foo.tpp"
> >> #endif // FOO_H
> >> 
> >> --------------------------------------------------------
> >> The file foo.tpp:
> >> --------------------------------------------------------
> >> template<int R>
> >> void Foo<R>::bar()
> >> {
> >> }
> >> --------------------------------------------------------
> >> 
> >> Now when I edit foo.tpp, the semantic analysis cannot resolve the
> >> class Foo<R> unless I #include "foo.h". This is safe because of the
> >> include guards, but if possible I would like to avoid this workaround
> >> because I would need to maintain a private branch of the project. Is
> >> there any other way to tell the parser that when editing foo.tpp it
> >> should parse foo.h along with it?
> >> 
> >> Best regards
> >> Raimar
> >> 
> >> _______________________________________________
> >> kdevelop mailing list
> >> kdevelop at kdevelop.org
> >> https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop
> 
> _______________________________________________
> kdevelop mailing list
> kdevelop at kdevelop.org
> https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop




More information about the KDevelop mailing list