[cfe-commits] r83088 - in /cfe/trunk: include/clang/AST/TypeLoc.h lib/AST/Decl.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Tue Sep 29 12:40:20 PDT 2009
Author: akirtzidis
Date: Tue Sep 29 14:40:20 2009
New Revision: 83088
URL: http://llvm.org/viewvc/llvm-project?rev=83088&view=rev
Log:
-Introduce TypeLoc::getOpaqueData()
-Make TypeLoc's constructor public.
Modified:
cfe/trunk/include/clang/AST/TypeLoc.h
cfe/trunk/lib/AST/Decl.cpp
Modified: cfe/trunk/include/clang/AST/TypeLoc.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TypeLoc.h?rev=83088&r1=83087&r2=83088&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/TypeLoc.h (original)
+++ cfe/trunk/include/clang/AST/TypeLoc.h Tue Sep 29 14:40:20 2009
@@ -31,11 +31,9 @@
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 @@
/// 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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.
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=83088&r1=83087&r2=83088&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Tue Sep 29 14:40:20 2009
@@ -39,7 +39,7 @@
/// \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));
}
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list