Skip to content

Commit 66228ed

Browse files
author
git apple-llvm automerger
committed
Merge commit '75edf0c18c77' from llvm.org/main into next
2 parents 3d9aae8 + 08775c7 commit 66228ed

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

clang/include/clang/Serialization/ASTReader.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,6 +1509,7 @@ class ASTReader
15091509
getModuleFileLevelDecls(ModuleFile &Mod);
15101510

15111511
private:
1512+
bool isConsumerInterestedIn(Decl *D);
15121513
void PassInterestingDeclsToConsumer();
15131514
void PassInterestingDeclToConsumer(Decl *D);
15141515

clang/lib/Serialization/ASTReaderDecl.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3200,15 +3200,16 @@ inline void ASTReader::LoadedDecl(unsigned Index, Decl *D) {
32003200
/// This routine should return true for anything that might affect
32013201
/// code generation, e.g., inline function definitions, Objective-C
32023202
/// declarations with metadata, etc.
3203-
static bool isConsumerInterestedIn(ASTContext &Ctx, Decl *D, bool HasBody) {
3203+
bool ASTReader::isConsumerInterestedIn(Decl *D) {
32043204
// An ObjCMethodDecl is never considered as "interesting" because its
32053205
// implementation container always is.
32063206

32073207
// An ImportDecl or VarDecl imported from a module map module will get
32083208
// emitted when we import the relevant module.
32093209
if (isPartOfPerModuleInitializer(D)) {
32103210
auto *M = D->getImportedOwningModule();
3211-
if (M && M->isModuleMapModule() && Ctx.DeclMustBeEmitted(D))
3211+
if (M && M->Kind == Module::ModuleMapModule &&
3212+
getContext().DeclMustBeEmitted(D))
32123213
return false;
32133214
}
32143215

@@ -3223,7 +3224,7 @@ static bool isConsumerInterestedIn(ASTContext &Ctx, Decl *D, bool HasBody) {
32233224
(Var->isThisDeclarationADefinition() == VarDecl::Definition ||
32243225
OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(Var));
32253226
if (const auto *Func = dyn_cast<FunctionDecl>(D))
3226-
return Func->doesThisDeclarationHaveABody() || HasBody;
3227+
return Func->doesThisDeclarationHaveABody() || PendingBodies.count(D);
32273228

32283229
if (auto *ES = D->getASTContext().getExternalSource())
32293230
if (ES->hasExternalDefinitions(D) == ExternalASTSource::EK_Never)
@@ -4174,7 +4175,7 @@ void ASTReader::PassInterestingDeclsToConsumer() {
41744175
while (!PotentiallyInterestingDecls.empty()) {
41754176
Decl *D = PotentiallyInterestingDecls.front();
41764177
PotentiallyInterestingDecls.pop_front();
4177-
if (isConsumerInterestedIn(getContext(), D, PendingBodies.count(D)))
4178+
if (isConsumerInterestedIn(D))
41784179
PassInterestingDeclToConsumer(D);
41794180
}
41804181
}
@@ -4198,8 +4199,7 @@ void ASTReader::loadDeclUpdateRecords(PendingUpdateRecord &Record) {
41984199
// the declaration, then we know it was interesting and we skip the call
41994200
// to isConsumerInterestedIn because it is unsafe to call in the
42004201
// current ASTReader state.
4201-
bool WasInteresting =
4202-
Record.JustLoaded || isConsumerInterestedIn(getContext(), D, false);
4202+
bool WasInteresting = Record.JustLoaded || isConsumerInterestedIn(D);
42034203
for (auto &FileAndOffset : UpdateOffsets) {
42044204
ModuleFile *F = FileAndOffset.first;
42054205
uint64_t Offset = FileAndOffset.second;
@@ -4231,8 +4231,7 @@ void ASTReader::loadDeclUpdateRecords(PendingUpdateRecord &Record) {
42314231

42324232
// We might have made this declaration interesting. If so, remember that
42334233
// we need to hand it off to the consumer.
4234-
if (!WasInteresting &&
4235-
isConsumerInterestedIn(getContext(), D, PendingBodies.count(D))) {
4234+
if (!WasInteresting && isConsumerInterestedIn(D)) {
42364235
PotentiallyInterestingDecls.push_back(D);
42374236
WasInteresting = true;
42384237
}

0 commit comments

Comments
 (0)