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

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 15 14:47:04 PST 2020


dexonsmith added inline comments.


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:248
+template <typename T,
+          std::enable_if_t<std::is_same<T, unsigned>::value, bool> = true>
 static void denormalizeSimpleEnum(SmallVectorImpl<const char *> &Args,
----------------
I don't think this needs to be templated; it can just use the same prototype it did before this patch (using `unsigned` directly).


================
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,
----------------
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.


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