diff options
author | Erik Pilkington <erik.pilkington@gmail.com> | 2016-07-16 00:35:23 +0000 |
---|---|---|
committer | Erik Pilkington <erik.pilkington@gmail.com> | 2016-07-16 00:35:23 +0000 |
commit | d3b0a63ca6016aceefdc147eeb88e90a988dacca (patch) | |
tree | 2576c0af7b32df8726bede4d459e7b275416754e /lib/Serialization/ASTWriterStmt.cpp | |
parent | c45b5c87351f6fd018c60eb4839db3a12f289179 (diff) |
[ObjC] Implement @available in the Parser and AST
This patch adds a new AST node: ObjCAvailabilityCheckExpr, and teaches the
Parser and Sema to generate it. This node represents an availability check of
the form:
@available(macos 10.10, *);
Which will eventually compile to a runtime check of the host's OS version. This
is the first patch of the feature I proposed here:
http://lists.llvm.org/pipermail/cfe-dev/2016-July/049851.html
Differential Revision: https://reviews.llvm.org/D22171
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275654 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriterStmt.cpp')
-rw-r--r-- | lib/Serialization/ASTWriterStmt.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Serialization/ASTWriterStmt.cpp b/lib/Serialization/ASTWriterStmt.cpp index 73f7219ba5..84e718e9ef 100644 --- a/lib/Serialization/ASTWriterStmt.cpp +++ b/lib/Serialization/ASTWriterStmt.cpp @@ -1142,6 +1142,13 @@ void ASTStmtWriter::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) { Code = serialization::EXPR_OBJC_BOOL_LITERAL; } +void ASTStmtWriter::VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) { + VisitExpr(E); + Record.AddSourceRange(E->getSourceRange()); + Record.AddVersionTuple(E->getVersion()); + Code = serialization::EXPR_OBJC_AVAILABILITY_CHECK; +} + //===----------------------------------------------------------------------===// // C++ Expressions and Statements. //===----------------------------------------------------------------------===// |