return(outerCatchFunct);
}
-
+namespace {
/// Represents our foreign exceptions
class OurCppRunException : public std::runtime_error {
public:
std::runtime_error::operator=(toCopy)));
}
- ~OurCppRunException (void) throw ();
+ virtual ~OurCppRunException (void) throw () {}
};
-
-// Provide out-of-line definition to prevent weak vtable.
-OurCppRunException::~OurCppRunException() throw () {}
+} // end anonymous namespace
/// Throws foreign C++ exception.
/// @param ignoreIt unused parameter that allows function to match implied
//===----------------------------------------------------------------------===//
// Abstract Syntax Tree (aka Parse Tree)
//===----------------------------------------------------------------------===//
-
+namespace {
/// ExprAST - Base class for all expression nodes.
class ExprAST {
public:
- virtual ~ExprAST();
+ virtual ~ExprAST() {}
};
/// NumberExprAST - Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
public:
NumberExprAST(double val) {}
- virtual ~NumberExprAST();
};
/// VariableExprAST - Expression class for referencing a variable, like "a".
std::string Name;
public:
VariableExprAST(const std::string &name) : Name(name) {}
- virtual ~VariableExprAST();
};
/// BinaryExprAST - Expression class for a binary operator.
class BinaryExprAST : public ExprAST {
public:
BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) {}
- virtual ~BinaryExprAST();
};
/// CallExprAST - Expression class for function calls.
public:
CallExprAST(const std::string &callee, std::vector<ExprAST*> &args)
: Callee(callee), Args(args) {}
- virtual ~CallExprAST();
};
-// Provide out-of-line definitions to prevent weak vtables.
-ExprAST::~ExprAST() {}
-NumberExprAST::~NumberExprAST() {}
-VariableExprAST::~VariableExprAST() {}
-BinaryExprAST::~BinaryExprAST() {}
-CallExprAST::~CallExprAST() {}
-
/// PrototypeAST - This class represents the "prototype" for a function,
/// which captures its name, and its argument names (thus implicitly the number
/// of arguments the function takes).
public:
FunctionAST(PrototypeAST *proto, ExprAST *body) {}
};
+} // end anonymous namespace
//===----------------------------------------------------------------------===//
// Parser
/// Error* - These are little helper functions for error handling.
ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; }
-FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; }
static ExprAST *ParseExpression();
//===----------------------------------------------------------------------===//
// Abstract Syntax Tree (aka Parse Tree)
//===----------------------------------------------------------------------===//
-
+namespace {
/// ExprAST - Base class for all expression nodes.
class ExprAST {
public:
- virtual ~ExprAST();
+ virtual ~ExprAST() {}
virtual Value *Codegen() = 0;
};
-// Provide out-of-line definition to prevent weak vtable.
-ExprAST::~ExprAST() {}
-
/// NumberExprAST - Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
Function *Codegen();
};
+} // end anonymous namespace
//===----------------------------------------------------------------------===//
// Parser
//===----------------------------------------------------------------------===//
// Abstract Syntax Tree (aka Parse Tree)
//===----------------------------------------------------------------------===//
-
+namespace {
/// ExprAST - Base class for all expression nodes.
class ExprAST {
public:
- virtual ~ExprAST();
+ virtual ~ExprAST() {}
virtual Value *Codegen() = 0;
};
-// Provide out-of-line definition to prevent weak vtable.
-ExprAST::~ExprAST() {}
-
/// NumberExprAST - Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
Function *Codegen();
};
+} // end anonymous namespace
//===----------------------------------------------------------------------===//
// Parser
//===----------------------------------------------------------------------===//
// Abstract Syntax Tree (aka Parse Tree)
//===----------------------------------------------------------------------===//
-
+namespace {
/// ExprAST - Base class for all expression nodes.
class ExprAST {
public:
- virtual ~ExprAST();
+ virtual ~ExprAST() {}
virtual Value *Codegen() = 0;
};
-// Provide out-of-line definition to prevent weak vtable.
-ExprAST::~ExprAST() {}
-
/// NumberExprAST - Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
Function *Codegen();
};
+} // end anonymous namespace
//===----------------------------------------------------------------------===//
// Parser
//===----------------------------------------------------------------------===//
// Abstract Syntax Tree (aka Parse Tree)
//===----------------------------------------------------------------------===//
-
+namespace {
/// ExprAST - Base class for all expression nodes.
class ExprAST {
public:
- virtual ~ExprAST();
+ virtual ~ExprAST() {}
virtual Value *Codegen() = 0;
};
-// Provide out-of-line definition to prevent weak vtable.
-ExprAST::~ExprAST() {}
-
/// NumberExprAST - Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
Function *Codegen();
};
+} // end anonymous namespace
//===----------------------------------------------------------------------===//
// Parser
//===----------------------------------------------------------------------===//
// Abstract Syntax Tree (aka Parse Tree)
//===----------------------------------------------------------------------===//
-
+namespace {
/// ExprAST - Base class for all expression nodes.
class ExprAST {
public:
- virtual ~ExprAST();
+ virtual ~ExprAST() {}
virtual Value *Codegen() = 0;
};
-// Provide out-of-line definition to prevent weak vtable.
-ExprAST::~ExprAST() {}
-
/// NumberExprAST - Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
Function *Codegen();
};
+} // end anonymous namespace
//===----------------------------------------------------------------------===//
// Parser
static cl::opt<bool> GenX86MMX("generate-x86-mmx",
cl::desc("Generate X86 MMX floating-point values"), cl::init(false));
+namespace {
/// A utility class to provide a pseudo-random number generator which is
/// the same across all platforms. This is somewhat close to the libc
/// implementation. Note: This is not a cryptographically secure pseudorandom
BB(Block),PT(PT),Ran(R),Context(BB->getContext()) {}
/// virtual D'tor to silence warnings.
- virtual ~Modifier();
+ virtual ~Modifier() {}
/// Add a new instruction.
virtual void Act() = 0;
struct LoadModifier: public Modifier {
LoadModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual ~LoadModifier();
virtual void Act() {
// Try to use predefined pointers. If non exist, use undef pointer value;
Value *Ptr = getRandomPointerValue();
struct StoreModifier: public Modifier {
StoreModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual ~StoreModifier();
virtual void Act() {
// Try to use predefined pointers. If non exist, use undef pointer value;
Value *Ptr = getRandomPointerValue();
struct BinModifier: public Modifier {
BinModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual ~BinModifier();
virtual void Act() {
Value *Val0 = getRandomVal();
/// Generate constant values.
struct ConstModifier: public Modifier {
ConstModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual ~ConstModifier();
-
virtual void Act() {
Type *Ty = pickType();
struct AllocaModifier: public Modifier {
AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R){}
- virtual ~AllocaModifier();
virtual void Act() {
Type *Tp = pickType();
struct ExtractElementModifier: public Modifier {
ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
Modifier(BB, PT, R) {}
- virtual ~ExtractElementModifier();
virtual void Act() {
Value *Val0 = getRandomVectorValue();
struct ShuffModifier: public Modifier {
ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual ~ShuffModifier();
-
virtual void Act() {
Value *Val0 = getRandomVectorValue();
struct InsertElementModifier: public Modifier {
InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
Modifier(BB, PT, R) {}
- virtual ~InsertElementModifier();
virtual void Act() {
Value *Val0 = getRandomVectorValue();
struct CastModifier: public Modifier {
CastModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual ~CastModifier();
-
virtual void Act() {
Value *V = getRandomVal();
struct SelectModifier: public Modifier {
SelectModifier(BasicBlock *BB, PieceTable *PT, Random *R):
Modifier(BB, PT, R) {}
- virtual ~SelectModifier();
virtual void Act() {
// Try a bunch of different select configuration until a valid one is found.
struct CmpModifier: public Modifier {
CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual ~CmpModifier();
-
virtual void Act() {
Value *Val0 = getRandomVal();
}
};
-// Use out-of-line definitions to prevent weak vtables.
-Modifier::~Modifier() {}
-LoadModifier::~LoadModifier() {}
-StoreModifier::~StoreModifier() {}
-BinModifier::~BinModifier() {}
-ConstModifier::~ConstModifier() {}
-AllocaModifier::~AllocaModifier() {}
-ExtractElementModifier::~ExtractElementModifier() {}
-ShuffModifier::~ShuffModifier() {}
-InsertElementModifier::~InsertElementModifier() {}
-CastModifier::~CastModifier() {}
-SelectModifier::~SelectModifier() {}
-CmpModifier::~CmpModifier() {}
-
-void FillFunction(Function *F, Random &R) {
+} // end anonymous namespace
+
+static void FillFunction(Function *F, Random &R) {
// Create a legal entry block.
BasicBlock *BB = BasicBlock::Create(F->getContext(), "BB", F);
ReturnInst::Create(F->getContext(), BB);
SM->ActN(5); // Throw in a few stores.
}
-void IntroduceControlFlow(Function *F, Random &R) {
+static void IntroduceControlFlow(Function *F, Random &R) {
std::vector<Instruction*> BoolInst;
for (BasicBlock::iterator it = F->begin()->begin(),
e = F->begin()->end(); it != e; ++it) {
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "gtest/gtest.h"
-namespace llvm {
-
-struct VirtualRefCounted : public RefCountedBaseVPTR {
- virtual void f();
+namespace {
+struct VirtualRefCounted : public llvm::RefCountedBaseVPTR {
+ virtual void f() {}
};
+}
-// Provide out-of-line definition to prevent weak vtable.
-void VirtualRefCounted::f() {}
+namespace llvm {
// Run this test with valgrind to detect memory leaks.
TEST(IntrusiveRefCntPtr, RefCountedBaseVPTRCopyDoesNotLeak) {
delete static_cast<SectionMemoryManager*>(object);
}
+namespace {
class MCJITCAPITest : public testing::Test, public MCJITTestAPICommon {
protected:
MCJITCAPITest() {
UnsupportedOSs.push_back(Triple::Cygwin);
}
- virtual void SetUp();
-
+ virtual void SetUp() {
+ didCallAllocateCodeSection = false;
+ Module = 0;
+ Function = 0;
+ Engine = 0;
+ Error = 0;
+ }
+
virtual void TearDown() {
if (Engine)
LLVMDisposeExecutionEngine(Engine);
LLVMExecutionEngineRef Engine;
char *Error;
};
-
-// Provide out-of-line definition to prevent weak vtable.
-void MCJITCAPITest::SetUp() {
- didCallAllocateCodeSection = false;
- Module = 0;
- Function = 0;
- Engine = 0;
- Error = 0;
-}
+} // end anonymous namespace
TEST_F(MCJITCAPITest, simple_function) {
SKIP_UNSUPPORTED_PLATFORM;
using namespace llvm;
-class MCJITMultipleModuleTest : public testing::Test, public MCJITTestBase {
-public:
- virtual ~MCJITMultipleModuleTest();
-};
-
-// Provide out-of-line definition to prevent weak vtable.
-MCJITMultipleModuleTest::~MCJITMultipleModuleTest() {}
-
namespace {
+class MCJITMultipleModuleTest : public testing::Test, public MCJITTestBase {};
+
// FIXME: ExecutionEngine has no support empty modules
/*
TEST_F(MCJITMultipleModuleTest, multiple_empty_modules) {
using namespace llvm;
+namespace {
+
class MCJITTest : public testing::Test, public MCJITTestBase {
protected:
-
- virtual void SetUp();
+ virtual void SetUp() { M.reset(createEmptyModule("<main>")); }
};
-// Provide out-of-line definition to prevent weak vtable.
-void MCJITTest::SetUp() {
- M.reset(createEmptyModule("<main>"));
-}
-
-namespace {
-
// FIXME: Ensure creating an execution engine does not crash when constructed
// with a null module.
/*
}
#endif
+namespace {
// (instrs a, b, ...) Evaluate and union all arguments. Identical to AddOp.
struct InstrsOp : public SetTheory::Operator {
virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
- ArrayRef<SMLoc> Loc);
-};
-
-// Provide out-of-line definition to prevent weak vtable.
-void InstrsOp::apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
ArrayRef<SMLoc> Loc) {
- ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc);
-}
+ ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc);
+ }
+};
// (instregex "OpcPat",...) Find all instructions matching an opcode pattern.
//
const CodeGenTarget &Target;
InstRegexOp(const CodeGenTarget &t): Target(t) {}
- virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
- ArrayRef<SMLoc> Loc);
-};
-
-// Provide out-of-line definition to prevent weak vtable.
-void InstRegexOp::apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
- ArrayRef<SMLoc> Loc) {
- SmallVector<Regex*, 4> RegexList;
- for (DagInit::const_arg_iterator
- AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) {
- StringInit *SI = dyn_cast<StringInit>(*AI);
- if (!SI)
- PrintFatalError(Loc, "instregex requires pattern string: "
- + Expr->getAsString());
- std::string pat = SI->getValue();
- // Implement a python-style prefix match.
- if (pat[0] != '^') {
- pat.insert(0, "^(");
- pat.insert(pat.end(), ')');
- }
- RegexList.push_back(new Regex(pat));
- }
- for (CodeGenTarget::inst_iterator I = Target.inst_begin(),
- E = Target.inst_end(); I != E; ++I) {
- for (SmallVectorImpl<Regex*>::iterator
- RI = RegexList.begin(), RE = RegexList.end(); RI != RE; ++RI) {
- if ((*RI)->match((*I)->TheDef->getName()))
- Elts.insert((*I)->TheDef);
+ void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
+ ArrayRef<SMLoc> Loc) {
+ SmallVector<Regex*, 4> RegexList;
+ for (DagInit::const_arg_iterator
+ AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) {
+ StringInit *SI = dyn_cast<StringInit>(*AI);
+ if (!SI)
+ PrintFatalError(Loc, "instregex requires pattern string: "
+ + Expr->getAsString());
+ std::string pat = SI->getValue();
+ // Implement a python-style prefix match.
+ if (pat[0] != '^') {
+ pat.insert(0, "^(");
+ pat.insert(pat.end(), ')');
+ }
+ RegexList.push_back(new Regex(pat));
+ }
+ for (CodeGenTarget::inst_iterator I = Target.inst_begin(),
+ E = Target.inst_end(); I != E; ++I) {
+ for (SmallVectorImpl<Regex*>::iterator
+ RI = RegexList.begin(), RE = RegexList.end(); RI != RE; ++RI) {
+ if ((*RI)->match((*I)->TheDef->getName()))
+ Elts.insert((*I)->TheDef);
+ }
}
+ DeleteContainerPointers(RegexList);
}
- DeleteContainerPointers(RegexList);
-}
+};
+} // end anonymous namespace
/// CodeGenModels ctor interprets machine model records and populates maps.
CodeGenSchedModels::CodeGenSchedModels(RecordKeeper &RK,
}
+namespace {
class ExtendedIntegerType : public Type {
unsigned BitWidth;
public:
explicit ExtendedIntegerType(unsigned bits)
: Type(TK_ExtendedIntegerType), BitWidth(bits) {}
- virtual ~ExtendedIntegerType();
static bool classof(const Type *T) {
return T->getKind() == TK_ExtendedIntegerType;
}
}
};
-// Provide out-of-line definition to prevent weak vtable.
-ExtendedIntegerType::~ExtendedIntegerType() {}
-
class ExtendedVectorType : public Type {
EVT ElementType;
unsigned NumElements;
public:
ExtendedVectorType(EVT elty, unsigned num)
: Type(TK_ExtendedVectorType), ElementType(elty), NumElements(num) {}
- virtual ~ExtendedVectorType();
static bool classof(const Type *T) {
return T->getKind() == TK_ExtendedVectorType;
}
return NumElements;
}
};
-
-// Provide out-of-line definition to prevent weak vtable.
-ExtendedVectorType::~ExtendedVectorType() {}
+} // end anonymous namespace
static std::map<unsigned, const Type *>
ExtendedIntegerTypeMap;