aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-08-25 15:47:45 +0000
committerDouglas Gregor <dgregor@apple.com>2009-08-25 15:47:45 +0000
commit8b55ce79391dcce51c52f8aff923f4607e6cd977 (patch)
treeb8b0c161abb057bbdf9d7899b0f7a8d7be5938b9
parentb044c473a155b7e827680635c1699cb2b5b6c0ee (diff)
Sanity checking for statement reference counts. Thanks for the suggestion, Fariborz
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79995 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/Stmt.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index b86717728c..53f0186671 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -174,6 +174,7 @@ public:
/// \brief Destroy the current statement and its children.
void Destroy(ASTContext &Ctx) {
+ assert(RefCount >= 0);
if (--RefCount == 0)
DoDestroy(Ctx);
}
@@ -183,6 +184,7 @@ public:
/// Invoke the Retain() operation when this statement or expression
/// is being shared by another owner.
Stmt *Retain() {
+ assert(RefCount >= 1);
++RefCount;
return this;
}