diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-25 02:50:08 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-25 02:50:08 +0000 |
commit | 2d680824e3a5272e386aa6c1d2a66676de7899fd (patch) | |
tree | 5a37a75e24db3600185b986a51d8e7c2b9669964 /include | |
parent | f245ae5a4a78d5a02b3b9e2dae819077a56d81e7 (diff) | |
download | external_llvm-2d680824e3a5272e386aa6c1d2a66676de7899fd.zip external_llvm-2d680824e3a5272e386aa6c1d2a66676de7899fd.tar.gz external_llvm-2d680824e3a5272e386aa6c1d2a66676de7899fd.tar.bz2 |
Make these methods const correct.
Thanks to Nick Lewycky for noticing it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187098 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/IR/Module.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/include/llvm/IR/Module.h b/include/llvm/IR/Module.h index 2514be4..3dbc5ff 100644 --- a/include/llvm/IR/Module.h +++ b/include/llvm/IR/Module.h @@ -352,15 +352,22 @@ public: /// 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; + const GlobalVariable *getGlobalVariable(StringRef Name, + bool AllowInternal = false) const { + return const_cast<Module *>(this)->getGlobalVariable(Name, AllowInternal); + } + + GlobalVariable *getGlobalVariable(StringRef Name, bool AllowInternal = false); /// 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 { + GlobalVariable *getNamedGlobal(StringRef Name) { return getGlobalVariable(Name, true); } + const GlobalVariable *getNamedGlobal(StringRef Name) const { + return const_cast<Module *>(this)->getNamedGlobal(Name); + } /// getOrInsertGlobal - Look up the specified global in the module symbol /// table. |