action: add is_atomic_var()
[model-checker.git] / action.cc
index 121f5ee7499d7161257dd136e5edd646bc8c8c94..a313b70fbe970810c96fe16bc1d7a0a27108508b 100644 (file)
--- a/action.cc
+++ b/action.cc
@@ -124,6 +124,12 @@ bool ModelAction::is_failed_trylock() const
        return (type == ATOMIC_TRYLOCK && value == VALUE_TRYFAILED);
 }
 
+/** @return True if this operation is performed on a C/C++ atomic variable */
+bool ModelAction::is_atomic_var() const
+{
+       return is_read() || could_be_write();
+}
+
 bool ModelAction::is_uninitialized() const
 {
        return type == ATOMIC_UNINIT;
@@ -349,6 +355,8 @@ void ModelAction::set_try_lock(bool obtainedlock) {
 /** @return The Node associated with this ModelAction */
 Node * ModelAction::get_node() const
 {
+       /* UNINIT actions do not have a Node */
+       ASSERT(!is_uninitialized());
        return node;
 }