clang: include/clang/AST/ASTUnresolvedSet.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CLANG_AST_ASTUNRESOLVEDSET_H
15#define LLVM_CLANG_AST_ASTUNRESOLVEDSET_H
16
22#include
23#include
24
26
27class NamedDecl;
28
29
32
33 struct DeclsTy : ASTVector {
34 DeclsTy() = default;
36
37 bool isLazy() const { return getTag(); }
38 void setLazy(bool Lazy) { setTag(Lazy); }
39 };
40
41 DeclsTy Decls;
42
43public:
46
49
52
55
58 }
59
62 }
63
64
65
66
69 if (I->getDecl() == Old) {
70 I->set(New, AS);
71 return true;
72 }
73 }
74 return false;
75 }
76
78 if (I == Decls.size() - 1)
79 Decls.pop_back();
80 else
81 Decls[I] = Decls.pop_back_val();
82 }
83
84 void clear() { Decls.clear(); }
85
86 bool empty() const { return Decls.empty(); }
87 unsigned size() const { return Decls.size(); }
88
90 Decls.reserve(C, N);
91 }
92
95 }
96
99};
100
101
102
105
106 void getFromExternalSource(ASTContext &C) const;
107
108public:
110 if (Impl.Decls.isLazy())
111 getFromExternalSource(C);
112 return Impl;
113 }
114
116
118 assert(Impl.empty() || Impl.Decls.isLazy());
119 Impl.Decls.setLazy(true);
121 }
122};
123
124}
125
126#endif
Defines various enumerations that describe declaration and type specifiers.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
An UnresolvedSet-like class which uses the ASTContext's allocator.
void append(ASTContext &C, iterator I, iterator E)
const DeclAccessPair & operator[](unsigned I) const
bool replace(const NamedDecl *Old, NamedDecl *New, AccessSpecifier AS)
Replaces the given declaration with the new one, once.
UnresolvedSetIterator iterator
UnresolvedSetIterator const_iterator
const_iterator end() const
ASTUnresolvedSet(ASTContext &C, unsigned N)
void reserve(ASTContext &C, unsigned N)
void addLazyDecl(ASTContext &C, GlobalDeclID ID, AccessSpecifier AS)
const_iterator begin() const
void addDecl(ASTContext &C, NamedDecl *D, AccessSpecifier AS)
ASTUnresolvedSet()=default
DeclAccessPair & operator[](unsigned I)
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
static DeclAccessPair makeLazy(uint64_t ID, AccessSpecifier AS)
An UnresolvedSet-like class that might not have been loaded from the external AST source yet.
void reserve(ASTContext &C, unsigned N)
void addLazyDecl(ASTContext &C, GlobalDeclID ID, AccessSpecifier AS)
ASTUnresolvedSet & get(ASTContext &C) const
This represents a decl that may have a name.
The iterator over UnresolvedSets.
The JSON file list parser is used to communicate input to InstallAPI.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...