Index: lld/trunk/lib/Driver/DarwinLdDriver.cpp =================================================================== --- lld/trunk/lib/Driver/DarwinLdDriver.cpp +++ lld/trunk/lib/Driver/DarwinLdDriver.cpp @@ -1068,7 +1068,7 @@ } // Parse the LLVM options before we process files in case the file handling - // makes use of things like DEBUG(). + // makes use of things like LLVM_DEBUG(). parseLLVMOptions(ctx); // Handle input files and sectcreate. Index: lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp +++ lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp @@ -282,7 +282,7 @@ private: llvm::Error perform(SimpleFile &mergedFile) override { - DEBUG(llvm::dbgs() << "MachO Compact Unwind pass\n"); + LLVM_DEBUG(llvm::dbgs() << "MachO Compact Unwind pass\n"); std::map unwindLocs; std::map dwarfFrames; @@ -319,7 +319,7 @@ // Finally, we can start creating pages based on these entries. - DEBUG(llvm::dbgs() << " Splitting entries into pages\n"); + LLVM_DEBUG(llvm::dbgs() << " Splitting entries into pages\n"); // FIXME: we split the entries into pages naively: lots of 4k pages followed // by a small one. ld64 tried to minimize space and align them to real 4k // boundaries. That might be worth doing, or perhaps we could perform some @@ -336,11 +336,13 @@ pages.back().entries = remainingInfos.slice(0, entriesInPage); remainingInfos = remainingInfos.slice(entriesInPage); - DEBUG(llvm::dbgs() - << " Page from " << pages.back().entries[0].rangeStart->name() - << " to " << pages.back().entries.back().rangeStart->name() << " + " - << llvm::format("0x%x", pages.back().entries.back().rangeLength) - << " has " << entriesInPage << " entries\n"); + LLVM_DEBUG(llvm::dbgs() + << " Page from " + << pages.back().entries[0].rangeStart->name() << " to " + << pages.back().entries.back().rangeStart->name() << " + " + << llvm::format("0x%x", + pages.back().entries.back().rangeLength) + << " has " << entriesInPage << " entries\n"); } while (!remainingInfos.empty()); auto *unwind = new (_file.allocator()) @@ -360,7 +362,7 @@ const SimpleFile &mergedFile, std::map &unwindLocs, std::vector &personalities, uint32_t &numLSDAs) { - DEBUG(llvm::dbgs() << " Collecting __compact_unwind entries\n"); + LLVM_DEBUG(llvm::dbgs() << " Collecting __compact_unwind entries\n"); for (const DefinedAtom *atom : mergedFile.defined()) { if (atom->contentType() != DefinedAtom::typeCompactUnwindInfo) @@ -369,14 +371,15 @@ auto unwindEntry = extractCompactUnwindEntry(atom); unwindLocs.insert(std::make_pair(unwindEntry.rangeStart, unwindEntry)); - DEBUG(llvm::dbgs() << " Entry for " << unwindEntry.rangeStart->name() - << ", encoding=" - << llvm::format("0x%08x", unwindEntry.encoding)); + LLVM_DEBUG(llvm::dbgs() << " Entry for " + << unwindEntry.rangeStart->name() << ", encoding=" + << llvm::format("0x%08x", unwindEntry.encoding)); if (unwindEntry.personalityFunction) - DEBUG(llvm::dbgs() << ", personality=" - << unwindEntry.personalityFunction->name() - << ", lsdaLoc=" << unwindEntry.lsdaLocation->name()); - DEBUG(llvm::dbgs() << '\n'); + LLVM_DEBUG(llvm::dbgs() + << ", personality=" + << unwindEntry.personalityFunction->name() + << ", lsdaLoc=" << unwindEntry.lsdaLocation->name()); + LLVM_DEBUG(llvm::dbgs() << '\n'); // Count number of LSDAs we see, since we need to know how big the index // will be while laying out the section. @@ -454,7 +457,7 @@ const std::map &dwarfFrames) { std::vector unwindInfos; - DEBUG(llvm::dbgs() << " Creating __unwind_info entries\n"); + LLVM_DEBUG(llvm::dbgs() << " Creating __unwind_info entries\n"); // The final order in the __unwind_info section must be derived from the // order of typeCode atoms, since that's how they'll be put into the object // file eventually (yuck!). @@ -465,10 +468,10 @@ unwindInfos.push_back(finalizeUnwindInfoEntryForAtom( atom, unwindLocs, personalities, dwarfFrames)); - DEBUG(llvm::dbgs() << " Entry for " << atom->name() - << ", final encoding=" - << llvm::format("0x%08x", unwindInfos.back().encoding) - << '\n'); + LLVM_DEBUG(llvm::dbgs() + << " Entry for " << atom->name() << ", final encoding=" + << llvm::format("0x%08x", unwindInfos.back().encoding) + << '\n'); } return unwindInfos; Index: lld/trunk/lib/ReaderWriter/MachO/LayoutPass.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/LayoutPass.cpp +++ lld/trunk/lib/ReaderWriter/MachO/LayoutPass.cpp @@ -191,7 +191,7 @@ // Sort atoms by their ordinal overrides only if they fall in the same // chain. if (leftRoot == rightRoot) { - DEBUG(reason = formatReason("override", lc._override, rc._override)); + LLVM_DEBUG(reason = formatReason("override", lc._override, rc._override)); return lc._override < rc._override; } @@ -200,8 +200,8 @@ DefinedAtom::ContentPermissions rightPerms = rightRoot->permissions(); if (leftPerms != rightPerms) { - DEBUG(reason = - formatReason("contentPerms", (int)leftPerms, (int)rightPerms)); + LLVM_DEBUG( + reason = formatReason("contentPerms", (int)leftPerms, (int)rightPerms)); return leftPerms < rightPerms; } @@ -210,7 +210,8 @@ DefinedAtom::ContentType rightType = rightRoot->contentType(); if (leftType != rightType) { - DEBUG(reason = formatReason("contentType", (int)leftType, (int)rightType)); + LLVM_DEBUG(reason = + formatReason("contentType", (int)leftType, (int)rightType)); return leftType < rightType; } @@ -226,8 +227,8 @@ const File *rightFile = &rightRoot->file(); if (leftFile != rightFile) { - DEBUG(reason = formatReason(".o order", (int)leftFile->ordinal(), - (int)rightFile->ordinal())); + LLVM_DEBUG(reason = formatReason(".o order", (int)leftFile->ordinal(), + (int)rightFile->ordinal())); return leftFile->ordinal() < rightFile->ordinal(); } @@ -236,8 +237,8 @@ uint64_t rightOrdinal = rightRoot->ordinal(); if (leftOrdinal != rightOrdinal) { - DEBUG(reason = formatReason("ordinal", (int)leftRoot->ordinal(), - (int)rightRoot->ordinal())); + LLVM_DEBUG(reason = formatReason("ordinal", (int)leftRoot->ordinal(), + (int)rightRoot->ordinal())); return leftOrdinal < rightOrdinal; } @@ -251,7 +252,7 @@ LayoutPass::SortOverride customSorter) { std::string reason; bool result = compareAtomsSub(lc, rc, customSorter, reason); - DEBUG({ + LLVM_DEBUG({ StringRef comp = result ? "<" : ">="; llvm::dbgs() << "Layout: '" << lc._atom.get()->name() << "' " << comp << " '" @@ -441,7 +442,7 @@ /// Perform the actual pass llvm::Error LayoutPass::perform(SimpleFile &mergedFile) { - DEBUG(llvm::dbgs() << "******** Laying out atoms:\n"); + LLVM_DEBUG(llvm::dbgs() << "******** Laying out atoms:\n"); // sort the atoms ScopedTask task(getDefaultDomain(), "LayoutPass"); File::AtomRange atomRange = mergedFile.defined(); @@ -450,12 +451,12 @@ buildFollowOnTable(atomRange); // Check the structure of followon graph if running in debug mode. - DEBUG(checkFollowonChain(atomRange)); + LLVM_DEBUG(checkFollowonChain(atomRange)); // Build override maps buildOrdinalOverrideMap(atomRange); - DEBUG({ + LLVM_DEBUG({ llvm::dbgs() << "unsorted atoms:\n"; printDefinedAtoms(atomRange); }); @@ -465,15 +466,15 @@ [&](const LayoutPass::SortKey &l, const LayoutPass::SortKey &r) -> bool { return compareAtoms(l, r, _customSorter); }); - DEBUG(checkTransitivity(vec, _customSorter)); + LLVM_DEBUG(checkTransitivity(vec, _customSorter)); undecorate(atomRange, vec); - DEBUG({ + LLVM_DEBUG({ llvm::dbgs() << "sorted atoms:\n"; printDefinedAtoms(atomRange); }); - DEBUG(llvm::dbgs() << "******** Finished laying out atoms\n"); + LLVM_DEBUG(llvm::dbgs() << "******** Finished laying out atoms\n"); return llvm::Error::success(); } Index: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp +++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp @@ -1431,8 +1431,8 @@ normalizedObjectToAtoms(MachOFile *file, const NormalizedFile &normalizedFile, bool copyRefs) { - DEBUG(llvm::dbgs() << "******** Normalizing file to atoms: " - << file->path() << "\n"); + LLVM_DEBUG(llvm::dbgs() << "******** Normalizing file to atoms: " + << file->path() << "\n"); bool scatterable = ((normalizedFile.flags & MH_SUBSECTIONS_VIA_SYMBOLS) != 0); // Create atoms from each section. Index: lld/trunk/wasm/InputChunks.cpp =================================================================== --- lld/trunk/wasm/InputChunks.cpp +++ lld/trunk/wasm/InputChunks.cpp @@ -103,16 +103,17 @@ verifyRelocTargets(); #endif - DEBUG(dbgs() << "applying relocations: " << getName() - << " count=" << Relocations.size() << "\n"); + LLVM_DEBUG(dbgs() << "applying relocations: " << getName() + << " count=" << Relocations.size() << "\n"); int32_t Off = OutputOffset - getInputSectionOffset(); for (const WasmRelocation &Rel : Relocations) { uint8_t *Loc = Buf + Rel.Offset + Off; uint32_t Value = File->calcNewValue(Rel); - DEBUG(dbgs() << "apply reloc: type=" << ReloctTypeToString(Rel.Type) - << " addend=" << Rel.Addend << " index=" << Rel.Index - << " value=" << Value << " offset=" << Rel.Offset << "\n"); + LLVM_DEBUG(dbgs() << "apply reloc: type=" << ReloctTypeToString(Rel.Type) + << " addend=" << Rel.Addend << " index=" << Rel.Index + << " value=" << Value << " offset=" << Rel.Offset + << "\n"); switch (Rel.Type) { case R_WEBASSEMBLY_TYPE_INDEX_LEB: @@ -145,8 +146,8 @@ return; int32_t Off = OutputOffset - getInputSectionOffset(); - DEBUG(dbgs() << "writeRelocations: " << File->getName() - << " offset=" << Twine(Off) << "\n"); + LLVM_DEBUG(dbgs() << "writeRelocations: " << File->getName() + << " offset=" << Twine(Off) << "\n"); for (const WasmRelocation &Rel : Relocations) { writeUleb128(OS, Rel.Type, "reloc type"); @@ -166,15 +167,15 @@ } void InputFunction::setFunctionIndex(uint32_t Index) { - DEBUG(dbgs() << "InputFunction::setFunctionIndex: " << getName() << " -> " - << Index << "\n"); + LLVM_DEBUG(dbgs() << "InputFunction::setFunctionIndex: " << getName() + << " -> " << Index << "\n"); assert(!hasFunctionIndex()); FunctionIndex = Index; } void InputFunction::setTableIndex(uint32_t Index) { - DEBUG(dbgs() << "InputFunction::setTableIndex: " << getName() << " -> " - << Index << "\n"); + LLVM_DEBUG(dbgs() << "InputFunction::setTableIndex: " << getName() << " -> " + << Index << "\n"); assert(!hasTableIndex()); TableIndex = Index; } Index: lld/trunk/wasm/InputFiles.cpp =================================================================== --- lld/trunk/wasm/InputFiles.cpp +++ lld/trunk/wasm/InputFiles.cpp @@ -159,7 +159,7 @@ void ObjFile::parse() { // Parse a memory buffer as a wasm file. - DEBUG(dbgs() << "Parsing object: " << toString(this) << "\n"); + LLVM_DEBUG(dbgs() << "Parsing object: " << toString(this) << "\n"); std::unique_ptr Bin = CHECK(createBinary(MB), toString(this)); auto *Obj = dyn_cast(Bin.get()); @@ -339,7 +339,7 @@ void ArchiveFile::parse() { // Parse a MemoryBufferRef as an archive file. - DEBUG(dbgs() << "Parsing library: " << toString(this) << "\n"); + LLVM_DEBUG(dbgs() << "Parsing library: " << toString(this) << "\n"); File = CHECK(Archive::create(MB), toString(this)); // Read the symbol table to construct Lazy symbols. @@ -348,7 +348,7 @@ Symtab->addLazy(this, &Sym); ++Count; } - DEBUG(dbgs() << "Read " << Count << " symbols\n"); + LLVM_DEBUG(dbgs() << "Read " << Count << " symbols\n"); } void ArchiveFile::addMember(const Archive::Symbol *Sym) { @@ -361,8 +361,8 @@ if (!Seen.insert(C.getChildOffset()).second) return; - DEBUG(dbgs() << "loading lazy: " << Sym->getName() << "\n"); - DEBUG(dbgs() << "from archive: " << toString(this) << "\n"); + LLVM_DEBUG(dbgs() << "loading lazy: " << Sym->getName() << "\n"); + LLVM_DEBUG(dbgs() << "from archive: " << toString(this) << "\n"); MemoryBufferRef MB = CHECK(C.getMemoryBufferRef(), Index: lld/trunk/wasm/MarkLive.cpp =================================================================== --- lld/trunk/wasm/MarkLive.cpp +++ lld/trunk/wasm/MarkLive.cpp @@ -37,7 +37,7 @@ if (!Config->GcSections) return; - DEBUG(dbgs() << "markLive\n"); + LLVM_DEBUG(dbgs() << "markLive\n"); SmallVector Q; auto Enqueue = [&](Symbol *Sym) { Index: lld/trunk/wasm/SymbolTable.cpp =================================================================== --- lld/trunk/wasm/SymbolTable.cpp +++ lld/trunk/wasm/SymbolTable.cpp @@ -118,7 +118,7 @@ DefinedFunction *SymbolTable::addSyntheticFunction(StringRef Name, uint32_t Flags, InputFunction *Function) { - DEBUG(dbgs() << "addSyntheticFunction: " << Name << "\n"); + LLVM_DEBUG(dbgs() << "addSyntheticFunction: " << Name << "\n"); assert(!find(Name)); SyntheticFunctions.emplace_back(Function); return replaceSymbol(insert(Name).first, Name, Flags, @@ -127,14 +127,15 @@ DefinedData *SymbolTable::addSyntheticDataSymbol(StringRef Name, uint32_t Flags) { - DEBUG(dbgs() << "addSyntheticDataSymbol: " << Name << "\n"); + LLVM_DEBUG(dbgs() << "addSyntheticDataSymbol: " << Name << "\n"); assert(!find(Name)); return replaceSymbol(insert(Name).first, Name, Flags); } DefinedGlobal *SymbolTable::addSyntheticGlobal(StringRef Name, uint32_t Flags, InputGlobal *Global) { - DEBUG(dbgs() << "addSyntheticGlobal: " << Name << " -> " << Global << "\n"); + LLVM_DEBUG(dbgs() << "addSyntheticGlobal: " << Name << " -> " << Global + << "\n"); assert(!find(Name)); SyntheticGlobals.emplace_back(Global); return replaceSymbol(insert(Name).first, Name, Flags, nullptr, @@ -145,20 +146,20 @@ uint32_t NewFlags) { // If existing symbol is undefined, replace it. if (!Existing->isDefined()) { - DEBUG(dbgs() << "resolving existing undefined symbol: " - << Existing->getName() << "\n"); + LLVM_DEBUG(dbgs() << "resolving existing undefined symbol: " + << Existing->getName() << "\n"); return true; } // Now we have two defined symbols. If the new one is weak, we can ignore it. if ((NewFlags & WASM_SYMBOL_BINDING_MASK) == WASM_SYMBOL_BINDING_WEAK) { - DEBUG(dbgs() << "existing symbol takes precedence\n"); + LLVM_DEBUG(dbgs() << "existing symbol takes precedence\n"); return false; } // If the existing symbol is weak, we should replace it. if (Existing->isWeak()) { - DEBUG(dbgs() << "replacing existing weak symbol\n"); + LLVM_DEBUG(dbgs() << "replacing existing weak symbol\n"); return true; } @@ -172,7 +173,7 @@ Symbol *SymbolTable::addDefinedFunction(StringRef Name, uint32_t Flags, InputFile *File, InputFunction *Function) { - DEBUG(dbgs() << "addDefinedFunction: " << Name << "\n"); + LLVM_DEBUG(dbgs() << "addDefinedFunction: " << Name << "\n"); Symbol *S; bool WasInserted; std::tie(S, WasInserted) = insert(Name); @@ -192,7 +193,8 @@ Symbol *SymbolTable::addDefinedData(StringRef Name, uint32_t Flags, InputFile *File, InputSegment *Segment, uint32_t Address, uint32_t Size) { - DEBUG(dbgs() << "addDefinedData:" << Name << " addr:" << Address << "\n"); + LLVM_DEBUG(dbgs() << "addDefinedData:" << Name << " addr:" << Address + << "\n"); Symbol *S; bool WasInserted; std::tie(S, WasInserted) = insert(Name); @@ -211,7 +213,7 @@ Symbol *SymbolTable::addDefinedGlobal(StringRef Name, uint32_t Flags, InputFile *File, InputGlobal *Global) { - DEBUG(dbgs() << "addDefinedGlobal:" << Name << "\n"); + LLVM_DEBUG(dbgs() << "addDefinedGlobal:" << Name << "\n"); Symbol *S; bool WasInserted; std::tie(S, WasInserted) = insert(Name); @@ -231,7 +233,7 @@ Symbol *SymbolTable::addUndefinedFunction(StringRef Name, uint32_t Flags, InputFile *File, const WasmSignature *Sig) { - DEBUG(dbgs() << "addUndefinedFunction: " << Name << "\n"); + LLVM_DEBUG(dbgs() << "addUndefinedFunction: " << Name << "\n"); Symbol *S; bool WasInserted; @@ -248,7 +250,7 @@ Symbol *SymbolTable::addUndefinedData(StringRef Name, uint32_t Flags, InputFile *File) { - DEBUG(dbgs() << "addUndefinedData: " << Name << "\n"); + LLVM_DEBUG(dbgs() << "addUndefinedData: " << Name << "\n"); Symbol *S; bool WasInserted; @@ -266,7 +268,7 @@ Symbol *SymbolTable::addUndefinedGlobal(StringRef Name, uint32_t Flags, InputFile *File, const WasmGlobalType *Type) { - DEBUG(dbgs() << "addUndefinedGlobal: " << Name << "\n"); + LLVM_DEBUG(dbgs() << "addUndefinedGlobal: " << Name << "\n"); Symbol *S; bool WasInserted; @@ -282,7 +284,7 @@ } void SymbolTable::addLazy(ArchiveFile *File, const Archive::Symbol *Sym) { - DEBUG(dbgs() << "addLazy: " << Sym->getName() << "\n"); + LLVM_DEBUG(dbgs() << "addLazy: " << Sym->getName() << "\n"); StringRef Name = Sym->getName(); Symbol *S; @@ -296,7 +298,7 @@ // If there is an existing undefined symbol, load a new one from the archive. if (S->isUndefined()) { - DEBUG(dbgs() << "replacing existing undefined\n"); + LLVM_DEBUG(dbgs() << "replacing existing undefined\n"); File->addMember(Sym); } } Index: lld/trunk/wasm/Symbols.cpp =================================================================== --- lld/trunk/wasm/Symbols.cpp +++ lld/trunk/wasm/Symbols.cpp @@ -71,7 +71,8 @@ } void Symbol::setOutputSymbolIndex(uint32_t Index) { - DEBUG(dbgs() << "setOutputSymbolIndex " << Name << " -> " << Index << "\n"); + LLVM_DEBUG(dbgs() << "setOutputSymbolIndex " << Name << " -> " << Index + << "\n"); assert(OutputSymbolIndex == INVALID_INDEX); OutputSymbolIndex = Index; } @@ -89,7 +90,7 @@ } void Symbol::setHidden(bool IsHidden) { - DEBUG(dbgs() << "setHidden: " << Name << " -> " << IsHidden << "\n"); + LLVM_DEBUG(dbgs() << "setHidden: " << Name << " -> " << IsHidden << "\n"); Flags &= ~WASM_SYMBOL_VISIBILITY_MASK; if (IsHidden) Flags |= WASM_SYMBOL_VISIBILITY_HIDDEN; @@ -105,7 +106,7 @@ } void FunctionSymbol::setFunctionIndex(uint32_t Index) { - DEBUG(dbgs() << "setFunctionIndex " << Name << " -> " << Index << "\n"); + LLVM_DEBUG(dbgs() << "setFunctionIndex " << Name << " -> " << Index << "\n"); assert(FunctionIndex == INVALID_INDEX); FunctionIndex = Index; } @@ -137,7 +138,7 @@ F->Function->setTableIndex(Index); return; } - DEBUG(dbgs() << "setTableIndex " << Name << " -> " << Index << "\n"); + LLVM_DEBUG(dbgs() << "setTableIndex " << Name << " -> " << Index << "\n"); assert(TableIndex == INVALID_INDEX); TableIndex = Index; } @@ -149,25 +150,25 @@ Function(Function) {} uint32_t DefinedData::getVirtualAddress() const { - DEBUG(dbgs() << "getVirtualAddress: " << getName() << "\n"); + LLVM_DEBUG(dbgs() << "getVirtualAddress: " << getName() << "\n"); if (Segment) return Segment->OutputSeg->StartVA + Segment->OutputSegmentOffset + Offset; return Offset; } void DefinedData::setVirtualAddress(uint32_t Value) { - DEBUG(dbgs() << "setVirtualAddress " << Name << " -> " << Value << "\n"); + LLVM_DEBUG(dbgs() << "setVirtualAddress " << Name << " -> " << Value << "\n"); assert(!Segment); Offset = Value; } uint32_t DefinedData::getOutputSegmentOffset() const { - DEBUG(dbgs() << "getOutputSegmentOffset: " << getName() << "\n"); + LLVM_DEBUG(dbgs() << "getOutputSegmentOffset: " << getName() << "\n"); return Segment->OutputSegmentOffset + Offset; } uint32_t DefinedData::getOutputSegmentIndex() const { - DEBUG(dbgs() << "getOutputSegmentIndex: " << getName() << "\n"); + LLVM_DEBUG(dbgs() << "getOutputSegmentIndex: " << getName() << "\n"); return Segment->OutputSeg->Index; } @@ -179,7 +180,7 @@ } void GlobalSymbol::setGlobalIndex(uint32_t Index) { - DEBUG(dbgs() << "setGlobalIndex " << Name << " -> " << Index << "\n"); + LLVM_DEBUG(dbgs() << "setGlobalIndex " << Name << " -> " << Index << "\n"); assert(GlobalIndex == INVALID_INDEX); GlobalIndex = Index; } @@ -197,14 +198,14 @@ Global(Global) {} uint32_t SectionSymbol::getOutputSectionIndex() const { - DEBUG(dbgs() << "getOutputSectionIndex: " << getName() << "\n"); + LLVM_DEBUG(dbgs() << "getOutputSectionIndex: " << getName() << "\n"); assert(OutputSectionIndex != INVALID_INDEX); return OutputSectionIndex; } void SectionSymbol::setOutputSectionIndex(uint32_t Index) { - DEBUG(dbgs() << "setOutputSectionIndex: " << getName() << " -> " << Index - << "\n"); + LLVM_DEBUG(dbgs() << "setOutputSectionIndex: " << getName() << " -> " << Index + << "\n"); assert(Index != INVALID_INDEX); OutputSectionIndex = Index; } Index: lld/trunk/wasm/Writer.cpp =================================================================== --- lld/trunk/wasm/Writer.cpp +++ lld/trunk/wasm/Writer.cpp @@ -304,7 +304,7 @@ P->second->setOutputSectionIndex(SectionIndex); } - DEBUG(dbgs() << "createCustomSection: " << Name << "\n"); + LLVM_DEBUG(dbgs() << "createCustomSection: " << Name << "\n"); OutputSections.push_back(make(Name, Pair.second)); } } @@ -716,7 +716,7 @@ if (!Sym->isLive()) continue; - DEBUG(dbgs() << "import: " << Sym->getName() << "\n"); + LLVM_DEBUG(dbgs() << "import: " << Sym->getName() << "\n"); ImportedSymbols.emplace_back(Sym); if (auto *F = dyn_cast(Sym)) F->setFunctionIndex(NumImportedFunctions++); @@ -757,7 +757,7 @@ Export = {Name, WASM_EXTERNAL_GLOBAL, FakeGlobalIndex++}; } - DEBUG(dbgs() << "Export: " << Name << "\n"); + LLVM_DEBUG(dbgs() << "Export: " << Name << "\n"); Exports.push_back(Export); } } @@ -770,7 +770,7 @@ unsigned SymbolIndex = SymtabEntries.size(); for (ObjFile *File : Symtab->ObjectFiles) { - DEBUG(dbgs() << "Symtab entries: " << File->getName() << "\n"); + LLVM_DEBUG(dbgs() << "Symtab entries: " << File->getName() << "\n"); for (Symbol *Sym : File->getSymbols()) { if (Sym->getFile() != File) continue; @@ -817,7 +817,7 @@ uint32_t Writer::registerType(const WasmSignature &Sig) { auto Pair = TypeIndices.insert(std::make_pair(Sig, Types.size())); if (Pair.second) { - DEBUG(dbgs() << "type " << toString(Sig) << "\n"); + LLVM_DEBUG(dbgs() << "type " << toString(Sig) << "\n"); Types.push_back(&Sig); } return Pair.first->second; @@ -857,7 +857,7 @@ AddDefinedFunction(Func); for (ObjFile *File : Symtab->ObjectFiles) { - DEBUG(dbgs() << "Functions: " << File->getName() << "\n"); + LLVM_DEBUG(dbgs() << "Functions: " << File->getName() << "\n"); for (InputFunction *Func : File->Functions) AddDefinedFunction(Func); } @@ -885,7 +885,7 @@ }; for (ObjFile *File : Symtab->ObjectFiles) { - DEBUG(dbgs() << "Handle relocs: " << File->getName() << "\n"); + LLVM_DEBUG(dbgs() << "Handle relocs: " << File->getName() << "\n"); for (InputChunk *Chunk : File->Functions) HandleRelocs(Chunk); for (InputChunk *Chunk : File->Segments) @@ -897,7 +897,7 @@ uint32_t GlobalIndex = NumImportedGlobals + InputGlobals.size(); auto AddDefinedGlobal = [&](InputGlobal *Global) { if (Global->Live) { - DEBUG(dbgs() << "AddDefinedGlobal: " << GlobalIndex << "\n"); + LLVM_DEBUG(dbgs() << "AddDefinedGlobal: " << GlobalIndex << "\n"); Global->setGlobalIndex(GlobalIndex++); InputGlobals.push_back(Global); } @@ -907,7 +907,7 @@ AddDefinedGlobal(Global); for (ObjFile *File : Symtab->ObjectFiles) { - DEBUG(dbgs() << "Globals: " << File->getName() << "\n"); + LLVM_DEBUG(dbgs() << "Globals: " << File->getName() << "\n"); for (InputGlobal *Global : File->Globals) AddDefinedGlobal(Global); } @@ -933,12 +933,12 @@ StringRef Name = getOutputDataSegmentName(Segment->getName()); OutputSegment *&S = SegmentMap[Name]; if (S == nullptr) { - DEBUG(dbgs() << "new segment: " << Name << "\n"); + LLVM_DEBUG(dbgs() << "new segment: " << Name << "\n"); S = make(Name, Segments.size()); Segments.push_back(S); } S->addInputSegment(Segment); - DEBUG(dbgs() << "added data: " << Name << ": " << S->Size << "\n"); + LLVM_DEBUG(dbgs() << "added data: " << Name << ": " << S->Size << "\n"); } } } Index: lld/trunk/wasm/WriterUtils.cpp =================================================================== --- lld/trunk/wasm/WriterUtils.cpp +++ lld/trunk/wasm/WriterUtils.cpp @@ -37,7 +37,7 @@ namespace lld { void wasm::debugWrite(uint64_t Offset, const Twine &Msg) { - DEBUG(dbgs() << format(" | %08lld: ", Offset) << Msg << "\n"); + LLVM_DEBUG(dbgs() << format(" | %08lld: ", Offset) << Msg << "\n"); } void wasm::writeUleb128(raw_ostream &OS, uint32_t Number, const Twine &Msg) {