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

black 1537534854 at qq.com
Sun Nov 24 00:05:25 UTC 2013


于 2013年11月24日 01:09, Nicolai Hähnle-Montoro 写道:
> On Fri, Nov 22, 2013 at 12:30 PM, black <1537534854 at qq.com> wrote:
>> 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.
> This is not true. It is fundamentally impossible to solve this problem
> perfectly, because when editing the included file, you do not know
> which context it is going to be included in.
>
> This is an inherent limitation of the include-based model of C++.
>
> You could play a game of trying to make some use cases work, e.g. when
> a file is only ever included in one single location. But now you've
> just introduced a silly corner case that is probably not tested
> properly, and breaks the first time somebody decides to include that
> file in two separate locations. Really, it's better to just not go
> there.
>
> Cheers,
> Nicolai
Once somebody include a *.cpp file in two separate locations, it will break.
So, what if just put the *.cpp file into the context which includes it , 
and we
do not parse the *.cpp file separately ? Just like a macro.



More information about the KDevelop-devel mailing list