I want to find a global variable by name in some module , I find LLVM function Module::getGlobalVariable(string name,Type* ty); My question is , is it necessary to specify the global variable type (second param) ? Why not just getGlobalVariable(string name). I look up the source , and find that it depend on SymbolTable.find() and SymbolTable only support find with type .is it True ? or I make something wrong ? thanks
Chris Lattner
2006-Mar-26 19:46 UTC
[LLVMdev] A question about Module::getGlobalVariable()
On Sun, 26 Mar 2006, lizhuo wrote:> I want to find a global variable by name in some module , > I find LLVM function Module::getGlobalVariable(string name,Type* ty); > > My question is , is it necessary to specify the global variable type (second param) ? > Why not just > getGlobalVariable(string name).If you are using LLVM CVS, you can use Module::getNamedGlobal(string name), which doesn't take a type. -Chris -- http://nondot.org/sabre/ http://llvm.org/