[PATCH] Refactor: Simplify boolean expressions in x86 target

David Blaikie dblaikie at gmail.com
Mon Mar 23 12:45:14 PDT 2015


Looks good, committed in r233002

On Sun, Mar 22, 2015 at 12:43 PM, Richard <legalize at xmission.com> wrote:

> Hi alexfh, sunfish, craig.topper,
>
> Simplify boolean expressions with `true` and `false` with `clang-tidy`
>
> http://reviews.llvm.org/D8519
>
> Files:
>   lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
>   lib/Target/X86/MCTargetDesc/X86ELFRelocationInfo.cpp
>   lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp
>
> Index: lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
> ===================================================================
> --- lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
> +++ lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
> @@ -310,11 +310,8 @@
>                                 uint8_t prefix,
>                                 uint64_t location)
>  {
> -  if (insn->prefixPresent[prefix] == 1 &&
> -     insn->prefixLocations[prefix] == location)
> -    return true;
> -  else
> -    return false;
> +  return insn->prefixPresent[prefix] == 1 &&
> +     insn->prefixLocations[prefix] == location;
>  }
>
>  /*
> Index: lib/Target/X86/MCTargetDesc/X86ELFRelocationInfo.cpp
> ===================================================================
> --- lib/Target/X86/MCTargetDesc/X86ELFRelocationInfo.cpp
> +++ lib/Target/X86/MCTargetDesc/X86ELFRelocationInfo.cpp
> @@ -36,7 +36,7 @@
>
>      MCSymbol *Sym = Ctx.GetOrCreateSymbol(SymName);
>      // FIXME: check that the value is actually the same.
> -    if (Sym->isVariable() == false)
> +    if (!Sym->isVariable())
>        Sym->setVariableValue(MCConstantExpr::Create(SymAddr, Ctx));
>
>      const MCExpr *Expr = nullptr;
> Index: lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp
> ===================================================================
> --- lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp
> +++ lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp
> @@ -38,7 +38,7 @@
>
>      MCSymbol *Sym = Ctx.GetOrCreateSymbol(SymName);
>      // FIXME: check that the value is actually the same.
> -    if (Sym->isVariable() == false)
> +    if (!Sym->isVariable())
>        Sym->setVariableValue(MCConstantExpr::Create(SymAddr, Ctx));
>      const MCExpr *Expr = nullptr;
>
> @@ -93,7 +93,7 @@
>          RSymI->getName(RSymName);
>
>          MCSymbol *RSym = Ctx.GetOrCreateSymbol(RSymName);
> -        if (RSym->isVariable() == false)
> +        if (!RSym->isVariable())
>            RSym->setVariableValue(MCConstantExpr::Create(RSymAddr, Ctx));
>
>          const MCExpr *RHS = MCSymbolRefExpr::Create(RSym, Ctx);
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150323/23fc7c6e/attachment.html>


More information about the llvm-commits mailing list