14 #ifndef LLVM_CLANG_AST_TYPELOC_H 15 #define LLVM_CLANG_AST_TYPELOC_H 24 #include "llvm/ADT/ArrayRef.h" 25 #include "llvm/Support/Casting.h" 26 #include "llvm/Support/Compiler.h" 27 #include "llvm/Support/MathExtras.h" 40 class ObjCInterfaceDecl;
41 class ObjCProtocolDecl;
42 class ObjCTypeParamDecl;
44 class TemplateTypeParmDecl;
46 class UnresolvedUsingTypenameDecl;
49 #define ABSTRACT_TYPELOC(Class, Base) 50 #define TYPELOC(Class, Base) \ 52 #include "clang/AST/TypeLocNodes.def" 62 const void *
Ty =
nullptr;
68 : Ty(ty.getAsOpaquePtr()), Data(opaqueData) {}
70 : Ty(ty), Data(opaqueData) {}
78 assert(T::isKind(*
this));
89 if (!T::isKind(*
this))
101 template <
typename T>
108 #define ABSTRACT_TYPE(Class, Base) 109 #define TYPE(Class, Base) \ 111 #include "clang/AST/TypeNodes.inc" 121 explicit operator bool()
const {
return Ty; }
159 return getLocalSourceRangeImpl(*
this);
170 return getNextTypeLocImpl(*
this);
197 initializeImpl(Context, *
this, Loc);
224 return !(LHS == RHS);
232 static bool isKind(
const TypeLoc&) {
246 return TypeLoc(
Ty, const_cast<void*>(static_cast<const void*>(
this + 1)));
257 return reinterpret_cast<const Type*
>(
Ty);
267 static bool isKind(
const TypeLoc &TL) {
285 dataInt = llvm::alignTo(dataInt, align);
321 static bool isKind(
const TypeLoc &TL) {
329 return castAs<UnqualTypeLoc>();
360 template <
class Base,
class Derived,
class TypeClass,
class LocalData>
364 const Derived *asDerived()
const {
365 return static_cast<const Derived*
>(
this);
368 static bool isKind(
const TypeLoc &TL) {
373 static bool classofType(
const Type *
Ty) {
379 return std::max(
unsigned(
alignof(LocalData)),
380 asDerived()->getExtraLocalDataAlignment());
384 unsigned size =
sizeof(LocalData);
385 unsigned extraAlign = asDerived()->getExtraLocalDataAlignment();
386 size = llvm::alignTo(size, extraAlign);
387 size += asDerived()->getExtraLocalDataSize();
393 if (asDerived()->getLocalDataSize() == 0)
return;
396 memcpy(getLocalData(), other.getLocalData(),
sizeof(LocalData));
401 memcpy(getExtraLocalData(), other.getExtraLocalData(),
402 asDerived()->getExtraLocalDataSize());
410 return cast<TypeClass>(Base::getTypePtr());
423 return static_cast<LocalData*
>(Base::Data);
430 unsigned size =
sizeof(LocalData);
431 unsigned extraAlign = asDerived()->getExtraLocalDataAlignment();
432 size = llvm::alignTo(size, extraAlign);
433 return reinterpret_cast<char*
>(Base::Data) + size;
437 auto data =
reinterpret_cast<uintptr_t>(Base::Data);
438 data += asDerived()->getLocalDataSize();
439 data = llvm::alignTo(data, getNextTypeAlign());
440 return reinterpret_cast<void*
>(data);
447 return TypeLoc(asDerived()->getInnerType(), getNonLocalData());
451 unsigned getInnerTypeSize()
const {
452 return getInnerTypeSize(asDerived()->getInnerType());
455 unsigned getInnerTypeSize(HasNoInnerType _)
const {
459 unsigned getInnerTypeSize(
QualType _)
const {
460 return getInnerTypeLoc().getFullDataSize();
463 unsigned getNextTypeAlign()
const {
464 return getNextTypeAlign(asDerived()->getInnerType());
467 unsigned getNextTypeAlign(HasNoInnerType _)
const {
471 unsigned getNextTypeAlign(
QualType T)
const {
478 return TypeLoc(T, getNonLocalData());
485 template <
class Base,
class Derived,
class TypeClass>
489 static bool classofType(
const Type *
Ty) {
493 static bool isKind(
const TypeLoc &TL) {
503 return cast<TypeClass>(Base::getTypePtr());
524 return this->getLocalData()->NameLoc;
528 this->getLocalData()->NameLoc = Loc;
542 static bool isKind(
const TypeLoc &TL);
556 return getLocalData()->BuiltinRange.getBegin();
560 getLocalData()->BuiltinRange = Loc;
564 SourceRange &BuiltinRange = getLocalData()->BuiltinRange;
566 BuiltinRange = Range;
584 return (bk >= BuiltinType::UShort && bk <= BuiltinType::UInt128)
585 || (bk >= BuiltinType::Short && bk <= BuiltinType::Float128)
586 || bk == BuiltinType::UChar
587 || bk == BuiltinType::SChar;
599 return getLocalData()->BuiltinRange;
603 if (needsExtraLocalData())
614 if (needsExtraLocalData())
615 getWrittenBuiltinSpecs().Sign = written;
619 if (needsExtraLocalData())
630 if (needsExtraLocalData())
631 getWrittenBuiltinSpecs().Width = written;
641 if (needsExtraLocalData())
642 getWrittenBuiltinSpecs().Type = written;
646 if (needsExtraLocalData())
647 return getWrittenBuiltinSpecs().ModeAttr;
653 if (needsExtraLocalData())
654 getWrittenBuiltinSpecs().ModeAttr = written;
659 if (needsExtraLocalData()) {
683 InjectedClassNameTypeLoc,
684 InjectedClassNameType> {
694 UnresolvedUsingTypeLoc,
695 UnresolvedUsingType> {
714 bool isDefinition()
const;
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!");
804 return *(this->
getTypePtr()->qual_begin() + i);
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());
911 ObjCObjectTypeLocInfo> {
920 return (
SourceLocation*)(getTypeArgLocArray() + getNumTypeArgs());
925 return this->getLocalData()->TypeArgsLAngleLoc;
929 this->getLocalData()->TypeArgsLAngleLoc = Loc;
933 return this->getLocalData()->TypeArgsRAngleLoc;
937 this->getLocalData()->TypeArgsRAngleLoc = Loc;
941 return this->
getTypePtr()->getTypeArgsAsWritten().size();
945 assert(i < getNumTypeArgs() &&
"Index is out of bounds!");
946 return getTypeArgLocArray()[i];
950 assert(i < getNumTypeArgs() &&
"Index is out of bounds!");
951 getTypeArgLocArray()[i] = TInfo;
955 return this->getLocalData()->ProtocolLAngleLoc;
959 this->getLocalData()->ProtocolLAngleLoc = Loc;
963 return this->getLocalData()->ProtocolRAngleLoc;
967 this->getLocalData()->ProtocolRAngleLoc = Loc;
975 assert(i < getNumProtocols() &&
"Index is out of bounds!");
976 return getProtocolLocArray()[i];
980 assert(i < getNumProtocols() &&
"Index is out of bounds!");
981 getProtocolLocArray()[i] = Loc;
985 assert(i < getNumProtocols() &&
"Index is out of bounds!");
986 return *(this->
getTypePtr()->qual_begin() + i);
991 return llvm::makeArrayRef(getProtocolLocArray(), getNumProtocols());
995 return getLocalData()->HasBaseTypeAsWritten;
999 getLocalData()->HasBaseTypeAsWritten = HasBaseType;
1003 return getInnerTypeLoc();
1009 start = getProtocolLAngleLoc();
1012 end = getTypeArgsRAngleLoc();
1025 "not enough alignment for tail-allocated data");
1041 ObjCInterfaceTypeLoc,
1043 ObjCInterfaceLocInfo> {
1050 return getLocalData()->NameLoc;
1054 getLocalData()->NameLoc = Loc;
1058 return SourceRange(getNameLoc(), getNameEndLoc());
1062 return getLocalData()->NameEndLoc;
1066 getLocalData()->NameEndLoc = Loc;
1081 MacroQualifiedType, MacroQualifiedLocInfo> {
1084 setExpansionLoc(Loc);
1094 return this->getLocalData()->ExpansionLoc;
1098 this->getLocalData()->ExpansionLoc = Loc;
1104 return getInnerLoc().getLocalSourceRange();
1118 return this->getLocalData()->LParenLoc;
1122 return this->getLocalData()->RParenLoc;
1126 this->getLocalData()->LParenLoc = Loc;
1130 this->getLocalData()->RParenLoc = Loc;
1134 return SourceRange(getLParenLoc(), getRParenLoc());
1143 return getInnerTypeLoc();
1152 if (ParenTypeLoc::isKind(*
this))
1153 return IgnoreParensImpl(*
this);
1160 AdjustedType, AdjustedLocInfo> {
1163 return getInnerTypeLoc();
1188 AdjustedTypeLoc, DecayedTypeLoc, DecayedType> {
1196 template <
class Derived,
class TypeClass,
class LocalData = Po
interLikeLocInfo>
1198 TypeClass, LocalData> {
1201 return this->getLocalData()->StarLoc;
1205 this->getLocalData()->StarLoc = Loc;
1209 return this->getInnerTypeLoc();
1230 return getSigilLoc();
1243 return getSigilLoc();
1258 MemberPointerLocInfo> {
1261 return getSigilLoc();
1273 return getLocalData()->ClassTInfo;
1277 getLocalData()->ClassTInfo = TI;
1282 setClassTInfo(
nullptr);
1287 return SourceRange(TI->getTypeLoc().getBeginLoc(), getStarLoc());
1296 ObjCObjectPointerType> {
1299 return getSigilLoc();
1311 return getTypePtr()->getPointeeTypeAsWritten();
1317 LValueReferenceTypeLoc,
1318 LValueReferenceType> {
1321 return getSigilLoc();
1331 RValueReferenceTypeLoc,
1332 RValueReferenceType> {
1335 return getSigilLoc();
1355 bool hasExceptionSpec()
const {
1356 if (
auto *FPT = dyn_cast<FunctionProtoType>(
getTypePtr())) {
1357 return FPT->hasExceptionSpec();
1363 assert(hasExceptionSpec() &&
"No exception spec range");
1366 return (
SourceRange *)(getParmArray() + getNumParams());
1371 return getLocalData()->LocalRangeBegin;
1375 getLocalData()->LocalRangeBegin = L;
1379 return getLocalData()->LocalRangeEnd;
1383 getLocalData()->LocalRangeEnd = L;
1387 return this->getLocalData()->LParenLoc;
1391 this->getLocalData()->LParenLoc = Loc;
1395 return this->getLocalData()->RParenLoc;
1399 this->getLocalData()->RParenLoc = Loc;
1403 return SourceRange(getLParenLoc(), getRParenLoc());
1407 if (hasExceptionSpec())
1408 return *getExceptionSpecRangePtr();
1413 if (hasExceptionSpec())
1414 *getExceptionSpecRangePtr() = R;
1418 return llvm::makeArrayRef(getParmArray(), getNumParams());
1429 return cast<FunctionProtoType>(
getTypePtr())->getNumParams();
1436 return getInnerTypeLoc();
1440 return SourceRange(getLocalRangeBegin(), getLocalRangeEnd());
1444 setLocalRangeBegin(Loc);
1447 setLocalRangeEnd(Loc);
1448 for (
unsigned i = 0, e = getNumParams(); i != e; ++i)
1449 setParam(i,
nullptr);
1450 if (hasExceptionSpec())
1451 setExceptionSpecRange(Loc);
1457 unsigned ExceptSpecSize = hasExceptionSpec() ?
sizeof(
SourceRange) : 0;
1458 return (getNumParams() *
sizeof(
ParmVarDecl *)) + ExceptSpecSize;
1468 FunctionProtoTypeLoc,
1469 FunctionProtoType> {
1474 FunctionNoProtoTypeLoc,
1475 FunctionNoProtoType> {
1490 return getLocalData()->LBracketLoc;
1494 getLocalData()->LBracketLoc = Loc;
1498 return getLocalData()->RBracketLoc;
1502 getLocalData()->RBracketLoc = Loc;
1506 return SourceRange(getLBracketLoc(), getRBracketLoc());
1510 return getLocalData()->Size;
1514 getLocalData()->Size = Size;
1518 return getInnerTypeLoc();
1522 return SourceRange(getLBracketLoc(), getRBracketLoc());
1526 setLBracketLoc(Loc);
1527 setRBracketLoc(Loc);
1528 setSizeExpr(
nullptr);
1536 ConstantArrayTypeLoc,
1537 ConstantArrayType> {
1542 IncompleteArrayTypeLoc,
1543 IncompleteArrayType> {
1548 DependentSizedArrayTypeLoc,
1549 DependentSizedArrayType> {
1559 VariableArrayTypeLoc,
1560 VariableArrayType> {
1576 TemplateSpecializationTypeLoc,
1577 TemplateSpecializationType,
1578 TemplateSpecializationLocInfo> {
1581 return getLocalData()->TemplateKWLoc;
1585 getLocalData()->TemplateKWLoc = Loc;
1589 return getLocalData()->LAngleLoc;
1593 getLocalData()->LAngleLoc = Loc;
1597 return getLocalData()->RAngleLoc;
1601 getLocalData()->RAngleLoc = Loc;
1609 getArgInfos()[i] = AI;
1613 return getArgInfos()[i];
1621 return getLocalData()->NameLoc;
1625 getLocalData()->NameLoc = Loc;
1641 if (getTemplateKeywordLoc().isValid())
1642 return SourceRange(getTemplateKeywordLoc(), getRAngleLoc());
1644 return SourceRange(getTemplateNameLoc(), getRAngleLoc());
1648 setTemplateKeywordLoc(Loc);
1649 setTemplateNameLoc(Loc);
1652 initializeArgLocs(Context, getNumArgs(),
getTypePtr()->getArgs(),
1653 getArgInfos(), Loc);
1656 static void initializeArgLocs(
ASTContext &Context,
unsigned NumArgs,
1683 DependentAddressSpaceTypeLoc,
1684 DependentAddressSpaceType,
1685 DependentAddressSpaceLocInfo> {
1691 return getLocalData()->AttrLoc;
1694 getLocalData()->AttrLoc = loc;
1701 return getLocalData()->ExprOperand;
1704 getLocalData()->ExprOperand = e;
1712 return getLocalData()->OperandParens;
1715 getLocalData()->OperandParens =
range;
1720 range.
setEnd(getAttrOperandParensRange().getEnd());
1733 return this->getInnerTypeLoc();
1737 setAttrNameLoc(loc);
1739 setAttrExprOperand(
getTypePtr()->getAddrSpaceExpr());
1760 DependentVectorTypeLoc,
1761 DependentVectorType> {};
1773 DependentSizedExtVectorTypeLoc,
1774 DependentSizedExtVectorType> {
1796 template <
class Derived,
class TypeClass,
class LocalData = TypeofLocInfo>
1798 :
public ConcreteTypeLoc<UnqualTypeLoc, Derived, TypeClass, LocalData> {
1801 return this->getLocalData()->TypeofLoc;
1805 this->getLocalData()->TypeofLoc = Loc;
1809 return this->getLocalData()->LParenLoc;
1813 this->getLocalData()->LParenLoc = Loc;
1817 return this->getLocalData()->RParenLoc;
1821 this->getLocalData()->RParenLoc = Loc;
1825 return SourceRange(getLParenLoc(), getRParenLoc());
1830 setRParenLoc(range.
getEnd());
1834 return SourceRange(getTypeofLoc(), getRParenLoc());
1846 TypeOfExprTypeLocInfo> {
1862 return this->
getTypePtr()->getUnderlyingType();
1866 return this->getLocalData()->UnderlyingTInfo;
1870 this->getLocalData()->UnderlyingTInfo = TI;
1892 UnaryTransformTypeLoc,
1894 UnaryTransformTypeLocInfo> {
1906 return getLocalData()->UnderlyingTInfo;
1910 getLocalData()->UnderlyingTInfo = TInfo;
1918 return SourceRange(getLParenLoc(), getRParenLoc());
1923 setRParenLoc(Range.
getEnd());
1957 return getLocalData()->NestedNameSpec;
1961 getLocalData()->NestedNameSpec = NNS;
1965 return getLocalData()->TemplateKWLoc;
1969 getLocalData()->TemplateKWLoc = Loc;
1973 return getLocalData()->ConceptNameLoc;
1977 getLocalData()->ConceptNameLoc = Loc;
1981 return getLocalData()->FoundDecl;
1985 getLocalData()->FoundDecl = D;
1989 return getTypePtr()->getTypeConstraintConcept();
1995 return getLocalData()->LAngleLoc.isValid();
1999 return this->getLocalData()->LAngleLoc;
2003 this->getLocalData()->LAngleLoc = Loc;
2007 return this->getLocalData()->RAngleLoc;
2011 this->getLocalData()->RAngleLoc = Loc;
2019 getArgInfos()[i] = AI;
2023 return getArgInfos()[i];
2034 ? (getNestedNameSpecifierLoc()
2035 ? getNestedNameSpecifierLoc().getBeginLoc()
2036 : (getTemplateKWLoc().isValid()
2037 ? getTemplateKWLoc()
2038 : getConceptNameLoc()))
2068 DeducedTemplateSpecializationTypeLoc,
2069 DeducedTemplateSpecializationType> {
2072 return getNameLoc();
2090 ElaboratedLocInfo> {
2093 return this->getLocalData()->ElaboratedKWLoc;
2097 this->getLocalData()->ElaboratedKWLoc = Loc;
2102 getLocalData()->QualifierData);
2108 "Inconsistent nested-name-specifier pointer");
2109 getLocalData()->QualifierData = QualifierLoc.
getOpaqueData();
2113 if (getElaboratedKeywordLoc().isValid())
2114 if (getQualifierLoc())
2120 return getQualifierLoc().getSourceRange();
2126 return getInnerTypeLoc();
2147 DependentNameTypeLoc,
2149 DependentNameLocInfo> {
2152 return this->getLocalData()->ElaboratedKWLoc;
2156 this->getLocalData()->ElaboratedKWLoc = Loc;
2161 getLocalData()->QualifierData);
2167 "Inconsistent nested-name-specifier pointer");
2168 getLocalData()->QualifierData = QualifierLoc.
getOpaqueData();
2172 return this->getLocalData()->NameLoc;
2176 this->getLocalData()->NameLoc = Loc;
2180 if (getElaboratedKeywordLoc().isValid())
2181 return SourceRange(getElaboratedKeywordLoc(), getNameLoc());
2204 DependentTemplateSpecializationTypeLoc,
2205 DependentTemplateSpecializationType,
2206 DependentTemplateSpecializationLocInfo> {
2209 return this->getLocalData()->ElaboratedKWLoc;
2213 this->getLocalData()->ElaboratedKWLoc = Loc;
2217 if (!getLocalData()->QualifierData)
2221 getLocalData()->QualifierData);
2225 if (!QualifierLoc) {
2230 getLocalData()->QualifierData =
nullptr;
2236 "Inconsistent nested-name-specifier pointer");
2237 getLocalData()->QualifierData = QualifierLoc.
getOpaqueData();
2241 return getLocalData()->TemplateKWLoc;
2245 getLocalData()->TemplateKWLoc = Loc;
2249 return this->getLocalData()->NameLoc;
2253 this->getLocalData()->NameLoc = Loc;
2257 return this->getLocalData()->LAngleLoc;
2261 this->getLocalData()->LAngleLoc = Loc;
2265 return this->getLocalData()->RAngleLoc;
2269 this->getLocalData()->RAngleLoc = Loc;
2277 getArgInfos()[i] = AI;
2281 return getArgInfos()[i];
2289 if (getElaboratedKeywordLoc().isValid())
2290 return SourceRange(getElaboratedKeywordLoc(), getRAngleLoc());
2291 else if (getQualifierLoc())
2293 else if (getTemplateKeywordLoc().isValid())
2294 return SourceRange(getTemplateKeywordLoc(), getRAngleLoc());
2296 return SourceRange(getTemplateNameLoc(), getRAngleLoc());
2327 PackExpansionType, PackExpansionTypeLocInfo> {
2330 return this->getLocalData()->EllipsisLoc;
2334 this->getLocalData()->EllipsisLoc = Loc;
2338 return SourceRange(getEllipsisLoc(), getEllipsisLoc());
2342 setEllipsisLoc(Loc);
2346 return getInnerTypeLoc();
2359 AtomicType, AtomicTypeLocInfo> {
2362 return this->getInnerTypeLoc();
2370 return this->getLocalData()->KWLoc;
2374 this->getLocalData()->KWLoc = Loc;
2378 return this->getLocalData()->LParenLoc;
2382 this->getLocalData()->LParenLoc = Loc;
2386 return this->getLocalData()->RParenLoc;
2390 this->getLocalData()->RParenLoc = Loc;
2394 return SourceRange(getLParenLoc(), getRParenLoc());
2399 setRParenLoc(Range.
getEnd());
2434 template <
typename T>
2437 while (!T::isKind(Cur)) {
2439 Cur = PTL.getInnerLoc();
2441 Cur = ATL.getModifiedLoc();
2443 Cur = ETL.getNamedTypeLoc();
2445 Cur = ATL.getOriginalLoc();
2447 Cur = MQL.getInnerLoc();
2451 return Cur.
getAs<T>();
2456 #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
unsigned getNumArgs() 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...
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
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 setConceptNameLoc(SourceLocation Loc)
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.
constexpr size_t align(size_t Size)
Aligns a size to the pointer alignment.
void setLAngleLoc(SourceLocation Loc)
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.
void copy(AutoTypeLoc Loc)
SourceLocation LocalRangeEnd
SourceLocation getEndLoc() const
Get the end source location.
bool hasBaseTypeAsWritten() const
SourceRange getLocalSourceRange() const
void setParensRange(SourceRange range)
SourceLocation getRParenLoc() const
bool isConstrained() 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
ConceptDecl * getNamedConcept() const
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)
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
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
SourceLocation getLAngleLoc() const
unsigned getExtraLocalDataAlignment() const
void setFoundDecl(NamedDecl *D)
__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 setTemplateKWLoc(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 setNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
void setHasBaseTypeAsWritten(bool HasBaseType)
SourceLocation getEnd() const
TypeLoc getInnerLoc() const
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() 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
NestedNameSpecifierLoc NestedNameSpec
void setTypeofLoc(SourceLocation Loc)
SourceRange getLocalSourceRange() const
Wrapper for source info for arrays.
SourceRange getLocalSourceRange() const
SourceLocation getTemplateNameLoc() const
QualType getInnerType() const
AutoTypeLoc getContainedAutoTypeLoc() const
Get the typeloc of an AutoType whose type will be deduced for a variable with an initializer of this ...
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.
NamedDecl * getFoundDecl() const
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 getRAngleLoc() const
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
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
TypeLoc getPointeeTypeLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
SourceLocation getElaboratedKeywordLoc() const
unsigned getNumParams() const
unsigned getExtraLocalDataSize() 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
AutoTypeKeyword getAutoKeyword() 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
void setRAngleLoc(SourceLocation Loc)
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.
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
bool hasExplicitTemplateArgs() const
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)
SourceLocation ConceptNameLoc
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
SourceLocation getTemplateKWLoc() 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)
TemplateArgumentLocInfo getArgLocInfo(unsigned i) const
TemplateArgumentLoc getArgLoc(unsigned i) const
SourceLocation TemplateKWLoc
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.
This represents a decl that may have a name.
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)
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.
SourceLocation getConceptNameLoc() const
void setElaboratedKeywordLoc(SourceLocation Loc)
Attr - This represents one attribute.
SourceLocation getTypeArgsRAngleLoc() const
void initializeLocal(ASTContext &Context, SourceLocation Loc)
void setUnderlyingTInfo(TypeSourceInfo *TI) const
SourceRange getParensRange() const