Currently, user-defined attributes (e.g. those registered via Clang plugins) don't hold much information or allow for much to be done with them, as their argument tokens are discarded entirely in almost all cases.
However, since they are quite flexible with their syntax (pretty much anything can go in there), it would be massively helpful if plugins could be handed the pre-processed and parsed tokens as a list to be consumed by third-party plugins and the like.
This diff creates a trailing data list for ParsedAttr objects and places the "recorded" tokens there from the lexer. I would have piggy-backed off of the normal backtrack system but unfortunately it doesn't call the handler for tokens being replayed from the backtrack cache, which in many cases we *do* care about. So I had to create a second recording callback.
The new plugin directory shows how this would be used from a plugin.
NOTE: I'm posting a bit prematurely, as on my WSL1 machine this caused a random test to fail, and I'm not entirely sure why. Hoping someone else can point me in the right direction to debug it.
The three tests that failed before hand were:
Failed Tests (3): Clang :: Frontend/plugin-delayed-template.cpp libc++ :: libcxx/gdb/gdb_pretty_printer_test.sh.cpp libc++ :: std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp
And after:
Failed Tests (4): Clang :: Frontend/plugin-delayed-template.cpp Clang :: SemaObjC/externally-retained-no-arc.m libc++ :: libcxx/gdb/gdb_pretty_printer_test.sh.cpp libc++ :: std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp
EDIT: Looks like the errors were transient on my end; successive runs of the identical changes on WSL1 produces different failures each time. CI appears to be green so hopefully everything is OK.
I'm not certain what this is actually doing -- the .exports file is empty (and no other plugin has this sort of .exports file thing). Is this needed?