Skip to content

Commit 332a504

Browse files
committed
Apply clang-tidy fixes for readability-container-size-empty in Target.cpp (NFC)
1 parent 867678d commit 332a504

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ std::optional<std::string> NVPTXSerializer::findTool(StringRef tool) {
221221
// 1. Check the toolkit path given in the command line.
222222
StringRef pathRef = targetOptions.getToolkitPath();
223223
SmallVector<char, 256> path;
224-
if (pathRef.size()) {
224+
if (!pathRef.empty()) {
225225
path.insert(path.begin(), pathRef.begin(), pathRef.end());
226226
llvm::sys::path::append(path, "bin", tool);
227227
if (llvm::sys::fs::can_execute(path))
@@ -236,7 +236,7 @@ std::optional<std::string> NVPTXSerializer::findTool(StringRef tool) {
236236
// 3. Check `getCUDAToolkitPath()`.
237237
pathRef = getCUDAToolkitPath();
238238
path.clear();
239-
if (pathRef.size()) {
239+
if (!pathRef.empty()) {
240240
path.insert(path.begin(), pathRef.begin(), pathRef.end());
241241
llvm::sys::path::append(path, "bin", tool);
242242
if (llvm::sys::fs::can_execute(path))
@@ -411,7 +411,7 @@ NVPTXSerializer::compileToBinary(const std::string &ptxCode) {
411411
LLVM_DEBUG({
412412
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> logBuffer =
413413
llvm::MemoryBuffer::getFile(logFile->first);
414-
if (logBuffer && (*logBuffer)->getBuffer().size()) {
414+
if (logBuffer && !(*logBuffer)->getBuffer().empty()) {
415415
llvm::dbgs() << "Output:\n" << (*logBuffer)->getBuffer() << "\n";
416416
llvm::dbgs().flush();
417417
}

0 commit comments

Comments
 (0)