[PATCH] D22171: [ObjC Availability] Implement parser support for Objective-C's @available
Erik Pilkington via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 11 15:52:30 PDT 2016
erik.pilkington added inline comments.
================
Comment at: lib/AST/StmtPrinter.cpp:502
@@ +501,3 @@
+ ObjCAvailabilityCheckExpr *Node) {
+ OS << "@available(...)";
+}
----------------
manmanren wrote:
> Why not print other information of Node?
Because by the time that we have the `ObjCAvailabilityCheckExpr`, we no longer keep track of the `AvailabilitySpec`s that are no longer relevant (ie, watchos if the platform we are targeting is macos), therefore we cannot replicate the text that lead to this particular `@available`. Is it worth it to carry these specs around? I can't think of any other time they are useful. (FWIW, many other AST nodes are also not fully supported, for example `ObjCAtCatchStmt` just above this.)
================
Comment at: lib/Parse/ParseDecl.cpp:723
@@ -722,3 +722,3 @@
VersionTuple Parser::ParseVersionTuple(SourceRange &Range) {
- Range = Tok.getLocation();
+ Range.setBegin(Tok.getLocation());
----------------
manmanren wrote:
> I don't quite get what motivates this change. Are we not setting the range correctly before, for version tuples?
Yes, `Range = Tok.getLocation()` sets both the Begin & End locations in Range to the same location, which makes us place the cursor at the wrong place in some diagnostics. I've fixed this a bit in the new patch.
http://reviews.llvm.org/D22171
More information about the cfe-commits
mailing list