[clang] [CopyProf] Clang frontend and driver integration. (PR #225905)

via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 25 03:48:27 PDT 2026


================
@@ -1053,6 +1054,37 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
     }
   }
 
+  // Annotate C++ special member functions so that CopyProfPass can instrument
+  // them, provided the object is at least as large as the size threshold.
+  if (CGM.getCodeGenOpts().CopyProf) {
+    const auto *MD = dyn_cast_or_null<CXXMethodDecl>(D);
+    const auto *CD = MD ? dyn_cast<CXXConstructorDecl>(MD) : nullptr;
+    // It's either some sort of c'tor (but not any move function), or either of
+    // copy assignment operator / d'tor.
+    bool IsCandidate =
----------------
newgre wrote:

Is it general style to make local variables that are not mutated "const", or is this personal preference? There seems to be quite a bit of code that does not use this style?

I've simplified the logic a bit so it looks different now. PTAL.

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


More information about the cfe-commits mailing list