From: Brian Norris <banorris@uci.edu>
Date: Fri, 7 Dec 2012 06:55:38 +0000 (-0800)
Subject: action: add is_atomic_var()
X-Git-Tag: oopsla2013~448
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7d97490a3d445eedb6073b5b00ee60604755f9a0;p=model-checker.git

action: add is_atomic_var()

To check if a ModelAction is for a C/C++ atomic variable (vs. a Thread
action, a fake ModelChecker action, a mutex, a condition variable, etc.)
---

diff --git a/action.cc b/action.cc
index d418bdb..a313b70 100644
--- 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;
diff --git a/action.h b/action.h
index 8a8e33e..a246123 100644
--- a/action.h
+++ b/action.h
@@ -108,6 +108,7 @@ public:
 	bool is_notify_one() const;
 	bool is_success_lock() const;
 	bool is_failed_trylock() const;
+	bool is_atomic_var() const;
 	bool is_uninitialized() const;
 	bool is_read() const;
 	bool is_write() const;