]> granicus.if.org Git - clang/commit
[analyzer] Create generic SMT Context class
authorMikhail R. Gadelha <mikhail.ramalho@gmail.com>
Wed, 25 Jul 2018 12:49:07 +0000 (12:49 +0000)
committerMikhail R. Gadelha <mikhail.ramalho@gmail.com>
Wed, 25 Jul 2018 12:49:07 +0000 (12:49 +0000)
commit5f3a8d4376e1ed065532d9b70733ee7fc775119a
tree406b49192123f03b506ae7dcb19319f2a8be832d
parentdf5b22a11e54e1f95eb943fc9906c69fdc8dce54
[analyzer] Create generic SMT Context class

Summary:
This patch creates `SMTContext` which will wrap a specific SMT context, through `SMTSolverContext`.

The templated `SMTSolverContext` class it's a simple wrapper around a SMT specific context (currently only used in the Z3 backend), while `Z3Context` inherits `SMTSolverContext<Z3_context>` and implements solver specific operations like initialization and destruction of the context.

This separation was done because:

1. We might want to keep one single context, shared across different `SMTConstraintManager`s. It can be achieved by constructing a `SMTContext`, through a function like `CreateSMTContext(Z3)`, `CreateSMTContext(BOOLECTOR)`, etc. The rest of the CSA only need to know about `SMTContext`, so maybe it's a good idea moving `SMTSolverContext` to a separate header in the future.

2. Any generic SMT operation will only require one `SMTSolverContext`object, which can access the specific context by calling `getContext()`.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

Differential Revision: https://reviews.llvm.org/D49233

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337914 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/StaticAnalyzer/Core/PathSensitive/SMTContext.h [new file with mode: 0644]
lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp