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

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 30 19:04:09 PDT 2022


ChuanqiXu added inline comments.


================
Comment at: clang/lib/Serialization/ASTReader.cpp:10020
+    auto GetMismatchedDeclLoc = [](const NamedDecl *Container,
+                                   ODRMismatchDecl DiffType, const Decl *D) {
+      SourceLocation Loc;
----------------
vsapsai wrote:
> 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.
Oh, sorry for I missed that. Thanks!


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