[llvm] r254254 - Simplify. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 29 06:33:06 PST 2015
Author: rafael
Date: Sun Nov 29 08:33:06 2015
New Revision: 254254
URL: http://llvm.org/viewvc/llvm-project?rev=254254&view=rev
Log:
Simplify. NFC.
Modified:
llvm/trunk/lib/Linker/LinkModules.cpp
Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=254254&r1=254253&r2=254254&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Sun Nov 29 08:33:06 2015
@@ -627,19 +627,6 @@ void ModuleLinker::copyGVAttributes(Glob
forceRenaming(NewGV, getName(SrcGV));
}
-static bool isLessConstraining(GlobalValue::VisibilityTypes a,
- GlobalValue::VisibilityTypes b) {
- if (a == GlobalValue::HiddenVisibility)
- return false;
- if (b == GlobalValue::HiddenVisibility)
- return true;
- if (a == GlobalValue::ProtectedVisibility)
- return false;
- if (b == GlobalValue::ProtectedVisibility)
- return true;
- return false;
-}
-
bool ModuleLinker::doImportAsDefinition(const GlobalValue *SGV) {
if (!isPerformingImport())
return false;
@@ -864,13 +851,22 @@ GlobalValue *ModuleLinker::copyGlobalAli
getLinkage(SGA), getName(SGA), DstM);
}
+static GlobalValue::VisibilityTypes
+getMinVisibility(GlobalValue::VisibilityTypes A,
+ GlobalValue::VisibilityTypes B) {
+ if (A == GlobalValue::HiddenVisibility || B == GlobalValue::HiddenVisibility)
+ return GlobalValue::HiddenVisibility;
+ if (A == GlobalValue::ProtectedVisibility ||
+ B == GlobalValue::ProtectedVisibility)
+ return GlobalValue::ProtectedVisibility;
+ return GlobalValue::DefaultVisibility;
+}
+
void ModuleLinker::setVisibility(GlobalValue *NewGV, const GlobalValue *SGV,
const GlobalValue *DGV) {
GlobalValue::VisibilityTypes Visibility = SGV->getVisibility();
if (DGV)
- Visibility = isLessConstraining(Visibility, DGV->getVisibility())
- ? DGV->getVisibility()
- : Visibility;
+ Visibility = getMinVisibility(DGV->getVisibility(), Visibility);
// For promoted locals, mark them hidden so that they can later be
// stripped from the symbol table to reduce bloat.
if (SGV->hasLocalLinkage() && doPromoteLocalToGlobal(SGV))
More information about the llvm-commits
mailing list