[clang-tools-extra] 062db99 - [clang-doc][NFC] Use destructuring in Mapper.cpp (#135515)

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 18 18:07:01 PDT 2025


Author: Paul Kirth
Date: 2025-04-18T18:06:57-07:00
New Revision: 062db99353749ec73a19b030b5553beee59cb0c0

URL: https://github.com/llvm/llvm-project/commit/062db99353749ec73a19b030b5553beee59cb0c0
DIFF: https://github.com/llvm/llvm-project/commit/062db99353749ec73a19b030b5553beee59cb0c0.diff

LOG: [clang-doc][NFC] Use destructuring in Mapper.cpp (#135515)

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

Added: 
    

Modified: 
    clang-tools-extra/clang-doc/Mapper.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-doc/Mapper.cpp b/clang-tools-extra/clang-doc/Mapper.cpp
index 022e3b12d82bc..950cdf55d4a63 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;
 }
 


        


More information about the cfe-commits mailing list