summaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-10-23 21:24:34 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-10-23 21:24:34 +0000
commit3873361e281d1b25fd4579cb42c76954cf40c3ef (patch)
tree15a03cd2fe6cf265d7e79c29f99b2e3f75a025b0 /lib/CodeGen/AsmPrinter/AsmPrinter.cpp
parentbb41c75ab51fcfc3ad36d3f8a438652b141e0fc0 (diff)
downloadllvm-3873361e281d1b25fd4579cb42c76954cf40c3ef.tar.gz
llvm-3873361e281d1b25fd4579cb42c76954cf40c3ef.tar.bz2
llvm-3873361e281d1b25fd4579cb42c76954cf40c3ef.tar.xz
Reduce casting and use a fully covered switch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193272 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 20d179fe7c..e2bd61f419 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -212,8 +212,10 @@ bool AsmPrinter::doInitialization(Module &M) {
llvm_unreachable("Unknown exception type.");
}
-void AsmPrinter::EmitLinkage(unsigned Linkage, MCSymbol *GVSym) const {
- switch ((GlobalValue::LinkageTypes)Linkage) {
+void AsmPrinter::EmitLinkage(unsigned L, MCSymbol *GVSym) const {
+ GlobalValue::LinkageTypes Linkage = (GlobalValue::LinkageTypes)L;
+
+ switch (Linkage) {
case GlobalValue::CommonLinkage:
case GlobalValue::LinkOnceAnyLinkage:
case GlobalValue::LinkOnceODRLinkage:
@@ -225,8 +227,7 @@ void AsmPrinter::EmitLinkage(unsigned Linkage, MCSymbol *GVSym) const {
// .globl _foo
OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global);
- if ((GlobalValue::LinkageTypes)Linkage !=
- GlobalValue::LinkOnceODRAutoHideLinkage)
+ if (Linkage != GlobalValue::LinkOnceODRAutoHideLinkage)
// .weak_definition _foo
OutStreamer.EmitSymbolAttribute(GVSym, MCSA_WeakDefinition);
else
@@ -239,7 +240,7 @@ void AsmPrinter::EmitLinkage(unsigned Linkage, MCSymbol *GVSym) const {
// .weak _foo
OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Weak);
}
- break;
+ return;
case GlobalValue::DLLExportLinkage:
case GlobalValue::AppendingLinkage:
// FIXME: appending linkage variables should go into a section of
@@ -248,14 +249,18 @@ void AsmPrinter::EmitLinkage(unsigned Linkage, MCSymbol *GVSym) const {
// If external or appending, declare as a global symbol.
// .globl _foo
OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global);
- break;
+ return;
case GlobalValue::PrivateLinkage:
case GlobalValue::InternalLinkage:
case GlobalValue::LinkerPrivateLinkage:
- break;
- default:
- llvm_unreachable("Unknown linkage type!");
+ return;
+ case GlobalValue::AvailableExternallyLinkage:
+ llvm_unreachable("Should never emit this");
+ case GlobalValue::DLLImportLinkage:
+ case GlobalValue::ExternalWeakLinkage:
+ llvm_unreachable("Don't know how to emit these");
}
+ llvm_unreachable("Unknown linkage type!");
}