This revision was automatically updated to reflect the committed changes.
Closed by commit rL302253: Add a fix-it for -Wunguarded-availability (authored
by arphaman).
Changed prior to commit:
https://reviews.llvm.org/D32424?vs=97922&id=97977#toc
Repository:
rL LLVM
https://reviews.llvm.org/
erik.pilkington accepted this revision.
erik.pilkington added a comment.
This revision is now accepted and ready to land.
LGTM, thanks!
Repository:
rL LLVM
https://reviews.llvm.org/D32424
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
ht
arphaman updated this revision to Diff 97922.
arphaman marked 2 inline comments as done.
arphaman added a comment.
- Simplify the RecursiveASTVisitor as suggested by Erik
- Improve the note to include `__builtin_available`
Repository:
rL LLVM
https://reviews.llvm.org/D32424
Files:
include/
arphaman added inline comments.
Comment at: lib/Sema/SemaDeclAttr.cpp:7151
+Visitor.Scope = Scope;
+Visitor.TraverseStmt(const_cast(Scope));
+return Visitor.LastMatchingDREFirstNonScopeStmt;
erik.pilkington wrote:
> I think this could be simplified: I
erik.pilkington added a comment.
Hi Alex, thanks for working on this! This looks right, but I have a couple of
comments.
Thanks,
Erik
Comment at: lib/Sema/SemaDeclAttr.cpp:7151
+Visitor.Scope = Scope;
+Visitor.TraverseStmt(const_cast(Scope));
+return Visitor.LastMa
arphaman updated this revision to Diff 96538.
arphaman added a comment.
Now the patch takes the following situations into account:
- Enclose only the statement in a `case`.
- If the fixit has to enclose a declaration statement, then the fixit will try
to enclose the appropriate uses as well.
R
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
arphaman created this revision.
This patch adds a fix-it for the -Wunguarded-availability warning. This fix-it
is similar to the Swift one: it suggests that you wrap the statement in an `if
(@available)` check. The produced fixits are indented (just like the Swift
ones) to make them look nice i