summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorAndy Gibbs <andyg1001@hotmail.co.uk>2015-12-17 16:43:53 +0000
committerAndy Gibbs <andyg1001@hotmail.co.uk>2015-12-17 16:43:53 +0000
commit33a0eb740e59d5498c835fd8d41f78ef7359e4a8 (patch)
tree57e91693ee8377a011b37ec65364f415e67b3986 /llvm
parent2e9207150a6ed1f02796cb1c4e5164138fe80e39 (diff)
downloadbcm5719-llvm-33a0eb740e59d5498c835fd8d41f78ef7359e4a8.tar.gz
bcm5719-llvm-33a0eb740e59d5498c835fd8d41f78ef7359e4a8.zip
Revert r254592 (virtual dtor in SCEVPredicate).
Clang has better diagnostics in this case. It is not necessary therefore to change the destructor to avoid what is effectively an invalid warning in gcc. Instead, better handle the warning flags given to the compiler. llvm-svn: 255905
Diffstat (limited to 'llvm')
-rw-r--r--llvm/cmake/modules/HandleLLVMOptions.cmake27
-rw-r--r--llvm/include/llvm/Analysis/ScalarEvolution.h2
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp2
3 files changed, 18 insertions, 13 deletions
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index f4ac6d7a73f..d583d0ee95c 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -391,16 +391,23 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
# Check if -Wnon-virtual-dtor warns even though the class is marked final.
# If it does, don't add it. So it won't be added on clang 3.4 and older.
# This also catches cases when -Wnon-virtual-dtor isn't supported by
- # the compiler at all.
- set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11 -Werror=non-virtual-dtor")
- CHECK_CXX_SOURCE_COMPILES("class base {public: virtual void anchor();protected: ~base();};
- class derived final : public base { public: ~derived();};
- int main() { return 0; }"
- CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR)
- set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
- append_if(CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR
- "-Wnon-virtual-dtor" CMAKE_CXX_FLAGS)
+ # the compiler at all. This flag is not activated for gcc since it will
+ # incorrectly identify a protected non-virtual base when there is a friend
+ # declaration.
+ if (NOT CMAKE_COMPILER_IS_GNUCXX)
+ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11 -Werror=non-virtual-dtor")
+ CHECK_CXX_SOURCE_COMPILES("class base {public: virtual void anchor();protected: ~base();};
+ class derived final : public base { public: ~derived();};
+ int main() { return 0; }"
+ CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR)
+ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+ append_if(CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR
+ "-Wnon-virtual-dtor" CMAKE_CXX_FLAGS)
+ endif()
+
+ # Enable -Wdelete-non-virtual-dtor if available.
+ add_flag_if_supported("-Wdelete-non-virtual-dtor" DELETE_NON_VIRTUAL_DTOR_FLAG)
# Check if -Wcomment is OK with an // comment ending with '\' if the next
# line is also a // comment.
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index 15565daf6d3..012fafb67a4 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -183,7 +183,7 @@ namespace llvm {
protected:
SCEVPredicateKind Kind;
- virtual ~SCEVPredicate();
+ ~SCEVPredicate() = default;
SCEVPredicate(const SCEVPredicate&) = default;
SCEVPredicate &operator=(const SCEVPredicate&) = default;
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 1c2fb3d1ed0..e5d8109fcbb 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -9628,8 +9628,6 @@ SCEVPredicate::SCEVPredicate(const FoldingSetNodeIDRef ID,
SCEVPredicateKind Kind)
: FastID(ID), Kind(Kind) {}
-SCEVPredicate::~SCEVPredicate() {}
-
SCEVEqualPredicate::SCEVEqualPredicate(const FoldingSetNodeIDRef ID,
const SCEVUnknown *LHS,
const SCEVConstant *RHS)
OpenPOWER on IntegriCloud