diff options
author | Juergen Ributzka <juergen@apple.com> | 2013-11-19 03:08:35 +0000 |
---|---|---|
committer | Juergen Ributzka <juergen@apple.com> | 2013-11-19 03:08:35 +0000 |
commit | 05c5a93283b830032532321fdc4c0fe6b8473aac (patch) | |
tree | a6dd62ef804f1e97d576d5741db7fb04f1ce771e /llvm/examples/Kaleidoscope/Chapter3/toy.cpp | |
parent | ef9315d942a0499141769e3c53c8830ee1e74841 (diff) | |
download | bcm5719-llvm-05c5a93283b830032532321fdc4c0fe6b8473aac.tar.gz bcm5719-llvm-05c5a93283b830032532321fdc4c0fe6b8473aac.zip |
[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.
llvm-svn: 195092
Diffstat (limited to 'llvm/examples/Kaleidoscope/Chapter3/toy.cpp')
-rw-r--r-- | llvm/examples/Kaleidoscope/Chapter3/toy.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/examples/Kaleidoscope/Chapter3/toy.cpp b/llvm/examples/Kaleidoscope/Chapter3/toy.cpp index 2494345c3f1..a7b60ba3220 100644 --- a/llvm/examples/Kaleidoscope/Chapter3/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter3/toy.cpp @@ -80,17 +80,14 @@ static int gettok() { //===----------------------------------------------------------------------===// // 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; @@ -150,6 +147,7 @@ public: Function *Codegen(); }; +} // end anonymous namespace //===----------------------------------------------------------------------===// // Parser |