[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();
+        if (!D)
+          return true;
+        auto const *RD = dyn_cast<CXXRecordDecl>(D);
----------------
AaronBallman wrote:

```suggestion
        const auto *RD = dyn_cast<CXXRecordDecl>(D);
```

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


More information about the cfe-commits mailing list