https://github.com/ilovepi created 
https://github.com/llvm/llvm-project/pull/135515

Destructuring makes the intent a bit clearer over first/second.

>From 208748cce41c402f6c82e5132887eeafdff70745 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulki...@google.com>
Date: Sat, 12 Apr 2025 19:19:19 -0700
Subject: [PATCH] [clang-doc][NFC] Use destructuring in Mapper.cpp

Destructuring makes the intent a bit clearer over first/second.
---
 clang-tools-extra/clang-doc/Mapper.cpp | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/clang-tools-extra/clang-doc/Mapper.cpp 
b/clang-tools-extra/clang-doc/Mapper.cpp
index 6c90db03424c6..2a10c146b4a91 100644
--- a/clang-tools-extra/clang-doc/Mapper.cpp
+++ b/clang-tools-extra/clang-doc/Mapper.cpp
@@ -59,18 +59,18 @@ bool MapASTVisitor::mapDecl(const T *D, bool IsDefinition) {
   bool IsFileInRootDir;
   llvm::SmallString<128> File =
       getFile(D, D->getASTContext(), CDCtx.SourceRoot, IsFileInRootDir);
-  auto I = serialize::emitInfo(D, getComment(D, D->getASTContext()),
-                               getLine(D, D->getASTContext()), File,
-                               IsFileInRootDir, CDCtx.PublicOnly);
-
-  // A null in place of I indicates that the serializer is skipping this decl
-  // for some reason (e.g. we're only reporting public decls).
-  if (I.first)
-    CDCtx.ECtx->reportResult(llvm::toHex(llvm::toStringRef(I.first->USR)),
-                             serialize::serialize(I.first));
-  if (I.second)
-    CDCtx.ECtx->reportResult(llvm::toHex(llvm::toStringRef(I.second->USR)),
-                             serialize::serialize(I.second));
+  auto [Child, Parent] = serialize::emitInfo(
+      D, getComment(D, D->getASTContext()), getLine(D, D->getASTContext()),
+      File, IsFileInRootDir, CDCtx.PublicOnly);
+
+  // A null in place of a valid Info indicates that the serializer is skipping
+  // this decl for some reason (e.g. we're only reporting public decls).
+  if (Child)
+    CDCtx.ECtx->reportResult(llvm::toHex(llvm::toStringRef(Child->USR)),
+                             serialize::serialize(Child));
+  if (Parent)
+    CDCtx.ECtx->reportResult(llvm::toHex(llvm::toStringRef(Parent->USR)),
+                             serialize::serialize(Parent));
   return true;
 }
 

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to