AppendingLinkage, ///< Special purpose, only applies to global arrays
InternalLinkage, ///< Rename collisions when linking (static functions).
PrivateLinkage, ///< Like Internal, but omit from symbol table.
- LinkerPrivateLinkage, ///< Like Private, but linker removes.
- LinkerPrivateWeakLinkage, ///< Like LinkerPrivate, but weak.
ExternalWeakLinkage,///< ExternalWeak linkage description.
CommonLinkage ///< Tentative definitions.
};
LinkageTypes linkage, const Twine &Name)
: Constant(ty, vty, Ops, NumOps), Linkage(linkage),
Visibility(DefaultVisibility), Alignment(0), UnnamedAddr(0),
- DllStorageClass(DefaultStorageClass), Parent(0) {
+ DllStorageClass(DefaultStorageClass), Parent(nullptr) {
setName(Name);
}
static bool isPrivateLinkage(LinkageTypes Linkage) {
return Linkage == PrivateLinkage;
}
- static bool isLinkerPrivateLinkage(LinkageTypes Linkage) {
- return Linkage == LinkerPrivateLinkage;
- }
- static bool isLinkerPrivateWeakLinkage(LinkageTypes Linkage) {
- return Linkage == LinkerPrivateWeakLinkage;
- }
static bool isLocalLinkage(LinkageTypes Linkage) {
- return isInternalLinkage(Linkage) || isPrivateLinkage(Linkage) ||
- isLinkerPrivateLinkage(Linkage) || isLinkerPrivateWeakLinkage(Linkage);
+ return isInternalLinkage(Linkage) || isPrivateLinkage(Linkage);
}
static bool isExternalWeakLinkage(LinkageTypes Linkage) {
return Linkage == ExternalWeakLinkage;
/// by something non-equivalent at link time. For example, if a function has
/// weak linkage then the code defining it may be replaced by different code.
static bool mayBeOverridden(LinkageTypes Linkage) {
- return Linkage == WeakAnyLinkage ||
- Linkage == LinkOnceAnyLinkage ||
- Linkage == CommonLinkage ||
- Linkage == ExternalWeakLinkage ||
- Linkage == LinkerPrivateWeakLinkage;
+ return Linkage == WeakAnyLinkage || Linkage == LinkOnceAnyLinkage ||
+ Linkage == CommonLinkage || Linkage == ExternalWeakLinkage;
}
/// isWeakForLinker - Whether the definition of this global may be replaced at
/// always a mistake: when working at the IR level use mayBeOverridden instead
/// as it knows about ODR semantics.
static bool isWeakForLinker(LinkageTypes Linkage) {
- return Linkage == AvailableExternallyLinkage ||
- Linkage == WeakAnyLinkage ||
- Linkage == WeakODRLinkage ||
- Linkage == LinkOnceAnyLinkage ||
- Linkage == LinkOnceODRLinkage ||
- Linkage == CommonLinkage ||
- Linkage == ExternalWeakLinkage ||
- Linkage == LinkerPrivateWeakLinkage;
+ return Linkage == AvailableExternallyLinkage || Linkage == WeakAnyLinkage ||
+ Linkage == WeakODRLinkage || Linkage == LinkOnceAnyLinkage ||
+ Linkage == LinkOnceODRLinkage || Linkage == CommonLinkage ||
+ Linkage == ExternalWeakLinkage;
}
bool hasExternalLinkage() const { return isExternalLinkage(Linkage); }
bool hasAppendingLinkage() const { return isAppendingLinkage(Linkage); }
bool hasInternalLinkage() const { return isInternalLinkage(Linkage); }
bool hasPrivateLinkage() const { return isPrivateLinkage(Linkage); }
- bool hasLinkerPrivateLinkage() const { return isLinkerPrivateLinkage(Linkage); }
- bool hasLinkerPrivateWeakLinkage() const {
- return isLinkerPrivateWeakLinkage(Linkage);
- }
bool hasLocalLinkage() const { return isLocalLinkage(Linkage); }
bool hasExternalWeakLinkage() const { return isExternalWeakLinkage(Linkage); }
bool hasCommonLinkage() const { return isCommonLinkage(Linkage); }
/// Materialize - make sure this GlobalValue is fully read. If the module is
/// corrupt, this returns true and fills in the optional string with
/// information about the problem. If successful, this returns false.
- bool Materialize(std::string *ErrInfo = 0);
+ bool Materialize(std::string *ErrInfo = nullptr);
/// Dematerialize - If this GlobalValue is read in, and if the GVMaterializer
/// supports it, release the memory for the function, and set it up to be
/// @}
/// Override from Constant class.
- virtual void destroyConstant();
+ void destroyConstant() override;
/// isDeclaration - Return true if the primary definition of this global
/// value is outside of the current translation unit.