Depends on D84190
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Frontend/CompilerInvocation.cpp | ||
---|---|---|
248 | I don't think this needs to be templated; it can just use the same prototype it did before this patch (using unsigned directly). | |
271–272 | Once the template is gone from the unsigned overload above, I wonder if we can use !std::is_convertible<T, unsigned> here, and let the unsigned overload directly catch any enums that aren't strongly typed. |
clang/lib/Frontend/CompilerInvocation.cpp | ||
---|---|---|
248 | I can remove it. I originally put it in there to be symmetrical with the template below. | |
271–272 | Unfortunately, std::is_convertible<T, unsigned>::value == false when T is an enum class (and it's the same for std::is_constructible<unsigned, T>::value): https://godbolt.org/z/Pvsr7v. I didn't find any type trait in the standard library that would have the same semantics as static_cast<unsigned, T>, but we could use something like this: https://godbolt.org/z/738dhe. |
lgtm with the fix above.
clang/lib/Frontend/CompilerInvocation.cpp | ||
---|---|---|
271–272 | I would suggest instead to just rename the unsigned version to denormalizeSimpleEnumImpl and removing the constraints on this one. |
clang-format not found in user's PATH; not linting file.