[cfe-dev] Criticism over a clang tool to reorder fields on constructor declarations

Manuel Klimek klimek at google.com
Fri Aug 17 08:43:55 PDT 2012


Hi Victor,

if I remember correctly we've been talking in IRC - have all your
issues been resolved?

Cheers,
/Manuel

On Thu, Aug 9, 2012 at 5:22 AM, Victor Vicente de Carvalho
<victor.v.carvalho at gmail.com> wrote:
> Hello,
>
> In the past month I've been working in a clang tool to refactor the fields
> which are declared on a class constructor to match the order declared on the
> header file, hence resolving the annoying Wreorder warning. After a series
> of difficulties finally I have something that is close to the ideal, and
> would like to someone more acquainted with clang internals to check if it's
> the best form to implement this.
>
> Also, I've got some problems that are still remaining:
>
> 1 - I've been following the samples I've managed to find through the
> internet, but every time I try to run the tool using the following command
> line (I'm intentionally not providing any include paths as I don't want to
> std to be parsed):
>
> ../cpp-fixya <SOURCE.CPP>  --
>
> I get the following errros:
>
> <premain>: CommandLine Error: Argument 'version' defined more than once!
> <premain>: CommandLine Error: Argument 'print-all-options' defined more than
> once!
> <premain>: CommandLine Error: Argument 'print-options' defined more than
> once!
> <premain>: CommandLine Error: Argument 'help-hidden' defined more than once!
> <premain>: CommandLine Error: Argument 'help' defined more than once!
> <premain>: CommandLine Error: Argument 'debug-only' defined more than once!
> <premain>: CommandLine Error: Argument 'debug-buffer-size' defined more than
> once!
> <premain>: CommandLine Error: Argument 'debug' defined more than once!
> cpp-fixya: CommandLine Error: Argument 'version' defined more than once!
> cpp-fixya: CommandLine Error: Argument 'print-all-options' defined more than
> once!
> cpp-fixya: CommandLine Error: Argument 'print-options' defined more than
> once!
> cpp-fixya: CommandLine Error: Argument 'help-hidden' defined more than once!
> cpp-fixya: CommandLine Error: Argument 'help' defined more than once!
> cpp-fixya: CommandLine Error: Argument 'debug-only' defined more than once!
> cpp-fixya: CommandLine Error: Argument 'debug-buffer-size' defined more than
> once!
> cpp-fixya: CommandLine Error: Argument 'debug' defined more than once!
>
>
> 2 - I haven't found a way to determine the class name for nested classes.
> How would be the best way to detect and generate the correct naming to a
> nested class? I've been using:
>
> d->getNameAsString()
>
> but it only returns the enclosing class
>
>
> 3 - How do I determine if a class declaration is on a header or a source
> file? I mean that because if it's a source-only declaration (i.e. private
> classes) the c++ compiler wont accept constructors in the form:
>
> Constructor::Constructor()  : <init_declrs> {
> }
>
> only in the form:
>
> Constructor()  : <init_declrs> {
> }
>
>
> Here is the code:
>
> https://gist.github.com/3300494
>
>
> Thanks in advance,
>
>
> Victor
>
>
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>



More information about the cfe-dev mailing list