[llvm] 4852c77 - [SCEV] Fix GCC -Wnon-virtual-dtor
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 1 01:12:37 PDT 2021
Author: Fangrui Song
Date: 2021-09-01T01:12:32-07:00
New Revision: 4852c770fe8703145dd2a35395985646ce57a454
URL: https://github.com/llvm/llvm-project/commit/4852c770fe8703145dd2a35395985646ce57a454
DIFF: https://github.com/llvm/llvm-project/commit/4852c770fe8703145dd2a35395985646ce57a454.diff
LOG: [SCEV] Fix GCC -Wnon-virtual-dtor
SCEVPredicate has a friend declaration. The friend can technically call the
protected destructor, so the warning is legitimate. Clang simply doesn't implement
the friend check.
Make the dtor virtual to fix the issue.
Added:
Modified:
llvm/include/llvm/Analysis/ScalarEvolution.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index 6ae865e011cf0..fa406fb095ce1 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -209,7 +209,8 @@ class SCEVPredicate : public FoldingSetNode {
protected:
SCEVPredicateKind Kind;
- ~SCEVPredicate() = default;
+ // Use virtual to suppress -Wnon-virtual-dtor in the presence of friend.
+ virtual ~SCEVPredicate() = default;
SCEVPredicate(const SCEVPredicate &) = default;
SCEVPredicate &operator=(const SCEVPredicate &) = default;
More information about the llvm-commits
mailing list