[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 9 05:47:31 PDT 2024
================
@@ -21,16 +21,67 @@
#include "clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicExtent.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
using namespace clang;
using namespace ento;
namespace {
+QualType getOverflowBuiltinResultType(const CallEvent &Call) {
+ assert(Call.getNumArgs() == 3);
+
+ return Call.getArgExpr(2)->getType()->getPointeeType();
+}
+
+QualType getOverflowBuiltinResultType(const CallEvent &Call, CheckerContext &C,
+ unsigned BI) {
+ assert(Call.getNumArgs() == 3);
+
+ ASTContext &Ast = C.getASTContext();
----------------
NagyDonat wrote:
`<bikeshedding>`
Checker code usually uses the name `ACtx` for 'the' `ASTContext` object, so consider using that here. However, `Ast` is also a completely correct name, so if you prefer it, feel free to keep it.
`</bikeshedding>`
https://github.com/llvm/llvm-project/pull/102602
More information about the cfe-commits
mailing list