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

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 5 02:16:27 PDT 2017


arphaman added inline comments.


================
Comment at: lib/Sema/SemaDeclAttr.cpp:7151
+    Visitor.Scope = Scope;
+    Visitor.TraverseStmt(const_cast<CompoundStmt *>(Scope));
+    return Visitor.LastMatchingDREFirstNonScopeStmt;
----------------
erik.pilkington wrote:
> I think this could be simplified: If we iterate backwards through the CompoundStmt::body(), calling `RecursiveASTVisitor::TraverseStmt()`, and bail out if we encounter a `DeclRefExpr` to D, returning the current Stmt. This also has the advantage that we don't have to iterate forward through the CompoundStmt when we're looking for the last Child Stmt. Have you considered this option?
Good idea, I will change this code.


Repository:
  rL LLVM

https://reviews.llvm.org/D32424





More information about the cfe-commits mailing list