In -fsyntax-only mode we don't have llvm::Module.
This commit is contained in:
parent
e0bc9916ab
commit
0944f060ec
@ -42,12 +42,12 @@ namespace cling {
|
|||||||
std::string m_MacrosFile;
|
std::string m_MacrosFile;
|
||||||
clang::ASTContext& m_ASTContext;
|
clang::ASTContext& m_ASTContext;
|
||||||
clang::Preprocessor& m_Preprocessor;
|
clang::Preprocessor& m_Preprocessor;
|
||||||
llvm::Module& m_Module;
|
llvm::Module* m_Module;
|
||||||
std::string m_DiffCommand;
|
std::string m_DiffCommand;
|
||||||
std::string m_Name;
|
std::string m_Name;
|
||||||
public:
|
public:
|
||||||
ClangInternalState(clang::ASTContext& AC, clang::Preprocessor& PP,
|
ClangInternalState(clang::ASTContext& AC, clang::Preprocessor& PP,
|
||||||
llvm::Module& M, const std::string& name);
|
llvm::Module* M, const std::string& name);
|
||||||
~ClangInternalState();
|
~ClangInternalState();
|
||||||
|
|
||||||
///\brief It is convenient the state object to be named so that can be
|
///\brief It is convenient the state object to be named so that can be
|
||||||
|
@ -36,8 +36,8 @@ using namespace clang;
|
|||||||
namespace cling {
|
namespace cling {
|
||||||
|
|
||||||
ClangInternalState::ClangInternalState(ASTContext& AC, Preprocessor& PP,
|
ClangInternalState::ClangInternalState(ASTContext& AC, Preprocessor& PP,
|
||||||
llvm::Module& M, const std::string& name)
|
llvm::Module* M, const std::string& name)
|
||||||
: m_ASTContext(AC), m_Preprocessor(PP), m_Module(M),
|
: m_ASTContext(AC), m_Preprocessor(PP), m_Module(M),
|
||||||
m_DiffCommand("diff -u --text "), m_Name(name) {
|
m_DiffCommand("diff -u --text "), m_Name(name) {
|
||||||
store();
|
store();
|
||||||
}
|
}
|
||||||
@ -68,10 +68,11 @@ namespace cling {
|
|||||||
m_MacrosOS.reset(createOutputFile("macros", &m_MacrosFile));
|
m_MacrosOS.reset(createOutputFile("macros", &m_MacrosFile));
|
||||||
|
|
||||||
printLookupTables(*m_LookupTablesOS.get(), m_ASTContext);
|
printLookupTables(*m_LookupTablesOS.get(), m_ASTContext);
|
||||||
printIncludedFiles(*m_IncludedFilesOS.get(),
|
printIncludedFiles(*m_IncludedFilesOS.get(),
|
||||||
m_ASTContext.getSourceManager());
|
m_ASTContext.getSourceManager());
|
||||||
printAST(*m_ASTOS.get(), m_ASTContext);
|
printAST(*m_ASTOS.get(), m_ASTContext);
|
||||||
printLLVMModule(*m_LLVMModuleOS.get(), m_Module);
|
if (m_Module)
|
||||||
|
printLLVMModule(*m_LLVMModuleOS.get(), *m_Module);
|
||||||
printMacroDefinitions(*m_MacrosOS.get(), m_Preprocessor);
|
printMacroDefinitions(*m_MacrosOS.get(), m_Preprocessor);
|
||||||
}
|
}
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -154,7 +154,7 @@ namespace cling {
|
|||||||
|
|
||||||
Interpreter::Interpreter(int argc, const char* const *argv,
|
Interpreter::Interpreter(int argc, const char* const *argv,
|
||||||
const char* llvmdir /*= 0*/) :
|
const char* llvmdir /*= 0*/) :
|
||||||
m_UniqueCounter(0), m_PrintAST(false), m_PrintIR(false),
|
m_UniqueCounter(0), m_PrintAST(false), m_PrintIR(false),
|
||||||
m_DynamicLookupEnabled(false), m_RawInputEnabled(false) {
|
m_DynamicLookupEnabled(false), m_RawInputEnabled(false) {
|
||||||
|
|
||||||
m_LLVMContext.reset(new llvm::LLVMContext);
|
m_LLVMContext.reset(new llvm::LLVMContext);
|
||||||
@ -172,8 +172,8 @@ namespace cling {
|
|||||||
&LeftoverArgs[0],
|
&LeftoverArgs[0],
|
||||||
llvmdir));
|
llvmdir));
|
||||||
Sema& SemaRef = getSema();
|
Sema& SemaRef = getSema();
|
||||||
m_LookupHelper.reset(new LookupHelper(new Parser(SemaRef.getPreprocessor(),
|
m_LookupHelper.reset(new LookupHelper(new Parser(SemaRef.getPreprocessor(),
|
||||||
SemaRef,
|
SemaRef,
|
||||||
/*SkipFunctionBodies*/false,
|
/*SkipFunctionBodies*/false,
|
||||||
/*isTemp*/true), this));
|
/*isTemp*/true), this));
|
||||||
|
|
||||||
@ -300,9 +300,9 @@ namespace cling {
|
|||||||
void Interpreter::storeInterpreterState(const std::string& name) const {
|
void Interpreter::storeInterpreterState(const std::string& name) const {
|
||||||
// This may induce deserialization
|
// This may induce deserialization
|
||||||
PushTransactionRAII RAII(this);
|
PushTransactionRAII RAII(this);
|
||||||
ClangInternalState* state
|
ClangInternalState* state
|
||||||
= new ClangInternalState(getCI()->getASTContext(),
|
= new ClangInternalState(getCI()->getASTContext(),
|
||||||
getCI()->getPreprocessor(), *getModule(), name);
|
getCI()->getPreprocessor(), getModule(), name);
|
||||||
m_StoredStates.push_back(state);
|
m_StoredStates.push_back(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ namespace cling {
|
|||||||
// This may induce deserialization
|
// This may induce deserialization
|
||||||
PushTransactionRAII RAII(this);
|
PushTransactionRAII RAII(this);
|
||||||
ClangInternalState state(getCI()->getASTContext(),
|
ClangInternalState state(getCI()->getASTContext(),
|
||||||
getCI()->getPreprocessor(), *getModule(), name);
|
getCI()->getPreprocessor(), getModule(), name);
|
||||||
for (unsigned i = 0, e = m_StoredStates.size(); i != e; ++i) {
|
for (unsigned i = 0, e = m_StoredStates.size(); i != e; ++i) {
|
||||||
if (m_StoredStates[i]->getName() == name) {
|
if (m_StoredStates[i]->getName() == name) {
|
||||||
m_StoredStates[i]->compare(state);
|
m_StoredStates[i]->compare(state);
|
||||||
@ -429,7 +429,9 @@ namespace cling {
|
|||||||
}
|
}
|
||||||
|
|
||||||
llvm::Module* Interpreter::getModule() const {
|
llvm::Module* Interpreter::getModule() const {
|
||||||
return m_IncrParser->getCodeGenerator()->GetModule();
|
if (m_IncrParser->hasCodeGenerator())
|
||||||
|
return m_IncrParser->getCodeGenerator()->GetModule();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
///\brief Maybe transform the input line to implement cint command line
|
///\brief Maybe transform the input line to implement cint command line
|
||||||
|
Loading…
x
Reference in New Issue
Block a user