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 | 29099ded0c1546dac891cf5510fd611a1d1992a5 (patch) | |
tree | 599ab477fd7cd169e7633e40a4bc3e3ad776d4b8 /clang/lib/Serialization/ASTWriterStmt.cpp | |
parent | 21b3a032af8bcacbe2b3712de96b033b7ff3f208 (diff) | |
download | bcm5719-llvm-29099ded0c1546dac891cf5510fd611a1d1992a5.tar.gz bcm5719-llvm-29099ded0c1546dac891cf5510fd611a1d1992a5.zip |
[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
llvm-svn: 275654
Diffstat (limited to 'clang/lib/Serialization/ASTWriterStmt.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriterStmt.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp index 73f7219ba5c..84e718e9ef2 100644 --- a/clang/lib/Serialization/ASTWriterStmt.cpp +++ b/clang/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. //===----------------------------------------------------------------------===// |