The initial goal of this revision was to improve the algorithms for resolving the template arguments of classes and multiclasses. However, along the way I discovered that the type checking of template arguments was inconsistent.
- Template argument values passed to inherited classes were type-checked and cast if necessary.
- Template argument values to anonymous class instantiations were type-checked but not cast.
- Template argument values to multiclasses were not type-checked at all.
Adding type checking for multiclasses revealed many invalid template argument values. These have been corrected in the various target TableGen files. See https://reviews.llvm.org/D95874.
So this revision improves the algorithms and type-checks/casts all template arguments.
While this revision is being reviewed, I will add a large test for all the template argument checking.
clang-format: please reformat the code
- PrintFatalError(getLoc(), Twine("Invalid value ") + Type + - "found when setting field '" + - Value.getNameInitAsString() + - "' of type '" + - Value.getType()->getAsString() + - "' after resolving references: " + - VR->getAsUnquotedString() + "\n"); + PrintFatalError( + getLoc(), + Twine("Invalid value ") + Type + "found when setting field '" +4 diff lines are omitted. See full path.