is this a bug of llvm::JIT::getPointerToBasicBlock?

I am reading the implementation of llvm::JIT::getPointerToBasicBlock and I think there might be a bug in it.

‘getPointerToBasicBlock’ first calls ‘getPointerToFunction’ and then try to look up the map returned by ‘getBasicBlockAddressMap(locked)’ to get the pointer of the BasicBlock.

‘getPointerToFunction’ calls ‘runJITOnFunctionUnlocked’ which in turn calls ‘jitTheFunction’. However, in 'jitTheFunction, there is a statement ‘getBasicBlockAddressMap(locked).clear()’. After returning from ‘getPointerToFunction’, the map is empty. So, you will never get the pointer of the BasicBlock.

Is this a bug? Or I should not call the function this way?

Bin LI,
State Key Laboratory of Computer Architecture,
Institute of Computing Technology of Chinese Academy of Sciences,
email: richardustc@gmail.com