[llvm] r330675 - Change if-conditionals to else-if as they should all be mutually exclusive.

Eric Christopher via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 23 18:57:02 PDT 2018


Author: echristo
Date: Mon Apr 23 18:57:02 2018
New Revision: 330675

URL: http://llvm.org/viewvc/llvm-project?rev=330675&view=rev
Log:
Change if-conditionals to else-if as they should all be mutually exclusive.

No functional change intended.

Modified:
    llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp

Modified: llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp?rev=330675&r1=330674&r2=330675&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp Mon Apr 23 18:57:02 2018
@@ -498,16 +498,16 @@ bool ELFAsmParser::ParseSectionArguments
   // Set the defaults first.
   if (hasPrefix(SectionName, ".rodata.") || SectionName == ".rodata1")
     Flags |= ELF::SHF_ALLOC;
-  if (SectionName == ".fini" || SectionName == ".init" ||
+  else if (SectionName == ".fini" || SectionName == ".init" ||
       hasPrefix(SectionName, ".text."))
     Flags |= ELF::SHF_ALLOC | ELF::SHF_EXECINSTR;
-  if (hasPrefix(SectionName, ".data.") || SectionName == ".data1" ||
+  else if (hasPrefix(SectionName, ".data.") || SectionName == ".data1" ||
       hasPrefix(SectionName, ".bss.") ||
       hasPrefix(SectionName, ".init_array.") ||
       hasPrefix(SectionName, ".fini_array.") ||
       hasPrefix(SectionName, ".preinit_array."))
     Flags |= ELF::SHF_ALLOC | ELF::SHF_WRITE;
-  if (hasPrefix(SectionName, ".tdata.") ||
+  else if (hasPrefix(SectionName, ".tdata.") ||
       hasPrefix(SectionName, ".tbss."))
     Flags |= ELF::SHF_ALLOC | ELF::SHF_WRITE | ELF::SHF_TLS;
 




More information about the llvm-commits mailing list