ymandel created this revision.
ymandel added a reviewer: xazax.hun.
Herald added a subscriber: rnkovacs.
Herald added a project: All.
ymandel requested review of this revision.
Herald added a project: clang.
Change from marking individual methods as `final` to marking the whole class.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D135923
Files:
clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
Index: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
===================================================================
--- clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
+++ clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
@@ -311,10 +311,7 @@
}
// Models an analysis that uses flow conditions.
-//
-// FIXME: Here and below: change class to final and final methods to override,
-// since we're marking them all as final.
-class SpecialBoolAnalysis
+class SpecialBoolAnalysis final
: public DataflowAnalysis<SpecialBoolAnalysis, NoopLattice> {
public:
explicit SpecialBoolAnalysis(ASTContext &Context)
@@ -356,7 +353,7 @@
bool compareEquivalent(QualType Type, const Value &Val1,
const Environment &Env1, const Value &Val2,
- const Environment &Env2) final {
+ const Environment &Env2) override {
const auto *Decl = Type->getAsCXXRecordDecl();
if (Decl == nullptr || Decl->getIdentifier() == nullptr ||
Decl->getName() != "SpecialBool")
@@ -377,7 +374,7 @@
// Always returns `true` to accept the `MergedVal`.
bool merge(QualType Type, const Value &Val1, const Environment &Env1,
const Value &Val2, const Environment &Env2, Value &MergedVal,
- Environment &MergedEnv) final {
+ Environment &MergedEnv) override {
const auto *Decl = Type->getAsCXXRecordDecl();
if (Decl == nullptr || Decl->getIdentifier() == nullptr ||
Decl->getName() != "SpecialBool")
@@ -469,7 +466,7 @@
});
}
-class OptionalIntAnalysis
+class OptionalIntAnalysis final
: public DataflowAnalysis<OptionalIntAnalysis, NoopLattice> {
public:
explicit OptionalIntAnalysis(ASTContext &Context)
@@ -514,7 +511,7 @@
bool compareEquivalent(QualType Type, const Value &Val1,
const Environment &Env1, const Value &Val2,
- const Environment &Env2) final {
+ const Environment &Env2) override {
// Nothing to say about a value that does not model an `OptionalInt`.
if (!Type->isRecordType() ||
Type->getAsCXXRecordDecl()->getQualifiedNameAsString() !=
"OptionalInt")
@@ -529,7 +526,7 @@
bool merge(QualType Type, const Value &Val1, const Environment &Env1,
const Value &Val2, const Environment &Env2, Value &MergedVal,
- Environment &MergedEnv) final {
+ Environment &MergedEnv) override {
// Nothing to say about a value that does not model an `OptionalInt`.
if (!Type->isRecordType() ||
Type->getAsCXXRecordDecl()->getQualifiedNameAsString() !=
"OptionalInt")
Index: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
===================================================================
--- clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
+++ clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
@@ -311,10 +311,7 @@
}
// Models an analysis that uses flow conditions.
-//
-// FIXME: Here and below: change class to final and final methods to override,
-// since we're marking them all as final.
-class SpecialBoolAnalysis
+class SpecialBoolAnalysis final
: public DataflowAnalysis<SpecialBoolAnalysis, NoopLattice> {
public:
explicit SpecialBoolAnalysis(ASTContext &Context)
@@ -356,7 +353,7 @@
bool compareEquivalent(QualType Type, const Value &Val1,
const Environment &Env1, const Value &Val2,
- const Environment &Env2) final {
+ const Environment &Env2) override {
const auto *Decl = Type->getAsCXXRecordDecl();
if (Decl == nullptr || Decl->getIdentifier() == nullptr ||
Decl->getName() != "SpecialBool")
@@ -377,7 +374,7 @@
// Always returns `true` to accept the `MergedVal`.
bool merge(QualType Type, const Value &Val1, const Environment &Env1,
const Value &Val2, const Environment &Env2, Value &MergedVal,
- Environment &MergedEnv) final {
+ Environment &MergedEnv) override {
const auto *Decl = Type->getAsCXXRecordDecl();
if (Decl == nullptr || Decl->getIdentifier() == nullptr ||
Decl->getName() != "SpecialBool")
@@ -469,7 +466,7 @@
});
}
-class OptionalIntAnalysis
+class OptionalIntAnalysis final
: public DataflowAnalysis<OptionalIntAnalysis, NoopLattice> {
public:
explicit OptionalIntAnalysis(ASTContext &Context)
@@ -514,7 +511,7 @@
bool compareEquivalent(QualType Type, const Value &Val1,
const Environment &Env1, const Value &Val2,
- const Environment &Env2) final {
+ const Environment &Env2) override {
// Nothing to say about a value that does not model an `OptionalInt`.
if (!Type->isRecordType() ||
Type->getAsCXXRecordDecl()->getQualifiedNameAsString() != "OptionalInt")
@@ -529,7 +526,7 @@
bool merge(QualType Type, const Value &Val1, const Environment &Env1,
const Value &Val2, const Environment &Env2, Value &MergedVal,
- Environment &MergedEnv) final {
+ Environment &MergedEnv) override {
// Nothing to say about a value that does not model an `OptionalInt`.
if (!Type->isRecordType() ||
Type->getAsCXXRecordDecl()->getQualifiedNameAsString() != "OptionalInt")
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits