Index: clang-move/ClangMove.cpp =================================================================== --- clang-move/ClangMove.cpp +++ clang-move/ClangMove.cpp @@ -676,8 +676,8 @@ Result.Nodes.getNodeAs("helper_decls")) { MovedDecls.push_back(ND); HelperDeclarations.push_back(ND); - DEBUG(llvm::dbgs() << "Add helper : " - << ND->getNameAsString() << " (" << ND << ")\n"); + LLVM_DEBUG(llvm::dbgs() << "Add helper : " << ND->getNameAsString() << " (" + << ND << ")\n"); } else if (const auto *UD = Result.Nodes.getNodeAs("using_decl")) { MovedDecls.push_back(UD); @@ -737,12 +737,12 @@ // We remove the helper declarations which are not used in the old.cc after // moving the given declarations. for (const auto *D : HelperDeclarations) { - DEBUG(llvm::dbgs() << "Check helper is used: " - << D->getNameAsString() << " (" << D << ")\n"); + LLVM_DEBUG(llvm::dbgs() << "Check helper is used: " + << D->getNameAsString() << " (" << D << ")\n"); if (!UsedDecls.count(HelperDeclRGBuilder::getOutmostClassOrFunDecl( D->getCanonicalDecl()))) { - DEBUG(llvm::dbgs() << "Helper removed in old.cc: " - << D->getNameAsString() << " (" << D << ")\n"); + LLVM_DEBUG(llvm::dbgs() << "Helper removed in old.cc: " + << D->getNameAsString() << " (" << D << ")\n"); RemovedDecls.push_back(D); } } @@ -822,8 +822,8 @@ D->getCanonicalDecl()))) continue; - DEBUG(llvm::dbgs() << "Helper used in new.cc: " << D->getNameAsString() - << " " << D << "\n"); + LLVM_DEBUG(llvm::dbgs() << "Helper used in new.cc: " << D->getNameAsString() + << " " << D << "\n"); ActualNewCCDecls.push_back(D); } @@ -933,7 +933,7 @@ moveAll(SM, Context->Spec.OldCC, Context->Spec.NewCC); return; } - DEBUG(RGBuilder.getGraph()->dump()); + LLVM_DEBUG(RGBuilder.getGraph()->dump()); moveDeclsToNewFiles(); removeDeclsInOldFiles(); } Index: clang-move/HelperDeclRefGraph.cpp =================================================================== --- clang-move/HelperDeclRefGraph.cpp +++ clang-move/HelperDeclRefGraph.cpp @@ -116,9 +116,9 @@ if (const auto *FuncRef = Result.Nodes.getNodeAs("func_ref")) { const auto *DC = Result.Nodes.getNodeAs("dc"); assert(DC); - DEBUG(llvm::dbgs() << "Find helper function usage: " - << FuncRef->getDecl()->getNameAsString() << " (" - << FuncRef->getDecl() << ")\n"); + LLVM_DEBUG(llvm::dbgs() << "Find helper function usage: " + << FuncRef->getDecl()->getNameAsString() << " (" + << FuncRef->getDecl() << ")\n"); RG->addEdge( getOutmostClassOrFunDecl(DC->getCanonicalDecl()), getOutmostClassOrFunDecl(FuncRef->getDecl()->getCanonicalDecl())); @@ -126,9 +126,9 @@ Result.Nodes.getNodeAs("used_class")) { const auto *DC = Result.Nodes.getNodeAs("dc"); assert(DC); - DEBUG(llvm::dbgs() << "Find helper class usage: " - << UsedClass->getNameAsString() << " (" << UsedClass - << ")\n"); + LLVM_DEBUG(llvm::dbgs() + << "Find helper class usage: " << UsedClass->getNameAsString() + << " (" << UsedClass << ")\n"); RG->addEdge(getOutmostClassOrFunDecl(DC->getCanonicalDecl()), UsedClass); } } Index: clang-tidy/ClangTidyOptions.cpp =================================================================== --- clang-tidy/ClangTidyOptions.cpp +++ clang-tidy/ClangTidyOptions.cpp @@ -223,7 +223,8 @@ // similar. std::vector FileOptionsProvider::getRawOptions(StringRef FileName) { - DEBUG(llvm::dbgs() << "Getting options for file " << FileName << "...\n"); + LLVM_DEBUG(llvm::dbgs() << "Getting options for file " << FileName + << "...\n"); std::vector RawOptions = DefaultOptionsProvider::getRawOptions(FileName); @@ -246,8 +247,8 @@ if (Result) { // Store cached value for all intermediate directories. while (Path != CurrentPath) { - DEBUG(llvm::dbgs() << "Caching configuration for path " << Path - << ".\n"); + LLVM_DEBUG(llvm::dbgs() << "Caching configuration for path " << Path + << ".\n"); CachedOptions[Path] = *Result; Path = llvm::sys::path::parent_path(Path); } @@ -274,7 +275,7 @@ for (const ConfigFileHandler &ConfigHandler : ConfigHandlers) { SmallString<128> ConfigFile(Directory); llvm::sys::path::append(ConfigFile, ConfigHandler.first); - DEBUG(llvm::dbgs() << "Trying " << ConfigFile << "...\n"); + LLVM_DEBUG(llvm::dbgs() << "Trying " << ConfigFile << "...\n"); bool IsFile = false; // Ignore errors from is_regular_file: we only need to know if we can read Index: clang-tidy/readability/IdentifierNamingCheck.cpp =================================================================== --- clang-tidy/readability/IdentifierNamingCheck.cpp +++ clang-tidy/readability/IdentifierNamingCheck.cpp @@ -836,10 +836,10 @@ std::string Fixup = fixupWithStyle(Name, Style); if (StringRef(Fixup).equals(Name)) { if (!IgnoreFailedSplit) { - DEBUG(llvm::dbgs() - << Decl->getLocStart().printToString(*Result.SourceManager) - << llvm::format(": unable to split words for %s '%s'\n", - KindName.c_str(), Name.str().c_str())); + LLVM_DEBUG(llvm::dbgs() + << Decl->getLocStart().printToString(*Result.SourceManager) + << llvm::format(": unable to split words for %s '%s'\n", + KindName.c_str(), Name.str().c_str())); } } else { NamingCheckFailure &Failure = NamingCheckFailures[NamingCheckId( @@ -873,10 +873,10 @@ std::string Fixup = fixupWithStyle(Name, Style); if (StringRef(Fixup).equals(Name)) { if (!IgnoreFailedSplit) { - DEBUG( - llvm::dbgs() << MacroNameTok.getLocation().printToString(SourceMgr) - << llvm::format(": unable to split words for %s '%s'\n", - KindName.c_str(), Name.str().c_str())); + LLVM_DEBUG(llvm::dbgs() + << MacroNameTok.getLocation().printToString(SourceMgr) + << llvm::format(": unable to split words for %s '%s'\n", + KindName.c_str(), Name.str().c_str())); } } else { NamingCheckId ID(MI->getDefinitionLoc(), Name); Index: include-fixer/IncludeFixer.cpp =================================================================== --- include-fixer/IncludeFixer.cpp +++ include-fixer/IncludeFixer.cpp @@ -156,7 +156,8 @@ clang::ASTContext &context = CI->getASTContext(); std::string QueryString = QualType(T->getUnqualifiedDesugaredType(), 0) .getAsString(context.getPrintingPolicy()); - DEBUG(llvm::dbgs() << "Query missing complete type '" << QueryString << "'"); + LLVM_DEBUG(llvm::dbgs() << "Query missing complete type '" << QueryString + << "'"); // Pass an empty range here since we don't add qualifier in this case. std::vector MatchedSymbols = query(QueryString, "", tooling::Range()); @@ -276,7 +277,8 @@ SymbolRange = CreateToolingRange(Typo.getLoc()); } - DEBUG(llvm::dbgs() << "TypoScopeQualifiers: " << TypoScopeString << "\n"); + LLVM_DEBUG(llvm::dbgs() << "TypoScopeQualifiers: " << TypoScopeString + << "\n"); std::vector MatchedSymbols = query(QueryString, TypoScopeString, SymbolRange); @@ -357,12 +359,12 @@ return {}; } - DEBUG(llvm::dbgs() << "Looking up '" << Query << "' at "); - DEBUG(CI->getSourceManager() - .getLocForStartOfFile(CI->getSourceManager().getMainFileID()) - .getLocWithOffset(Range.getOffset()) - .print(llvm::dbgs(), CI->getSourceManager())); - DEBUG(llvm::dbgs() << " ..."); + LLVM_DEBUG(llvm::dbgs() << "Looking up '" << Query << "' at "); + LLVM_DEBUG(CI->getSourceManager() + .getLocForStartOfFile(CI->getSourceManager().getMainFileID()) + .getLocWithOffset(Range.getOffset()) + .print(llvm::dbgs(), CI->getSourceManager())); + LLVM_DEBUG(llvm::dbgs() << " ..."); llvm::StringRef FileName = CI->getSourceManager().getFilename( CI->getSourceManager().getLocForStartOfFile( CI->getSourceManager().getMainFileID())); @@ -390,8 +392,8 @@ if (MatchedSymbols.empty()) MatchedSymbols = SymbolIndexMgr.search(Query, /*IsNestedSearch=*/true, FileName); - DEBUG(llvm::dbgs() << "Having found " << MatchedSymbols.size() - << " symbols\n"); + LLVM_DEBUG(llvm::dbgs() << "Having found " << MatchedSymbols.size() + << " symbols\n"); // We store a copy of MatchedSymbols in a place where it's globally reachable. // This is used by the standalone version of the tool. this->MatchedSymbols = MatchedSymbols; Index: include-fixer/SymbolIndexManager.cpp =================================================================== --- include-fixer/SymbolIndexManager.cpp +++ include-fixer/SymbolIndexManager.cpp @@ -97,8 +97,8 @@ Symbols.insert(Symbols.end(), Res.begin(), Res.end()); } - DEBUG(llvm::dbgs() << "Searching " << Names.back() << "... got " - << Symbols.size() << " results...\n"); + LLVM_DEBUG(llvm::dbgs() << "Searching " << Names.back() << "... got " + << Symbols.size() << " results...\n"); for (auto &SymAndSig : Symbols) { const SymbolInfo &Symbol = SymAndSig.Symbol;