Remove extraneous qualifications from names when
- the name is explicitly enclosed by corresponding namespaces, and
- the name is in a body of a function defined in corresponding
namespaces. Otherwise add missing qualifications.
This applies to individual sections of TableGen output, and makes name
lookup independent of the context in which these sections are included.