14 #ifndef LLVM_CLANG_SEMA_OWNERSHIP_H 15 #define LLVM_CLANG_SEMA_OWNERSHIP_H 19 #include "llvm/ADT/ArrayRef.h" 26 class CXXCtorInitializer;
27 class CXXBaseSpecifier;
30 class ParsedTemplateArgument;
34 class TemplateParameterList;
44 template <
class PtrTy>
47 explicit OpaquePtr(
void *Ptr) : Ptr(Ptr) {}
60 template <
typename Po
inteeT> PointeeT*
getPtrTo()
const {
70 template <
typename PtrT> PtrT
getPtrAs()
const {
75 return Traits::getFromVoidPointer(Ptr);
79 Ptr = Traits::getAsVoidPointer(
P);
82 explicit operator bool()
const {
return Ptr !=
nullptr; }
118 enum { NumLowBitsAvailable = 0 };
127 class DiagnosticBuilder;
134 static const bool value =
false;
142 template<
class PtrTy,
150 : Val(PtrTy()), Invalid(Invalid) {}
160 bool isUnset()
const {
return !Invalid && !Val; }
162 PtrTy
get()
const {
return Val; }
163 template <
typename T>
T *
getAs() {
return static_cast<T*
>(
get()); }
165 void set(PtrTy V) { Val = V; }
176 template<
typename PtrTy>
184 : PtrWithInvalid(static_cast<
uintptr_t>(Invalid)) { }
187 void *VP = PtrTraits::getAsVoidPointer(V);
188 PtrWithInvalid =
reinterpret_cast<uintptr_t>(VP);
189 assert((PtrWithInvalid & 0x01) == 0 &&
"Badly aligned pointer");
197 bool isInvalid()
const {
return PtrWithInvalid & 0x01; }
198 bool isUsable()
const {
return PtrWithInvalid > 0x01; }
199 bool isUnset()
const {
return PtrWithInvalid == 0; }
202 void *VP =
reinterpret_cast<void *
>(PtrWithInvalid & ~0x01);
203 return PtrTraits::getFromVoidPointer(VP);
205 template <
typename T>
T *
getAs() {
return static_cast<T*
>(
get()); }
208 void *VP = PtrTraits::getAsVoidPointer(V);
209 PtrWithInvalid =
reinterpret_cast<uintptr_t>(VP);
210 assert((PtrWithInvalid & 0x01) == 0 &&
"Badly aligned pointer");
214 void *VP = PtrTraits::getAsVoidPointer(RHS);
215 PtrWithInvalid =
reinterpret_cast<uintptr_t>(VP);
216 assert((PtrWithInvalid & 0x01) == 0 &&
"Badly aligned pointer");
239 static const bool value =
true;
242 static const bool value =
true;
245 static const bool value =
true;
248 static const bool value =
true;
277 assert(!R.
isInvalid() &&
"operation was asserted to never fail!");
282 assert(!R.
isInvalid() &&
"operation was asserted to never fail!");
MutableArrayRef< TemplateParameterList * > MultiTemplateParamsArg
OpaquePtr(std::nullptr_t=nullptr)
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
UnionOpaquePtr< QualType > UnionParsedType
PointeeT * getPtrTo() const
Returns plain pointer to the entity pointed by this wrapper.
Stmt - This represents one statement.
ActionResult< Expr * > ExprResult
const ActionResult & operator=(PtrTy RHS)
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
Wrapper for void* pointer.
static ActionResult getFromOpaquePointer(void *P)
MutableArrayRef< Stmt * > MultiStmtArg
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
PtrT getPtrAs() const
Returns pointer converted to the specified type.
void * getAsOpaquePtr() const
MutableArrayRef< ParsedTemplateArgument > ASTTemplateArgsPtr
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
ActionResult(const DiagnosticBuilder &)
A little helper class used to produce diagnostics.
ActionResult< Decl * > DeclResult
Expr - This represents one expression.
const FunctionProtoType * T
UnionOpaquePtr< TemplateName > UnionParsedTemplateTy
ActionResult< CXXCtorInitializer * > MemInitResult
The result type of a method or function.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
ActionResult(bool Invalid=false)
static UnionOpaquePtr make(OpaquePtr< T > P)
ActionResult< CXXBaseSpecifier * > BaseResult
MutableArrayRef< Expr * > MultiExprArg
UnionOpaquePtr - A version of OpaquePtr suitable for membership in a union.
Dataflow Directional Tag Classes.
static void * getAsVoidPointer(clang::OpaquePtr< T > P)
Represents a C++ base or member initializer.
UnionOpaquePtr & operator=(OpaquePtr< T > P)
static clang::OpaquePtr< T > getFromVoidPointer(void *P)
ActionResult< Stmt * > StmtResult
ActionResult< ParsedType > TypeResult
Represents a base class of a C++ class.
void * getAsOpaquePointer() const
ActionResult(bool Invalid=false)
ActionResult(const DiagnosticBuilder &)
OpaquePtr< TemplateName > ParsedTemplateTy
static OpaquePtr make(PtrTy P)
Expr * AssertSuccess(ExprResult R)
static OpaquePtr getFromOpaquePtr(void *P)
const ActionResult & operator=(PtrTy RHS)
MutableArrayRef< ParsedType > MultiTypeArg