[Mlir-commits] [mlir] 332a504 - Apply clang-tidy fixes for readability-container-size-empty in Target.cpp (NFC)

Mehdi Amini llvmlistbot at llvm.org
Thu Feb 15 16:03:26 PST 2024


Author: Mehdi Amini
Date: 2024-02-15T16:02:41-08:00
New Revision: 332a5049855a3bf3752288c2ba0e0a41f0c4fe39

URL: https://github.com/llvm/llvm-project/commit/332a5049855a3bf3752288c2ba0e0a41f0c4fe39
DIFF: https://github.com/llvm/llvm-project/commit/332a5049855a3bf3752288c2ba0e0a41f0c4fe39.diff

LOG: Apply clang-tidy fixes for readability-container-size-empty in Target.cpp (NFC)

Added: 
    

Modified: 
    mlir/lib/Target/LLVM/NVVM/Target.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Target/LLVM/NVVM/Target.cpp b/mlir/lib/Target/LLVM/NVVM/Target.cpp
index 68cd0e22d8e9e6..71b15a92782ed7 100644
--- a/mlir/lib/Target/LLVM/NVVM/Target.cpp
+++ b/mlir/lib/Target/LLVM/NVVM/Target.cpp
@@ -221,7 +221,7 @@ std::optional<std::string> NVPTXSerializer::findTool(StringRef tool) {
   // 1. Check the toolkit path given in the command line.
   StringRef pathRef = targetOptions.getToolkitPath();
   SmallVector<char, 256> path;
-  if (pathRef.size()) {
+  if (!pathRef.empty()) {
     path.insert(path.begin(), pathRef.begin(), pathRef.end());
     llvm::sys::path::append(path, "bin", tool);
     if (llvm::sys::fs::can_execute(path))
@@ -236,7 +236,7 @@ std::optional<std::string> NVPTXSerializer::findTool(StringRef tool) {
   // 3. Check `getCUDAToolkitPath()`.
   pathRef = getCUDAToolkitPath();
   path.clear();
-  if (pathRef.size()) {
+  if (!pathRef.empty()) {
     path.insert(path.begin(), pathRef.begin(), pathRef.end());
     llvm::sys::path::append(path, "bin", tool);
     if (llvm::sys::fs::can_execute(path))
@@ -411,7 +411,7 @@ NVPTXSerializer::compileToBinary(const std::string &ptxCode) {
   LLVM_DEBUG({
     llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> logBuffer =
         llvm::MemoryBuffer::getFile(logFile->first);
-    if (logBuffer && (*logBuffer)->getBuffer().size()) {
+    if (logBuffer && !(*logBuffer)->getBuffer().empty()) {
       llvm::dbgs() << "Output:\n" << (*logBuffer)->getBuffer() << "\n";
       llvm::dbgs().flush();
     }


        


More information about the Mlir-commits mailing list