Even though it inherits from StringRef, we need to mention it
explicitly, as the formatter selection mechanism does not take
inheritance into account.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
include/llvm/Support/FormatProviders.h | ||
---|---|---|
49–50 ↗ | (On Diff #88219) | Perhaps this should use "is_convertible" which would match the implementation (well, not quite - the implementation should probably use "StringRef S = V" rather than StringRef S(V))? |
include/llvm/Support/FormatProviders.h | ||
---|---|---|
49–50 ↗ | (On Diff #88219) | If it works I'm all for simplifying. Need to be careful with potentially overlapping conditions though. |
Using is_convertible will work right now. What will this prevent is someone
defining their own format_provider on a class which has a conversion operator
for StringRef. I've debated this with myself a bit. On one hand, it adds more
predictability (if something behaves enough like StringRef that in can be
converted to one, it should also be formatted like it). On the other hand, I'm
sure somebody somewhere will invent a case where it still makes sense to do
that.
But I suppose we can cross that bridge when we come to it.