There are several instances where we have diagnostics that take a warning form as well as an error form, but retain the same spelling between the two forms. Eg)
def warn_attribute_pointers_only : Warning< "%0 attribute only applies to pointer arguments">, InGroup<IgnoredAttributes>; def err_attribute_pointers_only : Error< "%0 attribute only applies to pointer arguments">; This duplication can make it easy for the two diagnostic wordings to get out of sync. For instance, with the attribute subject diagnostics, there is a %select list that must remain in sync between the two diagnostics. These two patches implement multiclass support for diagnostics. The llvm side of things modifies the table generator to pay attention to the whether the multiclass name should be a prefix or suffix. It does so by looking at whether the class name ends with an underscore. So foo_ will be treated as a prefix, and anything else will be treated as a suffix. The clang side uses the new tablegen functionality by creating a warning_and_error multiclass which uses the warn_ and err_ prefixes. Because they end with an underscore, they will be concatenated properly to form warn_attribute_pointers_only and err_attribute_pointers_only. If this approach seems like a good idea, I will also update the tablegen documentation to note the new functionality, and can likely switch over more diagnostics to using the warning_and_error base multiclass. ~Aaron
warning_error_clang.patch
Description: Binary data
multiclass_prefix.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
