I’m attempting to improve the following diagnostic:
foo.cc:2:14: error: empty parameter list defined with a typedef of 'void' not allowed in C++ void test(foo); ^
My main intent was to add a fixit that suggests replacing ‘foo’ with ‘void’ here. But I’ve come into two problems:
The source location of the unnamed (foo/void typed) parameter is the closing ‘)’ - presumably this is meant to be pointing to the name of the variable, but that doesn’t exist in this case. Should we be addressing this in some general way (I imagine lots of diagnostics might point to parameters & get the case of unnamed parameters wrong in the same way)?
I can’t seem to find the source range of the entire parameter (though in this case, I’d settle for the source range of the type if that were easier). Using ParamVarDecl’s getSourceRange to apply a replacement fixit to “void” I get a range that is too long, like this (the ^ is corrected in this case as I also changed the diagnostic to apply to the Param’s locStart rather than location) :
foo.cc:2:11: error: empty parameter list defined with a typedef of 'void' not allowed in C++ void test(foo); ^~~~ void
again - is this by design (in which case I’d need a local workaround/another way to find the desired source range), or should the range incorrect in general?