================
@@ -14980,6 +14988,22 @@ buildMemcpyForAssignmentOp(Sema &S, SourceLocation 
Loc, QualType T,
       S.Context, To, UO_AddrOf, S.Context.getPointerType(To->getType()),
       VK_PRValue, OK_Ordinary, Loc, false, S.CurFPFeatureOverrides());
 
+  if (SuppressMemaccessWarning) {
+    // An explicit cast to void* survives IgnoreParenImpCasts, so the memaccess
+    // check sees a void pointee and skips the non-trivial-copy warning.
+    QualType ConstVoidPtr =
+        S.Context.getPointerType(S.Context.VoidTy.withConst());
+    ExprResult FromCast = S.BuildCStyleCastExpr(
+        Loc, S.Context.getTrivialTypeSourceInfo(ConstVoidPtr, Loc), Loc, From);
+    ExprResult ToCast = S.BuildCStyleCastExpr(
----------------
cor3ntin wrote:

(`DiagnosticsEngine::setSeverity` may not be the cleanest option but it is... 
one option - it would be novel though)

https://github.com/llvm/llvm-project/pull/206579
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to