summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-05-20 19:00:58 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-05-20 19:00:58 +0000
commite432c510dc017b875ce134764e270a9963f24985 (patch)
tree3d8a505fc7d9b38984e61b13a2f018e5f67dd1ab
parent1d9aec67b07a9b489d40f3d10d1ade056edf0c8c (diff)
downloadbcm5719-llvm-e432c510dc017b875ce134764e270a9963f24985.tar.gz
bcm5719-llvm-e432c510dc017b875ce134764e270a9963f24985.zip
GlobalValue: Automatically reset visibility when setting local linkage
r208264 started asserting in `setLinkage()` and `setVisibility()` that visibility and linkage are compatible. There are a few places in clang where visibility is set first, and then linkage later, so the assert fires. In `setLinkage()`, it's clear what the visibility *should* be, so rather than updating all the call sites just automatically fix the visibility. The testcase for this is for *clang*, so it'll follow separately in cfe. PR19760 llvm-svn: 209227
-rw-r--r--llvm/include/llvm/IR/GlobalValue.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/include/llvm/IR/GlobalValue.h b/llvm/include/llvm/IR/GlobalValue.h
index 0ed302cdb4b..10df372945a 100644
--- a/llvm/include/llvm/IR/GlobalValue.h
+++ b/llvm/include/llvm/IR/GlobalValue.h
@@ -222,8 +222,8 @@ public:
bool hasCommonLinkage() const { return isCommonLinkage(Linkage); }
void setLinkage(LinkageTypes LT) {
- assert((!isLocalLinkage(LT) || hasDefaultVisibility()) &&
- "local linkage requires default visibility");
+ if (isLocalLinkage(LT))
+ Visibility = DefaultVisibility;
Linkage = LT;
}
LinkageTypes getLinkage() const { return Linkage; }
OpenPOWER on IntegriCloud