aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Parse/Ownership.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/clang/Parse/Ownership.h b/include/clang/Parse/Ownership.h
index 9665576a05..ce0707e9bf 100644
--- a/include/clang/Parse/Ownership.h
+++ b/include/clang/Parse/Ownership.h
@@ -204,8 +204,8 @@ namespace clang
/// when recovering from errors. These are in ActionBase because the smart
/// pointers need access to them.
virtual void DeleteExpr(ExprTy *E) {}
- virtual void DeleteStmt(StmtTy *E) {}
- virtual void DeleteTemplateParams(TemplateParamsTy *E) {}
+ virtual void DeleteStmt(StmtTy *S) {}
+ virtual void DeleteTemplateParams(TemplateParamsTy *P) {}
};
/// ASTDestroyer - The type of an AST node destruction function pointer.
@@ -383,6 +383,12 @@ namespace clang
return tmp;
}
+ /// Take outside ownership of the raw pointer and cast it down.
+ template<typename T>
+ T *takeAs() {
+ return static_cast<T*>(take());
+ }
+
/// Alias for interface familiarity with unique_ptr.
void * release() { return take(); }
@@ -443,6 +449,12 @@ namespace clang
return Result.get();
}
+ /// Take outside ownership of the raw pointer and cast it down.
+ template<typename T>
+ T *takeAs() {
+ return static_cast<T*>(take());
+ }
+
/// Alias for interface familiarity with unique_ptr.
void * release() { return take(); }