Move llvm::sys::DynamicLibrary out of the Interpreter header.

git-svn-id: http://root.cern.ch/svn/root/trunk@48685 27541ba8-7e3a-0410-8455-c3a389f83636
This commit is contained in:
Axel Naumann 2013-02-25 13:38:54 +00:00
parent 87356648fb
commit 9d69f41211
2 changed files with 21 additions and 4 deletions

View File

@ -12,10 +12,8 @@
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/DynamicLibrary.h"
#include <string>
#include <set>
namespace llvm {
class raw_ostream;
@ -24,6 +22,10 @@ namespace llvm {
class LLVMContext;
class Module;
class Type;
namespace sys {
class DynamicLibrary;
}
}
namespace clang {
@ -145,6 +147,14 @@ namespace cling {
friend class Interpreter;
};
///\brief Collection of DynamicLibraries loaded by this Interpreter;
/// or rather type-opaque wrapper thereof.
///
class DynLibSetBase {
public:
virtual ~DynLibSetBase() {}
};
private:
///\brief Interpreter invocation options.
@ -245,7 +255,7 @@ namespace cling {
///\brief DynamicLibraries loaded by this Interpreter.
///
std::set<llvm::sys::DynamicLibrary> m_DyLibs;
llvm::OwningPtr<DynLibSetBase> m_DyLibs;
///\brief Information about loaded files.
///

View File

@ -34,8 +34,10 @@
#include "llvm/Linker.h"
#include "llvm/LLVMContext.h"
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/Path.h"
#include <set>
#include <sstream>
#include <vector>
@ -57,6 +59,9 @@ namespace {
return cling::Interpreter::kExeSuccess;
}
class DynLibSetImpl: public std::set<llvm::sys::DynamicLibrary>,
public cling::Interpreter::DynLibSetBase {
};
} // unnamed namespace
@ -115,6 +120,8 @@ namespace cling {
m_UniqueCounter(0), m_PrintAST(false), m_DynamicLookupEnabled(false),
m_RawInputEnabled(false) {
m_DyLibs.reset(new DynLibSetImpl());
m_LLVMContext.reset(new llvm::LLVMContext);
std::vector<unsigned> LeftoverArgsIdx;
m_Opts = InvocationOptions::CreateFromArgs(argc, argv, LeftoverArgsIdx);
@ -750,7 +757,7 @@ namespace cling {
return kLoadLibError;
}
std::pair<std::set<llvm::sys::DynamicLibrary>::iterator, bool> insRes
= m_DyLibs.insert(DyLib);
= static_cast<DynLibSetImpl*>(m_DyLibs.get())->insert(DyLib);
if (!insRes.second)
return kLoadLibExists;
addLoadedFile(SoFile.str(), LoadedFileInfo::kDynamicLibrary,