[llvm] r301807 - Remove unnecessary conditions as suggested by clang-tidy. NFC

Gabor Horvath via llvm-commits llvm-commits at lists.llvm.org
Mon May 1 09:18:42 PDT 2017


Author: xazax
Date: Mon May  1 11:18:42 2017
New Revision: 301807

URL: http://llvm.org/viewvc/llvm-project?rev=301807&view=rev
Log:
Remove unnecessary conditions as suggested by clang-tidy. NFC

Patch by: Gergely Angeli!

Differential Revision: https://reviews.llvm.org/D31936

Modified:
    llvm/trunk/lib/CodeGen/DFAPacketizer.cpp
    llvm/trunk/lib/Support/SourceMgr.cpp
    llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp

Modified: llvm/trunk/lib/CodeGen/DFAPacketizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DFAPacketizer.cpp?rev=301807&r1=301806&r2=301807&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/DFAPacketizer.cpp (original)
+++ llvm/trunk/lib/CodeGen/DFAPacketizer.cpp Mon May  1 11:18:42 2017
@@ -213,10 +213,8 @@ VLIWPacketizerList::VLIWPacketizerList(M
 
 
 VLIWPacketizerList::~VLIWPacketizerList() {
-  if (VLIWScheduler)
-    delete VLIWScheduler;
-  if (ResourceTracker)
-    delete ResourceTracker;
+  delete VLIWScheduler;
+  delete ResourceTracker;
 }
 
 

Modified: llvm/trunk/lib/Support/SourceMgr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SourceMgr.cpp?rev=301807&r1=301806&r2=301807&view=diff
==============================================================================
--- llvm/trunk/lib/Support/SourceMgr.cpp (original)
+++ llvm/trunk/lib/Support/SourceMgr.cpp Mon May  1 11:18:42 2017
@@ -51,9 +51,7 @@ static LineNoCacheTy *getCache(void *Ptr
 }
 
 SourceMgr::~SourceMgr() {
-  // Delete the line # cache if allocated.
-  if (LineNoCacheTy *Cache = getCache(LineNoCache))
-    delete Cache;
+  delete getCache(LineNoCache);
 }
 
 unsigned SourceMgr::AddIncludeFile(const std::string &Filename,

Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=301807&r1=301806&r2=301807&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Mon May  1 11:18:42 2017
@@ -44,7 +44,7 @@ void TargetLoweringObjectFile::Initializ
                                           const TargetMachine &TM) {
   Ctx = &ctx;
   // `Initialize` can be called more than once.
-  if (Mang != nullptr) delete Mang;
+  delete Mang;
   Mang = new Mangler();
   InitMCObjectFileInfo(TM.getTargetTriple(), TM.isPositionIndependent(),
                        TM.getCodeModel(), *Ctx);




More information about the llvm-commits mailing list