Author: Volodymyr Sapsai Date: 2022-10-17T18:24:44-07:00 New Revision: 37fdca21f7f61dee5426f55b0ee7bf601d95afcd
URL: https://github.com/llvm/llvm-project/commit/37fdca21f7f61dee5426f55b0ee7bf601d95afcd DIFF: https://github.com/llvm/llvm-project/commit/37fdca21f7f61dee5426f55b0ee7bf601d95afcd.diff LOG: [ODRHash] Rename `isDeclToBeProcessed` to `isSubDeclToBeProcessed`. NFC intended. The method is used only for sub-Decls, so reflect that in the name. Added: Modified: clang/include/clang/AST/ODRDiagsEmitter.h clang/include/clang/AST/ODRHash.h clang/lib/AST/ODRDiagsEmitter.cpp clang/lib/AST/ODRHash.cpp Removed: ################################################################################ diff --git a/clang/include/clang/AST/ODRDiagsEmitter.h b/clang/include/clang/AST/ODRDiagsEmitter.h index af345310c3a4..d79b3e1c0649 100644 --- a/clang/include/clang/AST/ODRDiagsEmitter.h +++ b/clang/include/clang/AST/ODRDiagsEmitter.h @@ -64,7 +64,7 @@ class ODRDiagsEmitter { // Used with err_module_odr_violation_mismatch_decl and // note_module_odr_violation_mismatch_decl - // This list should be the same Decl's as in ODRHash::isDeclToBeProcessed + // This list should be the same Decl's as in ODRHash::isSubDeclToBeProcessed enum ODRMismatchDecl { EndOfClass, PublicSpecifer, diff --git a/clang/include/clang/AST/ODRHash.h b/clang/include/clang/AST/ODRHash.h index 59b74cf477dd..1ab20013a367 100644 --- a/clang/include/clang/AST/ODRHash.h +++ b/clang/include/clang/AST/ODRHash.h @@ -93,7 +93,7 @@ class ODRHash { // Save booleans until the end to lower the size of data to process. void AddBoolean(bool value); - static bool isDeclToBeProcessed(const Decl* D, const DeclContext *Parent); + static bool isSubDeclToBeProcessed(const Decl *D, const DeclContext *Parent); private: void AddDeclarationNameImpl(DeclarationName Name); diff --git a/clang/lib/AST/ODRDiagsEmitter.cpp b/clang/lib/AST/ODRDiagsEmitter.cpp index 3cc280a53a8c..1fda502e323b 100644 --- a/clang/lib/AST/ODRDiagsEmitter.cpp +++ b/clang/lib/AST/ODRDiagsEmitter.cpp @@ -630,7 +630,7 @@ bool ODRDiagsEmitter::diagnoseMismatch( auto PopulateHashes = [](DeclHashes &Hashes, const RecordDecl *Record, const DeclContext *DC) { for (const Decl *D : Record->decls()) { - if (!ODRHash::isDeclToBeProcessed(D, DC)) + if (!ODRHash::isSubDeclToBeProcessed(D, DC)) continue; Hashes.emplace_back(D, computeODRHash(D)); } @@ -1538,7 +1538,7 @@ bool ODRDiagsEmitter::diagnoseMismatch(const EnumDecl *FirstEnum, for (const Decl *D : Enum->decls()) { // Due to decl merging, the first EnumDecl is the parent of // Decls in both records. - if (!ODRHash::isDeclToBeProcessed(D, FirstEnum)) + if (!ODRHash::isSubDeclToBeProcessed(D, FirstEnum)) continue; assert(isa<EnumConstantDecl>(D) && "Unexpected Decl kind"); Hashes.emplace_back(cast<EnumConstantDecl>(D), computeODRHash(D)); @@ -1620,7 +1620,7 @@ bool ODRDiagsEmitter::diagnoseMismatch( auto PopulateHashes = [](DeclHashes &Hashes, const ObjCProtocolDecl *ID, const DeclContext *DC) { for (const Decl *D : ID->decls()) { - if (!ODRHash::isDeclToBeProcessed(D, DC)) + if (!ODRHash::isSubDeclToBeProcessed(D, DC)) continue; Hashes.emplace_back(D, computeODRHash(D)); } diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp index cbb3e8730517..b485e93f76c2 100644 --- a/clang/lib/AST/ODRHash.cpp +++ b/clang/lib/AST/ODRHash.cpp @@ -441,7 +441,7 @@ class ODRDeclVisitor : public ConstDeclVisitor<ODRDeclVisitor> { // Only allow a small portion of Decl's to be processed. Remove this once // all Decl's can be handled. -bool ODRHash::isDeclToBeProcessed(const Decl *D, const DeclContext *Parent) { +bool ODRHash::isSubDeclToBeProcessed(const Decl *D, const DeclContext *Parent) { if (D->isImplicit()) return false; if (D->getDeclContext() != Parent) return false; @@ -488,7 +488,7 @@ void ODRHash::AddCXXRecordDecl(const CXXRecordDecl *Record) { // accurate count of Decl's. llvm::SmallVector<const Decl *, 16> Decls; for (Decl *SubDecl : Record->decls()) { - if (isDeclToBeProcessed(SubDecl, Record)) { + if (isSubDeclToBeProcessed(SubDecl, Record)) { Decls.push_back(SubDecl); if (auto *Function = dyn_cast<FunctionDecl>(SubDecl)) { // Compute/Preload ODRHash into FunctionDecl. @@ -589,7 +589,7 @@ void ODRHash::AddFunctionDecl(const FunctionDecl *Function, // accurate count of Decl's. llvm::SmallVector<const Decl *, 16> Decls; for (Decl *SubDecl : Function->decls()) { - if (isDeclToBeProcessed(SubDecl, Function)) { + if (isSubDeclToBeProcessed(SubDecl, Function)) { Decls.push_back(SubDecl); } } @@ -615,7 +615,7 @@ void ODRHash::AddEnumDecl(const EnumDecl *Enum) { // accurate count of Decl's. llvm::SmallVector<const Decl *, 16> Decls; for (Decl *SubDecl : Enum->decls()) { - if (isDeclToBeProcessed(SubDecl, Enum)) { + if (isSubDeclToBeProcessed(SubDecl, Enum)) { assert(isa<EnumConstantDecl>(SubDecl) && "Unexpected Decl"); Decls.push_back(SubDecl); } @@ -642,7 +642,7 @@ void ODRHash::AddObjCProtocolDecl(const ObjCProtocolDecl *P) { // accurate count of Decl's. llvm::SmallVector<const Decl *, 16> Decls; for (Decl *SubDecl : P->decls()) { - if (isDeclToBeProcessed(SubDecl, P)) { + if (isSubDeclToBeProcessed(SubDecl, P)) { Decls.push_back(SubDecl); } } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits