diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp index 79808d67bf09..e95a7350921f 100644 --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -613,7 +613,7 @@ bool macho::link(llvm::ArrayRef argsArr, bool canExitEarly, break; case OPT_weak_library: { auto *dylibFile = dyn_cast_or_null(addFile(arg->getValue())); - if (dylibFile != nullptr) + if (dylibFile) dylibFile->forceWeakImport = true; break; } @@ -628,7 +628,7 @@ bool macho::link(llvm::ArrayRef argsArr, bool canExitEarly, StringRef name = arg->getValue(); if (Optional path = findLibrary(name)) { auto *dylibFile = dyn_cast_or_null(addFile(*path)); - if (opt.getID() == OPT_weak_l && dylibFile != nullptr) + if (opt.getID() == OPT_weak_l && dylibFile) dylibFile->forceWeakImport = true; break; } @@ -640,7 +640,7 @@ bool macho::link(llvm::ArrayRef argsArr, bool canExitEarly, StringRef name = arg->getValue(); if (Optional path = findFramework(name)) { auto *dylibFile = dyn_cast_or_null(addFile(*path)); - if (opt.getID() == OPT_weak_framework && dylibFile != nullptr) + if (opt.getID() == OPT_weak_framework && dylibFile) dylibFile->forceWeakImport = true; break; } diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp index 8516e90cffc3..ad2d6a25849a 100644 --- a/lld/MachO/InputFiles.cpp +++ b/lld/MachO/InputFiles.cpp @@ -387,7 +387,7 @@ static Optional loadReexport(StringRef path, DylibFile *umbrella) { // TODO: Expand @loader_path, @executable_path etc - if (currentTopLevelTapi != nullptr) { + if (currentTopLevelTapi) { for (InterfaceFile &child : make_pointee_range(currentTopLevelTapi->documents())) { if (path == child.getInstallName()) diff --git a/lld/MachO/OutputSegment.cpp b/lld/MachO/OutputSegment.cpp index 5e57c49f5c0a..07e45901581b 100644 --- a/lld/MachO/OutputSegment.cpp +++ b/lld/MachO/OutputSegment.cpp @@ -54,7 +54,7 @@ std::vector macho::outputSegments; OutputSegment *macho::getOrCreateOutputSegment(StringRef name) { OutputSegment *&segRef = nameToOutputSegment[name]; - if (segRef != nullptr) + if (segRef) return segRef; segRef = make();