================
@@ -417,17 +417,32 @@ class ASTWalker : public RecursiveASTVisitor<ASTWalker> {
   }
 
   bool VisitObjCMessageExpr(ObjCMessageExpr *E) {
+    auto startLoc = E->getSelectorStartLoc();
     // Identify the selector and the method declaration
     if (auto *Method = E->getMethodDecl()) {
       // Report the method as a used symbol
-      report(E->getSelectorStartLoc(), Method);
+      report(startLoc, Method);
     }
 
     // If it's a class message, report the interface/class as used
     if (E->getReceiverKind() == ObjCMessageExpr::Class) {
       if (auto *Interface = E->getReceiverInterface()) {
         report(E->getReceiverRange().getBegin(), Interface);
       }
----------------
nico wrote:

coding style nits: LLVM generally prefers early returns over if/else chains.  
So:

``` 
    // If it's a class message, report the interface/class as used
    if (E->getReceiverKind() == ObjCMessageExpr::Class) {
      if (auto *Interface = E->getReceiverInterface()) {
        report(E->getReceiverRange().getBegin(), Interface);
      }
      return true;
  // new code here, dedented
```

https://github.com/llvm/llvm-project/pull/212633
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to