aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/TypeLoc.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-09-29 19:43:35 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-09-29 19:43:35 +0000
commitf352bddf015e537350416c296dd2963524f554f9 (patch)
treeccbf5d7635646b159523395c8a0b32dd5e9c9c43 /lib/AST/TypeLoc.cpp
parent24fab41057e4b67ed69a6b4027d5ae0f2f6934dc (diff)
Introduce ObjCProtocolListLoc for keeping source location information for protocol references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83094 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/TypeLoc.cpp')
-rw-r--r--lib/AST/TypeLoc.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/AST/TypeLoc.cpp b/lib/AST/TypeLoc.cpp
index cea8dc5169..fbd7caa326 100644
--- a/lib/AST/TypeLoc.cpp
+++ b/lib/AST/TypeLoc.cpp
@@ -83,6 +83,7 @@ public:
/// \brief Returns the size of the type source info data block.
unsigned TypeLoc::getFullDataSize() const {
+ if (isNull()) return 0;
return TypeSizer().Visit(*this);
}
@@ -98,6 +99,7 @@ public:
#include "clang/AST/TypeLocNodes.def"
TypeLoc VisitTypeSpecLoc(TypeLoc TyLoc) { return TypeLoc(); }
+ TypeLoc VisitObjCProtocolListLoc(ObjCProtocolListLoc TL);
TypeLoc VisitTypeLoc(TypeLoc TyLoc) {
assert(0 && "A declarator loc wrapper was not handled!");
@@ -107,6 +109,10 @@ public:
}
+TypeLoc NextLoc::VisitObjCProtocolListLoc(ObjCProtocolListLoc TL) {
+ return TL.getBaseTypeLoc();
+}
+
TypeLoc NextLoc::VisitPointerLoc(PointerLoc TL) {
return TL.getPointeeLoc();
}
@@ -224,6 +230,24 @@ bool TypedefLoc::classof(const TypeLoc *TL) {
}
//===----------------------------------------------------------------------===//
+// ObjCProtocolListLoc Implementation
+//===----------------------------------------------------------------------===//
+
+namespace {
+
+class ObjCProtocolListLocChecker :
+ public TypeLocVisitor<ObjCProtocolListLocChecker, bool> {
+public:
+ bool VisitObjCProtocolListLoc(ObjCProtocolListLoc TyLoc) { return true; }
+};
+
+}
+
+bool ObjCProtocolListLoc::classof(const TypeLoc *TL) {
+ return ObjCProtocolListLocChecker().Visit(*TL);
+}
+
+//===----------------------------------------------------------------------===//
// PointerLoc Implementation
//===----------------------------------------------------------------------===//