[clang] [CIR] Upstream AssignmentMemcpyizer (PR #236803)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 6 07:59:15 PST 2026
================
@@ -24,6 +24,271 @@
using namespace clang;
using namespace clang::CIRGen;
+namespace {
+// TODO(cir): a lot of what we see under this namespace is a strong candidate
+// to be shared between LLVM and CIR codegen.
+
+/// RAII object to indicate that codegen is copying the value representation
+/// instead of the object representation. Useful when copying a struct or
+/// class which has uninitialized members and we're only performing
+/// lvalue-to-rvalue conversion on the object but not its members.
+class CopyingValueRepresentation {
+public:
+ explicit CopyingValueRepresentation(CIRGenFunction &cgf)
+ : cgf(cgf), oldSanOpts(cgf.sanOpts) {
+ cgf.sanOpts.set(SanitizerKind::Bool, false);
+ cgf.sanOpts.set(SanitizerKind::Enum, false);
+ }
+ ~CopyingValueRepresentation() { cgf.sanOpts = oldSanOpts; }
+
+private:
+ CIRGenFunction &cgf;
+ SanitizerSet oldSanOpts;
+};
+
+class FieldMemcpyizer {
+public:
+ FieldMemcpyizer(CIRGenFunction &cgf, const CXXMethodDecl *methodDecl,
+ const VarDecl *srcRec)
+ : cgf(cgf), methodDecl(methodDecl), classDecl(methodDecl->getParent()),
----------------
Fznamznon wrote:
Done in df2465c2202fc20af24296ec9e9cfcdb1830a055, thanks
https://github.com/llvm/llvm-project/pull/236803
More information about the cfe-commits
mailing list