Fwd: parse cpp files imported by #include "*.cpp"

black 1537534854 at qq.com
Fri Nov 22 11:30:57 UTC 2013

于 2013年11月22日 17:16, Milian Wolff 写道:
> On Friday 22 November 2013 16:59:32 black wrote:
>> 于 2013年11月22日 08:19, Sven Brauch 写道:
>>> There were complaints about this issue before; there's not really a sane
>>> way for an IDE to know which context the file will be embedded in, since
>>> this might be multiple different contexts. Additionally, I consider this
>>> pattern a very bad idea code-wise, so I'd call this a wontfix.
>>> If you see a sane way to do this, feel free to come up with a patch. I
>>> don't think it's worth the effort though -- try solving the issue
>>> differently code- wise instead
>> Thanks for your time. It is a bad coding style indeed. However , I want
>> to use kdevelop with
>> a big library for Computational Fluid Dynamics, named "OpenFOAM". And
>> this coding style was
>> used in this library everywhere, the work to change this bad coding
>> style in OpenFOAM will be
>> very huge. So it maybe worth to have a try.
> The example you posted does work btw. What won't work, is if you put these
> includes into namespaces or classes, which I've also seen projects do (Eigen
> e.g.).
> a.h
> namespace a {
> #include "a_impl.h"
> }
> a_impl.h
> int foo;
> b.cpp
> #include "a.h"
> auto foo = a::foo;
> But, as Sven said, this is a wontfix. It will probably be resolved as a side-
> effect once we use Clang instead of our own parser though.
> Bye
The "#include "*.cpp" " was put into namespaces, classes and functions 
everywhere in some libraries.
Clang will solve this problem perfectly. However, we have not seen the 
work of making it Clang-based.
  How about use the preprocessor in our cpp paser, just put the context 
imported by "#include "*.cpp""
in the main context ?

More information about the KDevelop-devel mailing list