diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-10 22:49:28 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-10 22:49:28 +0000 |
commit | e1b2abc2ed3f2c98985b06b4ad01c977bd584020 (patch) | |
tree | 00c5639500ef04b3f6555f66d8e790513d935632 /include | |
parent | edec2ee3bcde5ade31a76e329dcc4ac0fa7c7d11 (diff) |
AtomicExpr: make ASTStmtReader a friend and remove setters. Also fix saving
of an uninitialized Stmt* in serialization of __atomic_init and add a test of
atomics serialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154448 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/AST/Expr.h | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index e22c44d65a..0db9195a27 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -4470,7 +4470,7 @@ public: /// AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, /// __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the -/// similarly-named C++0x instructions. All of these instructions take one +/// similarly-named C++11 instructions. All of these instructions take one /// primary pointer and at least one memory order. class AtomicExpr : public Expr { public: @@ -4483,60 +4483,42 @@ private: SourceLocation BuiltinLoc, RParenLoc; AtomicOp Op; + friend class ASTStmtReader; + public: AtomicExpr(SourceLocation BLoc, Expr **args, unsigned nexpr, QualType t, AtomicOp op, SourceLocation RP); + /// \brief Determine the number of arguments the specified atomic builtin + /// should have. + static unsigned getNumSubExprs(AtomicOp Op); + /// \brief Build an empty AtomicExpr. explicit AtomicExpr(EmptyShell Empty) : Expr(AtomicExprClass, Empty) { } Expr *getPtr() const { return cast<Expr>(SubExprs[PTR]); } - void setPtr(Expr *E) { - SubExprs[PTR] = E; - } Expr *getOrder() const { return cast<Expr>(SubExprs[ORDER]); } - void setOrder(Expr *E) { - SubExprs[ORDER] = E; - } Expr *getVal1() const { if (Op == Init) return cast<Expr>(SubExprs[ORDER]); assert(NumSubExprs >= 3); return cast<Expr>(SubExprs[VAL1]); } - void setVal1(Expr *E) { - if (Op == Init) { - SubExprs[ORDER] = E; - return; - } - assert(NumSubExprs >= 3); - SubExprs[VAL1] = E; - } Expr *getOrderFail() const { assert(NumSubExprs == 5); return cast<Expr>(SubExprs[ORDER_FAIL]); } - void setOrderFail(Expr *E) { - assert(NumSubExprs == 5); - SubExprs[ORDER_FAIL] = E; - } Expr *getVal2() const { assert(NumSubExprs == 5); return cast<Expr>(SubExprs[VAL2]); } - void setVal2(Expr *E) { - assert(NumSubExprs == 5); - SubExprs[VAL2] = E; - } AtomicOp getOp() const { return Op; } - void setOp(AtomicOp op) { Op = op; } unsigned getNumSubExprs() { return NumSubExprs; } - void setNumSubExprs(unsigned num) { NumSubExprs = num; } Expr **getSubExprs() { return reinterpret_cast<Expr **>(SubExprs); } @@ -4550,10 +4532,7 @@ public: } SourceLocation getBuiltinLoc() const { return BuiltinLoc; } - void setBuiltinLoc(SourceLocation L) { BuiltinLoc = L; } - SourceLocation getRParenLoc() const { return RParenLoc; } - void setRParenLoc(SourceLocation L) { RParenLoc = L; } SourceRange getSourceRange() const LLVM_READONLY { return SourceRange(BuiltinLoc, RParenLoc); |