Index: tools/lld/COFF/ModuleDef.cpp =================================================================== --- tools/lld/COFF/ModuleDef.cpp +++ tools/lld/COFF/ModuleDef.cpp @@ -234,7 +234,7 @@ read(); if (Tok.K != Comma) { unget(); - Commit = 0; + Commit = nullptr; return; } readAsInt(Commit); Index: tools/lld/lib/Driver/Driver.cpp =================================================================== --- tools/lld/lib/Driver/Driver.cpp +++ tools/lld/lib/Driver/Driver.cpp @@ -73,7 +73,7 @@ args[0] = "lld (LLVM option parsing)"; for (unsigned i = 0; i != numArgs; ++i) args[i + 1] = ctx.llvmOptions()[i]; - args[numArgs + 1] = 0; + args[numArgs + 1] = nullptr; llvm::cl::ParseCommandLineOptions(numArgs + 1, args); } if (ctx.getNodes().empty()) @@ -136,4 +136,4 @@ return true; } -} // namespace +} // anonymous namespace Index: tools/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp =================================================================== --- tools/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp +++ tools/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp @@ -235,7 +235,7 @@ const char *cstr = nullTermSym.data(); int status; char *demangled = abi::__cxa_demangle(cstr, nullptr, nullptr, &status); - if (demangled == NULL) + if (!demangled) return symbolName; std::string result(demangled); // __cxa_demangle() always uses a malloc'ed buffer to return the result. Index: tools/lld/lib/ReaderWriter/MachO/LayoutPass.cpp =================================================================== --- tools/lld/lib/ReaderWriter/MachO/LayoutPass.cpp +++ tools/lld/lib/ReaderWriter/MachO/LayoutPass.cpp @@ -407,7 +407,7 @@ AtomToAtomT::iterator start = _followOnRoots.find(atom); if (start == _followOnRoots.end()) continue; - for (const DefinedAtom *nextAtom = start->second; nextAtom != NULL; + for (const DefinedAtom *nextAtom = start->second; nextAtom; nextAtom = _followOnNexts[nextAtom]) { AtomToOrdinalT::iterator pos = _ordinalOverrideMap.find(nextAtom); if (pos == _ordinalOverrideMap.end()) Index: tools/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp =================================================================== --- tools/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp +++ tools/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp @@ -74,7 +74,6 @@ return false; } - MachOLinkingContext::ArchInfo MachOLinkingContext::_s_archInfos[] = { { "x86_64", arch_x86_64, true, CPU_TYPE_X86_64, CPU_SUBTYPE_X86_64_ALL }, { "i386", arch_x86, true, CPU_TYPE_I386, CPU_SUBTYPE_X86_ALL }, @@ -273,8 +272,6 @@ llvm_unreachable("Unknown arch type"); } - - bool MachOLinkingContext::is64Bit() const { return is64Bit(_arch); } @@ -357,9 +354,6 @@ return archHandler().stubInfo().binderSymbolName; } - - - bool MachOLinkingContext::minOS(StringRef mac, StringRef iOS) const { uint32_t parsedVersion; switch (_os) { @@ -489,7 +483,6 @@ _frameworkDirs.push_back(fwPath); } - ErrorOr MachOLinkingContext::searchDirForLibrary(StringRef path, StringRef libName) const { @@ -518,8 +511,6 @@ return make_error_code(llvm::errc::no_such_file_or_directory); } - - ErrorOr MachOLinkingContext::searchLibrary(StringRef libName) const { SmallString<256> path; for (StringRef dir : searchDirs()) { @@ -531,7 +522,6 @@ return make_error_code(llvm::errc::no_such_file_or_directory); } - ErrorOr MachOLinkingContext::findPathForFramework(StringRef fwName) const{ SmallString<256> fullPath; for (StringRef dir : frameworkDirs()) { @@ -653,7 +643,6 @@ return result; } - MachODylibFile* MachOLinkingContext::findIndirectDylib(StringRef path) { // See if already loaded. auto pos = _pathToDylibMap.find(path); @@ -728,7 +717,6 @@ } } - void MachOLinkingContext::registerDylib(MachODylibFile *dylib, bool upward) const { std::lock_guard lock(_dylibsMutex); @@ -741,7 +729,6 @@ _upwardDylibs.insert(dylib); } - bool MachOLinkingContext::isUpwardDylib(StringRef installName) const { for (MachODylibFile *dylib : _upwardDylibs) { if (dylib->installName().equals(installName)) @@ -756,7 +743,6 @@ return *_archHandler; } - void MachOLinkingContext::addSectionAlignment(StringRef seg, StringRef sect, uint16_t align) { SectionAlign entry = { seg, sect, align }; @@ -774,7 +760,6 @@ return false; } - void MachOLinkingContext::addExportSymbol(StringRef sym) { // Support old crufty export lists with bogus entries. if (sym.endswith(".eh") || sym.startswith(".objc_category_name_")) { @@ -829,7 +814,7 @@ const char *cstr = nullTermSym.data() + 1; int status; char *demangled = abi::__cxa_demangle(cstr, nullptr, nullptr, &status); - if (demangled != NULL) { + if (demangled) { std::string result(demangled); // __cxa_demangle() always uses a malloc'ed buffer to return the result. free(demangled);