Review Request 123987: Don't create declarations for anonymous function parameters

Kevin Funk kfunk at kde.org
Wed Jun 3 08:26:17 UTC 2015



> On June 3, 2015, 7:22 a.m., Milian Wolff wrote:
> > duchain/builder.cpp, line 785
> > <https://git.reviewboard.kde.org/r/123987/diff/1/?file=378686#file378686line785>
> >
> >     this is very costly for the common case of non-empty identifiers. could you instead use the range and check whether that is empty please? i.e. skip the string conversion
> 
> Sergey Kalinichev wrote:
>     I've just tried it, but both: clang_Cursor_getSpellingNameRange and clang_getCursorExtent return non empty ranges, is there any other method?
>     Also this path is called for function parameters only which is not so often, so I don't think it's a problem at all.
> 
> Milian Wolff wrote:
>     Then please add a comment like "TODO: find a way to do this without a costly string conversion" and I'll take a look at it.
>     
>     thanks!

Just quickly scanned the clang source: I don't see an easy way to do this.

Otoh, `clang_getCursorSpelling()` is likely just increasing the ref count on an internal `cxstring`, so it might not be that problematic. Would need to check the backtrace what happens for the ParmDecl cursor, but I don't have a debug build of LLVM/Clang right now.

Still, please add an TODO.


- Kevin


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/123987/#review81098
-----------------------------------------------------------


On June 3, 2015, 7:04 a.m., Sergey Kalinichev wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/123987/
> -----------------------------------------------------------
> 
> (Updated June 3, 2015, 7:04 a.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Repository: kdev-clang
> 
> 
> Description
> -------
> 
> E.g.: void f(int);
> The int parameter is anonymous, so instead of creting a declaration pointing at the ) we do nothing here.
> 
> 
> Diffs
> -----
> 
>   duchain/builder.cpp 4165cfc 
>   tests/files/variables.cpp 71935e9 
> 
> Diff: https://git.reviewboard.kde.org/r/123987/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Sergey Kalinichev
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20150603/42011b07/attachment.html>


More information about the KDevelop-devel mailing list