You might want to canvas opinions from others who have developed in this area recently, such as @vsk, before putting this in, but aside from the missing comment and couple of nits, this looks good.
I'd also make sure your commit comment mentions that this is intended to match std::size in C++17 (perhaps referencing the version you're implementing and the relevant version, i.e. version 2).
Please add a comment, like the rest of the functions around here.
You're being inconsistent with your use of "std" here. Unfortunately, so is this entire file, so I can't say what is the preferred way, but at least make sure to use only one form in this function!
It looks like it's more common to explicitly specify the llvm:: prefix here, and that would also help with replacing instances with std::size once LLVM allows C++17 code, via find/replace.
It might also be good to try two different test inputs (with e.g. a different size of array and type).
LGTM. But I'd like somebody else to chip in on this as well before you commit. If nobody else does in the next couple of days, go ahead and commit.
Thinking about it, you might want to say that this is identical to C++17's version (see similar comments around make_unique below).
Indeed, this is the exact same function (and to be honest I didn't see it). But as c++17 is introducing this function with size as name, maybe we should switch to this one ? It's actually up to you guys ! :)
Good catch! I agree with a simple swap from one to the other at some point, but actually, maybe we should just abandon this change, and use array_lengthof, until we are ready to use C++17 directly? It would make the find/replace much easier: I took a quick look, and it looks like array_lengthof is solely used for this particular function, and not some other invocation. But "size" on the other hand will be much harder to isolate.