Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


On Tuesday 02 of April 2013, Michael Meeks wrote:
On Mon, 2013-04-01 at 16:04 +0200, Noel Grandin wrote:
Another way is to use a clang plugin to generate a more accurate list
of definitions and call sites.
That's what I would do, because clang would handle all of the macro
and language parsing.

      Completely agreed; I imagine it would be necessary to write some
intermediate format out from each clang compile - and then crunch those
together afterwards to see what was actually used.

      Hopefully - given the level of context that clang has - it'd be
reasonably easy to identify and elide virtual methods even DLLPUBLIC
ones - though we would presumably want to white-list any UNO interfaces'
virtual methods - which may well never be called; yet can't be removed.

      The compilerplugins/ directory has some nice README about plugins and
all the good things they can do :-) Potentially with a double pass
through the code - clang could auto-generate diffs of things o
remove ;->

 If somebody wants to play with this, there is a base for such a compiler 
check in compilerplugins/clang/store/unusedcode.cxx . It only checks whether 
all functions encountered are used or not (and it should handle both inline 
and virtuals correctly). It doesn't do anything more with it, but there are 
comments about what should be done with the data, which I expect should be 
fairly easy to do and just needs somebody to do it. It it to be used like 
other rewriters (see the README), expect it won't rewrite anything and only 
generate the data.

 There's no white-listing either, but that shouldn't be difficult, and the 
code could be similarly extended to also check for unused structs/classes, 
enums, etc.

-- 
 Lubos Lunak
 l.lunak@suse.cz

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.