[PATCH] D128489: [ODRHash diagnostics] Move common code for calculating diag locations in `DiagnoseODRMismatch` into a lambda. NFC.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 30 15:40:21 PDT 2022


vsapsai added a comment.

Thanks for the review!



================
Comment at: clang/lib/Serialization/ASTReader.cpp:10020
+    auto GetMismatchedDeclLoc = [](const NamedDecl *Container,
+                                   ODRMismatchDecl DiffType, const Decl *D) {
+      SourceLocation Loc;
----------------
ChuanqiXu wrote:
> DiffType is not necessary here, right?
Unfortunately, it is necessary. A little bit later we have
```
if (DiffType == EndOfClass && Tag)
```
where we use `DiffType`.

By the way, the implementation isn't really correct for `EndOfClass` and non-TagDecl as `Loc` remains invalid. But that's a separate issue, I've decided to keep the current change to NFC.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128489/new/

https://reviews.llvm.org/D128489



More information about the cfe-commits mailing list