@@ -250,12 +250,9 @@ GlobalVariable *Module::getGlobalVariable(StringRef Name,
250250}
251251
252252// / getOrInsertGlobal - Look up the specified global in the module symbol table.
253- // / 1. If it does not exist, add a declaration of the global and return it.
254- // / 2. Else, the global exists but has the wrong type: return the function
255- // / with a constantexpr cast to the right type.
256- // / 3. Finally, if the existing global is the correct declaration, return the
257- // / existing global.
258- Constant *Module::getOrInsertGlobal (
253+ // / If it does not exist, add a declaration of the global and return it.
254+ // / Otherwise, return the existing global.
255+ GlobalVariable *Module::getOrInsertGlobal (
259256 StringRef Name, Type *Ty,
260257 function_ref<GlobalVariable *()> CreateGlobalCallback) {
261258 // See if we have a definition for the specified global already.
@@ -269,7 +266,7 @@ Constant *Module::getOrInsertGlobal(
269266}
270267
271268// Overload to construct a global variable using its constructor's defaults.
272- Constant *Module::getOrInsertGlobal (StringRef Name, Type *Ty) {
269+ GlobalVariable *Module::getOrInsertGlobal (StringRef Name, Type *Ty) {
273270 return getOrInsertGlobal (Name, Ty, [&] {
274271 return new GlobalVariable (*this , Ty, false , GlobalVariable::ExternalLinkage,
275272 nullptr , Name);
0 commit comments