-Introduce TypeLoc::getOpaqueData()

-Make TypeLoc's constructor public.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83088 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Argyrios Kyrtzidis 2009-09-29 19:40:20 +00:00
Родитель 1ebd7405be
Коммит b735471f38
2 изменённых файлов: 11 добавлений и 10 удалений

Просмотреть файл

@ -31,11 +31,9 @@ protected:
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(); }
@ -47,6 +45,9 @@ public:
/// 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;
@ -165,7 +166,7 @@ public:
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.
@ -206,7 +207,7 @@ public:
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.
@ -247,7 +248,7 @@ public:
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.
@ -288,7 +289,7 @@ public:
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.
@ -350,7 +351,7 @@ public:
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.
@ -406,7 +407,7 @@ public:
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.

Просмотреть файл

@ -39,7 +39,7 @@ void Attr::Destroy(ASTContext &C) {
/// \brief Return the TypeLoc wrapper for the type source info.
TypeLoc DeclaratorInfo::getTypeLoc() const {
return TypeLoc::Create(Ty, (void*)(this + 1));
return TypeLoc(Ty, (void*)(this + 1));
}
//===----------------------------------------------------------------------===//