[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 2 07:00:21 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff ca827d53c5524409dcca5ade3949b25f38a60fef f9e571bfa3e64d9fb54e965f3c363aef40fa3b80 -- clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
index b6b0878459..5b4c3912f1 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
@@ -2518,7 +2518,8 @@ void CStringChecker::evalSprintfCommon(CheckerContext &C, const CallEvent &Call,
C.addTransition(State);
}
-void CStringChecker::evalGetentropy(CheckerContext &C, const CallEvent &Call) const {
+void CStringChecker::evalGetentropy(CheckerContext &C,
+ const CallEvent &Call) const {
DestinationArgExpr Buffer = {{Call.getArgExpr(0), 0}};
SizeArgExpr Size = {{Call.getArgExpr(1), 1}};
ProgramStateRef State = C.getState();
@@ -2529,7 +2530,7 @@ void CStringChecker::evalGetentropy(CheckerContext &C, const CallEvent &Call) co
ProgramStateRef StateZeroSize, StateNonZeroSize;
std::tie(StateZeroSize, StateNonZeroSize) =
- assumeZero(C, State, SizeVal, SizeTy);
+ assumeZero(C, State, SizeVal, SizeTy);
SVal Buff = C.getSVal(Buffer.Expression);
State = checkNonNull(C, StateNonZeroSize, Buffer, Buff);
@@ -2551,9 +2552,9 @@ void CStringChecker::evalGetentropy(CheckerContext &C, const CallEvent &Call) co
return;
}
- State = invalidateDestinationBufferBySize(
- C, State, Buffer.Expression, C.getSVal(Buffer.Expression), SizeVal,
- SizeTy);
+ State = invalidateDestinationBufferBySize(C, State, Buffer.Expression,
+ C.getSVal(Buffer.Expression),
+ SizeVal, SizeTy);
C.addTransition(State);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/83675
More information about the cfe-commits
mailing list