aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/TypeLoc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST/TypeLoc.cpp')
-rw-r--r--lib/AST/TypeLoc.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/AST/TypeLoc.cpp b/lib/AST/TypeLoc.cpp
index a95f38897a..cea8dc5169 100644
--- a/lib/AST/TypeLoc.cpp
+++ b/lib/AST/TypeLoc.cpp
@@ -18,6 +18,30 @@ using namespace clang;
// TypeLoc Implementation
//===----------------------------------------------------------------------===//
+namespace {
+
+/// \brief Return the source range for the visited TypeSpecLoc.
+class TypeLocRanger : public TypeLocVisitor<TypeLocRanger, SourceRange> {
+public:
+#define ABSTRACT_TYPELOC(CLASS)
+#define TYPELOC(CLASS, PARENT, TYPE) \
+ SourceRange Visit##CLASS(CLASS TyLoc) { return TyLoc.getSourceRange(); }
+#include "clang/AST/TypeLocNodes.def"
+
+ SourceRange VisitTypeLoc(TypeLoc TyLoc) {
+ assert(0 && "A typeloc wrapper was not handled!");
+ return SourceRange();
+ }
+};
+
+}
+
+SourceRange TypeLoc::getSourceRange() const {
+ if (isNull())
+ return SourceRange();
+ return TypeLocRanger().Visit(*this);
+}
+
/// \brief Returns the size of type source info data block for the given type.
unsigned TypeLoc::getFullDataSizeForType(QualType Ty) {
return TypeLoc(Ty, 0).getFullDataSize();
@@ -113,30 +137,6 @@ TypeLoc TypeLoc::getNextTypeLoc() const {
//===----------------------------------------------------------------------===//
namespace {
-
-/// \brief Return the source range for the visited TypeSpecLoc.
-class TypeSpecRanger : public TypeLocVisitor<TypeSpecRanger, SourceRange> {
-public:
-#define TYPELOC(CLASS, PARENT, TYPE)
-#define TYPESPEC_TYPELOC(CLASS, TYPE) \
- SourceRange Visit##CLASS(CLASS TyLoc) { return TyLoc.getSourceRange(); }
-#include "clang/AST/TypeLocNodes.def"
-
- SourceRange VisitTypeLoc(TypeLoc TyLoc) {
- assert(0 && "A typespec loc wrapper was not handled!");
- return SourceRange();
- }
-};
-
-}
-
-SourceRange TypeSpecLoc::getSourceRange() const {
- if (isNull())
- return SourceRange();
- return TypeSpecRanger().Visit(*this);
-}
-
-namespace {
class TypeSpecChecker : public TypeLocVisitor<TypeSpecChecker, bool> {
public:
bool VisitTypeSpecLoc(TypeSpecLoc TyLoc) { return true; }