Skip to content

Commit

Permalink
[llvm-debuginfo-analyzer] LLVM 16.0.0-rc1 Failing test on osx-64.
Browse files Browse the repository at this point in the history
As describe in

llvm#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
  • Loading branch information
CarlosAlbertoEnciso committed Feb 13, 2023
1 parent b49b429 commit 92716a4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 0 additions & 1 deletion llvm/include/llvm/DebugInfo/LogicalView/Core/LVElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <map>
#include <set>
Expand Down
7 changes: 0 additions & 7 deletions llvm/include/llvm/DebugInfo/LogicalView/Core/LVStringPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -90,8 +85,6 @@ class LVStringPool {
#endif
};

inline LVStringPool &getStringPool() { return LVStringPool::getInstance(); }

} // namespace logicalview
} // end namespace llvm

Expand Down
4 changes: 4 additions & 0 deletions llvm/include/llvm/DebugInfo/LogicalView/Core/LVSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -27,6 +28,9 @@
namespace llvm {
namespace logicalview {

// Returns the unique string pool instance.
LVStringPool &getStringPool();

template <typename T>
using TypeIsValid = std::bool_constant<std::is_pointer<T>::value>;

Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/DebugInfo/LogicalView/Core/LVSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit 92716a4

Please sign in to comment.