Review Request 112232: DUChain: fix template specialization for template class nested in class

Milian Wolff mail at milianw.de
Sun Aug 25 15:42:28 UTC 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/112232/#review38554
-----------------------------------------------------------

Ship it!


if everything else still passes and the issue is resolved that sounds like a good approach to fix this!

- Milian Wolff


On Aug. 24, 2013, 11:50 a.m., Max Schwarz wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/112232/
> -----------------------------------------------------------
> 
> (Updated Aug. 24, 2013, 11:50 a.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Description
> -------
> 
> This patch tries to fix KDevelop's understanding of template specializations of template classes nested in other contexts, e.g.
> 
> class A
> {
>   template<class T>
>   class B
>   {};
> };
> 
> template<>
> class A::B<int>
> {
> public:
>     int value;
> };
> 
> int main()
> {
>     A::B<int> a;
>     return a.value; // KDevelop does not know value
> }
> 
> My understanding of the DUChain code is very limited. But I think I have made out two apparent reasons and fixed them with this patch:
>  a) findLocalDeclarations() is used to find A::B inside the global scope, which does not work. Use findDeclarations() instead.
>  b) The template context cannot be found for template<...> class A::B, since a helper context for the prefix A:: is inserted between the
>     template context and the class context.
> 
> Someone with DUChain experience needs to have a look at it. I'm not sure I did the right thing, especially with issue b).
> 
> 
> Diffs
> -----
> 
>   languages/cpp/cppduchain/declarationbuilder.cpp 7216f1f 
>   languages/cpp/cppduchain/tests/test_duchain.cpp 0a32f0d 
> 
> Diff: http://git.reviewboard.kde.org/r/112232/diff/
> 
> 
> Testing
> -------
> 
> Seems to work, I have used it for two weeks now. I haven't done any further testing.
> 
> 
> Thanks,
> 
> Max Schwarz
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20130825/7a733181/attachment-0001.html>


More information about the KDevelop-devel mailing list