[PATCH] D121475: [Clang][Sema] Avoid crashing for `__builtin_memcpy_inline` with an array argument

Guillaume Chatelet via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 14 02:19:59 PDT 2022


gchatelet accepted this revision.
gchatelet added a comment.
This revision is now accepted and ready to land.

Thx for the patch, please address the comment before submitting.



================
Comment at: clang/lib/Sema/SemaChecking.cpp:1946-1953
+    auto ArgArrayConversion = [&](unsigned Arg) {
+      ExprResult ArgExpr =
+          DefaultFunctionArrayLvalueConversion(TheCall->getArg(Arg));
+      if (ArgExpr.isInvalid())
+        return true;
+      TheCall->setArg(Arg, ArgExpr.get());
+      return false;
----------------
[nit] It's unclear looking at the function name that it's failing when returning `true` - one has to read the code to understand. It may be fine now but could become messy with time and refactoring.
Either change the lambda's name `FailArgArrayConversion` or negate everything.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121475



More information about the cfe-commits mailing list