Understanding TableGen is a big question, because it’s used for many different things. Understanding how TableGen is used for diagnostics is relatively straightforward, however. There might be documentation, but here’s what you’ll need to know even if there isn’t.
Let’s look at the diagnostic definition that I found, hopefully the same one you found:
def note_constexpr_uninitialized : Note<
"%select{|sub}0object of type %1 is not initialized">;
The name after the “def” becomes a symbolic constant for this diagnostic. If you grep the clang source for that name, you’ll find where the diagnostic is generated. There might be only one place, there might be several.
Next, observe the %1
in the string. This is a placeholder for a parameter passed to the diagnostic engine, in this case the name of the type. The 1
means it is parameter number 1, where the numbers start at 0, so in this case it will be the second parameter.
Finally, observe the %select{|sub}0
part. This is a fancier kind of placeholder, but note that it still starts with %
and ends with a digit (in this case, 0
). That means the substitution is controlled by parameter 0 passed to the diagnostic. The select
operator expects an integer, which it uses to select one of the alternatives inside the braces, which are separated by |
. If you pass 0 as parameter 0, it will substitute the 0th alternative, which is the empty string; if you pass 1, it will substitute the 1th alternative, “sub”.
The diagnostics engine is set up to use stream-like operators, so in this case the code to generate the diagnostic will first call some kind of Diag method passing diag::note_constexpr_uninitialized
followed by stream operators for the parameters. This will probably look something like
foo.Diag(...) << isSubobject << typeName;
not exactly like that–I haven’t actually looked up the code–but it will have that general form.
To fix the diagnostic, you’ll need to (a) change the text of the message in the .td file, (b) modify each of the places the diagnostic is used to pass the correct name.