opnsense-src/lib/Checker/SimpleConstraintManager.h

84 lines
3.1 KiB
C
Raw Normal View History

2009-06-02 13:58:47 -04:00
//== SimpleConstraintManager.h ----------------------------------*- C++ -*--==//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Code shared between BasicConstraintManager and RangeConstraintManager.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H
#define LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H
2010-02-16 04:31:36 -05:00
#include "clang/Checker/PathSensitive/ConstraintManager.h"
#include "clang/Checker/PathSensitive/GRState.h"
2009-06-02 13:58:47 -04:00
namespace clang {
class SimpleConstraintManager : public ConstraintManager {
2010-01-15 10:39:40 -05:00
GRSubEngine &SU;
2009-06-02 13:58:47 -04:00
public:
2010-01-15 10:39:40 -05:00
SimpleConstraintManager(GRSubEngine &subengine) : SU(subengine) {}
2009-10-14 14:03:49 -04:00
virtual ~SimpleConstraintManager();
2009-06-22 04:08:35 -04:00
//===------------------------------------------------------------------===//
// Common implementation for the interface provided by ConstraintManager.
//===------------------------------------------------------------------===//
2009-06-02 13:58:47 -04:00
2009-06-22 04:08:35 -04:00
bool canReasonAbout(SVal X) const;
2009-06-02 13:58:47 -04:00
2009-10-14 14:03:49 -04:00
const GRState *Assume(const GRState *state, DefinedSVal Cond,
bool Assumption);
2009-06-02 13:58:47 -04:00
2009-06-22 04:08:35 -04:00
const GRState *Assume(const GRState *state, Loc Cond, bool Assumption);
2009-06-02 13:58:47 -04:00
2009-06-22 04:08:35 -04:00
const GRState *Assume(const GRState *state, NonLoc Cond, bool Assumption);
2009-06-02 13:58:47 -04:00
2009-06-22 04:08:35 -04:00
const GRState *AssumeSymInt(const GRState *state, bool Assumption,
const SymIntExpr *SE);
2009-10-14 14:03:49 -04:00
const GRState *AssumeInBound(const GRState *state, DefinedSVal Idx,
DefinedSVal UpperBound,
2009-06-22 04:08:35 -04:00
bool Assumption);
2009-10-14 14:03:49 -04:00
2009-06-22 04:08:35 -04:00
protected:
2009-10-14 14:03:49 -04:00
2009-06-22 04:08:35 -04:00
//===------------------------------------------------------------------===//
// Interface that subclasses must implement.
//===------------------------------------------------------------------===//
2009-10-14 14:03:49 -04:00
2009-06-22 04:08:35 -04:00
virtual const GRState *AssumeSymNE(const GRState *state, SymbolRef sym,
const llvm::APSInt& V) = 0;
2009-06-02 13:58:47 -04:00
2009-06-22 04:08:35 -04:00
virtual const GRState *AssumeSymEQ(const GRState *state, SymbolRef sym,
const llvm::APSInt& V) = 0;
2009-06-02 13:58:47 -04:00
2009-06-22 04:08:35 -04:00
virtual const GRState *AssumeSymLT(const GRState *state, SymbolRef sym,
const llvm::APSInt& V) = 0;
2009-06-02 13:58:47 -04:00
2009-06-22 04:08:35 -04:00
virtual const GRState *AssumeSymGT(const GRState *state, SymbolRef sym,
const llvm::APSInt& V) = 0;
2009-06-02 13:58:47 -04:00
2009-06-22 04:08:35 -04:00
virtual const GRState *AssumeSymLE(const GRState *state, SymbolRef sym,
const llvm::APSInt& V) = 0;
2009-06-02 13:58:47 -04:00
2009-06-22 04:08:35 -04:00
virtual const GRState *AssumeSymGE(const GRState *state, SymbolRef sym,
const llvm::APSInt& V) = 0;
2009-10-14 14:03:49 -04:00
2009-06-22 04:08:35 -04:00
//===------------------------------------------------------------------===//
// Internal implementation.
//===------------------------------------------------------------------===//
2009-10-14 14:03:49 -04:00
2009-06-22 04:08:35 -04:00
const GRState *AssumeAux(const GRState *state, Loc Cond,bool Assumption);
2009-10-14 14:03:49 -04:00
2009-06-22 04:08:35 -04:00
const GRState *AssumeAux(const GRState *state, NonLoc Cond, bool Assumption);
2009-06-02 13:58:47 -04:00
};
} // end clang namespace
#endif