[PATCH] D32424: Add a fix-it for -Wunguarded-availability

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 24 13:55:43 PDT 2017


ahatanak added a comment.

Do we want to enclose declaration statements in "if (@available)" too? I think doing so can cause compilation errors.

  int x = function();
  
  ++x; // if declaration is wrapped, this is an error because x is undeclared in this scope.

Also,  when function is used in a case clause, the whole case clause will be wrapped in "if (@available)". This won't cause a compilation error, but it's probably better to enclose only the statement of the case label.

  switch (c) {
  case1: t1 = function();
  default: break;
  }


Repository:
  rL LLVM

https://reviews.llvm.org/D32424





More information about the cfe-commits mailing list