[clang] [compiler-rt] [libcxx] [llvm] [clang] Warn about memset/memcpy to NonTriviallyCopyable types (PR #111434)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 06:39:41 PDT 2024


================
@@ -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) {
+        auto const *D = RT->getDecl();
----------------
AaronBallman wrote:

```suggestion
        const Decl *D = RT->getDecl();
```
Please only use `auto` when the type is spelled out in the initialization. Also, we use `const Type` and not `Type const` as the prevailing style, so you should stick with that.

https://github.com/llvm/llvm-project/pull/111434


More information about the cfe-commits mailing list