diff options
author | Craig Topper <craig.topper@gmail.com> | 2014-04-09 04:20:00 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2014-04-09 04:20:00 +0000 |
commit | 725011e72f7b6fa358d953cffbb63f218e20af8b (patch) | |
tree | b61db4fb01e1e0b56165db0b2702774f483d3d6a /include/llvm | |
parent | e4d89ec8de33c9ed3554dcc2b2391b7698dba1e3 (diff) | |
download | llvm-725011e72f7b6fa358d953cffbb63f218e20af8b.tar.gz llvm-725011e72f7b6fa358d953cffbb63f218e20af8b.tar.bz2 llvm-725011e72f7b6fa358d953cffbb63f218e20af8b.tar.xz |
[C++11] Replace some comparisons with 'nullptr' with simple boolean checks to reduce verbosity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205829 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/ADT/IntrusiveRefCntPtr.h | 2 | ||||
-rw-r--r-- | include/llvm/ADT/StringRef.h | 2 | ||||
-rw-r--r-- | include/llvm/ADT/ilist.h | 2 | ||||
-rw-r--r-- | include/llvm/CodeGen/PBQP/Graph.h | 4 | ||||
-rw-r--r-- | include/llvm/Support/CommandLine.h | 2 | ||||
-rw-r--r-- | include/llvm/Support/FileSystem.h | 4 | ||||
-rw-r--r-- | include/llvm/Support/YAMLParser.h | 2 |
7 files changed, 9 insertions, 9 deletions
diff --git a/include/llvm/ADT/IntrusiveRefCntPtr.h b/include/llvm/ADT/IntrusiveRefCntPtr.h index 449f445e71..cd1946c54d 100644 --- a/include/llvm/ADT/IntrusiveRefCntPtr.h +++ b/include/llvm/ADT/IntrusiveRefCntPtr.h @@ -179,7 +179,7 @@ public: typedef T* (IntrusiveRefCntPtr::*unspecified_bool_type) () const; operator unspecified_bool_type() const { - return Obj == nullptr ? nullptr : &IntrusiveRefCntPtr::getPtr; + return Obj ? &IntrusiveRefCntPtr::getPtr : nullptr; } void swap(IntrusiveRefCntPtr& other) { diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h index d306b399fa..bd5a550b9f 100644 --- a/include/llvm/ADT/StringRef.h +++ b/include/llvm/ADT/StringRef.h @@ -186,7 +186,7 @@ namespace llvm { /// str - Get the contents as an std::string. std::string str() const { - if (Data == nullptr) return std::string(); + if (!Data) return std::string(); return std::string(Data, Length); } diff --git a/include/llvm/ADT/ilist.h b/include/llvm/ADT/ilist.h index 3c076d4399..abb5a22fd2 100644 --- a/include/llvm/ADT/ilist.h +++ b/include/llvm/ADT/ilist.h @@ -383,7 +383,7 @@ public: // Miscellaneous inspection routines. size_type max_size() const { return size_type(-1); } bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { - return Head == nullptr || Head == getTail(); + return !Head || Head == getTail(); } // Front and back accessor functions... diff --git a/include/llvm/CodeGen/PBQP/Graph.h b/include/llvm/CodeGen/PBQP/Graph.h index 07c3337731..1b960381c7 100644 --- a/include/llvm/CodeGen/PBQP/Graph.h +++ b/include/llvm/CodeGen/PBQP/Graph.h @@ -336,7 +336,7 @@ namespace PBQP { /// each node in the graph, and handleAddEdge for each edge, to give the /// solver an opportunity to set up any requried metadata. void setSolver(SolverT &S) { - assert(Solver == nullptr && "Solver already set. Call unsetSolver()."); + assert(!Solver && "Solver already set. Call unsetSolver()."); Solver = &S; for (auto NId : nodeIds()) Solver->handleAddNode(NId); @@ -346,7 +346,7 @@ namespace PBQP { /// \brief Release from solver instance. void unsetSolver() { - assert(Solver != nullptr && "Solver not set."); + assert(Solver && "Solver not set."); Solver = nullptr; } diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h index 006680587b..ab94d61500 100644 --- a/include/llvm/Support/CommandLine.h +++ b/include/llvm/Support/CommandLine.h @@ -1664,7 +1664,7 @@ class alias : public Option { void done() { if (!hasArgStr()) error("cl::alias must have argument name specified!"); - if (AliasFor == nullptr) + if (!AliasFor) error("cl::alias must have an cl::aliasopt(option) specified!"); addArgument(); } diff --git a/include/llvm/Support/FileSystem.h b/include/llvm/Support/FileSystem.h index 52182a8e77..b2a0677082 100644 --- a/include/llvm/Support/FileSystem.h +++ b/include/llvm/Support/FileSystem.h @@ -828,9 +828,9 @@ public: bool operator==(const directory_iterator &RHS) const { if (State == RHS.State) return true; - if (RHS.State == nullptr) + if (!RHS.State) return State->CurrentEntry == directory_entry(); - if (State == nullptr) + if (!State) return RHS.State->CurrentEntry == directory_entry(); return State->CurrentEntry == RHS.State->CurrentEntry; } diff --git a/include/llvm/Support/YAMLParser.h b/include/llvm/Support/YAMLParser.h index cbe154464f..d9d632e00e 100644 --- a/include/llvm/Support/YAMLParser.h +++ b/include/llvm/Support/YAMLParser.h @@ -305,7 +305,7 @@ public: assert(Base && "Attempted to advance iterator past end!"); Base->increment(); // Create an end iterator. - if (Base->CurrentEntry == nullptr) + if (!Base->CurrentEntry) Base = nullptr; return *this; } |