summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-11-18 09:31:53 +0000
committerAlexey Samsonov <samsonov@google.com>2013-11-18 09:31:53 +0000
commitb21ab43cfc3fa0dacf5c95f04e58b6d804b59a16 (patch)
tree12f522231a5b3a875b1ac733a5bf1b1025088c7c /examples
parent69b2447b6a3fcc303e03cba8c7c50d745b0284d2 (diff)
Revert r194865 and r194874.
This change is incorrect. If you delete virtual destructor of both a base class and a subclass, then the following code: Base *foo = new Child(); delete foo; will not cause the destructor for members of Child class. As a result, I observe plently of memory leaks. Notable examples I investigated are: ObjectBuffer and ObjectBufferStream, AttributeImpl and StringSAttributeImpl. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194997 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples')
-rw-r--r--examples/ExceptionDemo/ExceptionDemo.cpp4
-rw-r--r--examples/Kaleidoscope/Chapter2/toy.cpp16
-rw-r--r--examples/Kaleidoscope/Chapter3/toy.cpp4
-rw-r--r--examples/Kaleidoscope/Chapter4/toy.cpp4
-rw-r--r--examples/Kaleidoscope/Chapter5/toy.cpp4
-rw-r--r--examples/Kaleidoscope/Chapter6/toy.cpp4
-rw-r--r--examples/Kaleidoscope/Chapter7/toy.cpp4
7 files changed, 7 insertions, 33 deletions
diff --git a/examples/ExceptionDemo/ExceptionDemo.cpp b/examples/ExceptionDemo/ExceptionDemo.cpp
index c935206b811..61b175091b7 100644
--- a/examples/ExceptionDemo/ExceptionDemo.cpp
+++ b/examples/ExceptionDemo/ExceptionDemo.cpp
@@ -1577,11 +1577,9 @@ public:
std::runtime_error::operator=(toCopy)));
}
- ~OurCppRunException (void) throw ();
+ ~OurCppRunException (void) throw () {}
};
-OurCppRunException::~OurCppRunException() throw () {}
-
/// Throws foreign C++ exception.
/// @param ignoreIt unused parameter that allows function to match implied
diff --git a/examples/Kaleidoscope/Chapter2/toy.cpp b/examples/Kaleidoscope/Chapter2/toy.cpp
index 43eeb1c2cd2..2dc6711eed7 100644
--- a/examples/Kaleidoscope/Chapter2/toy.cpp
+++ b/examples/Kaleidoscope/Chapter2/toy.cpp
@@ -79,39 +79,28 @@ static int gettok() {
/// ExprAST - Base class for all expression nodes.
class ExprAST {
public:
- virtual ~ExprAST();
+ virtual ~ExprAST() {}
};
-ExprAST::~ExprAST() {}
-
/// NumberExprAST - Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
public:
NumberExprAST(double val) {}
- virtual ~NumberExprAST();
};
-NumberExprAST::~NumberExprAST() {}
-
/// VariableExprAST - Expression class for referencing a variable, like "a".
class VariableExprAST : public ExprAST {
std::string Name;
public:
VariableExprAST(const std::string &name) : Name(name) {}
- virtual ~VariableExprAST();
};
-VariableExprAST::~VariableExprAST() {}
-
/// BinaryExprAST - Expression class for a binary operator.
class BinaryExprAST : public ExprAST {
public:
BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) {}
- virtual ~BinaryExprAST();
};
-BinaryExprAST::~BinaryExprAST() {}
-
/// CallExprAST - Expression class for function calls.
class CallExprAST : public ExprAST {
std::string Callee;
@@ -119,11 +108,8 @@ class CallExprAST : public ExprAST {
public:
CallExprAST(const std::string &callee, std::vector<ExprAST*> &args)
: Callee(callee), Args(args) {}
- virtual ~CallExprAST();
};
-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).
diff --git a/examples/Kaleidoscope/Chapter3/toy.cpp b/examples/Kaleidoscope/Chapter3/toy.cpp
index d25aa5d4d7f..0fb64e3a54d 100644
--- a/examples/Kaleidoscope/Chapter3/toy.cpp
+++ b/examples/Kaleidoscope/Chapter3/toy.cpp
@@ -84,12 +84,10 @@ static int gettok() {
/// ExprAST - Base class for all expression nodes.
class ExprAST {
public:
- virtual ~ExprAST();
+ virtual ~ExprAST() {}
virtual Value *Codegen() = 0;
};
-ExprAST::~ExprAST() {}
-
/// NumberExprAST - Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
diff --git a/examples/Kaleidoscope/Chapter4/toy.cpp b/examples/Kaleidoscope/Chapter4/toy.cpp
index a52b5552a29..0e41cc14ead 100644
--- a/examples/Kaleidoscope/Chapter4/toy.cpp
+++ b/examples/Kaleidoscope/Chapter4/toy.cpp
@@ -91,12 +91,10 @@ static int gettok() {
/// ExprAST - Base class for all expression nodes.
class ExprAST {
public:
- virtual ~ExprAST();
+ virtual ~ExprAST() {}
virtual Value *Codegen() = 0;
};
-ExprAST::~ExprAST() {}
-
/// NumberExprAST - Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
diff --git a/examples/Kaleidoscope/Chapter5/toy.cpp b/examples/Kaleidoscope/Chapter5/toy.cpp
index 2770a380b7e..d5a88a5a693 100644
--- a/examples/Kaleidoscope/Chapter5/toy.cpp
+++ b/examples/Kaleidoscope/Chapter5/toy.cpp
@@ -100,12 +100,10 @@ static int gettok() {
/// ExprAST - Base class for all expression nodes.
class ExprAST {
public:
- virtual ~ExprAST();
+ virtual ~ExprAST() {}
virtual Value *Codegen() = 0;
};
-ExprAST::~ExprAST() {}
-
/// NumberExprAST - Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
diff --git a/examples/Kaleidoscope/Chapter6/toy.cpp b/examples/Kaleidoscope/Chapter6/toy.cpp
index 2a0f212ef41..4d6a128cba2 100644
--- a/examples/Kaleidoscope/Chapter6/toy.cpp
+++ b/examples/Kaleidoscope/Chapter6/toy.cpp
@@ -105,12 +105,10 @@ static int gettok() {
/// ExprAST - Base class for all expression nodes.
class ExprAST {
public:
- virtual ~ExprAST();
+ virtual ~ExprAST() {}
virtual Value *Codegen() = 0;
};
-ExprAST::~ExprAST() {}
-
/// NumberExprAST - Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
diff --git a/examples/Kaleidoscope/Chapter7/toy.cpp b/examples/Kaleidoscope/Chapter7/toy.cpp
index 00628010d60..beb0c0099cc 100644
--- a/examples/Kaleidoscope/Chapter7/toy.cpp
+++ b/examples/Kaleidoscope/Chapter7/toy.cpp
@@ -109,12 +109,10 @@ static int gettok() {
/// ExprAST - Base class for all expression nodes.
class ExprAST {
public:
- virtual ~ExprAST();
+ virtual ~ExprAST() {}
virtual Value *Codegen() = 0;
};
-ExprAST::~ExprAST() {}
-
/// NumberExprAST - Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;