[PATCH] D83694: [clang][cli] Port DependencyOutput option flags to new option parsing system
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 20 15:37:47 PST 2020
dexonsmith added inline comments.
================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:156-159
+template <typename T>
+FlagToValueNormalizer<T> makeFlagToValueNormalizer(T Value) {
+ return FlagToValueNormalizer<T>{std::move(Value)};
}
----------------
dexonsmith wrote:
> Please declare this `static`.
BTW, I suspect we can save some compile time (once there are lots of these) with:
```
template <
class T,
std::enable_if_t<
sizeof(T) <= sizeof(uint64_t) &&
std::is_trivially_convertible<T, uint64_t>::value &&
std::is_trivially_convertible<uint64_t, T>::value,
bool> = false>
FlagToValueNormalizer<uint64_t> makeFlagToValueNormalizer(T Value) {
return FlagToValueNormalizer<uint64_t>{std::move(Value)};
}
template <
class T,
std::enable_if_t<
!(sizeof(T) <= sizeof(uint64_t) &&
std::is_trivially_convertible<T, uint64_t>::value &&
std::is_trivially_convertible<uint64_t, T>::value),
bool> = false>
FlagToValueNormalizer<T> makeFlagToValueNormalizer(T Value) {
return FlagToValueNormalizer<T>{std::move(Value)};
}
```
It'd be worth trying if/once the compile-time begins to climb to catch the enums (that aren't strongly typed) in a single instantiation.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83694/new/
https://reviews.llvm.org/D83694
More information about the cfe-commits
mailing list