Finding auto-transformable types


I have pushed a simplified version of the auto-modernizer I linked a few
days ago to github.

GitHub - steveire/clang-plugin-test

This version doesn't do replacements, but serves to illustrate some problem
I encountered while attempting to adjust certain declarations and leave
others alone.

Unfortunately the Clang API documentation is not very helpful, so I ended up
just copying things from other locations such as clang-tidy. That doesn't
result in the code doing the right thing, so I'm hoping for some help.

In the repo, there is also a test file

  std::vector<int> v = {1, 2, 4};

  int& three = v[2];
  three = 3;
  int three = v[2];
  three = 3;

The 'int& three' should be replaced with 'auto& three' and the 'int three'
should not be touched.

Can someone help adjust the plugin code to achieve that?

Additionally, I would like to be able to transform

  std::vector<int> v2;
  NotCopyable nc;


  auto v2 = std::vector<int>();
  NotCopyable nc;

but I could not figure out how to do that.

Finally, broadly my goal was 'transform to use auto if the rhs type is the
same as the lhs type'. I am wondering if I am missing some simpler way to do
that than the way I've been attempting so far. If you know an easier way,
please let me know.



ping? I'm still looking for a hero to help with this.