forked from OSchip/llvm-project
Add {ExternalSemaSource,SemaConsumer}::ForgetSema callback, and update PCHReader
to use it so it at least won't try to access Sema once it is gone. llvm-svn: 90261
This commit is contained in:
parent
8a8ba87ac8
commit
ec5f8ae6a8
|
@ -625,6 +625,9 @@ public:
|
|||
/// tree.
|
||||
virtual void InitializeSema(Sema &S);
|
||||
|
||||
/// \brief Inform the semantic consumer that Sema is no longer available.
|
||||
virtual void ForgetSema() { SemaObj = 0; }
|
||||
|
||||
/// \brief Retrieve the IdentifierInfo for the named identifier.
|
||||
///
|
||||
/// This routine builds a new IdentifierInfo for the given identifier. If any
|
||||
|
|
|
@ -34,6 +34,9 @@ public:
|
|||
/// tree.
|
||||
virtual void InitializeSema(Sema &S) {}
|
||||
|
||||
/// \brief Inform the semantic consumer that Sema is no longer available.
|
||||
virtual void ForgetSema() {}
|
||||
|
||||
/// \brief Load the contents of the global method pool for a given
|
||||
/// selector.
|
||||
///
|
||||
|
|
|
@ -34,6 +34,9 @@ namespace clang {
|
|||
/// tree.
|
||||
virtual void InitializeSema(Sema &S) {}
|
||||
|
||||
/// \brief Inform the semantic consumer that Sema is no longer available.
|
||||
virtual void ForgetSema() {}
|
||||
|
||||
// isa/cast/dyn_cast support
|
||||
static bool classof(const ASTConsumer *Consumer) {
|
||||
return Consumer->SemaConsumer;
|
||||
|
|
|
@ -75,7 +75,7 @@ void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer,
|
|||
while ((ADecl = P.RetrievePendingObjCImpDecl()))
|
||||
Consumer->HandleTopLevelDecl(ADecl.getAsVal<DeclGroupRef>());
|
||||
|
||||
// process any TopLevelDecls generated by #pragma weak
|
||||
// Process any TopLevelDecls generated by #pragma weak.
|
||||
for (llvm::SmallVector<Decl*,2>::iterator
|
||||
I = S.WeakTopLevelDecls().begin(),
|
||||
E = S.WeakTopLevelDecls().end(); I != E; ++I)
|
||||
|
@ -83,6 +83,13 @@ void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer,
|
|||
|
||||
Consumer->HandleTranslationUnit(Ctx);
|
||||
|
||||
if (ExternalSemaSource *ESS =
|
||||
dyn_cast_or_null<ExternalSemaSource>(Ctx.getExternalSource()))
|
||||
ESS->ForgetSema();
|
||||
|
||||
if (SemaConsumer *SC = dyn_cast<SemaConsumer>(Consumer))
|
||||
SC->ForgetSema();
|
||||
|
||||
if (PrintStats) {
|
||||
fprintf(stderr, "\nSTATISTICS:\n");
|
||||
P.getActions().PrintStats();
|
||||
|
|
Loading…
Reference in New Issue