This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by vsapsai on Jun 23 2022, 7:45 PM.

Diff Detail

Event Timeline

vsapsai created this revision.Jun 23 2022, 7:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2022, 7:45 PM
Herald added a subscriber: ributzka. · View Herald Transcript
vsapsai requested review of this revision.Jun 23 2022, 7:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2022, 7:45 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
vsapsai added a subscriber: Restricted Project.
ChuanqiXu accepted this revision.Jun 29 2022, 7:22 PM

LGTM with comments.

clang/lib/Serialization/ASTReader.cpp
10020

DiffType is not necessary here, right?

This revision is now accepted and ready to land.Jun 29 2022, 7:22 PM

Thanks for the review!

clang/lib/Serialization/ASTReader.cpp
10020

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.

ChuanqiXu added inline comments.Jun 30 2022, 7:04 PM
clang/lib/Serialization/ASTReader.cpp
10020

Oh, sorry for I missed that. Thanks!