mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-11 21:38:19 +00:00
GlobalValue: Assert symbols with local linkage have default visibility
The change to ExtractGV.cpp has no functionality change except to avoid the asserts. Existing testcases already cover this, so I didn't add a new one. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208264 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -93,7 +93,11 @@ public:
|
|||||||
bool hasProtectedVisibility() const {
|
bool hasProtectedVisibility() const {
|
||||||
return Visibility == ProtectedVisibility;
|
return Visibility == ProtectedVisibility;
|
||||||
}
|
}
|
||||||
void setVisibility(VisibilityTypes V) { Visibility = V; }
|
void setVisibility(VisibilityTypes V) {
|
||||||
|
assert((!hasLocalLinkage() || V == DefaultVisibility) &&
|
||||||
|
"local linkage requires default visibility");
|
||||||
|
Visibility = V;
|
||||||
|
}
|
||||||
|
|
||||||
DLLStorageClassTypes getDLLStorageClass() const {
|
DLLStorageClassTypes getDLLStorageClass() const {
|
||||||
return DLLStorageClassTypes(DllStorageClass);
|
return DLLStorageClassTypes(DllStorageClass);
|
||||||
@ -195,7 +199,11 @@ public:
|
|||||||
bool hasExternalWeakLinkage() const { return isExternalWeakLinkage(Linkage); }
|
bool hasExternalWeakLinkage() const { return isExternalWeakLinkage(Linkage); }
|
||||||
bool hasCommonLinkage() const { return isCommonLinkage(Linkage); }
|
bool hasCommonLinkage() const { return isCommonLinkage(Linkage); }
|
||||||
|
|
||||||
void setLinkage(LinkageTypes LT) { Linkage = LT; }
|
void setLinkage(LinkageTypes LT) {
|
||||||
|
assert((!isLocalLinkage(LT) || hasDefaultVisibility()) &&
|
||||||
|
"local linkage requires default visibility");
|
||||||
|
Linkage = LT;
|
||||||
|
}
|
||||||
LinkageTypes getLinkage() const { return Linkage; }
|
LinkageTypes getLinkage() const { return Linkage; }
|
||||||
|
|
||||||
bool isDiscardableIfUnused() const {
|
bool isDiscardableIfUnused() const {
|
||||||
|
@ -27,11 +27,10 @@ using namespace llvm;
|
|||||||
/// the split module remain valid.
|
/// the split module remain valid.
|
||||||
static void makeVisible(GlobalValue &GV, bool Delete) {
|
static void makeVisible(GlobalValue &GV, bool Delete) {
|
||||||
bool Local = GV.hasLocalLinkage();
|
bool Local = GV.hasLocalLinkage();
|
||||||
if (Local)
|
|
||||||
GV.setVisibility(GlobalValue::HiddenVisibility);
|
|
||||||
|
|
||||||
if (Local || Delete) {
|
if (Local || Delete) {
|
||||||
GV.setLinkage(GlobalValue::ExternalLinkage);
|
GV.setLinkage(GlobalValue::ExternalLinkage);
|
||||||
|
if (Local)
|
||||||
|
GV.setVisibility(GlobalValue::HiddenVisibility);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user