llvm.org GIT mirror llvm / 04d6002
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 Duncan P. N. Exon Smith 6 years ago
2 changed file(s) with 12 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
9292 bool hasProtectedVisibility() const {
9393 return Visibility == ProtectedVisibility;
9494 }
95 void setVisibility(VisibilityTypes V) { Visibility = V; }
95 void setVisibility(VisibilityTypes V) {
96 assert((!hasLocalLinkage() || V == DefaultVisibility) &&
97 "local linkage requires default visibility");
98 Visibility = V;
99 }
96100
97101 DLLStorageClassTypes getDLLStorageClass() const {
98102 return DLLStorageClassTypes(DllStorageClass);
194198 bool hasExternalWeakLinkage() const { return isExternalWeakLinkage(Linkage); }
195199 bool hasCommonLinkage() const { return isCommonLinkage(Linkage); }
196200
197 void setLinkage(LinkageTypes LT) { Linkage = LT; }
201 void setLinkage(LinkageTypes LT) {
202 assert((!isLocalLinkage(LT) || hasDefaultVisibility()) &&
203 "local linkage requires default visibility");
204 Linkage = LT;
205 }
198206 LinkageTypes getLinkage() const { return Linkage; }
199207
200208 bool isDiscardableIfUnused() const {
2626 /// the split module remain valid.
2727 static void makeVisible(GlobalValue &GV, bool Delete) {
2828 bool Local = GV.hasLocalLinkage();
29 if (Local)
30 GV.setVisibility(GlobalValue::HiddenVisibility);
31
3229 if (Local || Delete) {
3330 GV.setLinkage(GlobalValue::ExternalLinkage);
31 if (Local)
32 GV.setVisibility(GlobalValue::HiddenVisibility);
3433 return;
3534 }
3635