Hello,<div><br></div><div>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.</div>
<div><br></div><div>Also, I've got some problems that are still remaining:</div><div><br></div><div>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):</div>
<div><br></div><div><div>../cpp-fixya <SOURCE.CPP>  --</div></div><div><br></div><div>I get the following errros:</div><div><br></div><div><premain>: CommandLine Error: Argument 'version' defined more than once!</div>
<div><premain>: CommandLine Error: Argument 'print-all-options' defined more than once!</div><div><premain>: CommandLine Error: Argument 'print-options' defined more than once!</div><div><premain>: CommandLine Error: Argument 'help-hidden' defined more than once!</div>
<div><premain>: CommandLine Error: Argument 'help' defined more than once!</div><div><premain>: CommandLine Error: Argument 'debug-only' defined more than once!</div><div><premain>: CommandLine Error: Argument 'debug-buffer-size' defined more than once!</div>
<div><premain>: CommandLine Error: Argument 'debug' defined more than once!</div><div>cpp-fixya: CommandLine Error: Argument 'version' defined more than once!</div><div>cpp-fixya: CommandLine Error: Argument 'print-all-options' defined more than once!</div>
<div>cpp-fixya: CommandLine Error: Argument 'print-options' defined more than once!</div><div>cpp-fixya: CommandLine Error: Argument 'help-hidden' defined more than once!</div><div>cpp-fixya: CommandLine Error: Argument 'help' defined more than once!</div>
<div>cpp-fixya: CommandLine Error: Argument 'debug-only' defined more than once!</div><div>cpp-fixya: CommandLine Error: Argument 'debug-buffer-size' defined more than once!</div><div>cpp-fixya: CommandLine Error: Argument 'debug' defined more than once! </div>
<div><br></div><div><br></div><div>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:</div>
<div><br></div><div>d->getNameAsString() </div><div><br></div><div>but it only returns the enclosing class</div><div><br></div><div><br></div><div>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:</div>
<div><br></div><div>Constructor::Constructor()  : <init_declrs> {</div><div>}</div><div><br></div><div>only in the form:</div><div><br></div><div><div>Constructor()  : <init_declrs> {</div><div>}</div></div><div>
<br></div><div><br></div><div>Here is the code:</div><div><br></div><div><a href="https://gist.github.com/3300494">https://gist.github.com/3300494</a></div><div><br></div><div><br></div><div>Thanks in advance,</div><div><br>
</div><div><br></div><div>Victor</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div>