Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "llvm/Support/Path.h"

namespace cling {
class Dyld;
class InterpreterCallbacks;
class InvocationOptions;

Expand Down Expand Up @@ -66,7 +67,9 @@ namespace cling {
///
SearchPathInfos m_SearchPaths;

InterpreterCallbacks* m_Callbacks;
InterpreterCallbacks* m_Callbacks = nullptr;

Dyld* m_Dyld = nullptr;

///\brief Concatenates current include paths and the system include paths
/// and performs a lookup for the filename.
Expand Down Expand Up @@ -146,8 +149,7 @@ namespace cling {
/// dangerous libraries such as the ones overriding malloc.
///
void
initializeDyld(std::function<bool(llvm::StringRef)> shouldPermanentlyIgnore)
const;
initializeDyld(std::function<bool(llvm::StringRef)> shouldPermanentlyIgnore);

/// Find the first not-yet-loaded shared object that contains the symbol
///
Expand All @@ -159,6 +161,16 @@ namespace cling {
std::string searchLibrariesForSymbol(const std::string& mangledName,
bool searchSystem = true) const;

/// On a success returns to full path to a shared object that holds the
/// symbol pointed by func.
///
template <class T>
static std::string getSymbolLocation(T func) {
static_assert(std::is_pointer<T>::value, "Must be a function pointer!");
return getSymbolLocation(reinterpret_cast<void*>(func));
}


///\brief Explicitly tell the execution engine to use symbols from
/// a shared library that would otherwise not be used for symbol
/// resolution, e.g. because it was dlopened with RTLD_LOCAL.
Expand All @@ -176,15 +188,6 @@ namespace cling {
/// is a library but of incompatible file format.
///
static bool isSharedLibrary(llvm::StringRef libFullPath, bool* exists = 0);

/// On a success returns to full path to a shared object that holds the
/// symbol pointed by func.
///
template <class T>
static std::string getSymbolLocation(T func) {
static_assert(std::is_pointer<T>::value, "Must be a function pointer!");
return getSymbolLocation(reinterpret_cast<void*>(func));
}
};
} // end namespace cling
#endif // CLING_DYNAMIC_LIBRARY_MANAGER_H
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace cling {
DynamicLibraryManager::DynamicLibraryManager(const InvocationOptions& Opts)
: m_Opts(Opts), m_Callbacks(0) {
: m_Opts(Opts) {
const llvm::SmallVector<const char*, 10> kSysLibraryEnv = {
"LD_LIBRARY_PATH",
#if __APPLE__
Expand Down Expand Up @@ -65,8 +65,6 @@ namespace cling {
m_SearchPaths.push_back({".", /*IsUser*/true});
}

DynamicLibraryManager::~DynamicLibraryManager() {}

std::string
DynamicLibraryManager::lookupLibInPaths(llvm::StringRef libStem) const {
llvm::SmallVector<SearchPathInfo, 128> Paths;
Expand Down
Loading