- /// getGlobalVariable - Look up the specified global variable in the module
- /// symbol table. If it does not exist, return null. If AllowInternal is set
- /// to true, this function will return types that have InternalLinkage. By
- /// default, these types are not returned.
- GlobalVariable *getGlobalVariable(StringRef Name,
- bool AllowInternal = false) const;
-
- /// getNamedGlobal - Return the global variable in the module with the
- /// specified name, of arbitrary type. This method returns null if a global
- /// with the specified name is not found.
- GlobalVariable *getNamedGlobal(StringRef Name) const {
+ /// Look up the specified global variable in the module symbol table. If it
+ /// does not exist, return null. If AllowInternal is set to true, this
+ /// function will return types that have InternalLinkage. By default, these
+ /// types are not returned.
+ GlobalVariable *getGlobalVariable(StringRef Name) const {
+ return getGlobalVariable(Name, false);
+ }
+
+ GlobalVariable *getGlobalVariable(StringRef Name, bool AllowInternal) const {
+ return const_cast<Module *>(this)->getGlobalVariable(Name, AllowInternal);
+ }
+
+ GlobalVariable *getGlobalVariable(StringRef Name, bool AllowInternal = false);
+
+ /// Return the global variable in the module with the specified name, of
+ /// arbitrary type. This method returns null if a global with the specified
+ /// name is not found.
+ GlobalVariable *getNamedGlobal(StringRef Name) {