<div dir="ltr">It wasn't discussed, but a significant portion of LLVM doesn't explicitly compare. I mostly only converted if statements since I know I've seen lots of if statements that don't explicitly compare.<div>
<br></div><div>I didn't change things like</div><div><br></div><div>bool bar = foo != nullptr;</div><div><br></div><div>or</div><div><br></div><div>bool bar() { return foo != nullptr; }</div><div><br></div><div><br></div>
<div>Since those seemed less clear without a comparison operation.</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 9, 2014 at 6:20 AM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">FWIW, I think this is fine. The boolean test is idiomatic in C++ and I see no reason for LLVM to diverge.</p>
<div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On Apr 9, 2014 1:36 PM, "Eli Bendersky" <<a href="mailto:eliben@google.com" target="_blank">eliben@google.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Craig, was this change discussed somewhere? The LLVM coding guidelines are silent about this, but some C++ style guides recommend explicit comparisons to nullptr.<div><br></div><div>Eli</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Apr 8, 2014 at 9:20 PM, Craig Topper <span dir="ltr"><<a href="mailto:craig.topper@gmail.com" target="_blank">craig.topper@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: ctopper<br>
Date: Tue Apr 8 23:20:00 2014<br>
New Revision: 205829<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=205829&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=205829&view=rev</a><br>
Log:<br>
[C++11] Replace some comparisons with 'nullptr' with simple boolean checks to reduce verbosity.<br>
<br>
Modified:<br>
llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h<br>
llvm/trunk/include/llvm/ADT/StringRef.h<br>
llvm/trunk/include/llvm/ADT/ilist.h<br>
llvm/trunk/include/llvm/CodeGen/PBQP/Graph.h<br>
llvm/trunk/include/llvm/Support/CommandLine.h<br>
llvm/trunk/include/llvm/Support/FileSystem.h<br>
llvm/trunk/include/llvm/Support/YAMLParser.h<br>
llvm/trunk/lib/Support/Allocator.cpp<br>
llvm/trunk/lib/Support/CommandLine.cpp<br>
llvm/trunk/lib/Support/DynamicLibrary.cpp<br>
llvm/trunk/lib/Support/FoldingSet.cpp<br>
llvm/trunk/lib/Support/ManagedStatic.cpp<br>
llvm/trunk/lib/Support/PrettyStackTrace.cpp<br>
llvm/trunk/lib/Support/SourceMgr.cpp<br>
llvm/trunk/lib/Support/StringMap.cpp<br>
llvm/trunk/lib/Support/TargetRegistry.cpp<br>
llvm/trunk/lib/Support/Timer.cpp<br>
llvm/trunk/lib/Support/YAMLParser.cpp<br>
llvm/trunk/lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h (original)<br>
+++ llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h Tue Apr 8 23:20:00 2014<br>
@@ -179,7 +179,7 @@ public:<br>
<br>
typedef T* (IntrusiveRefCntPtr::*unspecified_bool_type) () const;<br>
operator unspecified_bool_type() const {<br>
- return Obj == nullptr ? nullptr : &IntrusiveRefCntPtr::getPtr;<br>
+ return Obj ? &IntrusiveRefCntPtr::getPtr : nullptr;<br>
}<br>
<br>
void swap(IntrusiveRefCntPtr& other) {<br>
<br>
Modified: llvm/trunk/include/llvm/ADT/StringRef.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/ADT/StringRef.h (original)<br>
+++ llvm/trunk/include/llvm/ADT/StringRef.h Tue Apr 8 23:20:00 2014<br>
@@ -186,7 +186,7 @@ namespace llvm {<br>
<br>
/// str - Get the contents as an std::string.<br>
std::string str() const {<br>
- if (Data == nullptr) return std::string();<br>
+ if (!Data) return std::string();<br>
return std::string(Data, Length);<br>
}<br>
<br>
<br>
Modified: llvm/trunk/include/llvm/ADT/ilist.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ilist.h?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ilist.h?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/ADT/ilist.h (original)<br>
+++ llvm/trunk/include/llvm/ADT/ilist.h Tue Apr 8 23:20:00 2014<br>
@@ -383,7 +383,7 @@ public:<br>
// Miscellaneous inspection routines.<br>
size_type max_size() const { return size_type(-1); }<br>
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const {<br>
- return Head == nullptr || Head == getTail();<br>
+ return !Head || Head == getTail();<br>
}<br>
<br>
// Front and back accessor functions...<br>
<br>
Modified: llvm/trunk/include/llvm/CodeGen/PBQP/Graph.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/PBQP/Graph.h?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/PBQP/Graph.h?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/PBQP/Graph.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/PBQP/Graph.h Tue Apr 8 23:20:00 2014<br>
@@ -336,7 +336,7 @@ namespace PBQP {<br>
/// each node in the graph, and handleAddEdge for each edge, to give the<br>
/// solver an opportunity to set up any requried metadata.<br>
void setSolver(SolverT &S) {<br>
- assert(Solver == nullptr && "Solver already set. Call unsetSolver().");<br>
+ assert(!Solver && "Solver already set. Call unsetSolver().");<br>
Solver = &S;<br>
for (auto NId : nodeIds())<br>
Solver->handleAddNode(NId);<br>
@@ -346,7 +346,7 @@ namespace PBQP {<br>
<br>
/// \brief Release from solver instance.<br>
void unsetSolver() {<br>
- assert(Solver != nullptr && "Solver not set.");<br>
+ assert(Solver && "Solver not set.");<br>
Solver = nullptr;<br>
}<br>
<br>
<br>
Modified: llvm/trunk/include/llvm/Support/CommandLine.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CommandLine.h?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CommandLine.h?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Support/CommandLine.h (original)<br>
+++ llvm/trunk/include/llvm/Support/CommandLine.h Tue Apr 8 23:20:00 2014<br>
@@ -1664,7 +1664,7 @@ class alias : public Option {<br>
void done() {<br>
if (!hasArgStr())<br>
error("cl::alias must have argument name specified!");<br>
- if (AliasFor == nullptr)<br>
+ if (!AliasFor)<br>
error("cl::alias must have an cl::aliasopt(option) specified!");<br>
addArgument();<br>
}<br>
<br>
Modified: llvm/trunk/include/llvm/Support/FileSystem.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FileSystem.h?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FileSystem.h?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Support/FileSystem.h (original)<br>
+++ llvm/trunk/include/llvm/Support/FileSystem.h Tue Apr 8 23:20:00 2014<br>
@@ -828,9 +828,9 @@ public:<br>
bool operator==(const directory_iterator &RHS) const {<br>
if (State == RHS.State)<br>
return true;<br>
- if (RHS.State == nullptr)<br>
+ if (!RHS.State)<br>
return State->CurrentEntry == directory_entry();<br>
- if (State == nullptr)<br>
+ if (!State)<br>
return RHS.State->CurrentEntry == directory_entry();<br>
return State->CurrentEntry == RHS.State->CurrentEntry;<br>
}<br>
<br>
Modified: llvm/trunk/include/llvm/Support/YAMLParser.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/YAMLParser.h?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/YAMLParser.h?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Support/YAMLParser.h (original)<br>
+++ llvm/trunk/include/llvm/Support/YAMLParser.h Tue Apr 8 23:20:00 2014<br>
@@ -305,7 +305,7 @@ public:<br>
assert(Base && "Attempted to advance iterator past end!");<br>
Base->increment();<br>
// Create an end iterator.<br>
- if (Base->CurrentEntry == nullptr)<br>
+ if (!Base->CurrentEntry)<br>
Base = nullptr;<br>
return *this;<br>
}<br>
<br>
Modified: llvm/trunk/lib/Support/Allocator.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Allocator.cpp?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Allocator.cpp?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/Allocator.cpp (original)<br>
+++ llvm/trunk/lib/Support/Allocator.cpp Tue Apr 8 23:20:00 2014<br>
@@ -39,7 +39,7 @@ void MallocSlabAllocator::Deallocate(Mem<br>
void BumpPtrAllocatorBase::PrintStats() const {<br>
unsigned NumSlabs = 0;<br>
size_t TotalMemory = 0;<br>
- for (MemSlab *Slab = CurSlab; Slab != nullptr; Slab = Slab->NextPtr) {<br>
+ for (MemSlab *Slab = CurSlab; Slab; Slab = Slab->NextPtr) {<br>
TotalMemory += Slab->Size;<br>
++NumSlabs;<br>
}<br>
@@ -53,7 +53,7 @@ void BumpPtrAllocatorBase::PrintStats()<br>
<br>
size_t BumpPtrAllocatorBase::getTotalMemory() const {<br>
size_t TotalMemory = 0;<br>
- for (MemSlab *Slab = CurSlab; Slab != nullptr; Slab = Slab->NextPtr) {<br>
+ for (MemSlab *Slab = CurSlab; Slab; Slab = Slab->NextPtr) {<br>
TotalMemory += Slab->Size;<br>
}<br>
return TotalMemory;<br>
<br>
Modified: llvm/trunk/lib/Support/CommandLine.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/CommandLine.cpp (original)<br>
+++ llvm/trunk/lib/Support/CommandLine.cpp Tue Apr 8 23:20:00 2014<br>
@@ -300,7 +300,7 @@ static inline bool ProvideOption(Option<br>
// Enforce value requirements<br>
switch (Handler->getValueExpectedFlag()) {<br>
case ValueRequired:<br>
- if (Value.data() == nullptr) { // No value specified?<br>
+ if (!Value.data()) { // No value specified?<br>
if (i+1 >= argc)<br>
return Handler->error("requires a value!");<br>
// Steal the next argument, like for '-o filename'<br>
@@ -400,7 +400,7 @@ static Option *HandlePrefixedOrGroupedOp<br>
// Do the lookup!<br>
size_t Length = 0;<br>
Option *PGOpt = getOptionPred(Arg, Length, isPrefixedOrGrouping, OptionsMap);<br>
- if (PGOpt == nullptr) return nullptr;<br>
+ if (!PGOpt) return nullptr;<br>
<br>
// If the option is a prefixed option, then the value is simply the<br>
// rest of the name... so fall through to later processing, by<br>
@@ -770,7 +770,7 @@ void cl::ParseCommandLineOptions(int arg<br>
<br>
// Calculate how many positional values are _required_.<br>
bool UnboundedFound = false;<br>
- for (size_t i = ConsumeAfterOpt != nullptr, e = PositionalOpts.size();<br>
+ for (size_t i = ConsumeAfterOpt ? 1 : 0, e = PositionalOpts.size();<br>
i != e; ++i) {<br>
Option *Opt = PositionalOpts[i];<br>
if (RequiresValue(Opt))<br>
@@ -845,8 +845,7 @@ void cl::ParseCommandLineOptions(int arg<br>
// All of the positional arguments have been fulfulled, give the rest to<br>
// the consume after option... if it's specified...<br>
//<br>
- if (PositionalVals.size() >= NumPositionalRequired &&<br>
- ConsumeAfterOpt != nullptr) {<br>
+ if (PositionalVals.size() >= NumPositionalRequired && ConsumeAfterOpt) {<br>
for (++i; i < argc; ++i)<br>
PositionalVals.push_back(std::make_pair(argv[i],i));<br>
break; // Handle outside of the argument processing loop...<br>
@@ -884,18 +883,18 @@ void cl::ParseCommandLineOptions(int arg<br>
Handler = LookupOption(ArgName, Value, Opts);<br>
<br>
// Check to see if this "option" is really a prefixed or grouped argument.<br>
- if (Handler == nullptr)<br>
+ if (!Handler)<br>
Handler = HandlePrefixedOrGroupedOption(ArgName, Value,<br>
ErrorParsing, Opts);<br>
<br>
// Otherwise, look for the closest available option to report to the user<br>
// in the upcoming error.<br>
- if (Handler == nullptr && SinkOpts.empty())<br>
+ if (!Handler && SinkOpts.empty())<br>
NearestHandler = LookupNearestOption(ArgName, Opts,<br>
NearestHandlerString);<br>
}<br>
<br>
- if (Handler == nullptr) {<br>
+ if (!Handler) {<br>
if (SinkOpts.empty()) {<br>
errs() << ProgramName << ": Unknown command line argument '"<br>
<< argv[i] << "'. Try: '" << argv[0] << " -help'\n";<br>
@@ -939,7 +938,7 @@ void cl::ParseCommandLineOptions(int arg<br>
<< " positional arguments: See: " << argv[0] << " -help\n";<br>
ErrorParsing = true;<br>
<br>
- } else if (ConsumeAfterOpt == nullptr) {<br>
+ } else if (!ConsumeAfterOpt) {<br>
// Positional args have already been handled if ConsumeAfter is specified.<br>
unsigned ValNo = 0, NumVals = static_cast<unsigned>(PositionalVals.size());<br>
for (size_t i = 0, e = PositionalOpts.size(); i != e; ++i) {<br>
@@ -1044,7 +1043,7 @@ void cl::ParseCommandLineOptions(int arg<br>
//<br>
<br>
bool Option::error(const Twine &Message, StringRef ArgName) {<br>
- if (ArgName.data() == nullptr) ArgName = ArgStr;<br>
+ if (!ArgName.data()) ArgName = ArgStr;<br>
if (ArgName.empty())<br>
errs() << HelpStr; // Be nice for positional arguments<br>
else<br>
@@ -1779,7 +1778,7 @@ void cl::SetVersionPrinter(void (*func)(<br>
}<br>
<br>
void cl::AddExtraVersionPrinter(void (*func)()) {<br>
- if (ExtraVersionPrinters == nullptr)<br>
+ if (!ExtraVersionPrinters)<br>
ExtraVersionPrinters = new std::vector<void (*)()>;<br>
<br>
ExtraVersionPrinters->push_back(func);<br>
<br>
Modified: llvm/trunk/lib/Support/DynamicLibrary.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/DynamicLibrary.cpp?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/DynamicLibrary.cpp?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/DynamicLibrary.cpp (original)<br>
+++ llvm/trunk/lib/Support/DynamicLibrary.cpp Tue Apr 8 23:20:00 2014<br>
@@ -58,7 +58,7 @@ DynamicLibrary DynamicLibrary::getPerman<br>
SmartScopedLock<true> lock(*SymbolsMutex);<br>
<br>
void *handle = dlopen(filename, RTLD_LAZY|RTLD_GLOBAL);<br>
- if (handle == nullptr) {<br>
+ if (!handle) {<br>
if (errMsg) *errMsg = dlerror();<br>
return DynamicLibrary();<br>
}<br>
@@ -66,11 +66,11 @@ DynamicLibrary DynamicLibrary::getPerman<br>
#ifdef __CYGWIN__<br>
// Cygwin searches symbols only in the main<br>
// with the handle of dlopen(NULL, RTLD_GLOBAL).<br>
- if (filename == NULL)<br>
+ if (!filename)<br>
handle = RTLD_DEFAULT;<br>
#endif<br>
<br>
- if (OpenedHandles == nullptr)<br>
+ if (!OpenedHandles)<br>
OpenedHandles = new DenseSet<void *>();<br>
<br>
// If we've already loaded this library, dlclose() the handle in order to<br>
<br>
Modified: llvm/trunk/lib/Support/FoldingSet.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FoldingSet.cpp?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FoldingSet.cpp?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/FoldingSet.cpp (original)<br>
+++ llvm/trunk/lib/Support/FoldingSet.cpp Tue Apr 8 23:20:00 2014<br>
@@ -323,7 +323,7 @@ void FoldingSetImpl::InsertNode(Node *N,<br>
// If this is the first insertion into this bucket, its next pointer will be<br>
// null. Pretend as if it pointed to itself, setting the low bit to indicate<br>
// that it is a pointer to the bucket.<br>
- if (Next == nullptr)<br>
+ if (!Next)<br>
Next = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(Bucket)|1);<br>
<br>
// Set the node's next pointer, and make the bucket point to the node.<br>
@@ -337,7 +337,7 @@ bool FoldingSetImpl::RemoveNode(Node *N)<br>
// Because each bucket is a circular list, we don't need to compute N's hash<br>
// to remove it.<br>
void *Ptr = N->getNextInBucket();<br>
- if (Ptr == nullptr) return false; // Not in folding set.<br>
+ if (!Ptr) return false; // Not in folding set.<br>
<br>
--NumNodes;<br>
N->SetNextInBucket(nullptr);<br>
@@ -390,7 +390,7 @@ FoldingSetImpl::Node *FoldingSetImpl::Ge<br>
FoldingSetIteratorImpl::FoldingSetIteratorImpl(void **Bucket) {<br>
// Skip to the first non-null non-self-cycle bucket.<br>
while (*Bucket != reinterpret_cast<void*>(-1) &&<br>
- (*Bucket == nullptr || GetNextPtr(*Bucket) == nullptr))<br>
+ (!*Bucket || !GetNextPtr(*Bucket)))<br>
++Bucket;<br>
<br>
NodePtr = static_cast<FoldingSetNode*>(*Bucket);<br>
@@ -410,7 +410,7 @@ void FoldingSetIteratorImpl::advance() {<br>
do {<br>
++Bucket;<br>
} while (*Bucket != reinterpret_cast<void*>(-1) &&<br>
- (*Bucket == nullptr || GetNextPtr(*Bucket) == nullptr));<br>
+ (!*Bucket || !GetNextPtr(*Bucket)));<br>
<br>
NodePtr = static_cast<FoldingSetNode*>(*Bucket);<br>
}<br>
@@ -420,6 +420,5 @@ void FoldingSetIteratorImpl::advance() {<br>
// FoldingSetBucketIteratorImpl Implementation<br>
<br>
FoldingSetBucketIteratorImpl::FoldingSetBucketIteratorImpl(void **Bucket) {<br>
- Ptr = (*Bucket == nullptr || GetNextPtr(*Bucket) == nullptr) ? (void*) Bucket<br>
- : *Bucket;<br>
+ Ptr = (!*Bucket || !GetNextPtr(*Bucket)) ? (void*) Bucket : *Bucket;<br>
}<br>
<br>
Modified: llvm/trunk/lib/Support/ManagedStatic.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ManagedStatic.cpp?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ManagedStatic.cpp?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/ManagedStatic.cpp (original)<br>
+++ llvm/trunk/lib/Support/ManagedStatic.cpp Tue Apr 8 23:20:00 2014<br>
@@ -24,7 +24,7 @@ void ManagedStaticBase::RegisterManagedS<br>
if (llvm_is_multithreaded()) {<br>
llvm_acquire_global_lock();<br>
<br>
- if (Ptr == nullptr) {<br>
+ if (!Ptr) {<br>
void* tmp = Creator ? Creator() : nullptr;<br>
<br>
TsanHappensBefore(this);<br>
<br>
Modified: llvm/trunk/lib/Support/PrettyStackTrace.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/PrettyStackTrace.cpp?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/PrettyStackTrace.cpp?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/PrettyStackTrace.cpp (original)<br>
+++ llvm/trunk/lib/Support/PrettyStackTrace.cpp Tue Apr 8 23:20:00 2014<br>
@@ -46,7 +46,7 @@ static unsigned PrintStack(const PrettyS<br>
/// PrintCurStackTrace - Print the current stack trace to the specified stream.<br>
static void PrintCurStackTrace(raw_ostream &OS) {<br>
// Don't print an empty trace.<br>
- if (PrettyStackTraceHead->get() == nullptr) return;<br>
+ if (!PrettyStackTraceHead->get()) return;<br>
<br>
// If there are pretty stack frames registered, walk and emit them.<br>
OS << "Stack dump:\n";<br>
<br>
Modified: llvm/trunk/lib/Support/SourceMgr.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SourceMgr.cpp?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SourceMgr.cpp?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/SourceMgr.cpp (original)<br>
+++ llvm/trunk/lib/Support/SourceMgr.cpp Tue Apr 8 23:20:00 2014<br>
@@ -114,7 +114,7 @@ SourceMgr::getLineAndColumn(SMLoc Loc, i<br>
if (*Ptr == '\n') ++LineNo;<br>
<br>
// Allocate the line number cache if it doesn't exist.<br>
- if (LineNoCache == nullptr)<br>
+ if (!LineNoCache)<br>
LineNoCache = new LineNoCacheTy();<br>
<br>
// Update the line # cache.<br>
<br>
Modified: llvm/trunk/lib/Support/StringMap.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/StringMap.cpp?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/StringMap.cpp?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/StringMap.cpp (original)<br>
+++ llvm/trunk/lib/Support/StringMap.cpp Tue Apr 8 23:20:00 2014<br>
@@ -70,7 +70,7 @@ unsigned StringMapImpl::LookupBucketFor(<br>
while (1) {<br>
StringMapEntryBase *BucketItem = TheTable[BucketNo];<br>
// If we found an empty bucket, this key isn't in the table yet, return it.<br>
- if (LLVM_LIKELY(BucketItem == nullptr)) {<br>
+ if (LLVM_LIKELY(!BucketItem)) {<br>
// If we found a tombstone, we want to reuse the tombstone instead of an<br>
// empty bucket. This reduces probing.<br>
if (FirstTombstone != -1) {<br>
@@ -124,7 +124,7 @@ int StringMapImpl::FindKey(StringRef Key<br>
while (1) {<br>
StringMapEntryBase *BucketItem = TheTable[BucketNo];<br>
// If we found an empty bucket, this key isn't in the table yet, return.<br>
- if (LLVM_LIKELY(BucketItem == nullptr))<br>
+ if (LLVM_LIKELY(!BucketItem))<br>
return -1;<br>
<br>
if (BucketItem == getTombstoneVal()) {<br>
@@ -212,7 +212,7 @@ void StringMapImpl::RehashTable() {<br>
// Fast case, bucket available.<br>
unsigned FullHash = HashTable[I];<br>
unsigned NewBucket = FullHash & (NewSize-1);<br>
- if (NewTableArray[NewBucket] == nullptr) {<br>
+ if (!NewTableArray[NewBucket]) {<br>
NewTableArray[FullHash & (NewSize-1)] = Bucket;<br>
NewHashArray[FullHash & (NewSize-1)] = FullHash;<br>
continue;<br>
<br>
Modified: llvm/trunk/lib/Support/TargetRegistry.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TargetRegistry.cpp?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TargetRegistry.cpp?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/TargetRegistry.cpp (original)<br>
+++ llvm/trunk/lib/Support/TargetRegistry.cpp Tue Apr 8 23:20:00 2014<br>
@@ -53,7 +53,7 @@ const Target *TargetRegistry::lookupTarg<br>
// Get the target specific parser.<br>
std::string TempError;<br>
TheTarget = TargetRegistry::lookupTarget(TheTriple.getTriple(), TempError);<br>
- if (TheTarget == nullptr) {<br>
+ if (!TheTarget) {<br>
Error = ": error: unable to get target for '"<br>
+ TheTriple.getTriple()<br>
+ "', see --version and --triple.\n";<br>
<br>
Modified: llvm/trunk/lib/Support/Timer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Timer.cpp?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Timer.cpp?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/Timer.cpp (original)<br>
+++ llvm/trunk/lib/Support/Timer.cpp Tue Apr 8 23:20:00 2014<br>
@@ -264,7 +264,7 @@ TimerGroup::TimerGroup(StringRef name)<br>
TimerGroup::~TimerGroup() {<br>
// If the timer group is destroyed before the timers it owns, accumulate and<br>
// print the timing data.<br>
- while (FirstTimer != nullptr)<br>
+ while (FirstTimer)<br>
removeTimer(*FirstTimer);<br>
<br>
// Remove the group from the TimerGroupList.<br>
@@ -291,7 +291,7 @@ void TimerGroup::removeTimer(Timer &T) {<br>
<br>
// Print the report when all timers in this group are destroyed if some of<br>
// them were started.<br>
- if (FirstTimer != nullptr || TimersToPrint.empty())<br>
+ if (FirstTimer || TimersToPrint.empty())<br>
return;<br>
<br>
raw_ostream *OutStream = CreateInfoOutputFile();<br>
<br>
Modified: llvm/trunk/lib/Support/YAMLParser.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/YAMLParser.cpp?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/YAMLParser.cpp?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/YAMLParser.cpp (original)<br>
+++ llvm/trunk/lib/Support/YAMLParser.cpp Tue Apr 8 23:20:00 2014<br>
@@ -1941,7 +1941,7 @@ void SequenceNode::increment() {<br>
case Token::TK_BlockEntry:<br>
getNext();<br>
CurrentEntry = parseBlockNode();<br>
- if (CurrentEntry == nullptr) { // An error occurred.<br>
+ if (!CurrentEntry) { // An error occurred.<br>
IsAtEnd = true;<br>
CurrentEntry = nullptr;<br>
}<br>
@@ -1963,7 +1963,7 @@ void SequenceNode::increment() {<br>
case Token::TK_BlockEntry:<br>
getNext();<br>
CurrentEntry = parseBlockNode();<br>
- if (CurrentEntry == nullptr) { // An error occurred.<br>
+ if (!CurrentEntry) { // An error occurred.<br>
IsAtEnd = true;<br>
CurrentEntry = nullptr;<br>
}<br>
<br>
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp?rev=205829&r1=205828&r2=205829&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp?rev=205829&r1=205828&r2=205829&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp (original)<br>
+++ llvm/trunk/lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp Tue Apr 8 23:20:00 2014<br>
@@ -111,7 +111,7 @@ static bool IsEliminableAddrSpaceCast(Op<br>
bool NVPTXFavorNonGenericAddrSpaces::hoistAddrSpaceCastFromGEP(<br>
GEPOperator *GEP) {<br>
Operator *Cast = dyn_cast<Operator>(GEP->getPointerOperand());<br>
- if (Cast == nullptr)<br>
+ if (!Cast)<br>
return false;<br>
<br>
if (!IsEliminableAddrSpaceCast(Cast))<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>~Craig
</div>