Hey folks,
Since we’re now requiring C++17, I’d like to get rid of makeXXX
functions like makeArrayRef
, and use deduction guides instead.
Apart from codebase modernization, there isn’t much benefit from that move, but I can still mention that it would slightly (probably negligibly) decrease the number of symbols / debug info, as deduction guides don’t generate new code.
I’ve already done the change (i.e. invoked sed
) for makeArrayRef
, see ⚙ D140896 [WIP] Move from llvm::makeArrayRef to ArrayRef deduction guides . The only non-automatic changes have been:
- Write the deduction guides
-
ArrayRef(some_uint8_pointer, 0)
needs to be changed intoArrayRef(some_uint8_pointer, (size_t)0)
to avoid an ambiguous call withArrayRef((uint8_t*), (uint8_t*))
-
CVSymbol sym(makeArrayRef(symStorage));
needed to be rewritten asCVSymbol sym{ArrayRef(symStorage)};
otherwise the compiler is confused and thinks we have a (bad) function prototype. There was a few similar situation across the codebase. - ADL doesn’t seem to work the same for deductio-guides and functions, so at some point the
llvm
namespace must be explicitly stated. - The “reference mode” of
makeArrayRef(ArrayRef<T> &)
that acts as no-op is not supported (a constructor cannot achieve that).