clang-format/libtooling for moving comments

Hi all,

I have a codebase changing code documentation and comment practices which I’d like to adjust automatically for the most part. The changes look easy, and certainly automatable, but I haven’t figured out how to do it with libtooling

I’d like to transform

struct MyStruct{
int field; //docline, at varying distances to the right
};

to

struct MyStruct{
//docline
int field;
};

In summary, this is about moving a comment following any declaration on the same line to the previous line at the same indentation level.

Related, I’d like to change many variations of

/**

  • comments
    */

to

///
/// comments
///

Is there an existing pathway for these transformations or active work? Anything close I can get a start from?

FYI actively using clang-format.

Thanks,
Jason