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;
|
||||
clang::ASTContext& m_ASTContext;
|
||||
clang::Preprocessor& m_Preprocessor;
|
||||
llvm::Module& m_Module;
|
||||
llvm::Module* m_Module;
|
||||
std::string m_DiffCommand;
|
||||
std::string m_Name;
|
||||
public:
|
||||
ClangInternalState(clang::ASTContext& AC, clang::Preprocessor& PP,
|
||||
llvm::Module& M, const std::string& name);
|
||||
llvm::Module* M, const std::string& name);
|
||||
~ClangInternalState();
|
||||
|
||||
///\brief It is convenient the state object to be named so that can be
|
||||
|
@ -36,8 +36,8 @@ using namespace clang;
|
||||
namespace cling {
|
||||
|
||||
ClangInternalState::ClangInternalState(ASTContext& AC, Preprocessor& PP,
|
||||
llvm::Module& M, const std::string& name)
|
||||
: m_ASTContext(AC), m_Preprocessor(PP), m_Module(M),
|
||||
llvm::Module* M, const std::string& name)
|
||||
: m_ASTContext(AC), m_Preprocessor(PP), m_Module(M),
|
||||
m_DiffCommand("diff -u --text "), m_Name(name) {
|
||||
store();
|
||||
}
|
||||
@ -68,10 +68,11 @@ namespace cling {
|
||||
m_MacrosOS.reset(createOutputFile("macros", &m_MacrosFile));
|
||||
|
||||
printLookupTables(*m_LookupTablesOS.get(), m_ASTContext);
|
||||
printIncludedFiles(*m_IncludedFilesOS.get(),
|
||||
printIncludedFiles(*m_IncludedFilesOS.get(),
|
||||
m_ASTContext.getSourceManager());
|
||||
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);
|
||||
}
|
||||
namespace {
|
||||
|
@ -154,7 +154,7 @@ namespace cling {
|
||||
|
||||
Interpreter::Interpreter(int argc, const char* const *argv,
|
||||
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_LLVMContext.reset(new llvm::LLVMContext);
|
||||
@ -172,8 +172,8 @@ namespace cling {
|
||||
&LeftoverArgs[0],
|
||||
llvmdir));
|
||||
Sema& SemaRef = getSema();
|
||||
m_LookupHelper.reset(new LookupHelper(new Parser(SemaRef.getPreprocessor(),
|
||||
SemaRef,
|
||||
m_LookupHelper.reset(new LookupHelper(new Parser(SemaRef.getPreprocessor(),
|
||||
SemaRef,
|
||||
/*SkipFunctionBodies*/false,
|
||||
/*isTemp*/true), this));
|
||||
|
||||
@ -300,9 +300,9 @@ namespace cling {
|
||||
void Interpreter::storeInterpreterState(const std::string& name) const {
|
||||
// This may induce deserialization
|
||||
PushTransactionRAII RAII(this);
|
||||
ClangInternalState* state
|
||||
ClangInternalState* state
|
||||
= new ClangInternalState(getCI()->getASTContext(),
|
||||
getCI()->getPreprocessor(), *getModule(), name);
|
||||
getCI()->getPreprocessor(), getModule(), name);
|
||||
m_StoredStates.push_back(state);
|
||||
}
|
||||
|
||||
@ -310,7 +310,7 @@ namespace cling {
|
||||
// This may induce deserialization
|
||||
PushTransactionRAII RAII(this);
|
||||
ClangInternalState state(getCI()->getASTContext(),
|
||||
getCI()->getPreprocessor(), *getModule(), name);
|
||||
getCI()->getPreprocessor(), getModule(), name);
|
||||
for (unsigned i = 0, e = m_StoredStates.size(); i != e; ++i) {
|
||||
if (m_StoredStates[i]->getName() == name) {
|
||||
m_StoredStates[i]->compare(state);
|
||||
@ -429,7 +429,9 @@ namespace cling {
|
||||
}
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user