Skip to content

Commit 032bf4b

Browse files
ilovepiIanWood1
authored andcommitted
[clang-doc][NFC] Use destructuring in Mapper.cpp (llvm#135515)
Destructuring makes the intent a bit clearer over first/second.
1 parent 293a7d7 commit 032bf4b

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,18 @@ bool MapASTVisitor::mapDecl(const T *D, bool IsDefinition) {
5959
bool IsFileInRootDir;
6060
llvm::SmallString<128> File =
6161
getFile(D, D->getASTContext(), CDCtx.SourceRoot, IsFileInRootDir);
62-
auto I = serialize::emitInfo(D, getComment(D, D->getASTContext()),
63-
getLine(D, D->getASTContext()), File,
64-
IsFileInRootDir, CDCtx.PublicOnly);
65-
66-
// A null in place of I indicates that the serializer is skipping this decl
67-
// for some reason (e.g. we're only reporting public decls).
68-
if (I.first)
69-
CDCtx.ECtx->reportResult(llvm::toHex(llvm::toStringRef(I.first->USR)),
70-
serialize::serialize(I.first));
71-
if (I.second)
72-
CDCtx.ECtx->reportResult(llvm::toHex(llvm::toStringRef(I.second->USR)),
73-
serialize::serialize(I.second));
62+
auto [Child, Parent] = serialize::emitInfo(
63+
D, getComment(D, D->getASTContext()), getLine(D, D->getASTContext()),
64+
File, IsFileInRootDir, CDCtx.PublicOnly);
65+
66+
// A null in place of a valid Info indicates that the serializer is skipping
67+
// this decl for some reason (e.g. we're only reporting public decls).
68+
if (Child)
69+
CDCtx.ECtx->reportResult(llvm::toHex(llvm::toStringRef(Child->USR)),
70+
serialize::serialize(Child));
71+
if (Parent)
72+
CDCtx.ECtx->reportResult(llvm::toHex(llvm::toStringRef(Parent->USR)),
73+
serialize::serialize(Parent));
7474
return true;
7575
}
7676

0 commit comments

Comments
 (0)