[PATCH] D79279: Add overloaded versions of builtin mem* functions

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 2 23:10:54 PDT 2020


rjmccall added inline comments.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:1605
+           }));
+  };
+
----------------
I am not a fan of this lambda style, not because I dislike lambdas, but because you've pulled a ton of code that's supporting one or two cases (that could easily be handled together) into a much wider scope.

Your helper code are doing a ton of redundant type checks and is probably not as general as you think it is.  You need to call `DefaultFunctionArrayLvalueConversion` on the pointer arguments, after which you can just check for a pointer type.  You also need to convert the size argument to a `size_t` as if initializing a parameter.  If you do these things, the IRGen code will get much simpler because e.g. it will not need to specially handle arrays anymore.  You will also start magically doing the right thing w.r.t ODR-uses of constexpr variables.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79279





More information about the cfe-commits mailing list