[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 8 05:08:00 PST 2024


================
@@ -2515,6 +2518,57 @@ void CStringChecker::evalSprintfCommon(CheckerContext &C, const CallEvent &Call,
   C.addTransition(State);
 }
 
+void CStringChecker::evalGetentropy(CheckerContext &C,
+                                    const CallEvent &Call, CharKind CK) const {
+  DestinationArgExpr Buffer = {{Call.getArgExpr(0), 0}};
+  SizeArgExpr Size = {{Call.getArgExpr(1), 1}};
+  ProgramStateRef State = C.getState();
+  const LocationContext *LCtx = C.getLocationContext();
----------------
steakhal wrote:

This is only used once. I think you could directly use there `C.getLocationContext()`.

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


More information about the cfe-commits mailing list