[MC][ARM] Don't set funcs to Thumb as a side effect of .hidden (#181156)
When assembling a source file which switches between Arm and Thumb state
using `.arm` and `.thumb`, if you defined a function in Arm state and
mark it as hidden at dynamic link time using `.hidden`, but don't
actually issue the `.hidden` directive until you have switched back to
Thumb state, then the function would be accidentally marked as Thumb as
a side effect of making it hidden.
This happened in `ARMELFStreamer::emitSymbolAttribute`, and the comment
suggests that it was semi-deliberate: it was intended to happen as a
side effect of `.type foo,%function`, because the function label might
have already been defined without a type, and shouldn't be marked as
Thumb until it's known that it's a function. But I think it was an
accident that the same behavior also applies to any other addition of a
symbol attribute, such as `.hidden`: the call to `setIsThumbFunc` was
conditioned on whether the symbol has function type after setting the
attribute, not whether function type was the attribute _actually being
set_. So if you set the symbol to function type and _then_ use
`.hidden`, the condition would match again.
Fixes #180358, in which this came up in real-world code: rustc's IR
output included a top-level function in the form of inline asm, defined
in Arm state, and marked it as hidden via the LLVM IR `declare`, so that
LLVM didn't emit the `.hidden` directive until after it had switched
back to Thumb state.
The new test case includes a check for the _intended_ behavior of the
code in `emitSymbolAttribute`, to confirm that that still works.