How to copy a Function

Hi,

I wanted to backup a Function before it is optimized. The Function
class disallows assignment operations as it comments:
  Function(const Function&); // DO NOT IMPLEMENT
  void operator=(const Function&); // DO NOT IMPLEMENT
Is there a way to construct a copy from an existing Function?

Thanks.

Hi,

I wanted to backup a Function before it is optimized. The Function
class disallows assignment operations as it comments:
Function(const Function&); // DO NOT IMPLEMENT
void operator=(const Function&); // DO NOT IMPLEMENT
Is there a way to construct a copy from an existing Function?

CloneFunction() may do what you want. See:
llvm/include/llvm/Transforms/Utils/Cloning.h

Hi,

I wanted to backup a Function before it is optimized. The Function
class disallows assignment operations as it comments:
Function(const Function&); // DO NOT IMPLEMENT
void operator=(const Function&); // DO NOT IMPLEMENT
Is there a way to construct a copy from an existing Function?

CloneFunction() may do what you want. See:
llvm/include/llvm/Transforms/Utils/Cloning.h

Thanks! This exactly implemented what I need.