aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-11-19 06:35:35 +0000
committerBill Wendling <isanbard@gmail.com>2013-11-19 06:35:35 +0000
commit9d7c776d32c8a4d64b37a91c2d627629cf1498ef (patch)
tree92f96f6c5615bd64c6f734f1534a7aa29a47c67a /tools
parentdb56a39b56db896a1043f3c2b6e5baf82d28cb0e (diff)
downloadexternal_llvm-9d7c776d32c8a4d64b37a91c2d627629cf1498ef.zip
external_llvm-9d7c776d32c8a4d64b37a91c2d627629cf1498ef.tar.gz
external_llvm-9d7c776d32c8a4d64b37a91c2d627629cf1498ef.tar.bz2
Merging r195092:
------------------------------------------------------------------------ r195092 | ributzka | 2013-11-18 19:08:35 -0800 (Mon, 18 Nov 2013) | 5 lines [weak vtables] Place class definitions into anonymous namespaces to prevent weak vtables. This patch places class definitions in implementation files into anonymous namespaces to prevent weak vtables. This eliminates the need of providing an out-of-line definition to pin the vtable explicitly to the file. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@195111 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-stress/llvm-stress.cpp38
1 files changed, 6 insertions, 32 deletions
diff --git a/tools/llvm-stress/llvm-stress.cpp b/tools/llvm-stress/llvm-stress.cpp
index 672e481..fd10baf 100644
--- a/tools/llvm-stress/llvm-stress.cpp
+++ b/tools/llvm-stress/llvm-stress.cpp
@@ -52,6 +52,7 @@ static cl::opt<bool> GenPPCFP128("generate-ppc-fp128",
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
@@ -128,7 +129,7 @@ public:
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;
@@ -287,7 +288,6 @@ protected:
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();
@@ -298,7 +298,6 @@ struct LoadModifier: public Modifier {
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();
@@ -317,7 +316,6 @@ struct StoreModifier: public Modifier {
struct BinModifier: public Modifier {
BinModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual ~BinModifier();
virtual void Act() {
Value *Val0 = getRandomVal();
@@ -362,8 +360,6 @@ struct BinModifier: public Modifier {
/// 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();
@@ -410,7 +406,6 @@ struct ConstModifier: public Modifier {
struct AllocaModifier: public Modifier {
AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R){}
- virtual ~AllocaModifier();
virtual void Act() {
Type *Tp = pickType();
@@ -421,7 +416,6 @@ struct AllocaModifier: public Modifier {
struct ExtractElementModifier: public Modifier {
ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
Modifier(BB, PT, R) {}
- virtual ~ExtractElementModifier();
virtual void Act() {
Value *Val0 = getRandomVectorValue();
@@ -435,8 +429,6 @@ struct ExtractElementModifier: public Modifier {
struct ShuffModifier: public Modifier {
ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual ~ShuffModifier();
-
virtual void Act() {
Value *Val0 = getRandomVectorValue();
@@ -465,7 +457,6 @@ struct ShuffModifier: public Modifier {
struct InsertElementModifier: public Modifier {
InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
Modifier(BB, PT, R) {}
- virtual ~InsertElementModifier();
virtual void Act() {
Value *Val0 = getRandomVectorValue();
@@ -482,8 +473,6 @@ struct InsertElementModifier: public Modifier {
struct CastModifier: public Modifier {
CastModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual ~CastModifier();
-
virtual void Act() {
Value *V = getRandomVal();
@@ -570,7 +559,6 @@ struct CastModifier: public Modifier {
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.
@@ -595,8 +583,6 @@ struct SelectModifier: public Modifier {
struct CmpModifier: public Modifier {
CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual ~CmpModifier();
-
virtual void Act() {
Value *Val0 = getRandomVal();
@@ -622,21 +608,9 @@ struct CmpModifier: public Modifier {
}
};
-// 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);
@@ -683,7 +657,7 @@ void FillFunction(Function *F, Random &R) {
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) {