From: Rui Ueyama Date: Wed, 15 Feb 2017 01:09:20 +0000 (+0000) Subject: Return early. NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=070aca8b5a74dcb5682cba8bfeef3c451ff67d5e;p=llvm Return early. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295137 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/MC/WinCOFFObjectWriter.cpp b/lib/MC/WinCOFFObjectWriter.cpp index 46a88ac0ebf..8ed5dd0c45e 100644 --- a/lib/MC/WinCOFFObjectWriter.cpp +++ b/lib/MC/WinCOFFObjectWriter.cpp @@ -427,24 +427,25 @@ static void encodeBase64StringEntry(char *Buffer, uint64_t Value) { } void WinCOFFObjectWriter::SetSectionName(COFFSection &S) { - if (S.Name.size() > COFF::NameSize) { - uint64_t StringTableEntry = Strings.getOffset(S.Name); - - if (StringTableEntry <= Max7DecimalOffset) { - SmallVector Buffer; - Twine('/').concat(Twine(StringTableEntry)).toVector(Buffer); - assert(Buffer.size() <= COFF::NameSize && Buffer.size() >= 2); - - std::memcpy(S.Header.Name, Buffer.data(), Buffer.size()); - } else if (StringTableEntry <= MaxBase64Offset) { - // Starting with 10,000,000, offsets are encoded as base64. - encodeBase64StringEntry(S.Header.Name, StringTableEntry); - } else { - report_fatal_error("COFF string table is greater than 64 GB."); - } - } else { + if (S.Name.size() <= COFF::NameSize) { std::memcpy(S.Header.Name, S.Name.c_str(), S.Name.size()); + return; + } + + uint64_t StringTableEntry = Strings.getOffset(S.Name); + if (StringTableEntry <= Max7DecimalOffset) { + SmallVector Buffer; + Twine('/').concat(Twine(StringTableEntry)).toVector(Buffer); + assert(Buffer.size() <= COFF::NameSize && Buffer.size() >= 2); + std::memcpy(S.Header.Name, Buffer.data(), Buffer.size()); + return; + } + if (StringTableEntry <= MaxBase64Offset) { + // Starting with 10,000,000, offsets are encoded as base64. + encodeBase64StringEntry(S.Header.Name, StringTableEntry); + return; } + report_fatal_error("COFF string table is greater than 64 GB."); } void WinCOFFObjectWriter::SetSymbolName(COFFSymbol &S) {