mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
TypeVariableType and ErrorType are canonical, even if
they're unchecked, and they should have Can* variants. Swift SVN r6375
This commit is contained in:
@@ -1,52 +0,0 @@
|
||||
//===-- TypeVisitor.h - SILGen TypeVisitor specialization -------*- C++ -*-===//
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See http://swift.org/LICENSE.txt for license information
|
||||
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines swift::Lowering::TypeVisitor.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef SWIFT_LOWERING_TYPEVISITOR_H
|
||||
#define SWIFT_LOWERING_TYPEVISITOR_H
|
||||
|
||||
#include "swift/AST/TypeVisitor.h"
|
||||
|
||||
namespace swift {
|
||||
namespace Lowering {
|
||||
|
||||
/// Lowering::TypeVisitor - This is a specialization of
|
||||
/// swift::TypeVisitor which works only on canonical types and
|
||||
/// which automatically ignores certain AST node kinds.
|
||||
template<typename ImplClass, typename RetTy = void, typename... Args>
|
||||
class TypeVisitor : public swift::TypeVisitor<ImplClass, RetTy, Args...> {
|
||||
public:
|
||||
|
||||
template <class... As> RetTy visit(CanType type, Args... args) {
|
||||
return swift::TypeVisitor<ImplClass, RetTy, Args...>
|
||||
::visit(Type(type), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#define TYPE(Id, Parent)
|
||||
#define UNCHECKED_TYPE(Id, Parent) \
|
||||
template <class... As> RetTy visit##Id##Type(Id##Type *T, Args... args) { \
|
||||
llvm_unreachable(#Id "Type should not survive to IR-gen"); \
|
||||
}
|
||||
#define SUGARED_TYPE(Id, Parent) \
|
||||
template <class... As> RetTy visit##Id##Type(Id##Type *T, Args... args) { \
|
||||
llvm_unreachable(#Id "Type should not survive canonicalization"); \
|
||||
}
|
||||
#include "swift/AST/TypeNodes.def"
|
||||
};
|
||||
|
||||
} // end namespace Lowering
|
||||
} // end namespace swift
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user