Use LLVM_NOEXCEPT and LLVM_CONSTEXPR macros.

This commit is contained in:
Frederich Munch 2016-09-05 03:19:50 -04:00 committed by sftnight
parent 4731d83009
commit e4ffea8cd4
5 changed files with 13 additions and 28 deletions

View File

@ -10,16 +10,9 @@
#ifndef CLING_RUNTIME_EXCEPTION_H
#define CLING_RUNTIME_EXCEPTION_H
#include "llvm/Support/Compiler.h"
#include <exception>
#ifndef CLING_NOEXCEPT
# if defined(_MSC_VER) && (_MSC_VER < 1900)
# define CLING_NOEXCEPT
# else
# define CLING_NOEXCEPT noexcept
# endif
#endif
namespace clang {
class Sema;
class Expr;
@ -31,9 +24,9 @@ namespace cling {
///
class InterpreterException : public std::exception {
public:
virtual ~InterpreterException() CLING_NOEXCEPT;
virtual ~InterpreterException() LLVM_NOEXCEPT;
virtual const char* what() const CLING_NOEXCEPT;
virtual const char* what() const LLVM_NOEXCEPT;
virtual void diagnose() const {}
};
@ -50,9 +43,9 @@ namespace cling {
DerefType m_Type;
public:
InvalidDerefException(clang::Sema* S, clang::Expr* E, DerefType type);
virtual ~InvalidDerefException() CLING_NOEXCEPT;
virtual ~InvalidDerefException() LLVM_NOEXCEPT;
const char* what() const CLING_NOEXCEPT override;
const char* what() const LLVM_NOEXCEPT override;
void diagnose() const override;
};
} // end namespace cling

View File

@ -32,8 +32,8 @@ namespace cling {
public:
CompilationException(const std::string& reason):
std::runtime_error(reason) {}
~CompilationException() noexcept; // vtable pinned to UserInterface.cpp
virtual const char* what() const throw() {
~CompilationException() LLVM_NOEXCEPT; // vtable pinned to UserInterface.cpp
virtual const char* what() const LLVM_NOEXCEPT {
return std::runtime_error::what(); }
};
}

View File

@ -14,14 +14,6 @@
#include "clang/AST/DeclVisitor.h"
#ifndef CLING_CONSTEXPR_FUNC
# if defined(_MSC_VER) && (_MSC_VER < 1900)
# define CLING_CONSTEXPR_FUNC
# else
# define CLING_CONSTEXPR_FUNC constexpr
# endif
#endif
namespace clang {
class CodeGenerator;
@ -260,7 +252,7 @@ namespace clang {
///
void CollectFilesToUncache(SourceLocation Loc);
CLING_CONSTEXPR_FUNC static bool isDefinition(void*) { return false; }
LLVM_CONSTEXPR static bool isDefinition(void*) { return false; }
static bool isDefinition(TagDecl* R);
static void resetDefinitionData(void*) {

View File

@ -53,15 +53,15 @@ void* cling_runtime_internal_throwIfInvalidPointer(void* Interp, void* Expr,
namespace cling {
// Pin vtable
InterpreterException::~InterpreterException() noexcept {}
InterpreterException::~InterpreterException() LLVM_NOEXCEPT {}
const char* InterpreterException::what() const noexcept {
const char* InterpreterException::what() const LLVM_NOEXCEPT {
return "runtime_exception\n";
}
InvalidDerefException::~InvalidDerefException() noexcept {}
InvalidDerefException::~InvalidDerefException() LLVM_NOEXCEPT {}
const char* InvalidDerefException::what() const noexcept {
const char* InvalidDerefException::what() const LLVM_NOEXCEPT {
// Invalid memory access.
if (m_Type == cling::InvalidDerefException::DerefType::INVALID_MEM)
return "Trying to access a pointer that points to an invalid memory address.";

View File

@ -111,7 +111,7 @@ namespace {
namespace cling {
// Declared in CompilationException.h; vtable pinned here.
CompilationException::~CompilationException() noexcept {}
CompilationException::~CompilationException() LLVM_NOEXCEPT {}
UserInterface::UserInterface(Interpreter& interp) {
// We need stream that doesn't close its file descriptor, thus we are not