[llvm] r269155 - Replace PrintLinkage with getLinkagePrintName. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Tue May 10 18:45:31 PDT 2016
Author: rafael
Date: Tue May 10 20:45:31 2016
New Revision: 269155
URL: http://llvm.org/viewvc/llvm-project?rev=269155&view=rev
Log:
Replace PrintLinkage with getLinkagePrintName. NFC.
Modified:
llvm/trunk/lib/IR/AsmWriter.cpp
Modified: llvm/trunk/lib/IR/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AsmWriter.cpp?rev=269155&r1=269154&r2=269155&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AsmWriter.cpp (original)
+++ llvm/trunk/lib/IR/AsmWriter.cpp Tue May 10 20:45:31 2016
@@ -2352,22 +2352,30 @@ void AssemblyWriter::printNamedMDNode(co
Out << "}\n";
}
-static void PrintLinkage(GlobalValue::LinkageTypes LT,
- formatted_raw_ostream &Out) {
+static const char *getLinkagePrintName(GlobalValue::LinkageTypes LT) {
switch (LT) {
- case GlobalValue::ExternalLinkage: break;
- case GlobalValue::PrivateLinkage: Out << "private "; break;
- case GlobalValue::InternalLinkage: Out << "internal "; break;
- case GlobalValue::LinkOnceAnyLinkage: Out << "linkonce "; break;
- case GlobalValue::LinkOnceODRLinkage: Out << "linkonce_odr "; break;
- case GlobalValue::WeakAnyLinkage: Out << "weak "; break;
- case GlobalValue::WeakODRLinkage: Out << "weak_odr "; break;
- case GlobalValue::CommonLinkage: Out << "common "; break;
- case GlobalValue::AppendingLinkage: Out << "appending "; break;
- case GlobalValue::ExternalWeakLinkage: Out << "extern_weak "; break;
+ case GlobalValue::ExternalLinkage:
+ return "";
+ case GlobalValue::PrivateLinkage:
+ return "private ";
+ case GlobalValue::InternalLinkage:
+ return "internal ";
+ case GlobalValue::LinkOnceAnyLinkage:
+ return "linkonce ";
+ case GlobalValue::LinkOnceODRLinkage:
+ return "linkonce_odr ";
+ case GlobalValue::WeakAnyLinkage:
+ return "weak ";
+ case GlobalValue::WeakODRLinkage:
+ return "weak_odr ";
+ case GlobalValue::CommonLinkage:
+ return "common ";
+ case GlobalValue::AppendingLinkage:
+ return "appending ";
+ case GlobalValue::ExternalWeakLinkage:
+ return "extern_weak ";
case GlobalValue::AvailableExternallyLinkage:
- Out << "available_externally ";
- break;
+ return "available_externally ";
}
}
@@ -2437,7 +2445,7 @@ void AssemblyWriter::printGlobal(const G
if (!GV->hasInitializer() && GV->hasExternalLinkage())
Out << "external ";
- PrintLinkage(GV->getLinkage(), Out);
+ Out << getLinkagePrintName(GV->getLinkage());
PrintVisibility(GV->getVisibility(), Out);
PrintDLLStorageClass(GV->getDLLStorageClass(), Out);
PrintThreadLocalModel(GV->getThreadLocalMode(), Out);
@@ -2474,7 +2482,7 @@ void AssemblyWriter::printIndirectSymbol
WriteAsOperandInternal(Out, GIS, &TypePrinter, &Machine, GIS->getParent());
Out << " = ";
- PrintLinkage(GIS->getLinkage(), Out);
+ Out << getLinkagePrintName(GIS->getLinkage());
PrintVisibility(GIS->getVisibility(), Out);
PrintDLLStorageClass(GIS->getDLLStorageClass(), Out);
PrintThreadLocalModel(GIS->getThreadLocalMode(), Out);
@@ -2586,7 +2594,7 @@ void AssemblyWriter::printFunction(const
else
Out << "define ";
- PrintLinkage(F->getLinkage(), Out);
+ Out << getLinkagePrintName(F->getLinkage());
PrintVisibility(F->getVisibility(), Out);
PrintDLLStorageClass(F->getDLLStorageClass(), Out);
More information about the llvm-commits
mailing list