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

Snehasish Kumar via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 25 09:57:10 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 =
----------------
snehasish wrote:

Personal preference influenced by the Google style guide. :)

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


More information about the cfe-commits mailing list