[llvm] r253138 - [llvm-ar] Simplify the code.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 14 10:25:18 PST 2015


Author: davide
Date: Sat Nov 14 12:25:18 2015
New Revision: 253138

URL: http://llvm.org/viewvc/llvm-project?rev=253138&view=rev
Log:
[llvm-ar] Simplify the code.

Modified:
    llvm/trunk/tools/llvm-ar/llvm-ar.cpp

Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=253138&r1=253137&r2=253138&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original)
+++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Sat Nov 14 12:25:18 2015
@@ -312,18 +312,9 @@ static void doPrint(StringRef Name, cons
 // Utility function for printing out the file mode when the 't' operation is in
 // verbose mode.
 static void printMode(unsigned mode) {
-  if (mode & 004)
-    outs() << "r";
-  else
-    outs() << "-";
-  if (mode & 002)
-    outs() << "w";
-  else
-    outs() << "-";
-  if (mode & 001)
-    outs() << "x";
-  else
-    outs() << "-";
+  outs() << ((mode & 004) ? "r" : "-");
+  outs() << ((mode & 002) ? "w" : "-");
+  outs() << ((mode & 001) ? "x" : "-");
 }
 
 // Implement the 't' operation. This function prints out just




More information about the llvm-commits mailing list