[PATCH] D84668: [clang][cli] Port TargetOpts simple string based options to new option parsing system

Michael Spencer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 17 09:12:44 PST 2020


Bigcheese accepted this revision.
Bigcheese added a comment.
This revision is now accepted and ready to land.

lgtm with the fix above.



================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:264-265
 
+template <typename T,
+          std::enable_if_t<!std::is_same<T, unsigned>::value, bool> = true>
+static void denormalizeSimpleEnum(SmallVectorImpl<const char *> &Args,
----------------
jansvoboda11 wrote:
> dexonsmith wrote:
> > 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.
> 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>.
I would suggest instead to just rename the `unsigned` version to `denormalizeSimpleEnumImpl` and removing the constraints on this one.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84668/new/

https://reviews.llvm.org/D84668



More information about the cfe-commits mailing list