本文整理汇总了C++中GlobalVariable::hasInternalLinkage方法的典型用法代码示例。如果您正苦于以下问题:C++ GlobalVariable::hasInternalLinkage方法的具体用法?C++ GlobalVariable::hasInternalLinkage怎么用?C++ GlobalVariable::hasInternalLinkage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlobalVariable
的用法示例。
在下文中一共展示了GlobalVariable::hasInternalLinkage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/// getGlobalVariable - Look up the specified global variable in the module
/// 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,
bool AllowInternal) const {
if (Value *V = ValSymTab->lookup(Name)) {
GlobalVariable *Result = dyn_cast<GlobalVariable>(V);
if (Result && (AllowInternal || !Result->hasInternalLinkage()))
return Result;
}
return 0;
}