|
clang 24.0.0git
|
#include "/work/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/Interpreter/ErrorRecovery.h"
Public Member Functions | |
| PTUMutationActions (IncrementalStateTracker &Tracker, Sema &S, CodeGenerator *CodeGen=nullptr) | |
| Sema & | getSema () const |
| CodeGenerator * | getCodeGen () const |
| uint32_t | DeclNeedingTracking (DeclShape S, const Decl *D) |
| This is called when a decl is created or seen for the first time. | |
| uint32_t | confirmMutation (const Decl *D, DeclShape S, uint32_t FlaggedKinds) |
| The single place to check whether a kind has actually changed. | |
| void | trackForSweep (const Decl *D, uint32_t Kinds) |
| Start tracking D for mutation kinds that need verification. | |
| void | untrackIfClosed (const Decl *D, DeclShape S, uint32_t Confirmed) |
| Stop tracking Decl D when it no longer needs verification. | |
| void | syncSweepTracking (const Decl *D, DeclShape S, uint32_t Kinds, bool IsNew) |
| bool | shouldRecurseInto (const Decl *D) |
| These are the places where the incremental state of a declaration is registered based on its DeclKind. | |
| void | VisitDeclContext (const DeclContext *DC) |
| void | VisitCXXRecordDecl (const CXXRecordDecl *RD) |
| void | VisitFunctionDecl (const FunctionDecl *FD) |
| void | VisitVarDecl (const VarDecl *VD) |
| void | VisitEnumDecl (const EnumDecl *ED) |
| void | VisitRedeclarableTemplateDecl (const RedeclarableTemplateDecl *RT) |
| void | CommitDecl (const Decl *D, MutationRecord *Rec) |
| void | CommitPTU (TranslationUnitDecl *MostRecentTU) |
| void | RestorePTU (TranslationUnitDecl *MostRecentTU) |
| Public Member Functions inherited from clang::declvisitor::Base< llvm::make_const_ptr, PTUMutationActions, void > | |
| void | Visit (PTR(Decl) D) |
| void | VisitDecl (PTR(Decl) D) |
Definition at line 514 of file ErrorRecovery.h.
|
inlineexplicit |
Definition at line 531 of file ErrorRecovery.h.
| void clang::PTUMutationActions::CommitDecl | ( | const Decl * | D, |
| MutationRecord * | Rec ) |
Definition at line 601 of file ErrorRecovery.cpp.
References clang::MutationRecord::add(), clang::classifyShape(), DeclNeedingTracking(), clang::Decl::isDefinedOutsideFunctionOrMethod(), uint32_t, and clang::declvisitor::Base< llvm::make_const_ptr, PTUMutationActions, void >::Visit().
Referenced by CommitPTU(), and VisitDeclContext().
| void clang::PTUMutationActions::CommitPTU | ( | TranslationUnitDecl * | MostRecentTU | ) |
Definition at line 629 of file ErrorRecovery.cpp.
References clang::cast(), CommitDecl(), clang::PTUStateInfo::Commited, clang::PTUStateInfo::ImplicitlyGeneratedDecls, clang::isReachableFromThisTU(), clang::PTUStateInfo::Mutations, clang::PTUStateInfo::noteMutated(), shouldRecurseInto(), clang::PTUStateInfo::ThisPTU, uint32_t, clang::PTUStateInfo::verifyMutations(), and VisitDeclContext().
| uint32_t clang::PTUMutationActions::confirmMutation | ( | const Decl * | D, |
| DeclShape | S, | ||
| uint32_t | FlaggedKinds ) |
The single place to check whether a kind has actually changed.
This handles both listener-less kinds and listener-unconfirmed mutations (currently SpecInfo and MemberSpecInfo). Mutations can be detected by both SweepTracker and the listener re-check. SweepTracker tracks hidden and listener-unconfirmed mutations in case the listener misses them. If the listener catches a mutation, it is removed from SweepTracker; see PTUStateInfo::verifyMutations. both use this functionality to verify mutation kind.
This check uses the decl shape and mutation kind to determine whether the decl has changed from its previous state.
Similarly, if a new hidden or listener-unconfirmed mutation is introduced in DeclNeedingTracking, and we need to determine whether it changed the previous state, the corresponding logic should be added here too when the kind is categorized as a hidden mutation from the listener.
Definition at line 401 of file ErrorRecovery.cpp.
References clang::cast(), clang::differsFromLast(), clang::Footprint(), and uint32_t.
Referenced by clang::SweepTracker::sweep(), and clang::PTUStateInfo::verifyMutations().
This is called when a decl is created or seen for the first time.
It also checks whether the decl is still in a mutation-sensitive state, meaning that a later PTU can modify it. Because of this, we need to track its state. This function provides a single place to decide whether a decl needs to be committed or not. It is called from CommitDecl to determine whether a new decl needs to be tracked.
This requires Decl to determine which mutation kinds apply to the shape and whether they need to be tracked. In the future, if a new mutation site is found for a shape, it should be added here along with the logic to determine whether the decl is still in an open, modifiable state.
Definition at line 326 of file ErrorRecovery.cpp.
References clang::cast(), and uint32_t.
Referenced by CommitDecl(), and untrackIfClosed().
|
inline |
Definition at line 538 of file ErrorRecovery.h.
|
inline |
Definition at line 537 of file ErrorRecovery.h.
| void clang::PTUMutationActions::RestorePTU | ( | TranslationUnitDecl * | MostRecentTU | ) |
Definition at line 865 of file ErrorRecovery.cpp.
References clang::PTUStateInfo::Commited, clang::PTUStateInfo::ID, clang::PTUStateInfo::ImplicitlyGeneratedDecls, clang::isReachableFromThisTU(), clang::PTUStateInfo::Mutations, clang::PTUStateInfo::noteMutated(), clang::ASTDeclUnmerger::RestoreDecl(), clang::PTUStateInfo::ThisPTU, uint32_t, clang::PTUStateInfo::verifyMutations(), and clang::declvisitor::Base< Ptr, ImplClass, RetTy >::Visit().
These are the places where the incremental state of a declaration is registered based on its DeclKind.
For a declaration created in the current PTU, its state is committed to the tracker. For an existing declaration modified in the current PTU, its previous state is recorded so it can be restored on undo.
The idea is to keep state tracking limited to a small set of known mutation sites for each DeclKind, instead of tracking changes everywhere in Clang.
Currently, this covers Class, Function, Enum, Template, etc. Each DeclKind is associated with the mutation kinds that need to be tracked.
When adding a new mutation site, it should be handled according to the corresponding DeclKind and mutation kind.
Definition at line 585 of file ErrorRecovery.cpp.
References clang::isa().
Referenced by CommitPTU(), and VisitDeclContext().
| void clang::PTUMutationActions::syncSweepTracking | ( | const Decl * | D, |
| DeclShape | S, | ||
| uint32_t | Kinds, | ||
| bool | IsNew ) |
Definition at line 520 of file ErrorRecovery.cpp.
References trackForSweep(), uint32_t, and untrackIfClosed().
Start tracking D for mutation kinds that need verification.
Called when a new mutation is committed or an undone mutation is restored. we apply this for listener unconfirmed cases.
Definition at line 500 of file ErrorRecovery.cpp.
References clang::KindsNeedingVerification, and uint32_t.
Referenced by syncSweepTracking().
Stop tracking Decl D when it no longer needs verification.
Re-check DeclNeedingTracking to see if a later PTU can still update D.
Definition at line 507 of file ErrorRecovery.cpp.
References DeclNeedingTracking(), clang::KindsNeedingVerification, and uint32_t.
Referenced by syncSweepTracking(), and clang::PTUStateInfo::verifyMutations().
|
inline |
Definition at line 554 of file ErrorRecovery.h.
| void clang::PTUMutationActions::VisitDeclContext | ( | const DeclContext * | DC | ) |
Definition at line 593 of file ErrorRecovery.cpp.
References clang::cast(), CommitDecl(), clang::DeclContext::decls(), shouldRecurseInto(), and VisitDeclContext().
Referenced by CommitPTU(), and VisitDeclContext().
|
inline |
Definition at line 557 of file ErrorRecovery.h.
|
inline |
Definition at line 555 of file ErrorRecovery.h.
|
inline |
Definition at line 558 of file ErrorRecovery.h.
|
inline |
Definition at line 556 of file ErrorRecovery.h.