From d0b5edd02be5f09c1d8d211f4a06b031a7b66510 Mon Sep 17 00:00:00 2001 From: Stephen Hines Date: Mon, 18 Apr 2011 16:38:03 -0700 Subject: Disallow union copies that contain RS object types This also cleans up RSObjectRefCount's usage of ASTContext a bit. BUG=4283858 Change-Id: I9ca61e27fc5d6eb1befc2da4fe2d157f5936a56f --- slang_rs_object_ref_count.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'slang_rs_object_ref_count.h') diff --git a/slang_rs_object_ref_count.h b/slang_rs_object_ref_count.h index 78984a7..fd3b5dc 100644 --- a/slang_rs_object_ref_count.h +++ b/slang_rs_object_ref_count.h @@ -59,11 +59,9 @@ class RSObjectRefCount : public clang::StmtVisitor { return; } - void ReplaceRSObjectAssignment(clang::BinaryOperator *AS, - clang::Diagnostic *Diags); + void ReplaceRSObjectAssignment(clang::BinaryOperator *AS); - void AppendRSObjectInit(clang::Diagnostic *Diags, - clang::VarDecl *VD, + void AppendRSObjectInit(clang::VarDecl *VD, clang::DeclStmt *DS, RSExportPrimitiveType::DataType DT, clang::Expr *InitExpr); @@ -73,9 +71,9 @@ class RSObjectRefCount : public clang::StmtVisitor { static clang::Stmt *ClearRSObject(clang::VarDecl *VD); }; + clang::ASTContext &mCtx; std::stack mScopeStack; bool RSInitFD; - clang::Diagnostic *mDiags; // RSSetObjectFD and RSClearObjectFD holds FunctionDecl of rsSetObject() // and rsClearObject() in the current ASTContext. @@ -103,15 +101,15 @@ class RSObjectRefCount : public clang::StmtVisitor { const clang::SourceLocation &Loc); public: - RSObjectRefCount() - : RSInitFD(false) { + explicit RSObjectRefCount(clang::ASTContext &C) + : mCtx(C), + RSInitFD(false) { return; } - void Init(clang::ASTContext &C, clang::Diagnostic *Diags) { + void Init() { if (!RSInitFD) { - GetRSRefCountingFunctions(C); - mDiags = Diags; + GetRSRefCountingFunctions(mCtx); RSInitFD = true; } return; -- cgit v1.2.3