[llvm] r268689 - Fix some Clang-tidy readability-simplify-boolean-expr and Include What You Use warnings.

Eugene Zelenko via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 14:35:48 PDT 2016


Author: eugenezelenko
Date: Thu May  5 16:35:47 2016
New Revision: 268689

URL: http://llvm.org/viewvc/llvm-project?rev=268689&view=rev
Log:
Fix some Clang-tidy readability-simplify-boolean-expr and Include What You Use warnings.

Differential revision: reviews.llvm.org/D19946

Modified:
    llvm/trunk/include/llvm/ADT/BitVector.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCChannel.h
    llvm/trunk/include/llvm/Support/FileSystem.h

Modified: llvm/trunk/include/llvm/ADT/BitVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/BitVector.h?rev=268689&r1=268688&r2=268689&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/BitVector.h (original)
+++ llvm/trunk/include/llvm/ADT/BitVector.h Thu May  5 16:35:47 2016
@@ -14,13 +14,13 @@
 #ifndef LLVM_ADT_BITVECTOR_H
 #define LLVM_ADT_BITVECTOR_H
 
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MathExtras.h"
 #include <algorithm>
 #include <cassert>
 #include <climits>
+#include <cstdint>
 #include <cstdlib>
+#include <cstring>
 
 namespace llvm {
 
@@ -69,7 +69,7 @@ public:
     }
 
     operator bool() const {
-      return ((*WordRef) & (BitWord(1) << BitPos)) ? true : false;
+      return ((*WordRef) & (BitWord(1) << BitPos)) != 0;
     }
   };
 
@@ -576,7 +576,7 @@ static inline size_t capacity_in_bytes(c
   return X.getMemorySize();
 }
 
-} // End llvm namespace
+} // end namespace llvm
 
 namespace std {
   /// Implement std::swap in terms of BitVector swap.
@@ -584,6 +584,6 @@ namespace std {
   swap(llvm::BitVector &LHS, llvm::BitVector &RHS) {
     LHS.swap(RHS);
   }
-}
+} // end namespace std
 
-#endif
+#endif // LLVM_ADT_BITVECTOR_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCChannel.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCChannel.h?rev=268689&r1=268688&r2=268689&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCChannel.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCChannel.h Thu May  5 16:35:47 2016
@@ -1,4 +1,11 @@
-// -*- c++ -*-
+//===- llvm/ExecutionEngine/Orc/RPCChannel.h --------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
 
 #ifndef LLVM_EXECUTIONENGINE_ORC_RPCCHANNEL_H
 #define LLVM_EXECUTIONENGINE_ORC_RPCCHANNEL_H
@@ -6,10 +13,15 @@
 #include "OrcError.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Endian.h"
-
+#include "llvm/Support/Error.h"
+#include <cstddef>
+#include <cstdint>
 #include <mutex>
-#include <system_error>
+#include <string>
+#include <tuple>
+#include <vector>
 
 namespace llvm {
 namespace orc {
@@ -146,7 +158,7 @@ inline Error deserialize(RPCChannel &C,
   if (auto Err = C.readBytes(reinterpret_cast<char *>(&VN), 1))
     return Err;
 
-  V = (VN != 0) ? true : false;
+  V = (VN != 0);
   return Error::success();
 }
 
@@ -234,4 +246,4 @@ template <typename T> Error deserialize(
 } // end namespace orc
 } // end namespace llvm
 
-#endif
+#endif // LLVM_EXECUTIONENGINE_ORC_RPCCHANNEL_H

Modified: llvm/trunk/include/llvm/Support/FileSystem.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FileSystem.h?rev=268689&r1=268688&r2=268689&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/FileSystem.h (original)
+++ llvm/trunk/include/llvm/Support/FileSystem.h Thu May  5 16:35:47 2016
@@ -29,13 +29,15 @@
 
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/DataTypes.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/TimeValue.h"
+#include <cassert>
+#include <cstdint>
 #include <ctime>
-#include <iterator>
 #include <stack>
 #include <string>
 #include <system_error>
@@ -263,7 +265,7 @@ struct file_magic {
   };
 
   bool is_object() const {
-    return V == unknown ? false : true;
+    return V != unknown;
   }
 
   file_magic() : V(unknown) {}
@@ -762,7 +764,7 @@ namespace detail {
     intptr_t IterationHandle;
     directory_entry CurrentEntry;
   };
-}
+} // end namespace detail
 
 /// directory_iterator - Iterates through the entries in path. There is no
 /// operator++ because we need an error_code. If it's really needed we can make
@@ -824,7 +826,7 @@ namespace detail {
     uint16_t Level;
     bool HasNoPushRequest;
   };
-}
+} // end namespace detail
 
 /// recursive_directory_iterator - Same as directory_iterator except for it
 /// recurses down into child directories.
@@ -923,4 +925,4 @@ public:
 } // end namespace sys
 } // end namespace llvm
 
-#endif
+#endif // LLVM_SUPPORT_FILESYSTEM_H




More information about the llvm-commits mailing list