aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Module.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
-rw-r--r--llvm/lib/IR/Module.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp
index c7daaaf..eb635dc 100644
--- a/llvm/lib/IR/Module.cpp
+++ b/llvm/lib/IR/Module.cpp
@@ -250,12 +250,9 @@ GlobalVariable *Module::getGlobalVariable(StringRef Name,
}
/// getOrInsertGlobal - Look up the specified global in the module symbol table.
-/// 1. If it does not exist, add a declaration of the global and return it.
-/// 2. Else, the global exists but has the wrong type: return the function
-/// with a constantexpr cast to the right type.
-/// 3. Finally, if the existing global is the correct declaration, return the
-/// existing global.
-Constant *Module::getOrInsertGlobal(
+/// If it does not exist, add a declaration of the global and return it.
+/// Otherwise, return the existing global.
+GlobalVariable *Module::getOrInsertGlobal(
StringRef Name, Type *Ty,
function_ref<GlobalVariable *()> CreateGlobalCallback) {
// See if we have a definition for the specified global already.
@@ -269,7 +266,7 @@ Constant *Module::getOrInsertGlobal(
}
// Overload to construct a global variable using its constructor's defaults.
-Constant *Module::getOrInsertGlobal(StringRef Name, Type *Ty) {
+GlobalVariable *Module::getOrInsertGlobal(StringRef Name, Type *Ty) {
return getOrInsertGlobal(Name, Ty, [&] {
return new GlobalVariable(*this, Ty, false, GlobalVariable::ExternalLinkage,
nullptr, Name);