this patch fixes Bug 27113 by adding support for string literals to the implementation of the MS extension __identifier.
Interesting, I hadn't seen __identifier before. It seems like a pretty esoteric feature.
I'm not sure this is the right way to get the string out of a string_literal.. this pattern seems more common: https://github.com/llvm/llvm-project/blob/llvmorg-12.0.0/clang/lib/Lex/Pragma.cpp#L755
For example, what should happen with __identifier("foo" "bar")?
It says in the bug report that MSVC emits a warning for this. What does the warning look like, and would it make sense for Clang too warn too (it might not, just wondering if we should consider it).
Maybe instead of removing this, move it to the cases that work above. For example, I guess this should work now?
int __identifier("foo") = 42; int bar = foo;
It would be interesting to see a non-error test case too, perhaps with a mangled name like in the PR, and to see that it makes it through to LLVM IR correctly..
Correctly handle string literals and add more test cases. Also MSVC by default gives an error when trying to use __identifier with a string literal but disabling/suppressing that error allows string literals to be used with __identifier. However given how esoteric it is, it wouldn't really be necessary for clang to give a warning or error like MSVC