Files
swift-mirror/include/swift/AST/KnownProtocols.h
Doug Gregor f82f001518 Migrate TypeChecker::getProtocol() over to ASTContext.
All of the known protocols are part of the Swift standard library
anyway, so look there for these special protocols.


Swift SVN r7694
2013-08-28 22:37:38 +00:00

44 lines
1.2 KiB
C++

//===--- KnownProtocols.h - Working with compiler protocols -----*- 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
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_AST_KNOWNPROTOCOLS_H
#define SWIFT_AST_KNOWNPROTOCOLS_H
namespace llvm {
class StringRef;
}
namespace swift {
/// \brief The set of known protocols.
enum class KnownProtocolKind : uint8_t {
#define PROTOCOL(Id) Id,
#include "swift/AST/KnownProtocols.def"
};
enum : uint8_t {
// This uses a preprocessor trick to count all the protocols. The enum value
// expression below expands to "+1+1+1...". (Note that the first plus
// is parsed as a unary operator.)
#define PROTOCOL(Id) +1
/// The number of known protocols.
NumKnownProtocols =
#include "swift/AST/KnownProtocols.def"
};
/// Retrieve the name of the given known protocol.
llvm::StringRef getProtocolName(KnownProtocolKind kind);
} // end namespace swift
#endif