[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 27 01:29:46 PST 2024
================
@@ -80,19 +88,53 @@ bool ChrootChecker::evalCall(const CallEvent &Call, CheckerContext &C) const {
void ChrootChecker::evalChroot(const CallEvent &Call, CheckerContext &C) const {
ProgramStateRef state = C.getState();
ProgramStateManager &Mgr = state->getStateManager();
+ const TargetInfo &TI = C.getASTContext().getTargetInfo();
+ SValBuilder &SVB = C.getSValBuilder();
+ BasicValueFactory &BVF = SVB.getBasicValueFactory();
+ ConstraintManager &CM = Mgr.getConstraintManager();
- // Once encouter a chroot(), set the enum value ROOT_CHANGED directly in
- // the GDM.
- state = Mgr.addGDM(state, ChrootChecker::getTag(), (void*) ROOT_CHANGED);
- C.addTransition(state);
+ const QualType sIntTy = C.getASTContext().getIntTypeForBitwidth(
+ /*DestWidth=*/TI.getIntWidth(), /*Signed=*/true);
----------------
steakhal wrote:
Wouldn't this be simpler?
```suggestion
const QualType IntTy = C.getASTContext().IntTy;
```
https://github.com/llvm/llvm-project/pull/117791
More information about the cfe-commits
mailing list