[PATCH] Refactor: Simplify boolean expressions in llvm-nm
Richard
legalize at xmission.com
Sun Mar 22 12:39:54 PDT 2015
Hi rafael, alexfh,
Simplify boolean expressions using `true` and `false` with `clang-tidy`
http://reviews.llvm.org/D8518
Files:
tools/llvm-nm/llvm-nm.cpp
Index: tools/llvm-nm/llvm-nm.cpp
===================================================================
--- tools/llvm-nm/llvm-nm.cpp
+++ tools/llvm-nm/llvm-nm.cpp
@@ -190,19 +190,15 @@
return true;
else if (A.Address == B.Address && A.Name < B.Name)
return true;
- else if (A.Address == B.Address && A.Name == B.Name && A.Size < B.Size)
- return true;
else
- return false;
+ return A.Address == B.Address && A.Name == B.Name && A.Size < B.Size;
} else {
if (A.Address > B.Address)
return true;
else if (A.Address == B.Address && A.Name > B.Name)
return true;
- else if (A.Address == B.Address && A.Name == B.Name && A.Size > B.Size)
- return true;
else
- return false;
+ return A.Address == B.Address && A.Name == B.Name && A.Size > B.Size;
}
}
@@ -212,19 +208,15 @@
return true;
else if (A.Size == B.Size && A.Name < B.Name)
return true;
- else if (A.Size == B.Size && A.Name == B.Name && A.Address < B.Address)
- return true;
else
- return false;
+ return A.Size == B.Size && A.Name == B.Name && A.Address < B.Address;
} else {
if (A.Size > B.Size)
return true;
else if (A.Size == B.Size && A.Name > B.Name)
return true;
- else if (A.Size == B.Size && A.Name == B.Name && A.Address > B.Address)
- return true;
else
- return false;
+ return A.Size == B.Size && A.Name == B.Name && A.Address > B.Address;
}
}
@@ -234,19 +226,15 @@
return true;
else if (A.Name == B.Name && A.Size < B.Size)
return true;
- else if (A.Name == B.Name && A.Size == B.Size && A.Address < B.Address)
- return true;
else
- return false;
+ return A.Name == B.Name && A.Size == B.Size && A.Address < B.Address;
} else {
if (A.Name > B.Name)
return true;
else if (A.Name == B.Name && A.Size > B.Size)
return true;
- else if (A.Name == B.Name && A.Size == B.Size && A.Address > B.Address)
- return true;
else
- return false;
+ return A.Name == B.Name && A.Size == B.Size && A.Address > B.Address;
}
}
@@ -263,10 +251,8 @@
return true;
else if (isa<ELF32BEObjectFile>(Obj))
return false;
- else if (isa<ELF64BEObjectFile>(Obj))
- return true;
else
- return false;
+ return isa<ELF64BEObjectFile>(Obj);
}
static StringRef CurrentFilename;
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8518.22426.patch
Type: text/x-patch
Size: 2431 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150322/eeb12d6b/attachment.bin>
More information about the llvm-commits
mailing list