Skip to content

Commit

Permalink
[clang-dataflow][NFC] Mark test analysis classes as final.
Browse files Browse the repository at this point in the history
Change from marking individual methods as `final` to marking the whole class.

Differential Revision: https://reviews.llvm.org/D135923
  • Loading branch information
ymand committed Oct 14, 2022
1 parent de6dfbb commit 13cd184
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,7 @@ TEST_F(NoreturnDestructorTest, ConditionalOperatorNestedBranchReturns) {
}

// 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)
Expand Down Expand Up @@ -356,7 +353,7 @@ class SpecialBoolAnalysis

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")
Expand All @@ -377,7 +374,7 @@ class SpecialBoolAnalysis
// 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")
Expand Down Expand Up @@ -469,7 +466,7 @@ TEST_F(JoinFlowConditionsTest, JoinDistinctButProvablyEquivalentValues) {
});
}

class OptionalIntAnalysis
class OptionalIntAnalysis final
: public DataflowAnalysis<OptionalIntAnalysis, NoopLattice> {
public:
explicit OptionalIntAnalysis(ASTContext &Context)
Expand Down Expand Up @@ -514,7 +511,7 @@ class OptionalIntAnalysis

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")
Expand All @@ -529,7 +526,7 @@ class OptionalIntAnalysis

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")
Expand Down

0 comments on commit 13cd184

Please sign in to comment.