]> granicus.if.org Git - clang/commitdiff
-Introduce TypeLoc::getOpaqueData()
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 29 Sep 2009 19:40:20 +0000 (19:40 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 29 Sep 2009 19:40:20 +0000 (19:40 +0000)
-Make TypeLoc's constructor public.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83088 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/TypeLoc.h
lib/AST/Decl.cpp

index bb9744a20202655399f00ce4e0fc2b3260c6bab8..93cc48aa07c5a54f0d20f2702777ffdba1c6f04f 100644 (file)
@@ -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.
index 24dd3e5e3d74c0ce5e2a36cf2ddd965460974078..fe32c396c587a5a7f4a641afad40ce2df6f1979b 100644 (file)
@@ -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));
 }
 
 //===----------------------------------------------------------------------===//