[PATCH] D128690: [ODRHash diagnostics] Preparation to minimize subsequent diffs. NFC.
Chuanqi Xu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 13 19:18:58 PDT 2022
ChuanqiXu added inline comments.
================
Comment at: clang/lib/Serialization/ASTReader.cpp:10621-10626
// Compute the hash of the method as if it has no body.
- auto ComputeCXXMethodODRHash = [&Hash](const CXXMethodDecl *D) {
- Hash.clear();
- Hash.AddFunctionDecl(D, true /*SkipBody*/);
- return Hash.CalculateHash();
+ auto ComputeCXXMethodODRHash = [](const CXXMethodDecl *D) {
+ ODRHash Hasher;
+ Hasher.AddFunctionDecl(D, true /*SkipBody*/);
+ return Hasher.CalculateHash();
};
----------------
vsapsai wrote:
> ChuanqiXu wrote:
> > Couldn't we hoist this like others?
> It is used only on the lines below - 10632 & 10634, so I think it is good to keep its scope small. And not hoisting is consistent with other places using lambdas close to their 2 calls like different kinds of `PopulateHashes`.
>
> This is a good observation. I've checked the usage of other hoisted lambdas and `ComputeTemplateParameterListODRHash` is used only in 2 places, so now I think we shouldn't hoist it.
Makes sense to me : )
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128690/new/
https://reviews.llvm.org/D128690
More information about the cfe-commits
mailing list