Make CompilationException public, (also) use new cling runtime exception as base.
This commit is contained in:
parent
0a9be4bfd1
commit
0782d4d515
30
include/cling/UserInterface/CompilationException.h
Normal file
30
include/cling/UserInterface/CompilationException.h
Normal file
@ -0,0 +1,30 @@
|
||||
//--------------------------------------------------------------------*- C++ -*-
|
||||
// CLING - the C++ LLVM-based InterpreterG :)
|
||||
// author: Axel Naumann <axel@cern.ch>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef CLING_COMPILATIONEXCEPTION_H
|
||||
#define CLING_COMPILATIONEXCEPTION_H
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include "cling/Interpreter/RuntimeExceptions.h"
|
||||
|
||||
namespace cling {
|
||||
class Interpreter;
|
||||
class MetaProcessor;
|
||||
|
||||
//\brief Exception pull us out of JIT (llvm + clang) errors.
|
||||
class CompilationException:
|
||||
public virtual runtime::InterpreterException,
|
||||
public virtual std::runtime_error {
|
||||
public:
|
||||
CompilationException(const std::string& reason):
|
||||
std::runtime_error(reason) {}
|
||||
~CompilationException() throw(); // vtable pinned to UserInterface.cpp
|
||||
virtual const char* what() const throw() {
|
||||
return std::runtime_error::what(); }
|
||||
};
|
||||
}
|
||||
|
||||
#endif // CLING_COMPILATIONEXCEPTION_H
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "cling/UserInterface/UserInterface.h"
|
||||
|
||||
#include "cling/UserInterface/CompilationException.h"
|
||||
#include "cling/Interpreter/RuntimeException.h"
|
||||
#include "cling/Interpreter/StoredValueRef.h"
|
||||
#include "cling/MetaProcessor/MetaProcessor.h"
|
||||
@ -35,17 +36,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace cling {
|
||||
class compilerException: public std::exception {
|
||||
public:
|
||||
compilerException(const std::string& reason): Reason(reason) {}
|
||||
~compilerException() throw() {}
|
||||
virtual const char* what() const throw() { return Reason.c_str(); }
|
||||
private:
|
||||
std::string Reason;
|
||||
};
|
||||
}
|
||||
|
||||
namespace {
|
||||
// Handle fatal llvm errors by throwing an exception..
|
||||
// Yes, throwing exceptions in error handlers is bad.
|
||||
@ -53,11 +43,14 @@ namespace {
|
||||
void exceptionErrorHandler(void * /*user_data*/,
|
||||
const std::string& reason,
|
||||
bool /*gen_crash_diag*/) {
|
||||
throw cling::compilerException(reason);
|
||||
throw cling::CompilationException(reason);
|
||||
}
|
||||
}
|
||||
|
||||
namespace cling {
|
||||
// Declared in CompilationException.h; vtable pinned here.
|
||||
CompilationException::~CompilationException() throw() {}
|
||||
|
||||
UserInterface::UserInterface(Interpreter& interp) {
|
||||
// We need stream that doesn't close its file descriptor, thus we are not
|
||||
// using llvm::outs. Keeping file descriptor open we will be able to use
|
||||
|
Loading…
Reference in New Issue
Block a user