[PATCH] D130470: [clang][analyzer] Add more wide-character functions to CStringChecker

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 27 05:57:15 PDT 2022


balazske added a comment.

A related question:
Is it better to have a more generic function like this:

  void CStringChecker::evalMemmove(CheckerContext &C, const CallExpr *CE,
                                   bool IsRestricted, bool IsMempcpy, bool IsWide) const {
    // void *memmove(void *dst, const void *src, size_t n);
    // The return value is the address of the destination buffer.
    DestinationArgExpr Dest = {CE->getArg(0), 0};
    SourceArgExpr Src = {CE->getArg(1), 1};
    SizeArgExpr Size = {CE->getArg(2), 2};
  
    evalCopyCommon(C, CE, C.getState(), Size, Dest, Src, IsRestricted, IsMempcpy,
                   IsWide);
  }

(Instead of `bool` enums can be used.) Or make additional versions of the eval functions and remove the `IsWide` argument (this is even more code repetition)?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130470/new/

https://reviews.llvm.org/D130470



More information about the cfe-commits mailing list