From 1d1dd80f321ae0fe77f51e8481d6eea07a4d5717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B6r=C3=B6k=20Edvin?= Date: Fri, 11 Sep 2009 15:17:48 +0300 Subject: [PATCH] Fix global variable names. --- libclamav/c++/bytecode2llvm.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libclamav/c++/bytecode2llvm.cpp b/libclamav/c++/bytecode2llvm.cpp index 0a8125833..2394d6995 100644 --- a/libclamav/c++/bytecode2llvm.cpp +++ b/libclamav/c++/bytecode2llvm.cpp @@ -356,11 +356,13 @@ public: globals.reserve(bc->num_globals); for (unsigned i=0;inum_globals;i++) { const Type *Ty = mapType(bc->globaltys[i]); - GlobalVariable *GV = cast(M->getOrInsertGlobal("glob"+i, - Ty)); + // TODO: validate number of components against type_components unsigned c = 0; - GV->setInitializer(buildConstant(Ty, bc->globals[i], c)); + Constant *C = buildConstant(Ty, bc->globals[i], c); + GlobalVariable *GV = new GlobalVariable(*M, Ty, true, + GlobalValue::InternalLinkage, + C, "glob"+Twine(i)); globals.push_back(GV); }