Add ASTDumper support for AvailabilityQueryExpr

This patch also moves some static utility methods involving PlatformKind out of Attr.h and into PlatformKind.h.


Swift SVN r21896
This commit is contained in:
Devin Coughlin
2014-09-12 00:13:48 +00:00
parent ef791914a1
commit 5a9ccc5ab2
10 changed files with 99 additions and 47 deletions

View File

@@ -1,4 +1,4 @@
//===--- PlatformKinds.h - Swift Language Platform Kinds --------*- C++ -*-===//
//===--- PlatformKind.h - Swift Language Platform Kinds ---------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
@@ -17,15 +17,31 @@
#ifndef SWIFT_AST_PLATFORM_KIND_H
#define SWIFT_AST_PLATFORM_KIND_H
#include "swift/Basic/LLVM.h"
#include "swift/Basic/Optional.h"
#include "llvm/ADT/StringRef.h"
namespace swift {
/// Available platforms for the availability attribute.
enum class PlatformKind {
enum class PlatformKind {
none,
#define AVAILABILITY_PLATFORM(X, PrettyName) X,
#include "swift/AST/PlatformKinds.def"
};
/// Returns the short string representating the platform, suitable for
/// use in availability specifications (e.g., "OSX").
StringRef platformString(PlatformKind platform);
/// Returns the platform kind corresponding to the passed-in short platform name
/// or Nothing if such a platform kind does not exist.
Optional<PlatformKind> platformFromString(StringRef Name);
/// Returns a human-readiable version of the platform name as a string, suitable
/// for emission in diagnostics (e.g., "OS X").
StringRef prettyPlatformString(PlatformKind platform);
} // end namespace swift
#endif