Make CIFactory a namespace, not a class.

Signed-off-by: Vassil Vassilev <vvasilev@cern.ch>
This commit is contained in:
Frederich Munch 2016-08-16 05:53:04 -04:00 committed by sftnight
parent 5ee1cfb7c3
commit 60ecba7d61
3 changed files with 20 additions and 27 deletions

View File

@ -26,28 +26,19 @@ namespace clang {
namespace cling {
class InvocationOptions;
class CIFactory {
public:
namespace CIFactory {
typedef std::unique_ptr<llvm::MemoryBuffer> MemBufPtr_t;
// TODO: Add overload that takes file not MemoryBuffer
static clang::CompilerInstance* createCI(llvm::StringRef Code,
const InvocationOptions& Opts,
const char* LLVMDir);
clang::CompilerInstance* createCI(llvm::StringRef Code,
const InvocationOptions& Opts,
const char* LLVMDir);
static clang::CompilerInstance* createCI(MemBufPtr_t Buffer,
int Argc,
const char* const *Argv,
const char* LLVMDir,
bool OnlyLex = false);
private:
//---------------------------------------------------------------------
//! Constructor
//---------------------------------------------------------------------
CIFactory() = delete;
~CIFactory() = delete;
};
clang::CompilerInstance* createCI(MemBufPtr_t Buffer, int Argc,
const char* const *Argv,
const char* LLVMDir,
bool OnlyLex = false);
} // namespace CIFactory
} // namespace cling
#endif // CLING_CIFACTORY_H

View File

@ -1159,18 +1159,21 @@ namespace {
} // unnamed namespace
CompilerInstance* CIFactory::createCI(llvm::StringRef Code,
const InvocationOptions& Opts,
const char* LLVMDir) {
namespace cling {
namespace CIFactory {
CompilerInstance* createCI(llvm::StringRef Code, const InvocationOptions& Opts,
const char* LLVMDir) {
return createCIImpl(llvm::MemoryBuffer::getMemBuffer(Code),
Opts.CompilerOpts, LLVMDir, false /*OnlyLex*/);
}
CompilerInstance* CIFactory::createCI(MemBufPtr_t Buffer,
int argc,
const char* const *argv,
const char* LLVMDir,
bool OnlyLex) {
CompilerInstance* createCI(MemBufPtr_t Buffer, int argc, const char* const *argv,
const char* LLVMDir, bool OnlyLex) {
return createCIImpl(std::move(Buffer), CompilerOptions(argc, argv),
LLVMDir, OnlyLex);
}
}
}

View File

@ -36,7 +36,6 @@ namespace clang {
namespace cling {
class BackendPasses;
class CompilationOptions;
class CIFactory;
class DeclCollector;
class ExecutionContext;
class Interpreter;