Remove runtime namespace from NullDerefException and rename RuntimeException.h to Exception.h.
(cherry picked from commit 234da8bfedce8661c2b8bc50f72632c240c4dfd8)
This commit is contained in:
parent
8ab37ec3d6
commit
1d46fe88d8
@ -14,14 +14,14 @@ CLINGS := $(wildcard $(MODDIR)/lib/Interpreter/*.cpp) \
|
||||
$(wildcard $(MODDIR)/lib/TagsExtension/*.cpp) \
|
||||
$(wildcard $(MODDIR)/lib/Utils/*.cpp)
|
||||
CLINGO := $(call stripsrc,$(CLINGS:.cpp=.o))
|
||||
CLINGEXCEPO := $(call stripsrc,$(MODDIR)/lib/Interpreter/RuntimeException.o)
|
||||
CLINGEXCEPO := $(call stripsrc,$(MODDIR)/lib/Interpreter/Exception.o)
|
||||
CLINGCOMPDH := $(call stripsrc,$(MODDIR)/lib/Interpreter/cling-compiledata.h)
|
||||
|
||||
CLINGDEP := $(CLINGO:.o=.d)
|
||||
|
||||
CLINGETC_CLING := DynamicExprInfo.h DynamicLookupRuntimeUniverse.h \
|
||||
DynamicLookupLifetimeHandler.h Interpreter.h InvocationOptions.h \
|
||||
RuntimeException.h RuntimePrintValue.h RuntimeUniverse.h Value.h
|
||||
Exception.h RuntimePrintValue.h RuntimeUniverse.h Value.h
|
||||
|
||||
CLINGETC_LLVM := llvm/ADT/IntrusiveRefCntPtr.h \
|
||||
llvm/ADT/StringRef.h \
|
||||
|
42
include/cling/Interpreter/Exception.h
Normal file
42
include/cling/Interpreter/Exception.h
Normal file
@ -0,0 +1,42 @@
|
||||
//--------------------------------------------------------------------*- C++ -*-
|
||||
// CLING - the C++ LLVM-based InterpreterG :)
|
||||
// author: Vassil Vassilev <vasil.georgiev.vasilev@cern.ch>
|
||||
//
|
||||
// This file is dual-licensed: you can choose to license it under the University
|
||||
// of Illinois Open Source License or the GNU Lesser General Public License. See
|
||||
// LICENSE.TXT for details.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef CLING_RUNTIME_EXCEPTION_H
|
||||
#define CLING_RUNTIME_EXCEPTION_H
|
||||
|
||||
namespace clang {
|
||||
class Sema;
|
||||
class Expr;
|
||||
}
|
||||
|
||||
namespace cling {
|
||||
///\brief Base class for all interpreter exceptions.
|
||||
///
|
||||
class InterpreterException {
|
||||
public:
|
||||
virtual const char* what() const throw();
|
||||
virtual ~InterpreterException();
|
||||
};
|
||||
|
||||
///\brief Exception that is thrown when a null pointer dereference is found
|
||||
/// or a method taking non-null arguments is called with NULL argument.
|
||||
///
|
||||
class NullDerefException : public InterpreterException {
|
||||
private:
|
||||
clang::Sema* m_Sema;
|
||||
clang::Expr* m_Arg;
|
||||
public:
|
||||
NullDerefException(clang::Sema* S, clang::Expr* E);
|
||||
virtual ~NullDerefException();
|
||||
|
||||
virtual const char* what() const throw();
|
||||
void diagnose() const throw();
|
||||
};
|
||||
} // end namespace cling
|
||||
#endif // CLING_RUNTIME_EXCEPTION_H
|
@ -1,44 +0,0 @@
|
||||
//--------------------------------------------------------------------*- C++ -*-
|
||||
// CLING - the C++ LLVM-based InterpreterG :)
|
||||
// author: Vassil Vassilev <vasil.georgiev.vasilev@cern.ch>
|
||||
//
|
||||
// This file is dual-licensed: you can choose to license it under the University
|
||||
// of Illinois Open Source License or the GNU Lesser General Public License. See
|
||||
// LICENSE.TXT for details.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef CLING_RUNTIME_EXCEPTION_H
|
||||
#define CLING_RUNTIME_EXCEPTION_H
|
||||
|
||||
namespace clang {
|
||||
class Sema;
|
||||
class Expr;
|
||||
}
|
||||
|
||||
namespace cling {
|
||||
namespace runtime {
|
||||
///\brief Base class for all interpreter exceptions.
|
||||
///
|
||||
class InterpreterException {
|
||||
public:
|
||||
virtual const char* what() const throw();
|
||||
virtual ~InterpreterException();
|
||||
};
|
||||
|
||||
///\brief Exception that is thrown when a null pointer dereference is found
|
||||
/// or a method taking non-null arguments is called with NULL argument.
|
||||
///
|
||||
class NullDerefException : public InterpreterException {
|
||||
private:
|
||||
clang::Sema* m_Sema;
|
||||
clang::Expr* m_Arg;
|
||||
public:
|
||||
NullDerefException(clang::Sema* S, clang::Expr* E);
|
||||
virtual ~NullDerefException();
|
||||
|
||||
virtual const char* what() const throw();
|
||||
void diagnose() const throw();
|
||||
};
|
||||
} // end namespace runtime
|
||||
} // end namespace cling
|
||||
#endif // CLING_RUNTIME_EXCEPTION_H
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include "cling/Interpreter/RuntimeException.h"
|
||||
#include "cling/Interpreter/Exception.h"
|
||||
|
||||
namespace cling {
|
||||
class Interpreter;
|
||||
|
@ -41,7 +41,7 @@ add_cling_library(clingInterpreter
|
||||
NullDerefProtectionTransformer.cpp
|
||||
RequiredSymbols.cpp
|
||||
ValueExtractionSynthesizer.cpp
|
||||
RuntimeException.cpp
|
||||
Exception.cpp
|
||||
Transaction.cpp
|
||||
ASTTransformer.cpp
|
||||
TransactionUnloader.cpp
|
||||
@ -55,12 +55,12 @@ add_cling_library(clingInterpreter
|
||||
)
|
||||
|
||||
if(NOT WIN32)
|
||||
set_source_files_properties(RuntimeException.cpp COMPILE_FLAGS -fexceptions)
|
||||
set_source_files_properties(Exception.cpp COMPILE_FLAGS -fexceptions)
|
||||
endif()
|
||||
|
||||
set_source_files_properties(Interpreter.cpp COMPILE_FLAGS -DCLING_VERSION=${CLING_VERSION})
|
||||
|
||||
#set_source_files_properties(RuntimeException.cpp COMPILE_FLAGS " /EHsc ")
|
||||
#set_source_files_properties(Exception.cpp COMPILE_FLAGS " /EHsc ")
|
||||
# the line above doesn't work, and it gives the following warnings:
|
||||
# cl : Command line warning D9025: overriding '/EHs' with '/EHs-'
|
||||
# cl : Command line warning D9025: overriding '/EHc' with '/EHc-'
|
||||
|
@ -8,7 +8,7 @@
|
||||
// LICENSE.TXT for details.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "cling/Interpreter/RuntimeException.h"
|
||||
#include "cling/Interpreter/Exception.h"
|
||||
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "clang/Sema/Sema.h"
|
||||
@ -18,32 +18,30 @@ extern "C" {
|
||||
void cling__runtime__internal__throwNullDerefException(void* Sema, void* Expr) {
|
||||
clang::Sema* S = (clang::Sema*)Sema;
|
||||
clang::Expr* E = (clang::Expr*)Expr;
|
||||
throw cling::runtime::NullDerefException(S, E);
|
||||
throw cling::NullDerefException(S, E);
|
||||
}
|
||||
}
|
||||
|
||||
namespace cling {
|
||||
namespace runtime {
|
||||
// Pin vtable
|
||||
InterpreterException::~InterpreterException() {}
|
||||
// Pin vtable
|
||||
InterpreterException::~InterpreterException() {}
|
||||
|
||||
const char* InterpreterException::what() const throw() {
|
||||
return "runtime_exception\n";
|
||||
}
|
||||
const char* InterpreterException::what() const throw() {
|
||||
return "runtime_exception\n";
|
||||
}
|
||||
|
||||
|
||||
NullDerefException::NullDerefException(clang::Sema* S, clang::Expr* E)
|
||||
: m_Sema(S), m_Arg(E) {}
|
||||
NullDerefException::NullDerefException(clang::Sema* S, clang::Expr* E)
|
||||
: m_Sema(S), m_Arg(E) {}
|
||||
|
||||
NullDerefException::~NullDerefException() {}
|
||||
NullDerefException::~NullDerefException() {}
|
||||
|
||||
const char* NullDerefException::what() const throw() {
|
||||
return "Trying to dereference null pointer or trying to call routine taking non-null arguments";
|
||||
}
|
||||
const char* NullDerefException::what() const throw() {
|
||||
return "Trying to dereference null pointer or trying to call routine taking non-null arguments";
|
||||
}
|
||||
|
||||
void NullDerefException::diagnose() const throw() {
|
||||
m_Sema->Diag(m_Arg->getLocStart(), clang::diag::warn_null_arg)
|
||||
<< m_Arg->getSourceRange();
|
||||
}
|
||||
} // end namespace runtime
|
||||
void NullDerefException::diagnose() const throw() {
|
||||
m_Sema->Diag(m_Arg->getLocStart(), clang::diag::warn_null_arg)
|
||||
<< m_Arg->getSourceRange();
|
||||
}
|
||||
} // end namespace cling
|
@ -34,7 +34,7 @@ $(ObjRootDir)/cling-compiledata.h: FORCE
|
||||
@diff -q $@_tmp $@ > /dev/null 2>&1 || mv $@_tmp $@
|
||||
@rm -f $@_tmp
|
||||
|
||||
$(ObjRootDir)/RuntimeException.o: CXX.Flags := $(subst -fno-exceptions,,$(CXX.Flags))
|
||||
$(ObjRootDir)/Exception.o: CXX.Flags := $(subst -fno-exceptions,,$(CXX.Flags))
|
||||
$(ObjRootDir)/CIFactory.o: $(ObjRootDir)/cling-compiledata.h
|
||||
$(ObjRootDir)/CIFactory.o: CXX.Flags += -I$(ObjRootDir) -pthread
|
||||
$(ObjRootDir)/Interpreter.o: $(ObjRootDir)/cling-compiledata.h
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "cling/UserInterface/UserInterface.h"
|
||||
|
||||
#include "cling/UserInterface/CompilationException.h"
|
||||
#include "cling/Interpreter/RuntimeException.h"
|
||||
#include "cling/Interpreter/Exception.h"
|
||||
#include "cling/MetaProcessor/MetaProcessor.h"
|
||||
#include "textinput/TextInput.h"
|
||||
#include "textinput/StreamReader.h"
|
||||
|
@ -491,7 +491,7 @@ INCLUDE_CLING_FILES := \
|
||||
include/cling/Interpreter/Interpreter.h \
|
||||
include/cling/Interpreter/InvocationOptions.h \
|
||||
include/cling/Interpreter/LookupHelper.h \
|
||||
include/cling/Interpreter/RuntimeException.h \
|
||||
include/cling/Interpreter/Exception.h \
|
||||
include/cling/Interpreter/RuntimeUniverse.h \
|
||||
include/cling/Interpreter/Transaction.h \
|
||||
include/cling/Interpreter/Value.h \
|
||||
|
Loading…
Reference in New Issue
Block a user