14 #ifndef LLVM_CLANG_AST_TYPELOC_H 15 #define LLVM_CLANG_AST_TYPELOC_H 25 #include "llvm/ADT/ArrayRef.h" 26 #include "llvm/Support/Casting.h" 27 #include "llvm/Support/Compiler.h" 28 #include "llvm/Support/MathExtras.h" 39 class ObjCInterfaceDecl;
40 class ObjCProtocolDecl;
41 class ObjCTypeParamDecl;
42 class TemplateTypeParmDecl;
44 class UnresolvedUsingTypenameDecl;
47 #define ABSTRACT_TYPELOC(Class, Base) 48 #define TYPELOC(Class, Base) \ 50 #include "clang/AST/TypeLocNodes.def" 60 const void *
Ty =
nullptr;
66 : Ty(ty.getAsOpaquePtr()), Data(opaqueData) {}
68 : Ty(ty), Data(opaqueData) {}
76 assert(T::isKind(*
this));
87 if (!T::isKind(*
this))
106 #define ABSTRACT_TYPE(Class, Base) 107 #define TYPE(Class, Base) \ 109 #include "clang/AST/TypeNodes.def" 119 explicit operator bool()
const {
return Ty; }
157 return getLocalSourceRangeImpl(*
this);
168 return getNextTypeLocImpl(*
this);
193 initializeImpl(Context, *
this, Loc);
220 return !(LHS == RHS);
228 static bool isKind(
const TypeLoc&) {
242 return TypeLoc(
Ty, const_cast<void*>(static_cast<const void*>(
this + 1)));
253 return reinterpret_cast<const Type*
>(
Ty);
263 static bool isKind(
const TypeLoc &TL) {
281 dataInt = llvm::alignTo(dataInt, align);
317 static bool isKind(
const TypeLoc &TL) {
325 return castAs<UnqualTypeLoc>();
356 template <
class Base,
class Derived,
class TypeClass,
class LocalData>
360 const Derived *asDerived()
const {
361 return static_cast<const Derived*
>(
this);
364 static bool isKind(
const TypeLoc &TL) {
369 static bool classofType(
const Type *
Ty) {
375 return std::max(
unsigned(
alignof(LocalData)),
376 asDerived()->getExtraLocalDataAlignment());
380 unsigned size =
sizeof(LocalData);
381 unsigned extraAlign = asDerived()->getExtraLocalDataAlignment();
382 size = llvm::alignTo(size, extraAlign);
383 size += asDerived()->getExtraLocalDataSize();
389 if (asDerived()->getLocalDataSize() == 0)
return;
392 memcpy(getLocalData(), other.getLocalData(),
sizeof(LocalData));
397 memcpy(getExtraLocalData(), other.getExtraLocalData(),
398 asDerived()->getExtraLocalDataSize());
406 return cast<TypeClass>(Base::getTypePtr());
419 return static_cast<LocalData*
>(Base::Data);
426 unsigned size =
sizeof(LocalData);
427 unsigned extraAlign = asDerived()->getExtraLocalDataAlignment();
428 size = llvm::alignTo(size, extraAlign);
429 return reinterpret_cast<char*
>(Base::Data) + size;
433 auto data =
reinterpret_cast<uintptr_t>(Base::Data);
434 data += asDerived()->getLocalDataSize();
435 data = llvm::alignTo(data, getNextTypeAlign());
436 return reinterpret_cast<void*
>(data);
443 return TypeLoc(asDerived()->getInnerType(), getNonLocalData());
447 unsigned getInnerTypeSize()
const {
448 return getInnerTypeSize(asDerived()->getInnerType());
451 unsigned getInnerTypeSize(HasNoInnerType _)
const {
455 unsigned getInnerTypeSize(
QualType _)
const {
456 return getInnerTypeLoc().getFullDataSize();
459 unsigned getNextTypeAlign()
const {
460 return getNextTypeAlign(asDerived()->getInnerType());
463 unsigned getNextTypeAlign(HasNoInnerType _)
const {
467 unsigned getNextTypeAlign(
QualType T)
const {
474 return TypeLoc(T, getNonLocalData());
481 template <
class Base,
class Derived,
class TypeClass>
485 static bool classofType(
const Type *
Ty) {
489 static bool isKind(
const TypeLoc &TL) {
499 return cast<TypeClass>(Base::getTypePtr());
520 return this->getLocalData()->NameLoc;
524 this->getLocalData()->NameLoc = Loc;
538 static bool isKind(
const TypeLoc &TL);
552 return getLocalData()->BuiltinRange.getBegin();
556 getLocalData()->BuiltinRange = Loc;
560 SourceRange &BuiltinRange = getLocalData()->BuiltinRange;
562 BuiltinRange = Range;
580 return (bk >= BuiltinType::UShort && bk <= BuiltinType::UInt128)
581 || (bk >= BuiltinType::Short && bk <= BuiltinType::Float128)
582 || bk == BuiltinType::UChar
583 || bk == BuiltinType::SChar;
595 return getLocalData()->BuiltinRange;
599 if (needsExtraLocalData())
610 if (needsExtraLocalData())
611 getWrittenBuiltinSpecs().Sign = written;
615 if (needsExtraLocalData())
626 if (needsExtraLocalData())
627 getWrittenBuiltinSpecs().Width = written;
637 if (needsExtraLocalData())
638 getWrittenBuiltinSpecs().Type = written;
642 if (needsExtraLocalData())
643 return getWrittenBuiltinSpecs().ModeAttr;
649 if (needsExtraLocalData())
650 getWrittenBuiltinSpecs().ModeAttr = written;
655 if (needsExtraLocalData()) {
679 InjectedClassNameTypeLoc,
680 InjectedClassNameType> {
690 UnresolvedUsingTypeLoc,
691 UnresolvedUsingType> {
736 TemplateTypeParmTypeLoc,
737 TemplateTypeParmType> {
749 ObjCTypeParamTypeLoc,
751 ObjCTypeParamTypeLocInfo> {
761 return this->getLocalData()->NameLoc;
765 this->getLocalData()->NameLoc = Loc;
769 return getNumProtocols() ?
779 return getNumProtocols() ?
793 assert(i < getNumProtocols() &&
"Index is out of bounds!");
794 return getProtocolLocArray()[
i];
798 assert(i < getNumProtocols() &&
"Index is out of bounds!");
799 getProtocolLocArray()[
i] = Loc;
803 assert(i < getNumProtocols() &&
"Index is out of bounds!");
808 return llvm::makeArrayRef(getProtocolLocArray(), getNumProtocols());
814 if (!this->getNumProtocols())
return 0;
835 SubstTemplateTypeParmTypeLoc,
836 SubstTemplateTypeParmType> {
842 SubstTemplateTypeParmPackTypeLoc,
843 SubstTemplateTypeParmPackType> {
869 return getInnerTypeLoc();
874 return getLocalData()->TypeAttr;
877 getLocalData()->TypeAttr = A;
881 return dyn_cast_or_null<T>(getAttr());
894 return getAttr() ? getAttr()->getRange() :
SourceRange();
922 ObjCObjectTypeLocInfo> {
931 return (
SourceLocation*)(getTypeArgLocArray() + getNumTypeArgs());
936 return this->getLocalData()->TypeArgsLAngleLoc;
940 this->getLocalData()->TypeArgsLAngleLoc = Loc;
944 return this->getLocalData()->TypeArgsRAngleLoc;
948 this->getLocalData()->TypeArgsRAngleLoc = Loc;
952 return this->
getTypePtr()->getTypeArgsAsWritten().size();
956 assert(i < getNumTypeArgs() &&
"Index is out of bounds!");
957 return getTypeArgLocArray()[
i];
961 assert(i < getNumTypeArgs() &&
"Index is out of bounds!");
962 getTypeArgLocArray()[
i] = TInfo;
966 return this->getLocalData()->ProtocolLAngleLoc;
970 this->getLocalData()->ProtocolLAngleLoc = Loc;
974 return this->getLocalData()->ProtocolRAngleLoc;
978 this->getLocalData()->ProtocolRAngleLoc = Loc;
986 assert(i < getNumProtocols() &&
"Index is out of bounds!");
987 return getProtocolLocArray()[
i];
991 assert(i < getNumProtocols() &&
"Index is out of bounds!");
992 getProtocolLocArray()[
i] = Loc;
996 assert(i < getNumProtocols() &&
"Index is out of bounds!");
1002 return llvm::makeArrayRef(getProtocolLocArray(), getNumProtocols());
1006 return getLocalData()->HasBaseTypeAsWritten;
1010 getLocalData()->HasBaseTypeAsWritten = HasBaseType;
1014 return getInnerTypeLoc();
1020 start = getProtocolLAngleLoc();
1023 end = getTypeArgsRAngleLoc();
1036 "not enough alignment for tail-allocated data");
1052 ObjCInterfaceTypeLoc,
1054 ObjCInterfaceLocInfo> {
1061 return getLocalData()->NameLoc;
1065 getLocalData()->NameLoc = Loc;
1069 return SourceRange(getNameLoc(), getNameEndLoc());
1073 return getLocalData()->NameEndLoc;
1077 getLocalData()->NameEndLoc = Loc;
1092 MacroQualifiedType, MacroQualifiedLocInfo> {
1095 setExpansionLoc(Loc);
1105 return this->getLocalData()->ExpansionLoc;
1109 this->getLocalData()->ExpansionLoc = Loc;
1115 return getInnerLoc().getLocalSourceRange();
1129 return this->getLocalData()->LParenLoc;
1133 return this->getLocalData()->RParenLoc;
1137 this->getLocalData()->LParenLoc = Loc;
1141 this->getLocalData()->RParenLoc = Loc;
1145 return SourceRange(getLParenLoc(), getRParenLoc());
1154 return getInnerTypeLoc();
1163 if (ParenTypeLoc::isKind(*
this))
1164 return IgnoreParensImpl(*
this);
1171 AdjustedType, AdjustedLocInfo> {
1174 return getInnerTypeLoc();
1199 AdjustedTypeLoc, DecayedTypeLoc, DecayedType> {
1207 template <
class Derived,
class TypeClass,
class LocalData = Po
interLikeLocInfo>
1209 TypeClass, LocalData> {
1212 return this->getLocalData()->StarLoc;
1216 this->getLocalData()->StarLoc = Loc;
1220 return this->getInnerTypeLoc();
1241 return getSigilLoc();
1254 return getSigilLoc();
1269 MemberPointerLocInfo> {
1272 return getSigilLoc();
1284 return getLocalData()->ClassTInfo;
1288 getLocalData()->ClassTInfo = TI;
1293 setClassTInfo(
nullptr);
1298 return SourceRange(TI->getTypeLoc().getBeginLoc(), getStarLoc());
1307 ObjCObjectPointerType> {
1310 return getSigilLoc();
1322 return getTypePtr()->getPointeeTypeAsWritten();
1328 LValueReferenceTypeLoc,
1329 LValueReferenceType> {
1332 return getSigilLoc();
1342 RValueReferenceTypeLoc,
1343 RValueReferenceType> {
1346 return getSigilLoc();
1366 bool hasExceptionSpec()
const {
1367 if (
auto *FPT = dyn_cast<FunctionProtoType>(
getTypePtr())) {
1368 return FPT->hasExceptionSpec();
1374 assert(hasExceptionSpec() &&
"No exception spec range");
1377 return (
SourceRange *)(getParmArray() + getNumParams());
1382 return getLocalData()->LocalRangeBegin;
1386 getLocalData()->LocalRangeBegin = L;
1390 return getLocalData()->LocalRangeEnd;
1394 getLocalData()->LocalRangeEnd = L;
1398 return this->getLocalData()->LParenLoc;
1402 this->getLocalData()->LParenLoc = Loc;
1406 return this->getLocalData()->RParenLoc;
1410 this->getLocalData()->RParenLoc = Loc;
1414 return SourceRange(getLParenLoc(), getRParenLoc());
1418 if (hasExceptionSpec())
1419 return *getExceptionSpecRangePtr();
1424 if (hasExceptionSpec())
1425 *getExceptionSpecRangePtr() = R;
1429 return llvm::makeArrayRef(getParmArray(), getNumParams());
1440 return cast<FunctionProtoType>(
getTypePtr())->getNumParams();
1447 return getInnerTypeLoc();
1451 return SourceRange(getLocalRangeBegin(), getLocalRangeEnd());
1455 setLocalRangeBegin(Loc);
1458 setLocalRangeEnd(Loc);
1459 for (
unsigned i = 0, e = getNumParams();
i != e; ++
i)
1460 setParam(
i,
nullptr);
1461 if (hasExceptionSpec())
1462 setExceptionSpecRange(Loc);
1468 unsigned ExceptSpecSize = hasExceptionSpec() ?
sizeof(
SourceRange) : 0;
1469 return (getNumParams() *
sizeof(
ParmVarDecl *)) + ExceptSpecSize;
1479 FunctionProtoTypeLoc,
1480 FunctionProtoType> {
1485 FunctionNoProtoTypeLoc,
1486 FunctionNoProtoType> {
1501 return getLocalData()->LBracketLoc;
1505 getLocalData()->LBracketLoc = Loc;
1509 return getLocalData()->RBracketLoc;
1513 getLocalData()->RBracketLoc = Loc;
1517 return SourceRange(getLBracketLoc(), getRBracketLoc());
1521 return getLocalData()->Size;
1525 getLocalData()->Size = Size;
1529 return getInnerTypeLoc();
1533 return SourceRange(getLBracketLoc(), getRBracketLoc());
1537 setLBracketLoc(Loc);
1538 setRBracketLoc(Loc);
1539 setSizeExpr(
nullptr);
1547 ConstantArrayTypeLoc,
1548 ConstantArrayType> {
1553 IncompleteArrayTypeLoc,
1554 IncompleteArrayType> {
1559 DependentSizedArrayTypeLoc,
1560 DependentSizedArrayType> {
1570 VariableArrayTypeLoc,
1571 VariableArrayType> {
1587 TemplateSpecializationTypeLoc,
1588 TemplateSpecializationType,
1589 TemplateSpecializationLocInfo> {
1592 return getLocalData()->TemplateKWLoc;
1596 getLocalData()->TemplateKWLoc = Loc;
1600 return getLocalData()->LAngleLoc;
1604 getLocalData()->LAngleLoc = Loc;
1608 return getLocalData()->RAngleLoc;
1612 getLocalData()->RAngleLoc = Loc;
1620 getArgInfos()[
i] = AI;
1624 return getArgInfos()[
i];
1632 return getLocalData()->NameLoc;
1636 getLocalData()->NameLoc = Loc;
1652 if (getTemplateKeywordLoc().isValid())
1653 return SourceRange(getTemplateKeywordLoc(), getRAngleLoc());
1655 return SourceRange(getTemplateNameLoc(), getRAngleLoc());
1659 setTemplateKeywordLoc(Loc);
1660 setTemplateNameLoc(Loc);
1663 initializeArgLocs(Context, getNumArgs(),
getTypePtr()->getArgs(),
1664 getArgInfos(), Loc);
1667 static void initializeArgLocs(
ASTContext &Context,
unsigned NumArgs,
1694 DependentAddressSpaceTypeLoc,
1695 DependentAddressSpaceType,
1696 DependentAddressSpaceLocInfo> {
1702 return getLocalData()->AttrLoc;
1705 getLocalData()->AttrLoc = loc;
1712 return getLocalData()->ExprOperand;
1715 getLocalData()->ExprOperand = e;
1723 return getLocalData()->OperandParens;
1726 getLocalData()->OperandParens =
range;
1731 range.
setEnd(getAttrOperandParensRange().getEnd());
1744 return this->getInnerTypeLoc();
1748 setAttrNameLoc(loc);
1750 setAttrExprOperand(
getTypePtr()->getAddrSpaceExpr());
1771 DependentVectorTypeLoc,
1772 DependentVectorType> {};
1784 DependentSizedExtVectorTypeLoc,
1785 DependentSizedExtVectorType> {
1807 template <
class Derived,
class TypeClass,
class LocalData = TypeofLocInfo>
1809 :
public ConcreteTypeLoc<UnqualTypeLoc, Derived, TypeClass, LocalData> {
1812 return this->getLocalData()->TypeofLoc;
1816 this->getLocalData()->TypeofLoc = Loc;
1820 return this->getLocalData()->LParenLoc;
1824 this->getLocalData()->LParenLoc = Loc;
1828 return this->getLocalData()->RParenLoc;
1832 this->getLocalData()->RParenLoc = Loc;
1836 return SourceRange(getLParenLoc(), getRParenLoc());
1841 setRParenLoc(range.
getEnd());
1845 return SourceRange(getTypeofLoc(), getRParenLoc());
1857 TypeOfExprTypeLocInfo> {
1873 return this->
getTypePtr()->getUnderlyingType();
1877 return this->getLocalData()->UnderlyingTInfo;
1881 this->getLocalData()->UnderlyingTInfo = TI;
1903 UnaryTransformTypeLoc,
1905 UnaryTransformTypeLocInfo> {
1917 return getLocalData()->UnderlyingTInfo;
1921 getLocalData()->UnderlyingTInfo = TInfo;
1929 return SourceRange(getLParenLoc(), getRParenLoc());
1934 setRParenLoc(Range.
getEnd());
1950 DeducedTemplateSpecializationTypeLoc,
1951 DeducedTemplateSpecializationType> {
1954 return getNameLoc();
1972 ElaboratedLocInfo> {
1975 return this->getLocalData()->ElaboratedKWLoc;
1979 this->getLocalData()->ElaboratedKWLoc = Loc;
1984 getLocalData()->QualifierData);
1990 "Inconsistent nested-name-specifier pointer");
1991 getLocalData()->QualifierData = QualifierLoc.
getOpaqueData();
1995 if (getElaboratedKeywordLoc().isValid())
1996 if (getQualifierLoc())
2002 return getQualifierLoc().getSourceRange();
2008 return getInnerTypeLoc();
2029 DependentNameTypeLoc,
2031 DependentNameLocInfo> {
2034 return this->getLocalData()->ElaboratedKWLoc;
2038 this->getLocalData()->ElaboratedKWLoc = Loc;
2043 getLocalData()->QualifierData);
2049 "Inconsistent nested-name-specifier pointer");
2050 getLocalData()->QualifierData = QualifierLoc.
getOpaqueData();
2054 return this->getLocalData()->NameLoc;
2058 this->getLocalData()->NameLoc = Loc;
2062 if (getElaboratedKeywordLoc().isValid())
2063 return SourceRange(getElaboratedKeywordLoc(), getNameLoc());
2086 DependentTemplateSpecializationTypeLoc,
2087 DependentTemplateSpecializationType,
2088 DependentTemplateSpecializationLocInfo> {
2091 return this->getLocalData()->ElaboratedKWLoc;
2095 this->getLocalData()->ElaboratedKWLoc = Loc;
2099 if (!getLocalData()->QualifierData)
2103 getLocalData()->QualifierData);
2107 if (!QualifierLoc) {
2112 getLocalData()->QualifierData =
nullptr;
2118 "Inconsistent nested-name-specifier pointer");
2119 getLocalData()->QualifierData = QualifierLoc.
getOpaqueData();
2123 return getLocalData()->TemplateKWLoc;
2127 getLocalData()->TemplateKWLoc = Loc;
2131 return this->getLocalData()->NameLoc;
2135 this->getLocalData()->NameLoc = Loc;
2139 return this->getLocalData()->LAngleLoc;
2143 this->getLocalData()->LAngleLoc = Loc;
2147 return this->getLocalData()->RAngleLoc;
2151 this->getLocalData()->RAngleLoc = Loc;
2159 getArgInfos()[
i] = AI;
2163 return getArgInfos()[
i];
2171 if (getElaboratedKeywordLoc().isValid())
2172 return SourceRange(getElaboratedKeywordLoc(), getRAngleLoc());
2173 else if (getQualifierLoc())
2175 else if (getTemplateKeywordLoc().isValid())
2176 return SourceRange(getTemplateKeywordLoc(), getRAngleLoc());
2178 return SourceRange(getTemplateNameLoc(), getRAngleLoc());
2209 PackExpansionType, PackExpansionTypeLocInfo> {
2212 return this->getLocalData()->EllipsisLoc;
2216 this->getLocalData()->EllipsisLoc = Loc;
2220 return SourceRange(getEllipsisLoc(), getEllipsisLoc());
2224 setEllipsisLoc(Loc);
2228 return getInnerTypeLoc();
2241 AtomicType, AtomicTypeLocInfo> {
2244 return this->getInnerTypeLoc();
2252 return this->getLocalData()->KWLoc;
2256 this->getLocalData()->KWLoc = Loc;
2260 return this->getLocalData()->LParenLoc;
2264 this->getLocalData()->LParenLoc = Loc;
2268 return this->getLocalData()->RParenLoc;
2272 this->getLocalData()->RParenLoc = Loc;
2276 return SourceRange(getLParenLoc(), getRParenLoc());
2281 setRParenLoc(Range.
getEnd());
2316 template <
typename T>
2319 while (!T::isKind(Cur)) {
2321 Cur = PTL.getInnerLoc();
2323 Cur = ATL.getModifiedLoc();
2325 Cur = ETL.getNamedTypeLoc();
2327 Cur = ATL.getOriginalLoc();
2329 Cur = MQL.getInnerLoc();
2333 return Cur.
getAs<T>();
2338 #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
SourceLocation getExpansionLoc() 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.
One of these records is kept for each identifier that is lexed.
void setLocalRangeEnd(SourceLocation L)
Expr * getUnderlyingExpr() const
SourceRange getLocalSourceRange() const
SourceLocation TypeArgsLAngleLoc
SourceRange getLocalSourceRange() const
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
SourceLocation ExpansionLoc
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)
__DEVICE__ int max(int __a, int __b)
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 setExpansionLoc(SourceLocation Loc)
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)
QualType getInnerType() const
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
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
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
TypeLoc getInnerLoc() const
SourceRange getLocalSourceRange() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
TypeSourceInfo * UnderlyingTInfo
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.
TypeLoc IgnoreMacroDefinitions() const
Strips MacroDefinitionTypeLocs from a type location.
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)
const IdentifierInfo * getMacroIdentifier() const
unsigned getExtraLocalDataSize() const
__DEVICE__ int min(int __a, int __b)
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
ObjCProtocolDecl * getProtocol(unsigned i) const
SourceLocation getAmpLoc() const
void copy(TypeLoc other)
Copies the other type loc into this one.
void setProtocolLAngleLoc(SourceLocation Loc)
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 initializeLocal(ASTContext &Context, SourceLocation Loc)
void setUnderlyingTInfo(TypeSourceInfo *TI) const
SourceRange getParensRange() const