================
@@ -8899,18 +8899,42 @@ void Sema::CheckMemaccessArguments(const CallExpr *Call,
           << ArgIdx << FnName << PointeeTy
           << Call->getCallee()->getSourceRange());
     else if (const auto *RT = PointeeTy->getAs<RecordType>()) {
+
+      auto IsTriviallyCopyableCXXRecord = [](auto const *RT) {
----------------
AaronBallman wrote:

```suggestion
      auto IsTriviallyCopyableCXXRecord = [](const RecordType *RT) {
```
Do not use `auto` when there's only one type this can be called with (I just 
spent a lot of time writing comments that I had to delete because this can only 
accept a `RecordType`).

Actually, I don't think we even need the lambda. You could precalculate this as 
a local variable:
```
bool IsTriviallyCopyableCXXRecord = false;
if (const auto *RD = RT->getAsCXXRecordDecl())
  IsTriviallyCopyableCXXRecord = RD->isTriviallyCopyable();
```
should suffice. (The call should return `false` if the record has no definition 
because that's an incomplete type but that's a good test case to ensure we 
have.)

https://github.com/llvm/llvm-project/pull/111434
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to