diff options
author | Morgan Deters <mdeters@gmail.com> | 2010-03-05 08:26:37 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2010-03-05 08:26:37 +0000 |
commit | 88b52c971b43248e6ceacf1c8140a06427d0418d (patch) | |
tree | 4ee443c898a858fcdd658f3f043e4180eddd8784 /src/context/context.cpp | |
parent | 29cc307cdf2c42bebf4f5615874a864783f47fd0 (diff) |
* public/private code untangled (smt/smt_engine.h no longer #includes
expr/node.h). This removes the warnings we had during compilation,
and heads off a number of potential linking errors due to improper
inlining of private (library-only) stuff in client (out-of-library)
code.
* "configure" now takes some options as part of a "bare-option" build
type (e.g., "./configure debug-coverage" or "./configure production-muzzle").
* split cdo.h, cdlist.h, cdmap.h, and cdset.h from context.h
* split cdlist_black unit test from context_black
* implement CDMap<>.
* give ExprManagers ownership of the context (and have SmtEngine share
that one)
* fix main driver to properly report file-not-found
* fix MemoryMappedInputBuffer class to report reasons for
"errno"-returned system errors
* src/expr/attribute.h: context-dependent attribute kinds now
supported
* test/unit/expr/node_white.h: context-dependent attribute tests
* src/prop/cnf_conversion.h and associated parts of src/util/options.h
and src/main/getopt.cpp: obsolete command-line option, removed.
* src/util/Assert.h: assertions are now somewhat more useful (in debug
builds, anyway) during stack unwinding.
* test/unit/theory/theory_black.h: test context-dependent behavior of
registerTerm() attribute for theories
* src/expr/node_builder.h: formatting, fixes for arithmetic
convenience node builders, check memory allocations
* test/unit/expr/node_builder_black.h: add tessts for addition,
subtraction, unary minus, and multiplication convenience node
builders
* src/expr/attribute.h: more comments
* (various) code formatting, comment cleanup, added throws specifier
to some destructors
* contrib/code-checker: prototype perl script to test (some) code policy
* contrib/indent-settings: command line for GNU indent to indent using
CVC4 style (sort of; this is a work in progress)
* COPYING: legal stuff
* DESIGN_QUESTIONS: obsolete, removed
Diffstat (limited to 'src/context/context.cpp')
-rw-r--r-- | src/context/context.cpp | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/src/context/context.cpp b/src/context/context.cpp index 5ff377194..8e87741b5 100644 --- a/src/context/context.cpp +++ b/src/context/context.cpp @@ -29,7 +29,7 @@ Context::Context() : d_pCNOpre(NULL), d_pCNOpost(NULL) { } -Context::~Context() { +Context::~Context() throw(AssertionException) { // Delete all Scopes popto(0); @@ -38,13 +38,13 @@ Context::~Context() { // Clear ContextNotifyObj lists so there are no dangling pointers ContextNotifyObj* pCNO; - while (d_pCNOpre != NULL) { + while(d_pCNOpre != NULL) { pCNO = d_pCNOpre; pCNO->d_ppCNOprev = NULL; d_pCNOpre = pCNO->d_pCNOnext; pCNO->d_pCNOnext = NULL; } - while (d_pCNOpost != NULL) { + while(d_pCNOpost != NULL) { pCNO = d_pCNOpost; pCNO->d_ppCNOprev = NULL; d_pCNOpost = pCNO->d_pCNOnext; @@ -69,7 +69,7 @@ void Context::pop() { // Notify the (pre-pop) ContextNotifyObj objects ContextNotifyObj* pCNO = d_pCNOpre; - while (pCNO != NULL) { + while(pCNO != NULL) { pCNO->notify(); pCNO = pCNO->d_pCNOnext; } @@ -88,7 +88,7 @@ void Context::pop() { // Notify the (post-pop) ContextNotifyObj objects pCNO = d_pCNOpost; - while (pCNO != NULL) { + while(pCNO != NULL) { pCNO->notify(); pCNO = pCNO->d_pCNOnext; } @@ -99,8 +99,8 @@ void Context::pop() { void Context::popto(int toLevel) { // Pop scopes until there are none left or toLevel is reached - if (toLevel < 0) toLevel = 0; - while (toLevel < getLevel()) pop(); + if(toLevel < 0) toLevel = 0; + while(toLevel < getLevel()) pop(); } @@ -147,19 +147,17 @@ void ContextObj::update() { } -ContextObj* ContextObj::restoreAndContinue() -{ +ContextObj* ContextObj::restoreAndContinue() { // Variable to hold next object in list ContextObj* pContextObjNext; // Check the restore pointer. If NULL, this must be the bottom Scope - if (d_pContextObjRestore == NULL) { + if(d_pContextObjRestore == NULL) { Assert(d_pScope == d_pScope->getContext()->getBottomScope(), "Expected bottom scope"); pContextObjNext = d_pContextObjNext; // Nothing else to do - } - else { + } else { // Call restore to update the subclass data restore(d_pContextObjRestore); @@ -177,48 +175,48 @@ ContextObj* ContextObj::restoreAndContinue() } -ContextObj::ContextObj(Context* pContext) - : d_pContextObjRestore(NULL) -{ +ContextObj::ContextObj(Context* pContext) : + d_pContextObjRestore(NULL) { + Assert(pContext != NULL, "NULL context pointer"); + d_pScope = pContext->getBottomScope(); d_pScope->addToChain(this); } -ContextObj::~ContextObj() -{ +ContextObj::~ContextObj() throw(AssertionException) { for(;;) { - if (next() != NULL) { + if(next() != NULL) { next()->prev() = prev(); } *(prev()) = next(); - if (d_pContextObjRestore == NULL) break; + if(d_pContextObjRestore == NULL) { + break; + } restoreAndContinue(); } } ContextNotifyObj::ContextNotifyObj(Context* pContext, bool preNotify) { - if (preNotify) { + if(preNotify) { pContext->addNotifyObjPre(this); - } - else { + } else { pContext->addNotifyObjPost(this); } } -ContextNotifyObj::~ContextNotifyObj() -{ - if (d_pCNOnext != NULL) { + +ContextNotifyObj::~ContextNotifyObj() throw(AssertionException) { + if(d_pCNOnext != NULL) { d_pCNOnext->d_ppCNOprev = d_ppCNOprev; } - if (d_ppCNOprev != NULL) { + if(d_ppCNOprev != NULL) { *(d_ppCNOprev) = d_pCNOnext; } } -} /* CVC4::context namespace */ - +} /* CVC4::context namespace */ } /* CVC4 namespace */ |