15 #ifndef LLVM_CLANG_AST_TYPELOC_H 16 #define LLVM_CLANG_AST_TYPELOC_H 26 #include "llvm/ADT/ArrayRef.h" 27 #include "llvm/Support/Casting.h" 28 #include "llvm/Support/Compiler.h" 29 #include "llvm/Support/MathExtras.h" 40 class ObjCInterfaceDecl;
41 class ObjCProtocolDecl;
42 class ObjCTypeParamDecl;
43 class TemplateTypeParmDecl;
45 class UnresolvedUsingTypenameDecl;
48 #define ABSTRACT_TYPELOC(Class, Base) 49 #define TYPELOC(Class, Base) \ 51 #include "clang/AST/TypeLocNodes.def" 61 const void *
Ty =
nullptr;
67 : Ty(ty.getAsOpaquePtr()), Data(opaqueData) {}
69 : Ty(ty), Data(opaqueData) {}
77 assert(T::isKind(*
this));
88 if (!T::isKind(*
this))
100 template <
typename T>
107 #define ABSTRACT_TYPE(Class, Base) 108 #define TYPE(Class, Base) \ 110 #include "clang/AST/TypeNodes.def" 120 explicit operator bool()
const {
return Ty; }
158 return getLocalSourceRangeImpl(*
this);
169 return getNextTypeLocImpl(*
this);
191 initializeImpl(Context, *
this, Loc);
218 return !(LHS == RHS);
226 static bool isKind(
const TypeLoc&) {
240 return TypeLoc(
Ty, const_cast<void*>(static_cast<const void*>(
this + 1)));
251 return reinterpret_cast<const Type*
>(
Ty);
261 static bool isKind(
const TypeLoc &TL) {
279 dataInt = llvm::alignTo(dataInt, align);
315 static bool isKind(
const TypeLoc &TL) {
323 return castAs<UnqualTypeLoc>();
354 template <
class Base,
class Derived,
class TypeClass,
class LocalData>
358 const Derived *asDerived()
const {
359 return static_cast<const Derived*
>(
this);
362 static bool isKind(
const TypeLoc &TL) {
367 static bool classofType(
const Type *
Ty) {
373 return std::max(
unsigned(
alignof(LocalData)),
374 asDerived()->getExtraLocalDataAlignment());
378 unsigned size =
sizeof(LocalData);
379 unsigned extraAlign = asDerived()->getExtraLocalDataAlignment();
380 size = llvm::alignTo(size, extraAlign);
381 size += asDerived()->getExtraLocalDataSize();
387 if (asDerived()->getLocalDataSize() == 0)
return;
390 memcpy(getLocalData(), other.getLocalData(),
sizeof(LocalData));
395 memcpy(getExtraLocalData(), other.getExtraLocalData(),
396 asDerived()->getExtraLocalDataSize());
404 return cast<TypeClass>(Base::getTypePtr());
417 return static_cast<LocalData*
>(Base::Data);
424 unsigned size =
sizeof(LocalData);
425 unsigned extraAlign = asDerived()->getExtraLocalDataAlignment();
426 size = llvm::alignTo(size, extraAlign);
427 return reinterpret_cast<char*
>(Base::Data) + size;
431 auto data =
reinterpret_cast<uintptr_t>(Base::Data);
432 data += asDerived()->getLocalDataSize();
433 data = llvm::alignTo(data, getNextTypeAlign());
434 return reinterpret_cast<void*
>(data);
441 return TypeLoc(asDerived()->getInnerType(), getNonLocalData());
445 unsigned getInnerTypeSize()
const {
446 return getInnerTypeSize(asDerived()->getInnerType());
449 unsigned getInnerTypeSize(HasNoInnerType _)
const {
453 unsigned getInnerTypeSize(
QualType _)
const {
454 return getInnerTypeLoc().getFullDataSize();
457 unsigned getNextTypeAlign()
const {
458 return getNextTypeAlign(asDerived()->getInnerType());
461 unsigned getNextTypeAlign(HasNoInnerType _)
const {
465 unsigned getNextTypeAlign(
QualType T)
const {
472 return TypeLoc(T, getNonLocalData());
479 template <
class Base,
class Derived,
class TypeClass>
483 static bool classofType(
const Type *
Ty) {
487 static bool isKind(
const TypeLoc &TL) {
497 return cast<TypeClass>(Base::getTypePtr());
518 return this->getLocalData()->NameLoc;
522 this->getLocalData()->NameLoc = Loc;
536 static bool isKind(
const TypeLoc &TL);
550 return getLocalData()->BuiltinRange.getBegin();
554 getLocalData()->BuiltinRange = Loc;
558 SourceRange &BuiltinRange = getLocalData()->BuiltinRange;
560 BuiltinRange = Range;
578 return (bk >= BuiltinType::UShort && bk <= BuiltinType::UInt128)
579 || (bk >= BuiltinType::Short && bk <= BuiltinType::Float128)
580 || bk == BuiltinType::UChar
581 || bk == BuiltinType::SChar;
593 return getLocalData()->BuiltinRange;
597 if (needsExtraLocalData())
608 if (needsExtraLocalData())
609 getWrittenBuiltinSpecs().Sign = written;
613 if (needsExtraLocalData())
624 if (needsExtraLocalData())
625 getWrittenBuiltinSpecs().Width = written;
635 if (needsExtraLocalData())
636 getWrittenBuiltinSpecs().Type = written;
640 if (needsExtraLocalData())
641 return getWrittenBuiltinSpecs().ModeAttr;
647 if (needsExtraLocalData())
648 getWrittenBuiltinSpecs().ModeAttr = written;
653 if (needsExtraLocalData()) {
677 InjectedClassNameTypeLoc,
678 InjectedClassNameType> {
688 UnresolvedUsingTypeLoc,
689 UnresolvedUsingType> {
734 TemplateTypeParmTypeLoc,
735 TemplateTypeParmType> {
747 ObjCTypeParamTypeLoc,
749 ObjCTypeParamTypeLocInfo> {
759 return this->getLocalData()->NameLoc;
763 this->getLocalData()->NameLoc = Loc;
767 return getNumProtocols() ?
777 return getNumProtocols() ?
791 assert(i < getNumProtocols() &&
"Index is out of bounds!");
792 return getProtocolLocArray()[i];
796 assert(i < getNumProtocols() &&
"Index is out of bounds!");
797 getProtocolLocArray()[i] = Loc;
801 assert(i < getNumProtocols() &&
"Index is out of bounds!");
802 return *(this->
getTypePtr()->qual_begin() + i);
806 return llvm::makeArrayRef(getProtocolLocArray(), getNumProtocols());
812 if (!this->getNumProtocols())
return 0;
833 SubstTemplateTypeParmTypeLoc,
834 SubstTemplateTypeParmType> {
840 SubstTemplateTypeParmPackTypeLoc,
841 SubstTemplateTypeParmPackType> {
867 return getInnerTypeLoc();
872 return getLocalData()->TypeAttr;
875 getLocalData()->TypeAttr = A;
879 return dyn_cast_or_null<T>(getAttr());
892 return getAttr() ? getAttr()->getRange() :
SourceRange();
920 ObjCObjectTypeLocInfo> {
929 return (
SourceLocation*)(getTypeArgLocArray() + getNumTypeArgs());
934 return this->getLocalData()->TypeArgsLAngleLoc;
938 this->getLocalData()->TypeArgsLAngleLoc = Loc;
942 return this->getLocalData()->TypeArgsRAngleLoc;
946 this->getLocalData()->TypeArgsRAngleLoc = Loc;
950 return this->
getTypePtr()->getTypeArgsAsWritten().size();
954 assert(i < getNumTypeArgs() &&
"Index is out of bounds!");
955 return getTypeArgLocArray()[i];
959 assert(i < getNumTypeArgs() &&
"Index is out of bounds!");
960 getTypeArgLocArray()[i] = TInfo;
964 return this->getLocalData()->ProtocolLAngleLoc;
968 this->getLocalData()->ProtocolLAngleLoc = Loc;
972 return this->getLocalData()->ProtocolRAngleLoc;
976 this->getLocalData()->ProtocolRAngleLoc = Loc;
984 assert(i < getNumProtocols() &&
"Index is out of bounds!");
985 return getProtocolLocArray()[i];
989 assert(i < getNumProtocols() &&
"Index is out of bounds!");
990 getProtocolLocArray()[i] = Loc;
994 assert(i < getNumProtocols() &&
"Index is out of bounds!");
995 return *(this->
getTypePtr()->qual_begin() + i);
1000 return llvm::makeArrayRef(getProtocolLocArray(), getNumProtocols());
1004 return getLocalData()->HasBaseTypeAsWritten;
1008 getLocalData()->HasBaseTypeAsWritten = HasBaseType;
1012 return getInnerTypeLoc();
1018 start = getProtocolLAngleLoc();
1021 end = getTypeArgsRAngleLoc();
1034 "not enough alignment for tail-allocated data");
1050 ObjCInterfaceTypeLoc,
1052 ObjCInterfaceLocInfo> {
1059 return getLocalData()->NameLoc;
1063 getLocalData()->NameLoc = Loc;
1067 return SourceRange(getNameLoc(), getNameEndLoc());
1071 return getLocalData()->NameEndLoc;
1075 getLocalData()->NameEndLoc = Loc;
1094 return this->getLocalData()->LParenLoc;
1098 return this->getLocalData()->RParenLoc;
1102 this->getLocalData()->LParenLoc = Loc;
1106 this->getLocalData()->RParenLoc = Loc;
1110 return SourceRange(getLParenLoc(), getRParenLoc());
1119 return getInnerTypeLoc();
1128 if (ParenTypeLoc::isKind(*
this))
1129 return IgnoreParensImpl(*
this);
1136 AdjustedType, AdjustedLocInfo> {
1139 return getInnerTypeLoc();
1164 AdjustedTypeLoc, DecayedTypeLoc, DecayedType> {
1172 template <
class Derived,
class TypeClass,
class LocalData = Po
interLikeLocInfo>
1174 TypeClass, LocalData> {
1177 return this->getLocalData()->StarLoc;
1181 this->getLocalData()->StarLoc = Loc;
1185 return this->getInnerTypeLoc();
1206 return getSigilLoc();
1219 return getSigilLoc();
1234 MemberPointerLocInfo> {
1237 return getSigilLoc();
1249 return getLocalData()->ClassTInfo;
1253 getLocalData()->ClassTInfo = TI;
1258 setClassTInfo(
nullptr);
1263 return SourceRange(TI->getTypeLoc().getBeginLoc(), getStarLoc());
1272 ObjCObjectPointerType> {
1275 return getSigilLoc();
1287 return getTypePtr()->getPointeeTypeAsWritten();
1293 LValueReferenceTypeLoc,
1294 LValueReferenceType> {
1297 return getSigilLoc();
1307 RValueReferenceTypeLoc,
1308 RValueReferenceType> {
1311 return getSigilLoc();
1331 bool hasExceptionSpec()
const {
1332 if (
auto *FPT = dyn_cast<FunctionProtoType>(
getTypePtr())) {
1333 return FPT->hasExceptionSpec();
1339 assert(hasExceptionSpec() &&
"No exception spec range");
1342 return (
SourceRange *)(getParmArray() + getNumParams());
1347 return getLocalData()->LocalRangeBegin;
1351 getLocalData()->LocalRangeBegin = L;
1355 return getLocalData()->LocalRangeEnd;
1359 getLocalData()->LocalRangeEnd = L;
1363 return this->getLocalData()->LParenLoc;
1367 this->getLocalData()->LParenLoc = Loc;
1371 return this->getLocalData()->RParenLoc;
1375 this->getLocalData()->RParenLoc = Loc;
1379 return SourceRange(getLParenLoc(), getRParenLoc());
1383 if (hasExceptionSpec())
1384 return *getExceptionSpecRangePtr();
1389 if (hasExceptionSpec())
1390 *getExceptionSpecRangePtr() = R;
1394 return llvm::makeArrayRef(getParmArray(), getNumParams());
1405 return cast<FunctionProtoType>(
getTypePtr())->getNumParams();
1412 return getInnerTypeLoc();
1416 return SourceRange(getLocalRangeBegin(), getLocalRangeEnd());
1420 setLocalRangeBegin(Loc);
1423 setLocalRangeEnd(Loc);
1424 for (
unsigned i = 0, e = getNumParams(); i != e; ++i)
1425 setParam(i,
nullptr);
1426 if (hasExceptionSpec())
1427 setExceptionSpecRange(Loc);
1433 unsigned ExceptSpecSize = hasExceptionSpec() ?
sizeof(
SourceRange) : 0;
1434 return (getNumParams() *
sizeof(
ParmVarDecl *)) + ExceptSpecSize;
1444 FunctionProtoTypeLoc,
1445 FunctionProtoType> {
1450 FunctionNoProtoTypeLoc,
1451 FunctionNoProtoType> {
1466 return getLocalData()->LBracketLoc;
1470 getLocalData()->LBracketLoc = Loc;
1474 return getLocalData()->RBracketLoc;
1478 getLocalData()->RBracketLoc = Loc;
1482 return SourceRange(getLBracketLoc(), getRBracketLoc());
1486 return getLocalData()->Size;
1490 getLocalData()->Size = Size;
1494 return getInnerTypeLoc();
1498 return SourceRange(getLBracketLoc(), getRBracketLoc());
1502 setLBracketLoc(Loc);
1503 setRBracketLoc(Loc);
1504 setSizeExpr(
nullptr);
1512 ConstantArrayTypeLoc,
1513 ConstantArrayType> {
1518 IncompleteArrayTypeLoc,
1519 IncompleteArrayType> {
1524 DependentSizedArrayTypeLoc,
1525 DependentSizedArrayType> {
1535 VariableArrayTypeLoc,
1536 VariableArrayType> {
1552 TemplateSpecializationTypeLoc,
1553 TemplateSpecializationType,
1554 TemplateSpecializationLocInfo> {
1557 return getLocalData()->TemplateKWLoc;
1561 getLocalData()->TemplateKWLoc = Loc;
1565 return getLocalData()->LAngleLoc;
1569 getLocalData()->LAngleLoc = Loc;
1573 return getLocalData()->RAngleLoc;
1577 getLocalData()->RAngleLoc = Loc;
1585 getArgInfos()[i] = AI;
1589 return getArgInfos()[i];
1597 return getLocalData()->NameLoc;
1601 getLocalData()->NameLoc = Loc;
1617 if (getTemplateKeywordLoc().isValid())
1618 return SourceRange(getTemplateKeywordLoc(), getRAngleLoc());
1620 return SourceRange(getTemplateNameLoc(), getRAngleLoc());
1624 setTemplateKeywordLoc(Loc);
1625 setTemplateNameLoc(Loc);
1628 initializeArgLocs(Context, getNumArgs(),
getTypePtr()->getArgs(),
1629 getArgInfos(), Loc);
1632 static void initializeArgLocs(
ASTContext &Context,
unsigned NumArgs,
1659 DependentAddressSpaceTypeLoc,
1660 DependentAddressSpaceType,
1661 DependentAddressSpaceLocInfo> {
1667 return getLocalData()->AttrLoc;
1670 getLocalData()->AttrLoc = loc;
1677 return getLocalData()->ExprOperand;
1680 getLocalData()->ExprOperand = e;
1688 return getLocalData()->OperandParens;
1691 getLocalData()->OperandParens = range;
1696 range.
setEnd(getAttrOperandParensRange().getEnd());
1709 return this->getInnerTypeLoc();
1713 setAttrNameLoc(loc);
1715 setAttrExprOperand(
getTypePtr()->getAddrSpaceExpr());
1736 DependentVectorTypeLoc,
1737 DependentVectorType> {};
1749 DependentSizedExtVectorTypeLoc,
1750 DependentSizedExtVectorType> {
1772 template <
class Derived,
class TypeClass,
class LocalData = TypeofLocInfo>
1774 :
public ConcreteTypeLoc<UnqualTypeLoc, Derived, TypeClass, LocalData> {
1777 return this->getLocalData()->TypeofLoc;
1781 this->getLocalData()->TypeofLoc = Loc;
1785 return this->getLocalData()->LParenLoc;
1789 this->getLocalData()->LParenLoc = Loc;
1793 return this->getLocalData()->RParenLoc;
1797 this->getLocalData()->RParenLoc = Loc;
1801 return SourceRange(getLParenLoc(), getRParenLoc());
1806 setRParenLoc(range.
getEnd());
1810 return SourceRange(getTypeofLoc(), getRParenLoc());
1822 TypeOfExprTypeLocInfo> {
1838 return this->
getTypePtr()->getUnderlyingType();
1842 return this->getLocalData()->UnderlyingTInfo;
1846 this->getLocalData()->UnderlyingTInfo = TI;
1868 UnaryTransformTypeLoc,
1870 UnaryTransformTypeLocInfo> {
1882 return getLocalData()->UnderlyingTInfo;
1886 getLocalData()->UnderlyingTInfo = TInfo;
1894 return SourceRange(getLParenLoc(), getRParenLoc());
1899 setRParenLoc(Range.
getEnd());
1915 DeducedTemplateSpecializationTypeLoc,
1916 DeducedTemplateSpecializationType> {
1919 return getNameLoc();
1937 ElaboratedLocInfo> {
1940 return this->getLocalData()->ElaboratedKWLoc;
1944 this->getLocalData()->ElaboratedKWLoc = Loc;
1949 getLocalData()->QualifierData);
1955 "Inconsistent nested-name-specifier pointer");
1956 getLocalData()->QualifierData = QualifierLoc.
getOpaqueData();
1960 if (getElaboratedKeywordLoc().isValid())
1961 if (getQualifierLoc())
1967 return getQualifierLoc().getSourceRange();
1973 return getInnerTypeLoc();
1994 DependentNameTypeLoc,
1996 DependentNameLocInfo> {
1999 return this->getLocalData()->ElaboratedKWLoc;
2003 this->getLocalData()->ElaboratedKWLoc = Loc;
2008 getLocalData()->QualifierData);
2014 "Inconsistent nested-name-specifier pointer");
2015 getLocalData()->QualifierData = QualifierLoc.
getOpaqueData();
2019 return this->getLocalData()->NameLoc;
2023 this->getLocalData()->NameLoc = Loc;
2027 if (getElaboratedKeywordLoc().isValid())
2028 return SourceRange(getElaboratedKeywordLoc(), getNameLoc());
2051 DependentTemplateSpecializationTypeLoc,
2052 DependentTemplateSpecializationType,
2053 DependentTemplateSpecializationLocInfo> {
2056 return this->getLocalData()->ElaboratedKWLoc;
2060 this->getLocalData()->ElaboratedKWLoc = Loc;
2064 if (!getLocalData()->QualifierData)
2068 getLocalData()->QualifierData);
2072 if (!QualifierLoc) {
2077 getLocalData()->QualifierData =
nullptr;
2083 "Inconsistent nested-name-specifier pointer");
2084 getLocalData()->QualifierData = QualifierLoc.
getOpaqueData();
2088 return getLocalData()->TemplateKWLoc;
2092 getLocalData()->TemplateKWLoc = Loc;
2096 return this->getLocalData()->NameLoc;
2100 this->getLocalData()->NameLoc = Loc;
2104 return this->getLocalData()->LAngleLoc;
2108 this->getLocalData()->LAngleLoc = Loc;
2112 return this->getLocalData()->RAngleLoc;
2116 this->getLocalData()->RAngleLoc = Loc;
2124 getArgInfos()[i] = AI;
2128 return getArgInfos()[i];
2136 if (getElaboratedKeywordLoc().isValid())
2137 return SourceRange(getElaboratedKeywordLoc(), getRAngleLoc());
2138 else if (getQualifierLoc())
2140 else if (getTemplateKeywordLoc().isValid())
2141 return SourceRange(getTemplateKeywordLoc(), getRAngleLoc());
2143 return SourceRange(getTemplateNameLoc(), getRAngleLoc());
2174 PackExpansionType, PackExpansionTypeLocInfo> {
2177 return this->getLocalData()->EllipsisLoc;
2181 this->getLocalData()->EllipsisLoc = Loc;
2185 return SourceRange(getEllipsisLoc(), getEllipsisLoc());
2189 setEllipsisLoc(Loc);
2193 return getInnerTypeLoc();
2206 AtomicType, AtomicTypeLocInfo> {
2209 return this->getInnerTypeLoc();
2217 return this->getLocalData()->KWLoc;
2221 this->getLocalData()->KWLoc = Loc;
2225 return this->getLocalData()->LParenLoc;
2229 this->getLocalData()->LParenLoc = Loc;
2233 return this->getLocalData()->RParenLoc;
2237 this->getLocalData()->RParenLoc = Loc;
2241 return SourceRange(getLParenLoc(), getRParenLoc());
2246 setRParenLoc(Range.
getEnd());
2281 template <
typename T>
2284 while (!T::isKind(Cur)) {
2286 Cur = PTL.getInnerLoc();
2288 Cur = ATL.getModifiedLoc();
2290 Cur = ETL.getNamedTypeLoc();
2292 Cur = ATL.getOriginalLoc();
2296 return Cur.
getAs<T>();
2301 #endif // LLVM_CLANG_AST_TYPELOC_H ObjCInterfaceDecl * getIFaceDecl() const
unsigned getExtraLocalDataSize() const
SourceRange getLocalSourceRange() const
SourceLocation getNameLoc() const
TemplateTypeParmDecl * getDecl() const
TypeLoc getValueLoc() const
unsigned getExtraLocalDataAlignment() const
SourceRange OperandParens
static unsigned getFullDataSizeForType(QualType Ty)
Returns the size of type source info data block for the given type.
SourceRange getExceptionSpecRange() const
unsigned getLocalDataSize() const
void initializeLocal(ASTContext &Context, SourceLocation Loc)
const TypeClass * getTypePtr() const
TypeSourceInfo * ClassTInfo
A (possibly-)qualified type.
void setStarLoc(SourceLocation Loc)
SourceLocation TypeArgsRAngleLoc
Wrapper for source info for tag types.
const TypeClass * getTypePtr() const
void setNameEndLoc(SourceLocation Loc)
SourceLocation getKWLoc() const
SourceRange getLocalSourceRange() const
void setKWLoc(SourceLocation Loc)
void setRParenLoc(SourceLocation Loc)
TypeLoc getNextTypeLoc() const
Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the TypeLoc is a PointerLoc and next Typ...
void setStarLoc(SourceLocation Loc)
void setLAngleLoc(SourceLocation Loc)
void setExceptionSpecRange(SourceRange R)
unsigned getLocalDataSize() const
Returns the size of the type source info data block that is specific to this type.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
TypeLoc getValueLoc() const
void initializeLocal(ASTContext &Context, SourceLocation Loc)
C Language Family Type Representation.
void setWrittenWidthSpec(TypeSpecifierWidth written)
WrittenBuiltinSpecs & getWrittenBuiltinSpecs()
HasNoInnerType getInnerType() const
SourceLocation ProtocolLAngleLoc
TypeLocClass getTypeLocClass() const
The base class of the type hierarchy.
void setTemplateKeywordLoc(SourceLocation Loc)
Wrapper for source info for typedefs.
TypeLoc getOriginalLoc() const
A container of type source information.
unsigned getExtraLocalDataSize() const
Wrapper for source info for pointers decayed from arrays and functions.
SourceLocation LocalRangeEnd
SourceLocation getEndLoc() const
Get the end source location.
bool hasBaseTypeAsWritten() const
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
void setParensRange(SourceRange range)
SourceLocation getRParenLoc() const
void initialize(ASTContext &Context, SourceLocation Loc) const
Initializes this to state that every location in this type is the given location. ...
Wrapper for source info for member pointers.
Wrapper of type source information for a type with non-trivial direct qualifiers. ...
SourceRange getLocalSourceRange() const
TypeSpecifierType
Specifies the kind of type.
SourceLocation getStarLoc() const
ArrayRef< SourceLocation > getProtocolLocs() const
TypeLoc getNamedTypeLoc() const
void setAttrOperandParensRange(SourceRange range)
void setProtocolRAngleLoc(SourceLocation Loc)
void setBegin(SourceLocation b)
SourceRange getLocalSourceRange() const
Expr * getAttrExprOperand() const
The attribute's expression operand, if it has one.
Represents a parameter to a function.
void initializeLocal(ASTContext &Context, SourceLocation loc)
SourceLocation NameEndLoc
void initializeLocal(ASTContext &Context, SourceLocation Loc)
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
A reasonable base class for TypeLocs that correspond to types that are written as a type-specifier...
SourceLocation getAmpAmpLoc() const
void setTypeArgTInfo(unsigned i, TypeSourceInfo *TInfo)
const Type * getTypePtr() const
bool needsExtraLocalData() const
void setParensRange(SourceRange Range)
void initializeLocal(ASTContext &Context, SourceLocation Loc)
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Base wrapper for a particular "section" of type source info.
Represents a struct/union/class.
void initializeLocal(ASTContext &Context, SourceLocation Loc)
unsigned getExtraLocalDataSize() const
TypeSpecifierSign getWrittenSignSpec() const
unsigned getExtraLocalDataSize() const
Returns the size of the type source info data block that is specific to this type.
void setLocalRangeEnd(SourceLocation L)
Expr * getUnderlyingExpr() const
SourceRange getLocalSourceRange() const
SourceLocation TypeArgsLAngleLoc
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
void initializeLocal(ASTContext &Context, SourceLocation Loc)
TypeLoc getInnerLoc() const
void setBuiltinLoc(SourceLocation Loc)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
TypeSpecifierSign
Specifies the signedness of a type, e.g., signed or unsigned.
TypeSourceInfo * getUnderlyingTInfo() const
void setRBracketLoc(SourceLocation Loc)
SourceRange getLocalSourceRange() const
SourceLocation RBracketLoc
QualType getInnerType() const
SourceLocation getProtocolLAngleLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
void setElaboratedKeywordLoc(SourceLocation Loc)
SourceLocation getProtocolRAngleLoc() const
void initializeLocal(ASTContext &Context, SourceLocation Loc)
ParmVarDecl * getParam(unsigned i) const
Wrapper for source info for unresolved typename using decls.
SourceLocation getRParenLoc() const
TypeLoc getNextTypeLoc() const
ArrayRef< SourceLocation > getProtocolLocs() const
void copy(DependentTemplateSpecializationTypeLoc Loc)
Wrapper of type source information for a type with no direct qualifiers.
unsigned getExtraLocalDataAlignment() const
SourceLocation getLParenLoc() const
SourceLocation getLAngleLoc() const
TypeSpecifierWidth getWrittenWidthSpec() const
void setProtocolLoc(unsigned i, SourceLocation Loc)
void setLParenLoc(SourceLocation Loc)
void setAttr(const Attr *A)
void setNameLoc(SourceLocation Loc)
SourceLocation getLParenLoc() const
void setCaretLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
Wrapper for source info for injected class names of class templates.
friend bool operator==(const TypeLoc &LHS, const TypeLoc &RHS)
bool HasBaseTypeAsWritten
unsigned getNumProtocols() const
SourceLocation getProtocolLoc(unsigned i) const
SourceLocation getSigilLoc() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
const Type * getClass() const
Wrapper for source info for functions.
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Initializes the local data of this type source info block to provide no information.
SourceLocation getElaboratedKeywordLoc() const
Wrapper for substituted template type parameters.
Wrapper for substituted template type parameters.
SourceLocation getLParenLoc() const
unsigned getExtraLocalDataAlignment() const
void setRParenLoc(SourceLocation Loc)
TypeLoc(const Type *ty, void *opaqueData)
void expandBuiltinRange(SourceRange Range)
SourceRange getLocalSourceRange() const
SourceLocation getTemplateKeywordLoc() const
CXXRecordDecl * getDecl() const
Wrapper for source info for ObjC interfaces.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
void initializeLocal(ASTContext &Context, SourceLocation Loc)
QualType getInnerType() const
QualType getInnerType() const
Returns the type before the address space attribute application area.
void setNameLoc(SourceLocation Loc)
Represents an Objective-C protocol declaration.
SourceLocation getNameLoc() const
TemplateArgumentLocInfo getArgLocInfo(unsigned i) const
void setProtocolLoc(unsigned i, SourceLocation Loc)
TemplateArgumentLoc getArgLoc(unsigned i) const
bool isDefinition() const
True if the tag was defined in this type specifier.
void setLocalRangeBegin(SourceLocation L)
Represents an ObjC class declaration.
void copy(ElaboratedTypeLoc Loc)
SourceLocation findNullabilityLoc() const
Find the location of the nullability specifier (__nonnull, __nullable, or __null_unspecifier), if there is one.
unsigned getNumArgs() const
SourceLocation getProtocolRAngleLoc() const
SourceLocation LocalRangeBegin
SourceLocation getElaboratedKeywordLoc() const
void setAttrNameLoc(SourceLocation loc)
SourceLocation getNameEndLoc() const
SourceRange getLocalSourceRange() const
SourceLocation getTemplateKeywordLoc() const
void * getOpaqueData() const
Get the pointer where source information is stored.
SourceLocation getBuiltinLoc() const
TypeLoc getInnerTypeLoc() const
ObjCProtocolDecl * getProtocol(unsigned i) const
SourceRange getLocalSourceRange() const
void * QualifierData
Data associated with the nested-name-specifier location.
SourceRange getLocalSourceRange() const
Get the local source range.
SourceLocation getNameLoc() const
EnumDecl * getDecl() const
void setSizeExpr(Expr *Size)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
QualType getInnerType() const
void setTemplateNameLoc(SourceLocation Loc)
TagDecl * getDecl() const
SourceLocation getBeginLoc() const
Get the begin source location.
bool hasWrittenSignSpec() const
SourceLocation getTemplateNameLoc() const
Type source information for an attributed type.
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
This represents one expression.
SourceLocation getLocalRangeEnd() const
void setModeAttr(bool written)
SourceLocation EllipsisLoc
Declaration of a template type parameter.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
SourceRange getBracketsRange() const
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
bool hasWrittenTypeSpec() const
void initializeLocal(ASTContext &Context, SourceLocation Loc)
void setWrittenSignSpec(TypeSpecifierSign written)
SourceLocation getCaretLoc() const
SourceLocation getEllipsisLoc() const
SourceRange getLocalSourceRange() const
void setRParenLoc(SourceLocation Loc)
void setNameLoc(SourceLocation Loc)
void setLParenLoc(SourceLocation Loc)
SourceLocation getLocalRangeBegin() const
Wrapper for source info for enum types.
SourceLocation getProtocolLAngleLoc() const
void setEllipsisLoc(SourceLocation Loc)
void setAttrExprOperand(Expr *e)
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
void setHasBaseTypeAsWritten(bool HasBaseType)
SourceLocation getEnd() const
SourceRange getLocalSourceRange() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
TypeSourceInfo * UnderlyingTInfo
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
TypeLoc getReturnLoc() const
SourceRange getLocalSourceRange() const
void setStarLoc(SourceLocation Loc)
TemplateArgumentLocInfo getArgLocInfo(unsigned i) const
void setTypeofLoc(SourceLocation Loc)
SourceRange getLocalSourceRange() const
Wrapper for source info for arrays.
SourceRange getLocalSourceRange() const
SourceLocation getTemplateNameLoc() const
QualType getInnerType() const
TypeLoc getPatternLoc() const
unsigned getExtraLocalDataSize() const
TypeLoc IgnoreParens() const
void * getExtraLocalData() const
Gets a pointer past the Info structure; useful for classes with local data that can't be captured in ...
void setLAngleLoc(SourceLocation Loc)
const Attr * getAttr() const
The type attribute.
Encodes a location in the source.
SourceLocation getStarLoc() const
SourceRange getLocalSourceRange() const
void initializeLocal(ASTContext &Context, SourceLocation Loc)
void setProtocolLAngleLoc(SourceLocation Loc)
Represents the declaration of a struct/union/class/enum.
void setProtocolRAngleLoc(SourceLocation Loc)
A metaprogramming base class for TypeLoc classes which correspond to a particular Type subclass...
SourceLocation getRParenLoc() const
friend bool operator!=(const TypeLoc &LHS, const TypeLoc &RHS)
RecordDecl * getDecl() const
void initializeLocal(ASTContext &Context, SourceLocation Loc)
SourceLocation ProtocolRAngleLoc
SourceLocation getStarLoc() const
QualType getInnerType() const
SourceRange getLocalSourceRange() const
UnqualTypeLoc(const Type *Ty, void *Data)
bool hasWrittenWidthSpec() const
TypeLocClass
The kinds of TypeLocs.
void setElaboratedKeywordLoc(SourceLocation Loc)
QualType getInnerType() const
void setWrittenTypeSpec(TypeSpecifierType written)
void setAmpLoc(SourceLocation Loc)
void setLBracketLoc(SourceLocation Loc)
SourceLocation ElaboratedKWLoc
TypeClass getTypeClass() const
unsigned getExtraLocalDataAlignment() const
SourceLocation getRAngleLoc() const
TypeLoc findExplicitQualifierLoc() const
Find a type with the location of an explicit type qualifier.
A metaprogramming class designed for concrete subtypes of abstract types where all subtypes share equ...
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
ArrayRef< ParmVarDecl * > getParams() const
unsigned getFullDataSize() const
Returns the size of the type source info data block.
static QualType getFromOpaquePtr(const void *Ptr)
QualType getInnerType() const
TypeLoc getElementLoc() const
Defines various enumerations that describe declaration and type specifiers.
void setLParenLoc(SourceLocation Loc)
void setTemplateKeywordLoc(SourceLocation Loc)
TypeLoc(QualType ty, void *opaqueData)
void setTypeArgsLAngleLoc(SourceLocation Loc)
Base class for declarations which introduce a typedef-name.
SourceLocation getTypeofLoc() const
Represents a template argument.
unsigned getLocalDataAlignment() const
ParmVarDecl ** getParmArray() const
TypeSourceInfo * getClassTInfo() const
void setClassTInfo(TypeSourceInfo *TI)
const Type * getTypePtr() const
QualType getInnerType() const
void initializeLocal(ASTContext &Context, SourceLocation loc)
Dataflow Directional Tag Classes.
SourceLocation TemplateKWLoc
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
bool isValid() const
Return true if this is a valid SourceLocation object.
void setAmpAmpLoc(SourceLocation Loc)
void initializeLocal(ASTContext &Context, SourceLocation Loc)
QualType getType() const
Get the type for which this source info wrapper provides information.
SourceRange getLocalSourceRange() const
TemplateArgumentLoc getArgLoc(unsigned i) const
QualType getInnerType() const
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
SourceLocation getRAngleLoc() const
Represents a dependent using declaration which was marked with typename.
Represents the declaration of an Objective-C type parameter.
void * getNonLocalData() const
LocalData * getLocalData() const
void setSigilLoc(SourceLocation Loc)
TypeLoc getModifiedLoc() const
The modified type, which is generally canonically different from the attribute type.
SourceRange getLocalSourceRange() const
ObjCTypeParamDecl * getDecl() const
TypeLoc getPointeeTypeLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getElaboratedKeywordLoc() const
unsigned getNumParams() const
void setNameLoc(SourceLocation Loc)
SourceLocation getRBracketLoc() const
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
unsigned getExtraLocalDataAlignment() const
TypeLoc getPointeeLoc() const
Location wrapper for a TemplateArgument.
SourceRange getLocalSourceRange() const
static bool classof(const OMPClause *T)
TypeSourceInfo * getTypeArgTInfo(unsigned i) const
TypedefNameDecl * getTypedefNameDecl() const
SourceLocation getTemplateNameLoc() const
SourceLocation getKWLoc() const
SourceLocation getRParenLoc() const
void setTemplateNameLoc(SourceLocation Loc)
const WrittenBuiltinSpecs & getWrittenBuiltinSpecs() const
unsigned getLocalDataSize() const
SourceLocation getProtocolLoc(unsigned i) const
Expr * getSizeExpr() const
TypeLocClass getTypeLocClass() const
void setTypeArgsRAngleLoc(SourceLocation Loc)
Wrapper for source info for record types.
UnresolvedUsingTypenameDecl * getDecl() const
SourceLocation getLBracketLoc() const
void copy(TemplateSpecializationTypeLoc Loc)
Wraps an ObjCPointerType with source location information.
unsigned getNumArgs() const
void initializeLocal(ASTContext &Context, SourceLocation Loc)
QualType getInnerType() const
SourceLocation getLParenLoc() const
TypeLoc getBaseLoc() const
Structure that packs information about the type specifiers that were written in a particular type spe...
UnqualTypeLoc getUnqualifiedLoc() const
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
SourceLocation getLAngleLoc() const
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
SourceLocation getTypeArgsLAngleLoc() const
void setKWLoc(SourceLocation Loc)
QualType getInnerType() const
SourceRange getParensRange() const
Defines the clang::SourceLocation class and associated facilities.
void setEnd(SourceLocation e)
Represents a C++ struct/union/class.
TypeSpecifierWidth
Specifies the width of a type, e.g., short, long, or long long.
QualType getInnerType() const
void setParam(unsigned i, ParmVarDecl *VD)
void copyLocal(TypeLoc other)
static unsigned getLocalAlignmentForType(QualType Ty)
Returns the alignment of type source info data block for the given type.
TypeLoc getNextTypeLoc() const
void copyLocal(Derived other)
SourceRange getLocalSourceRange() const
unsigned getExtraLocalDataAlignment() const
unsigned getNumProtocols() const
void setLParenLoc(SourceLocation Loc)
Location information for a TemplateArgument.
void initializeLocal(ASTContext &Context, SourceLocation Loc)
unsigned getExtraLocalDataSize() const
SourceLocation getNameLoc() const
QualType getUnderlyingType() const
void setRAngleLoc(SourceLocation Loc)
SourceRange getAttrOperandParensRange() const
The location of the parentheses around the operand, if there is an operand.
SourceLocation TemplateKWLoc
unsigned getNumTypeArgs() const
__DEVICE__ int max(int __a, int __b)
ObjCProtocolDecl * getProtocol(unsigned i) const
SourceLocation getAmpLoc() const
void copy(TypeLoc other)
Copies the other type loc into this one.
void setProtocolLAngleLoc(SourceLocation Loc)
__DEVICE__ int min(int __a, int __b)
SourceLocation getAttrNameLoc() const
The location of the attribute name, i.e.
attr::Kind getAttrKind() const
void initializeFullCopy(TypeLoc Other)
Initializes this by copying its information from another TypeLoc of the same type.
unsigned getExtraLocalDataAlignment() const
Wrapper for source info for builtin types.
void setRParenLoc(SourceLocation Loc)
Wrapper for template type parameters.
A trivial tuple used to represent a source range.
void copy(DependentNameTypeLoc Loc)
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
void setTemplateNameLoc(SourceLocation Loc)
NestedNameSpecifierLoc getQualifierLoc() const
Expr * getUnderlyingExpr() const
void initializeLocal(ASTContext &Context, SourceLocation Loc)
SourceRange getLocalSourceRange() const
void initializeFullCopy(TypeLoc Other, unsigned Size)
Initializes this by copying its information from another TypeLoc of the same type.
unsigned getExtraLocalDataSize() const
SourceRange getParensRange() const
SourceLocation getNameLoc() const
SourceRange getLocalSourceRange() const
Wrapper for source info for pointers.
SourceLocation getBegin() const
unsigned getLocalDataAlignment() const
Returns the alignment of the type source info data block that is specific to this type...
Wrapper for source info for block pointers.
void setElaboratedKeywordLoc(SourceLocation Loc)
Attr - This represents one attribute.
SourceLocation getLocation() const
SourceLocation getTypeArgsRAngleLoc() const
void setUnderlyingTInfo(TypeSourceInfo *TI) const
SourceRange getParensRange() const