[cfe-dev] Checking if function have been emitted

Mehdi Amini via cfe-dev cfe-dev at lists.llvm.org
Mon Jan 2 18:55:02 PST 2017


> On Dec 30, 2016, at 10:38 AM, Piotr Padlewski via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> Hi,
> I would like to check if there is inline virtual function that was not emitted.
> 
> I tried to do something like this based on CodeGenModule::GetOrCreateLLVMFunction:
> 
>       StringRef Name = CGM.getMangledName(VFunction);
>       auto *Entry = CGM.GetGlobalValue(Name);
> 
>       // If function doesn't exist or doesn't have a definition.
>       if (!Entry || Entry->isDeclaration())
>         return true;
> 
> But Entry->isDeclaration() returns True for functions that I would expect to be emited.
> What is the proper way of checking that?

isDeclaration() only returns true for a function that does not have a body / hasn’t been materialized yet. Do you observe that it is not the case in practice? Or are you trying to look if a function will be emitted by clang but hasn’t already?

— 
Mehdi




More information about the cfe-dev mailing list