diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-06-04 19:06:53 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-06-04 19:06:53 +0000 |
commit | 89f9d3a7651d1225f3f56ae3387c83b98a26da00 (patch) | |
tree | 14da82887f160245b293c572a1a4d7b3ff712a8c | |
parent | c71a4915ca216847599d03cab4ed1c5086b0eb43 (diff) |
Added a field to BlockDeclRefExpr for future use.
No functionality change yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105479 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/Expr.h | 12 | ||||
-rw-r--r-- | lib/AST/StmtProfile.cpp | 2 | ||||
-rw-r--r-- | lib/Frontend/PCHReaderStmt.cpp | 3 | ||||
-rw-r--r-- | lib/Frontend/PCHWriterStmt.cpp | 1 |
4 files changed, 15 insertions, 3 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index 66639e2ef7..248cf7bbfd 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -3305,12 +3305,14 @@ class BlockDeclRefExpr : public Expr { SourceLocation Loc; bool IsByRef : 1; bool ConstQualAdded : 1; + Stmt *CopyConstructorVal; public: // FIXME: Fix type/value dependence! BlockDeclRefExpr(ValueDecl *d, QualType t, SourceLocation l, bool ByRef, - bool constAdded = false) + bool constAdded = false, + Stmt *copyConstructorVal = 0) : Expr(BlockDeclRefExprClass, t, false, false), D(d), Loc(l), IsByRef(ByRef), - ConstQualAdded(constAdded) {} + ConstQualAdded(constAdded), CopyConstructorVal(copyConstructorVal) {} // \brief Build an empty reference to a declared variable in a // block. @@ -3331,6 +3333,12 @@ public: bool isConstQualAdded() const { return ConstQualAdded; } void setConstQualAdded(bool C) { ConstQualAdded = C; } + + const Expr *getCopyConstructorExpr() const + { return cast_or_null<Expr>(CopyConstructorVal); } + Expr *getCopyConstructorExpr() + { return cast_or_null<Expr>(CopyConstructorVal); } + void setCopyConstructorExpr(Expr *E) { CopyConstructorVal = E; } static bool classof(const Stmt *T) { return T->getStmtClass() == BlockDeclRefExprClass; diff --git a/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp index ac3a9eeda6..4b17e5262e 100644 --- a/lib/AST/StmtProfile.cpp +++ b/lib/AST/StmtProfile.cpp @@ -428,6 +428,8 @@ void StmtProfiler::VisitBlockDeclRefExpr(BlockDeclRefExpr *S) { VisitDecl(S->getDecl()); ID.AddBoolean(S->isByRef()); ID.AddBoolean(S->isConstQualAdded()); + if (S->getCopyConstructorExpr()) + Visit(S->getCopyConstructorExpr()); } static Stmt::StmtClass DecodeOperatorCall(CXXOperatorCallExpr *S, diff --git a/lib/Frontend/PCHReaderStmt.cpp b/lib/Frontend/PCHReaderStmt.cpp index 3931adbe8f..d58a9730bb 100644 --- a/lib/Frontend/PCHReaderStmt.cpp +++ b/lib/Frontend/PCHReaderStmt.cpp @@ -764,7 +764,8 @@ unsigned PCHStmtReader::VisitBlockDeclRefExpr(BlockDeclRefExpr *E) { E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++])); E->setByRef(Record[Idx++]); E->setConstQualAdded(Record[Idx++]); - return 0; + E->setCopyConstructorExpr(cast_or_null<Expr>(StmtStack.back())); + return 1; } //===----------------------------------------------------------------------===// diff --git a/lib/Frontend/PCHWriterStmt.cpp b/lib/Frontend/PCHWriterStmt.cpp index a9ee43527c..b3501d0984 100644 --- a/lib/Frontend/PCHWriterStmt.cpp +++ b/lib/Frontend/PCHWriterStmt.cpp @@ -688,6 +688,7 @@ void PCHStmtWriter::VisitBlockDeclRefExpr(BlockDeclRefExpr *E) { Writer.AddSourceLocation(E->getLocation(), Record); Record.push_back(E->isByRef()); Record.push_back(E->isConstQualAdded()); + Writer.WriteSubStmt(E->getCopyConstructorExpr()); Code = pch::EXPR_BLOCK_DECL_REF; } |