From 92716a42a6aa584fb009031a9f703b5dac310043 Mon Sep 17 00:00:00 2001 From: Carlos Alberto Enciso Date: Mon, 13 Feb 2023 05:25:17 +0000 Subject: [PATCH] [llvm-debuginfo-analyzer] LLVM 16.0.0-rc1 Failing test on osx-64. As describe in https://github.com/llvm/llvm-project/issues/60363 the following DebugInfo LogicalView Tests unit tests failed: - ELFReader - SelectElements The tests fail only on the OSX-64 platform with the CMake options: -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON Using the same options on a Linux platform all the tests pass: - https://lab.llvm.org/buildbot/#/builders/196 - llvm-x86_64-debian-dylib Basically it is a dynamic library initialization affecting a static instance for the string pool (LVStringPool). That string pool instance is accessed by all the logical elements to store/retrieve any associated string during the creation of the logical view. For a logical view comparison, both logical readers (Reference and Target) use retrieved indexes when comparing their strings. Moved the static instance to LVSupport module (unnamed namespace). Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D143716 --- llvm/include/llvm/DebugInfo/LogicalView/Core/LVElement.h | 1 - .../include/llvm/DebugInfo/LogicalView/Core/LVStringPool.h | 7 ------- llvm/include/llvm/DebugInfo/LogicalView/Core/LVSupport.h | 4 ++++ llvm/lib/DebugInfo/LogicalView/Core/LVSupport.cpp | 6 ++++++ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVElement.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVElement.h index 2603c4542e8dc7..68dfefba3b3cda 100644 --- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVElement.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVElement.h @@ -15,7 +15,6 @@ #define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVELEMENT_H #include "llvm/DebugInfo/LogicalView/Core/LVObject.h" -#include "llvm/DebugInfo/LogicalView/Core/LVStringPool.h" #include "llvm/Support/Casting.h" #include #include diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVStringPool.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVStringPool.h index 671ccf5d0e152d..4c596b5b1dde73 100644 --- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVStringPool.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVStringPool.h @@ -71,11 +71,6 @@ class LVStringPool { return (Index >= Entries.size()) ? StringRef() : Entries[Index]->getKey(); } - static LVStringPool &getInstance() { - static LVStringPool Instance; - return Instance; - } - void print(raw_ostream &OS) const { if (!Entries.empty()) { OS << "\nString Pool:\n"; @@ -90,8 +85,6 @@ class LVStringPool { #endif }; -inline LVStringPool &getStringPool() { return LVStringPool::getInstance(); } - } // namespace logicalview } // end namespace llvm diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSupport.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSupport.h index bff1499c1a60f0..a2274ec1a62f73 100644 --- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSupport.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSupport.h @@ -16,6 +16,7 @@ #include "llvm/ADT/SmallBitVector.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/Twine.h" +#include "llvm/DebugInfo/LogicalView/Core/LVStringPool.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Format.h" #include "llvm/Support/Path.h" @@ -27,6 +28,9 @@ namespace llvm { namespace logicalview { +// Returns the unique string pool instance. +LVStringPool &getStringPool(); + template using TypeIsValid = std::bool_constant::value>; diff --git a/llvm/lib/DebugInfo/LogicalView/Core/LVSupport.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVSupport.cpp index 9fa1f28eb0895f..6d55b755ed46ce 100644 --- a/llvm/lib/DebugInfo/LogicalView/Core/LVSupport.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Core/LVSupport.cpp @@ -20,6 +20,12 @@ using namespace llvm::logicalview; #define DEBUG_TYPE "Support" +namespace { +// Unique string pool instance used by all logical readers. +LVStringPool StringPool; +} // namespace +LVStringPool &llvm::logicalview::getStringPool() { return StringPool; } + // Perform the following transformations to the given 'Path': // - all characters to lowercase. // - '\\' into '/' (Platform independent).