[llvm] r209227 - GlobalValue: Automatically reset visibility when setting local linkage
Duncan P. N. Exon Smith
dexonsmith at apple.com
Tue May 20 12:00:58 PDT 2014
Author: dexonsmith
Date: Tue May 20 14:00:58 2014
New Revision: 209227
URL: http://llvm.org/viewvc/llvm-project?rev=209227&view=rev
Log:
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
Modified:
llvm/trunk/include/llvm/IR/GlobalValue.h
Modified: llvm/trunk/include/llvm/IR/GlobalValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/GlobalValue.h?rev=209227&r1=209226&r2=209227&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/GlobalValue.h (original)
+++ llvm/trunk/include/llvm/IR/GlobalValue.h Tue May 20 14:00:58 2014
@@ -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; }
More information about the llvm-commits
mailing list