@@ -620,10 +620,11 @@ void Dyld::ScanForLibraries(bool searchSystemLibraries /* = false*/) {
620620
621621 LLVM_DEBUG (dbgs () << " Dyld::ScanForLibraries: system="
622622 << (searchSystemLibraries ? " true" : " false" ) << " \n " );
623+ #ifndef NDEBUG
623624 for (const DynamicLibraryManager::SearchPathInfo& Info : searchPaths)
624625 LLVM_DEBUG (dbgs () << " >>>" << Info.Path << " , "
625626 << (Info.IsUser ? " user\n " : " system\n " ));
626-
627+ # endif
627628 llvm::SmallSet<const BasePath*, 32 > ScannedPaths;
628629
629630 for (const DynamicLibraryManager::SearchPathInfo& Info : searchPaths) {
@@ -769,11 +770,12 @@ void Dyld::ScanForLibraries(bool searchSystemLibraries /* = false*/) {
769770 << RPathToStr (RPath) << " \n " );
770771 LLVM_DEBUG (dbgs () << " Dyld::ScanForLibraries: RUNPATH="
771772 << RPathToStr (RunPath) << " \n " );
773+ #ifndef NDEBUG
772774 int x = 0 ;
773775 for (StringRef dep : Deps)
774776 LLVM_DEBUG (dbgs () << " Dyld::ScanForLibraries: Deps[" << x++
775777 << " ]=" << dep.str () << " \n " );
776-
778+ # endif
777779 // Heuristics for workaround performance problems:
778780 // (H1) If RPATH and RUNPATH == "" -> skip handling Deps
779781 if (RPath.empty () && RunPath.empty ()) {
@@ -965,10 +967,11 @@ void Dyld::BuildBloomFilter(LibraryPath* Lib,
965967 }
966968
967969 LLVM_DEBUG (dbgs () << " Dyld::BuildBloomFilter: Symbols:\n " );
970+ #ifndef NDEBUG
968971 for (auto it : symbols)
969972 LLVM_DEBUG (dbgs () << " Dyld::BuildBloomFilter"
970973 << " - " << it << " \n " );
971-
974+ # endif
972975 // Generate BloomFilter
973976 for (const auto & S : symbols) {
974977 if (m_UseHashTable)
@@ -1036,7 +1039,11 @@ bool Dyld::ContainsSymbol(const LibraryPath* Lib, StringRef mangledName,
10361039 }
10371040
10381041 auto ForeachSymbol =
1042+ #ifndef NDEBUG
10391043 [&library_filename](
1044+ #else
1045+ [](
1046+ #endif
10401047 llvm::iterator_range<llvm::object::symbol_iterator> range,
10411048 unsigned IgnoreSymbolFlags, llvm::StringRef mangledName) -> bool {
10421049 for (const llvm::object::SymbolRef& S : range) {
@@ -1157,6 +1164,7 @@ bool Dyld::ShouldPermanentlyIgnore(StringRef FileName) const {
11571164void Dyld::dumpDebugInfo () const {
11581165#define DEBUG_TYPE " Dyld:"
11591166 LLVM_DEBUG (dbgs () << " ---\n " );
1167+ #ifndef NDEBUG
11601168 size_t x = 0 ;
11611169 for (auto const & item : m_BasePaths.m_Paths ) {
11621170 LLVM_DEBUG (dbgs () << " Dyld: - m_BasePaths[" << x++ << " ]:" << &item << " : "
@@ -1174,6 +1182,7 @@ void Dyld::dumpDebugInfo() const {
11741182 << " : " << item->m_Path << " , " << item->m_LibName
11751183 << " \n " );
11761184 }
1185+ #endif
11771186#undef DEBUG_TYPE
11781187}
11791188
@@ -1213,12 +1222,13 @@ std::string Dyld::searchLibrariesForSymbol(StringRef mangledName,
12131222 // from our lists of not-yet-loaded libs.
12141223
12151224 LLVM_DEBUG (dbgs () << " Dyld::ResolveSymbol: m_QueriedLibraries:\n " );
1225+ #ifndef NDEBUG
12161226 size_t x = 0 ;
12171227 for (auto item : m_QueriedLibraries.GetLibraries ()) {
12181228 LLVM_DEBUG (dbgs () << " Dyld::ResolveSymbol - [" << x++ << " ]:" << &item
12191229 << " : " << item->GetFullName () << " \n " );
12201230 }
1221-
1231+ # endif
12221232 for (const LibraryPath* P : m_QueriedLibraries.GetLibraries ()) {
12231233 const std::string LibName = P->GetFullName ();
12241234 if (!m_DynamicLibraryManager.isLibraryLoaded (LibName))
0 commit comments