From 57743effb8055a9d9a0ae951f835a82b2f1e85a4 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 24 Jul 2009 05:01:55 +0000 Subject: [PATCH] reduce indentation git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76951 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ELFTargetAsmInfo.cpp | 72 +++++++++++++++++---------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/lib/Target/ELFTargetAsmInfo.cpp b/lib/Target/ELFTargetAsmInfo.cpp index 872b472dbed..1785d156c82 100644 --- a/lib/Target/ELFTargetAsmInfo.cpp +++ b/lib/Target/ELFTargetAsmInfo.cpp @@ -78,11 +78,13 @@ ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const { SectionKind::Kind Kind = SectionKindForGlobal(GV); if (GV->isWeakForLinker()) { - // FIXME: Use mangler interface (PR4584). - std::string Name = getSectionPrefixForUniqueGlobal(Kind)+GV->getName(); - unsigned Flags = SectionFlagsForGlobal(GV, Name.c_str()); - return getNamedSection(Name.c_str(), Flags); - } + if (const char *Prefix = getSectionPrefixForUniqueGlobal(Kind)) { + // FIXME: Use mangler interface (PR4584). + std::string Name = Prefix+GV->getName(); + unsigned Flags = SectionFlagsForGlobal(GV, Name.c_str()); + return getNamedSection(Name.c_str(), Flags); + } + } if (const Function *F = dyn_cast(GV)) { switch (F->getLinkage()) { @@ -94,36 +96,36 @@ ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const { case Function::ExternalLinkage: return TextSection; } - } else { - const GlobalVariable *GVar = cast(GV); - switch (Kind) { - default: llvm_unreachable("Unsuported section kind for global"); - case SectionKind::Data: - case SectionKind::DataRel: - return DataRelSection; - case SectionKind::DataRelLocal: - return DataRelLocalSection; - case SectionKind::DataRelRO: - return DataRelROSection; - case SectionKind::DataRelROLocal: - return DataRelROLocalSection; - case SectionKind::BSS: - return getBSSSection_(); - case SectionKind::ROData: - return getReadOnlySection(); - case SectionKind::RODataMergeStr: - return MergeableStringSection(GVar); - case SectionKind::RODataMergeConst: { - const Type *Ty = GVar->getInitializer()->getType(); - const TargetData *TD = TM.getTargetData(); - return getSectionForMergableConstant(TD->getTypeAllocSize(Ty), 0); - } - case SectionKind::ThreadData: - // ELF targets usually support TLS stuff - return TLSDataSection; - case SectionKind::ThreadBSS: - return TLSBSSSection; - } + } + + const GlobalVariable *GVar = cast(GV); + switch (Kind) { + default: llvm_unreachable("Unsuported section kind for global"); + case SectionKind::Data: + case SectionKind::DataRel: + return DataRelSection; + case SectionKind::DataRelLocal: + return DataRelLocalSection; + case SectionKind::DataRelRO: + return DataRelROSection; + case SectionKind::DataRelROLocal: + return DataRelROLocalSection; + case SectionKind::BSS: + return getBSSSection_(); + case SectionKind::ROData: + return getReadOnlySection(); + case SectionKind::RODataMergeStr: + return MergeableStringSection(GVar); + case SectionKind::RODataMergeConst: { + const Type *Ty = GVar->getInitializer()->getType(); + const TargetData *TD = TM.getTargetData(); + return getSectionForMergableConstant(TD->getTypeAllocSize(Ty), 0); + } + case SectionKind::ThreadData: + // ELF targets usually support TLS stuff + return TLSDataSection; + case SectionKind::ThreadBSS: + return TLSBSSSection; } }