[llvm-commits] CVS: llvm/lib/VMCore/Module.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Dec 4 21:30:34 PST 2005
Changes in directory llvm/lib/VMCore:
Module.cpp updated: 1.61 -> 1.62
---
Log message:
Add a flag to Module::getGlobalVariable to allow it to return vars with
internal linkage.
Patch provided by Evan Jones, thanks!
---
Diffs of the changes: (+7 -7)
Module.cpp | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
Index: llvm/lib/VMCore/Module.cpp
diff -u llvm/lib/VMCore/Module.cpp:1.61 llvm/lib/VMCore/Module.cpp:1.62
--- llvm/lib/VMCore/Module.cpp:1.61 Thu Apr 21 18:46:51 2005
+++ llvm/lib/VMCore/Module.cpp Sun Dec 4 23:30:21 2005
@@ -206,17 +206,17 @@
//
/// getGlobalVariable - Look up the specified global variable in the module
-/// symbol table. If it does not exist, return null. Note that this only
-/// returns a global variable if it does not have internal linkage. The type
-/// argument should be the underlying type of the global, ie, it should not
-/// have the top-level PointerType, which represents the address of the
-/// global.
+/// symbol table. If it does not exist, return null. The type argument
+/// should be the underlying type of the global, i.e., it should not have
+/// the top-level PointerType, which represents the address of the global.
+/// If AllowInternal is set to true, this function will return types that
+/// have InternalLinkage. By default, these types are not returned.
///
GlobalVariable *Module::getGlobalVariable(const std::string &Name,
- const Type *Ty) {
+ const Type *Ty, bool AllowInternal) {
if (Value *V = getSymbolTable().lookup(PointerType::get(Ty), Name)) {
GlobalVariable *Result = cast<GlobalVariable>(V);
- if (!Result->hasInternalLinkage())
+ if (AllowInternal || !Result->hasInternalLinkage())
return Result;
}
return 0;
More information about the llvm-commits
mailing list