- Factor out the code that will be shared by both parameter and local variable fix-its
- Add a check to ensure that a TypeLoc::isNull is false before using the TypeLoc
- Remove the special check for whether a fixing variable involves unnamed types. This check is unnecessary now. Because we will give up on fixing a pointer type variable v, if we cannot obtain the source range of the pointee type of v. Using unnamed types is just one of the many causes of such scenarios. Besides, in some cases, we have no problem in referring to unnamed types. Therefore, we remove the special handling since we have a more general solution already.
For example,
typedef struct {int x;} UNNAMED_T; UNNAMED_T * x; // we can refer to the unnamed struct using `UNNAMED_T` typedef struct {int x;} * UNNAMED_PTR; UNNAMED_PTR y; // we cannot obtain the source range of the pointee type of `y`, so we will give up
- Move tests for cv-qualified parameters and unnamed types out of the "...-unsupported.cpp" test file.
I'd rather just use literals in expressions. Saves a couple mallocs, a couple memcpys, and a couple lines of code.
(They'll probably turn into variables later anyway, when we transcend beyond span, so arguably not worth fixing.)