Skip to content

Commit 58ebac8

Browse files
committed
Fix -Wnon-virtual-dtor warnings and renable -Werror
This adds a destructor to TreeVisitor to fix the following warning: 'TreeVisitor' has virtual functions but non-virtual destructor [-Wnon-virtual-dtor]
1 parent 778c8e2 commit 58ebac8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bindgen/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ execute_process(COMMAND ${LLVM_CONFIG_PROGRAM} --system-libs --link-static
4646
include_directories(SYSTEM ${LLVM_INCLUDE_DIR})
4747

4848
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLVM_CXX_FLAGS}")
49+
add_compile_options(-fexceptions -std=c++11 -Wall -Wconversion -Werror)
4950

5051
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
5152
# macOS does not guarantee backwards compatible system calls and therefore
@@ -57,8 +58,6 @@ else()
5758
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LLVM_LINKER_FLAGS} -static")
5859
endif()
5960

60-
add_compile_options(-Wall -Wconversion)
61-
6261
add_executable(bindgen
6362
Main.cpp
6463
visitor/ScalaFrontendAction.h

bindgen/visitor/TreeVisitor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class TreeVisitor : public clang::RecursiveASTVisitor<TreeVisitor> {
2626
TreeVisitor(clang::CompilerInstance *CI, IR &ir)
2727
: astContext(&(CI->getASTContext())), typeTranslator(astContext, ir),
2828
cycleDetection(typeTranslator), ir(ir) {}
29+
virtual ~TreeVisitor() {}
2930

3031
virtual bool VisitFunctionDecl(clang::FunctionDecl *func);
3132
virtual bool VisitTypedefDecl(clang::TypedefDecl *tpdef);

0 commit comments

Comments
 (0)