QualType Ty;
void *Data;
- TypeLoc(QualType ty, void *data) : Ty(ty), Data(data) { }
- static TypeLoc Create(QualType ty, void *data) { return TypeLoc(ty,data); }
- friend class DeclaratorInfo;
public:
TypeLoc() : Data(0) { }
+ TypeLoc(QualType ty, void *opaqueData) : Ty(ty), Data(opaqueData) { }
bool isNull() const { return Ty.isNull(); }
operator bool() const { return !isNull(); }
/// information.
QualType getSourceType() const { return Ty; }
+ /// \brief Get the pointer where source information is stored.
+ void *getOpaqueData() const { return Data; }
+
/// \brief Find the TypeSpecLoc that is part of this TypeLoc.
TypeSpecLoc getTypeSpecLoc() const;
TypeLoc getPointeeLoc() const {
void *Next = static_cast<char*>(Data) + getLocalDataSize();
- return Create(cast<PointerType>(Ty)->getPointeeType(), Next);
+ return TypeLoc(cast<PointerType>(Ty)->getPointeeType(), Next);
}
/// \brief Find the TypeSpecLoc that is part of this PointerLoc.
TypeLoc getPointeeLoc() const {
void *Next = static_cast<char*>(Data) + getLocalDataSize();
- return Create(cast<BlockPointerType>(Ty)->getPointeeType(), Next);
+ return TypeLoc(cast<BlockPointerType>(Ty)->getPointeeType(), Next);
}
/// \brief Find the TypeSpecLoc that is part of this BlockPointerLoc.
TypeLoc getPointeeLoc() const {
void *Next = static_cast<char*>(Data) + getLocalDataSize();
- return Create(cast<MemberPointerType>(Ty)->getPointeeType(), Next);
+ return TypeLoc(cast<MemberPointerType>(Ty)->getPointeeType(), Next);
}
/// \brief Find the TypeSpecLoc that is part of this MemberPointerLoc.
TypeLoc getPointeeLoc() const {
void *Next = static_cast<char*>(Data) + getLocalDataSize();
- return Create(cast<ReferenceType>(Ty)->getPointeeType(), Next);
+ return TypeLoc(cast<ReferenceType>(Ty)->getPointeeType(), Next);
}
/// \brief Find the TypeSpecLoc that is part of this ReferenceLoc.
TypeLoc getResultLoc() const {
void *Next = static_cast<char*>(Data) + getLocalDataSize();
- return Create(cast<FunctionType>(Ty)->getResultType(), Next);
+ return TypeLoc(cast<FunctionType>(Ty)->getResultType(), Next);
}
/// \brief Find the TypeSpecLoc that is part of this FunctionLoc.
TypeLoc getElementLoc() const {
void *Next = static_cast<char*>(Data) + getLocalDataSize();
- return Create(cast<ArrayType>(Ty)->getElementType(), Next);
+ return TypeLoc(cast<ArrayType>(Ty)->getElementType(), Next);
}
/// \brief Find the TypeSpecLoc that is part of this ArrayLoc.