diff options
author | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
commit | 952eddef9aff85b1e92626e89baaf7a360e2ac85 (patch) | |
tree | df8df0b0067b381eab470a3b8f28d14a552a6340 /include/clang/AST/StmtIterator.h | |
parent | ea266cad53e3d49771fa38103913d3ec7a166694 (diff) | |
download | FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.zip FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.tar.gz |
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841
Diffstat (limited to 'include/clang/AST/StmtIterator.h')
-rw-r--r-- | include/clang/AST/StmtIterator.h | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/include/clang/AST/StmtIterator.h b/include/clang/AST/StmtIterator.h index b933ed0..fbc8e5d 100644 --- a/include/clang/AST/StmtIterator.h +++ b/include/clang/AST/StmtIterator.h @@ -15,6 +15,7 @@ #define LLVM_CLANG_AST_STMT_ITR_H #include "llvm/Support/DataTypes.h" +#include "llvm/Support/Compiler.h" #include <cassert> #include <cstddef> #include <iterator> @@ -28,18 +29,14 @@ class VariableArrayType; class StmtIteratorBase { protected: - enum { DeclMode = 0x1, SizeOfTypeVAMode = 0x2, DeclGroupMode = 0x3, + enum { StmtMode = 0x0, SizeOfTypeVAMode = 0x1, DeclGroupMode = 0x2, Flags = 0x3 }; Stmt **stmt; - union { Decl *decl; Decl **DGI; }; + Decl **DGI; uintptr_t RawVAPtr; Decl **DGE; - bool inDecl() const { - return (RawVAPtr & Flags) == DeclMode; - } - bool inDeclGroup() const { return (RawVAPtr & Flags) == DeclGroupMode; } @@ -49,7 +46,7 @@ protected: } bool inStmt() const { - return (RawVAPtr & Flags) == 0; + return (RawVAPtr & Flags) == StmtMode; } const VariableArrayType *getVAPtr() const { @@ -57,7 +54,7 @@ protected: } void setVAPtr(const VariableArrayType *P) { - assert (inDecl() || inDeclGroup() || inSizeOfTypeVA()); + assert (inDeclGroup() || inSizeOfTypeVA()); RawVAPtr = reinterpret_cast<uintptr_t>(P) | (RawVAPtr & Flags); } @@ -67,11 +64,10 @@ protected: Stmt*& GetDeclExpr() const; - StmtIteratorBase(Stmt **s) : stmt(s), decl(0), RawVAPtr(0) {} - StmtIteratorBase(Decl *d, Stmt **s); + StmtIteratorBase(Stmt **s) : stmt(s), DGI(0), RawVAPtr(0) {} StmtIteratorBase(const VariableArrayType *t); StmtIteratorBase(Decl **dgi, Decl **dge); - StmtIteratorBase() : stmt(0), decl(0), RawVAPtr(0) {} + StmtIteratorBase() : stmt(0), DGI(0), RawVAPtr(0) {} }; @@ -86,7 +82,6 @@ public: StmtIteratorImpl() {} StmtIteratorImpl(Stmt **s) : StmtIteratorBase(s) {} StmtIteratorImpl(Decl **dgi, Decl **dge) : StmtIteratorBase(dgi, dge) {} - StmtIteratorImpl(Decl *d, Stmt **s) : StmtIteratorBase(d, s) {} StmtIteratorImpl(const VariableArrayType *t) : StmtIteratorBase(t) {} DERIVED& operator++() { @@ -107,15 +102,15 @@ public: } bool operator==(const DERIVED& RHS) const { - return stmt == RHS.stmt && decl == RHS.decl && RawVAPtr == RHS.RawVAPtr; + return stmt == RHS.stmt && DGI == RHS.DGI && RawVAPtr == RHS.RawVAPtr; } bool operator!=(const DERIVED& RHS) const { - return stmt != RHS.stmt || decl != RHS.decl || RawVAPtr != RHS.RawVAPtr; + return stmt != RHS.stmt || DGI != RHS.DGI || RawVAPtr != RHS.RawVAPtr; } REFERENCE operator*() const { - return (REFERENCE) (inStmt() ? *stmt : GetDeclExpr()); + return inStmt() ? *stmt : GetDeclExpr(); } REFERENCE operator->() const { return operator*(); } @@ -131,9 +126,6 @@ struct StmtIterator : public StmtIteratorImpl<StmtIterator,Stmt*&> { StmtIterator(const VariableArrayType *t) : StmtIteratorImpl<StmtIterator,Stmt*&>(t) {} - - StmtIterator(Decl* D, Stmt **s = 0) - : StmtIteratorImpl<StmtIterator,Stmt*&>(D, s) {} }; struct ConstStmtIterator : public StmtIteratorImpl<ConstStmtIterator, @@ -156,7 +148,7 @@ struct StmtRange : std::pair<StmtIterator,StmtIterator> { : std::pair<StmtIterator,StmtIterator>(begin, end) {} bool empty() const { return first == second; } - operator bool() const { return !empty(); } + LLVM_EXPLICIT operator bool() const { return !empty(); } Stmt *operator->() const { return first.operator->(); } Stmt *&operator*() const { return first.operator*(); } @@ -199,7 +191,7 @@ struct ConstStmtRange : std::pair<ConstStmtIterator,ConstStmtIterator> { : std::pair<ConstStmtIterator,ConstStmtIterator>(begin, end) {} bool empty() const { return first == second; } - operator bool() const { return !empty(); } + LLVM_EXPLICIT operator bool() const { return !empty(); } const Stmt *operator->() const { return first.operator->(); } const Stmt *operator*() const { return first.operator*(); } |