[PATCH] Refactor: Simplify boolean conditional return statements in tools/llvm-nm
Richard
legalize at xmission.com
Mon May 25 11:52:08 PDT 2015
Hi rafael, Bigcheese, void, chandlerc, ddunbar, resistor,
Use clang-tidy to simplify boolean conditional return statements
http://reviews.llvm.org/D10004
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,57 +190,45 @@
return true;
if (A.Address == B.Address && A.Name < B.Name)
return true;
- if (A.Address == B.Address && A.Name == B.Name && A.Size < B.Size)
- return true;
- return false;
+ return A.Address == B.Address && A.Name == B.Name && A.Size < B.Size;
}
if (A.Address > B.Address)
return true;
if (A.Address == B.Address && A.Name > B.Name)
return true;
- if (A.Address == B.Address && A.Name == B.Name && A.Size > B.Size)
- return true;
- return false;
+ return A.Address == B.Address && A.Name == B.Name && A.Size > B.Size;
}
static bool compareSymbolSize(const NMSymbol &A, const NMSymbol &B) {
if (!ReverseSort) {
if (A.Size < B.Size)
return true;
if (A.Size == B.Size && A.Name < B.Name)
return true;
- if (A.Size == B.Size && A.Name == B.Name && A.Address < B.Address)
- return true;
- return false;
+ return A.Size == B.Size && A.Name == B.Name && A.Address < B.Address;
}
if (A.Size > B.Size)
return true;
if (A.Size == B.Size && A.Name > B.Name)
return true;
- if (A.Size == B.Size && A.Name == B.Name && A.Address > B.Address)
- return true;
- return false;
+ return A.Size == B.Size && A.Name == B.Name && A.Address > B.Address;
}
static bool compareSymbolName(const NMSymbol &A, const NMSymbol &B) {
if (!ReverseSort) {
if (A.Name < B.Name)
return true;
if (A.Name == B.Name && A.Size < B.Size)
return true;
- if (A.Name == B.Name && A.Size == B.Size && A.Address < B.Address)
- return true;
- return false;
+ return A.Name == B.Name && A.Size == B.Size && A.Address < B.Address;
}
if (A.Name > B.Name)
return true;
if (A.Name == B.Name && A.Size > B.Size)
return true;
- if (A.Name == B.Name && A.Size == B.Size && A.Address > B.Address)
- return true;
- return false;
+ return A.Name == B.Name && A.Size == B.Size && A.Address > B.Address;
}
static char isSymbolList64Bit(SymbolicFile &Obj) {
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10004.26469.patch
Type: text/x-patch
Size: 2189 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150525/7ae140cc/attachment.bin>
More information about the llvm-commits
mailing list