bool changed = false;
for (ObjCMethodList *M = &Data.Instance; !changed && M && M->Method;
M = M->Next) {
- if (M->Method->getPCHLevel() == 0)
+ if (!M->Method->isFromASTFile())
changed = true;
}
for (ObjCMethodList *M = &Data.Factory; !changed && M && M->Method;
M = M->Next) {
- if (M->Method->getPCHLevel() == 0)
+ if (!M->Method->isFromASTFile())
changed = true;
}
if (!changed)
TD = SemaRef.LocallyScopedExternalDecls.begin(),
TDEnd = SemaRef.LocallyScopedExternalDecls.end();
TD != TDEnd; ++TD) {
- if (TD->second->getPCHLevel() == 0)
+ if (!TD->second->isFromASTFile())
AddDeclRef(TD->second, LocallyScopedExternalDecls);
}
for (DeclContext::decl_iterator I = TU->noload_decls_begin(),
E = TU->noload_decls_end();
I != E; ++I) {
- if ((*I)->getPCHLevel() == 0)
+ if (!(*I)->isFromASTFile())
NewGlobalDecls.push_back(std::make_pair((*I)->getKind(), GetDeclRef(*I)));
else if ((*I)->isChangedSinceDeserialization())
(void)GetDeclRef(*I); // Make sure it's written, but don't record it.
assert(D->isDefinition());
if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) {
// We are interested when a PCH decl is modified.
- if (RD->getPCHLevel() > 0) {
+ if (RD->isFromASTFile()) {
// A forward reference was mutated into a definition. Rewrite it.
// FIXME: This happens during template instantiation, should we
// have created a new definition decl instead ?
continue;
// We are interested when a PCH decl is modified.
- if (Redecl->getPCHLevel() > 0) {
+ if (Redecl->isFromASTFile()) {
UpdateRecord &Record = DeclUpdates[Redecl];
Record.push_back(UPD_CXX_SET_DEFINITIONDATA);
assert(Redecl->DefinitionData);
if (isa<TranslationUnitDecl>(DC) || isa<NamespaceDecl>(DC))
return;
- if (!(D->getPCHLevel() == 0 && cast<Decl>(DC)->getPCHLevel() > 0))
+ if (!(!D->isFromASTFile() && cast<Decl>(DC)->isFromASTFile()))
return; // Not a source decl added to a DeclContext from PCH.
AddUpdatedDeclContext(DC);
void ASTWriter::AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {
assert(D->isImplicit());
- if (!(D->getPCHLevel() == 0 && RD->getPCHLevel() > 0))
+ if (!(!D->isFromASTFile() && RD->isFromASTFile()))
return; // Not a source member added to a class from PCH.
if (!isa<CXXMethodDecl>(D))
return; // We are interested in lazily declared implicit methods.
const ClassTemplateSpecializationDecl *D) {
// The specializations set is kept in the canonical template.
TD = TD->getCanonicalDecl();
- if (!(D->getPCHLevel() == 0 && TD->getPCHLevel() > 0))
+ if (!(!D->isFromASTFile() && TD->isFromASTFile()))
return; // Not a source specialization added to a template from PCH.
UpdateRecord &Record = DeclUpdates[TD];
const FunctionDecl *D) {
// The specializations set is kept in the canonical template.
TD = TD->getCanonicalDecl();
- if (!(D->getPCHLevel() == 0 && TD->getPCHLevel() > 0))
+ if (!(!D->isFromASTFile() && TD->isFromASTFile()))
return; // Not a source specialization added to a template from PCH.
UpdateRecord &Record = DeclUpdates[TD];
}
void ASTWriter::CompletedImplicitDefinition(const FunctionDecl *D) {
- if (D->getPCHLevel() == 0)
+ if (!D->isFromASTFile())
return; // Declaration not imported from PCH.
// Implicit decl from a PCH was defined.
}
void ASTWriter::StaticDataMemberInstantiated(const VarDecl *D) {
- if (D->getPCHLevel() == 0)
+ if (!D->isFromASTFile())
return;
// Since the actual instantiation is delayed, this really means that we need
void ASTWriter::AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
const ObjCInterfaceDecl *IFD) {
- if (IFD->getPCHLevel() == 0)
+ if (!IFD->isFromASTFile())
return; // Declaration not imported from PCH.
if (CatD->getNextClassCategory() &&
- CatD->getNextClassCategory()->getPCHLevel() == 0)
+ !CatD->getNextClassCategory()->isFromASTFile())
return; // We already recorded that the tail of a category chain should be
// attached to an interface.
Record.push_back(D->isUsed(false));
Record.push_back(D->isReferenced());
Record.push_back(D->getAccess());
- Record.push_back(D->getPCHLevel());
+ Record.push_back(D->PCHLevel);
Record.push_back(D->ModulePrivate);
}
if (!D->hasAttrs() &&
!D->isImplicit() &&
!D->isUsed(false) &&
- D->getPCHLevel() == 0 &&
+ !D->isFromASTFile() &&
D->RedeclLink.getNext() == D &&
!D->isInvalidDecl() &&
!D->isReferenced() &&
if (!D->hasAttrs() &&
!D->isImplicit() &&
!D->isUsed(false) &&
- D->getPCHLevel() == 0 &&
+ !D->isFromASTFile() &&
!D->hasExtInfo() &&
D->RedeclLink.getNext() == D &&
!D->isInvalidDecl() &&
if (!D->hasAttrs() &&
!D->isImplicit() &&
!D->isUsed(false) &&
- D->getPCHLevel() == 0 &&
+ !D->isFromASTFile() &&
!D->hasExtInfo() &&
D->RedeclLink.getNext() == D &&
!D->isInvalidDecl() &&
!D->isUsed(false) &&
!D->isInvalidDecl() &&
!D->isReferenced() &&
- D->getPCHLevel() == 0 &&
+ !D->isFromASTFile() &&
!D->isModulePrivate() &&
!D->getBitWidth() &&
!D->hasExtInfo() &&
!D->isUsed(false) &&
!D->isInvalidDecl() &&
!D->isReferenced() &&
- D->getPCHLevel() == 0 &&
+ !D->isFromASTFile() &&
!D->isModulePrivate() &&
!D->getBitWidth() &&
!D->hasInClassInitializer() &&
!D->isReferenced() &&
D->getAccess() == AS_none &&
!D->isModulePrivate() &&
- D->getPCHLevel() == 0 &&
+ !D->isFromASTFile() &&
D->getDeclName().getNameKind() == DeclarationName::Identifier &&
!D->hasExtInfo() &&
D->RedeclLink.getNext() == D &&
!D->isUsed(false) &&
D->getAccess() == AS_none &&
!D->isModulePrivate() &&
- D->getPCHLevel() == 0 &&
+ !D->isFromASTFile() &&
D->getStorageClass() == 0 &&
!D->hasCXXDirectInitializer() && // Can params have this ever?
D->getFunctionScopeDepth() == 0 &&
Code = serialization::DECL_NAMESPACE;
if (Writer.hasChain() && !D->isOriginalNamespace() &&
- D->getOriginalNamespace()->getPCHLevel() > 0) {
+ D->getOriginalNamespace()->isFromASTFile()) {
NamespaceDecl *NS = D->getOriginalNamespace();
Writer.AddUpdatedDeclContext(NS);
// anonymous namespace.
Decl *Parent = cast<Decl>(
D->getParent()->getRedeclContext()->getPrimaryContext());
- if (Parent->getPCHLevel() > 0 || isa<TranslationUnitDecl>(Parent)) {
+ if (Parent->isFromASTFile() || isa<TranslationUnitDecl>(Parent)) {
ASTWriter::UpdateRecord &Record = Writer.DeclUpdates[Parent];
Record.push_back(UPD_CXX_ADDED_ANONYMOUS_NAMESPACE);
Writer.AddDeclRef(D, Record);