Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个类型的对象CallInst。如何获取被调用函数(又名被调用者)的名称。假设函数被直接调用(即,没有间接函数调用)。
CallInst
StringRef get_function_name(CallInst *call) { Function *fun = call->getCalledFunction(); if (fun) // thanks @Anton Korobeynikov return fun->getName(); // inherited from llvm::Value else return StringRef("indirect call"); }
无论如何,这就是文档所暗示的: