[LLVMdev] GlobalVaraible and Function have the same name

Tony Scudiero tscud at cray.com
Mon Jan 12 09:35:54 PST 2009


Hi all,

I just walked across an interesting situation in 
Module::getOrInsertFunction(Name, Type) in the LLVM C API.

In my particular case:

One of the first things we do is add a global variable named foo which 
is a [ 100 x i64 ].

Later we add a function    void foo(...)

unfortunately, when we do the getOrInsertFunction we get back

 void (...) *  bitcast ([100 x i64]* @foo_ to void (...)*)

because the symbol foo already exists in the ValueSymbolTable.

Am I correct in interpreting this as a constraint that no two items in 
the ValueSymbolTable
can have the same name, even if they're of entirely different types (in 
this case Function entry point and
global variable) ?  Is there any way, short of renaming on our end, 
around this? Thanks!


    -Tony S.







More information about the llvm-dev mailing list