]> granicus.if.org Git - clang/commitdiff
Pull TypeLocVisitor into its own header file.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 29 Sep 2009 21:27:32 +0000 (21:27 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 29 Sep 2009 21:27:32 +0000 (21:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83112 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/TypeLoc.h
include/clang/AST/TypeLocVisitor.h [new file with mode: 0644]
lib/AST/TypeLoc.cpp
lib/Frontend/PCHReaderDecl.cpp
lib/Frontend/PCHWriterDecl.cpp
lib/Index/ASTVisitor.h
lib/Index/ResolveLocation.cpp

index 100003929d1c8be15f3d50f6ba1f4a9197ef20b0..a6184375e0957ad117006ae2526a057bc18cf13b 100644 (file)
@@ -15,7 +15,6 @@
 #define LLVM_CLANG_AST_TYPELOC_H
 
 #include "clang/AST/Type.h"
-#include "clang/AST/TypeVisitor.h"
 
 namespace clang {
   class ParmVarDecl;
@@ -534,41 +533,6 @@ public:
   static bool classof(const ArrayLoc *TL) { return true; }
 };
 
-#define DISPATCH(CLASS) \
-  return static_cast<ImplClass*>(this)->Visit ## CLASS(cast<CLASS>(TyLoc))
-
-template<typename ImplClass, typename RetTy=void>
-class TypeLocVisitor {
-  class TypeDispatch : public TypeVisitor<TypeDispatch, RetTy> {
-    ImplClass *Impl;
-    TypeLoc TyLoc;
-
-  public:
-    TypeDispatch(ImplClass *impl, TypeLoc &tyLoc) : Impl(impl), TyLoc(tyLoc) { }
-#define ABSTRACT_TYPELOC(CLASS)
-#define TYPELOC(CLASS, PARENT, TYPE)                              \
-    RetTy Visit##TYPE(TYPE *) {                                   \
-      return Impl->Visit##CLASS(reinterpret_cast<CLASS&>(TyLoc)); \
-    }
-#include "clang/AST/TypeLocNodes.def"
-  };
-
-public:
-  RetTy Visit(TypeLoc TyLoc) {
-    TypeDispatch TD(static_cast<ImplClass*>(this), TyLoc);
-    return TD.Visit(TyLoc.getSourceType().getTypePtr());
-  }
-
-#define TYPELOC(CLASS, PARENT, TYPE) RetTy Visit##CLASS(CLASS TyLoc) {       \
-  DISPATCH(PARENT);                                                          \
-}
-#include "clang/AST/TypeLocNodes.def"
-
-  RetTy VisitTypeLoc(TypeLoc TyLoc) { return RetTy(); }
-};
-
-#undef DISPATCH
-
 }
 
 #endif
diff --git a/include/clang/AST/TypeLocVisitor.h b/include/clang/AST/TypeLocVisitor.h
new file mode 100644 (file)
index 0000000..df386ca
--- /dev/null
@@ -0,0 +1,58 @@
+//===--- TypeLocVisitor.h - Visitor for TypeLoc subclasses ------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file defines the TypeLocVisitor interface.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_CLANG_AST_TYPELOCVISITOR_H
+#define LLVM_CLANG_AST_TYPELOCVISITOR_H
+
+#include "clang/AST/TypeLoc.h"
+#include "clang/AST/TypeVisitor.h"
+
+namespace clang {
+
+#define DISPATCH(CLASS) \
+  return static_cast<ImplClass*>(this)->Visit ## CLASS(cast<CLASS>(TyLoc))
+
+template<typename ImplClass, typename RetTy=void>
+class TypeLocVisitor {
+  class TypeDispatch : public TypeVisitor<TypeDispatch, RetTy> {
+    ImplClass *Impl;
+    TypeLoc TyLoc;
+
+  public:
+    TypeDispatch(ImplClass *impl, TypeLoc &tyLoc) : Impl(impl), TyLoc(tyLoc) { }
+#define ABSTRACT_TYPELOC(CLASS)
+#define TYPELOC(CLASS, PARENT, TYPE)                              \
+    RetTy Visit##TYPE(TYPE *) {                                   \
+      return Impl->Visit##CLASS(reinterpret_cast<CLASS&>(TyLoc)); \
+    }
+#include "clang/AST/TypeLocNodes.def"
+  };
+
+public:
+  RetTy Visit(TypeLoc TyLoc) {
+    TypeDispatch TD(static_cast<ImplClass*>(this), TyLoc);
+    return TD.Visit(TyLoc.getSourceType().getTypePtr());
+  }
+
+#define TYPELOC(CLASS, PARENT, TYPE) RetTy Visit##CLASS(CLASS TyLoc) {       \
+  DISPATCH(PARENT);                                                          \
+}
+#include "clang/AST/TypeLocNodes.def"
+
+  RetTy VisitTypeLoc(TypeLoc TyLoc) { return RetTy(); }
+};
+
+#undef DISPATCH
+
+}  // end namespace clang
+
+#endif // LLVM_CLANG_AST_TYPELOCVISITOR_H
index 1337def2a0508a3b4a2d48018dd3882d05d99e9b..c24477ae81c5f4ba471c3cab36dce00103e87022 100644 (file)
@@ -11,7 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/AST/TypeLoc.h"
+#include "clang/AST/TypeLocVisitor.h"
 using namespace clang;
 
 //===----------------------------------------------------------------------===//
index 9b28e8bac79c1142fea1d1e012edf4d6172d8d47..353a6464b18dbb5649adbcf3665c04f61ede5c32 100644 (file)
@@ -18,7 +18,7 @@
 #include "clang/AST/DeclVisitor.h"
 #include "clang/AST/DeclGroup.h"
 #include "clang/AST/Expr.h"
-#include "clang/AST/TypeLoc.h"
+#include "clang/AST/TypeLocVisitor.h"
 using namespace clang;
 
 
index 9573d43c7173c2eb636687a1941c33039d3db8d6..4527bb1f90108ce8525ac8813d933c24494347eb 100644 (file)
@@ -14,7 +14,7 @@
 #include "clang/Frontend/PCHWriter.h"
 #include "clang/AST/DeclVisitor.h"
 #include "clang/AST/Expr.h"
-#include "clang/AST/TypeLoc.h"
+#include "clang/AST/TypeLocVisitor.h"
 #include "llvm/Bitcode/BitstreamWriter.h"
 #include <cstdio>
 
index 4da188809592017f1c3a663defdfbe999d95a850..e18aa57b4d1abf68ebd938863a5dc4892dd4e429 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "clang/AST/DeclVisitor.h"
 #include "clang/AST/StmtVisitor.h"
-#include "clang/AST/TypeLoc.h"
+#include "clang/AST/TypeLocVisitor.h"
 
 namespace clang {
 
index 633ed0590e11bf20a6ef01742515c55df8e91b04..229669dc330ba36049258bb1034728d784ad87b1 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "clang/Index/Utils.h"
 #include "clang/Index/ASTLocation.h"
-#include "clang/AST/TypeLoc.h"
+#include "clang/AST/TypeLocVisitor.h"
 #include "clang/AST/DeclVisitor.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/Lex/Lexer.h"