[PATCH] D128690: [ODRHash diagnostics] Preparation to minimize subsequent diffs. NFC.
Volodymyr Sapsai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 12 18:02:35 PDT 2022
vsapsai 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();
};
----------------
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.
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