Refactor: Simplify boolean expressions in x86 target
authorDavid Blaikie <dblaikie@gmail.com>
Mon, 23 Mar 2015 19:42:36 +0000 (19:42 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Mon, 23 Mar 2015 19:42:36 +0000 (19:42 +0000)
Simplify boolean expressions with `true` and `false` with `clang-tidy`

Patch by Richard Thomson.

Differential Revision: http://reviews.llvm.org/D8519

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233002 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
lib/Target/X86/MCTargetDesc/X86ELFRelocationInfo.cpp
lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp

index 49e64032ad76aefa581274c85b369f3d54c1652b..7c9e012738875d2d8ff60ca0fcdfa2e2c487565d 100644 (file)
@@ -310,11 +310,8 @@ static bool isPrefixAtLocation(struct InternalInstruction* insn,
                                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 b6793168facf8999d38d6bf0958f16a76209ac67..10b83f40fc3833e6c212a0f2455c033555d052c0 100644 (file)
@@ -36,7 +36,7 @@ public:
 
     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 3b81d53e948c1b03b3e71fb28729f86f56c1279a..81749fcc6b430a577014c0a22d78858a952d2191 100644 (file)
@@ -38,7 +38,7 @@ public:
 
     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 @@ public:
         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);