Skip to content

Commit

Permalink
[analyzer][NFC] Simplify CStringChecker strong types
Browse files Browse the repository at this point in the history
  • Loading branch information
steakhal committed Jul 7, 2023
1 parent 6ef16f2 commit d68aae3
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,12 @@ using namespace std::placeholders;

namespace {
struct AnyArgExpr {
// FIXME: Remove constructor in C++17 to turn it into an aggregate.
AnyArgExpr(const Expr *Expression, unsigned ArgumentIndex)
: Expression{Expression}, ArgumentIndex{ArgumentIndex} {}
const Expr *Expression;
unsigned ArgumentIndex;
};

struct SourceArgExpr : AnyArgExpr {
using AnyArgExpr::AnyArgExpr; // FIXME: Remove using in C++17.
};

struct DestinationArgExpr : AnyArgExpr {
using AnyArgExpr::AnyArgExpr; // FIXME: Same.
};

struct SizeArgExpr : AnyArgExpr {
using AnyArgExpr::AnyArgExpr; // FIXME: Same.
};
struct SourceArgExpr : AnyArgExpr {};
struct DestinationArgExpr : AnyArgExpr {};
struct SizeArgExpr : AnyArgExpr {};

using ErrorMessage = SmallString<128>;
enum class AccessKind { write, read };
Expand Down Expand Up @@ -1425,7 +1413,7 @@ void CStringChecker::evalMemmove(CheckerContext &C, const CallExpr *CE,

void CStringChecker::evalBcopy(CheckerContext &C, const CallExpr *CE) const {
// void bcopy(const void *src, void *dst, size_t n);
SourceArgExpr Src(CE->getArg(0), 0);
SourceArgExpr Src{CE->getArg(0), 0};
DestinationArgExpr Dest = {CE->getArg(1), 1};
SizeArgExpr Size = {CE->getArg(2), 2};

Expand Down

0 comments on commit d68aae3

Please sign in to comment.