[clang] [clang][analyzer] Model more wide-character versions of string functions (PR #113908)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 30 00:59:10 PDT 2024


================
@@ -2524,8 +2625,33 @@ void CStringChecker::evalStdCopyCommon(CheckerContext &C,
   C.addTransition(State);
 }
 
-void CStringChecker::evalMemset(CheckerContext &C,
-                                const CallEvent &Call) const {
+namespace {
+CharUnits getSizeOfUnit(CharKind CK, CheckerContext &C) {
+  assert(CK == CK_Regular || CK == CK_Wide);
+  auto UnitType =
+      CK == CK_Regular ? C.getASTContext().CharTy : C.getASTContext().WCharTy;
+
+  return C.getASTContext().getTypeSizeInChars(UnitType);
+}
+
+SVal getCharValCast(CharKind CK, CheckerContext &C, ProgramStateRef State,
----------------
steakhal wrote:

```suggestion
static SVal getCharValCast(CharKind CK, CheckerContext &C, ProgramStateRef State,
```

https://github.com/llvm/llvm-project/pull/113908


More information about the cfe-commits mailing list