File indexing completed on 2026-05-10 08:36:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef LLVM_CLANG_AST_PARENTMAP_H
0014 #define LLVM_CLANG_AST_PARENTMAP_H
0015
0016 namespace clang {
0017 class Stmt;
0018 class Expr;
0019
0020 class ParentMap {
0021 void* Impl;
0022 public:
0023 ParentMap(Stmt* ASTRoot);
0024 ~ParentMap();
0025
0026
0027
0028
0029 void addStmt(Stmt* S);
0030
0031
0032
0033
0034 void setParent(const Stmt *S, const Stmt *Parent);
0035
0036 Stmt *getParent(Stmt*) const;
0037 Stmt *getParentIgnoreParens(Stmt *) const;
0038 Stmt *getParentIgnoreParenCasts(Stmt *) const;
0039 Stmt *getParentIgnoreParenImpCasts(Stmt *) const;
0040 Stmt *getOuterParenParent(Stmt *) const;
0041
0042 const Stmt *getParent(const Stmt* S) const {
0043 return getParent(const_cast<Stmt*>(S));
0044 }
0045
0046 const Stmt *getParentIgnoreParens(const Stmt *S) const {
0047 return getParentIgnoreParens(const_cast<Stmt*>(S));
0048 }
0049
0050 const Stmt *getParentIgnoreParenCasts(const Stmt *S) const {
0051 return getParentIgnoreParenCasts(const_cast<Stmt*>(S));
0052 }
0053
0054 bool hasParent(const Stmt *S) const { return getParent(S) != nullptr; }
0055
0056 bool isConsumedExpr(Expr *E) const;
0057
0058 bool isConsumedExpr(const Expr *E) const {
0059 return isConsumedExpr(const_cast<Expr*>(E));
0060 }
0061 };
0062
0063 }
0064 #endif