14#include "cling/Interpreter/Interpreter.h"
15#include "cling/Interpreter/LookupHelper.h"
17#include "clang/AST/DeclTemplate.h"
21 cling::Interpreter::PushTransactionRAII RAII(
fInterp);
37 if (
auto *NSD = llvm::dyn_cast<clang::NamespaceDecl>(*fDeclIter)) {
38 if (NSD->isInlineNamespace() || NSD->isAnonymousNamespace()) {
41 fContexts.push_back(NSD);
44 }
else if (
auto *ED = llvm::dyn_cast<clang::EnumDecl>(*fDeclIter)) {
45 if (!ED->isScoped()) {
47 fContexts.push_back(ED);
50 }
else if (
auto *RD = llvm::dyn_cast<clang::RecordDecl>(*fDeclIter)) {
51 if (RD->isAnonymousStructOrUnion()) {
53 fContexts.push_back(RD);
65 while (HandleInlineDeclContext())
75 while (fDeclIter == fContexts[fDCIdx]->decls_end()) {
77 if (fDCIdx == fContexts.size())
79 cling::Interpreter::PushTransactionRAII RAII(fInterp);
80 fDeclIter = fContexts[fDCIdx]->decls_begin();
88 return AdvanceToFirstValidDecl();
94 cling::Interpreter::PushTransactionRAII RAII(interp);
102 if (Iter() ==
End()) {
104 fUsingIterStack.pop();
105 if (fUsingIterStack.empty())
110 if (
auto *UD = llvm::dyn_cast<clang::UsingDecl>(Iter()->getTargetDecl())) {
111 if (UD->shadow_size()) {
112 cling::Interpreter::PushTransactionRAII RAII(fInterp);
113 fUsingIterStack.push({UD});
125 fTemplateSpec =
nullptr;
127 const clang::Decl *D = Get();
128 if (
auto *UD = llvm::dyn_cast<clang::UsingDecl>(D)) {
129 if (UD->shadow_size()) {
130 assert(!fUsingDeclIter.IsValid() &&
"Expected UsingDecl to be already handled by UsingDeclIter!");
136 if (
auto *USD = llvm::dyn_cast<clang::UsingShadowDecl>(D)) {
137 if (!ShouldSkip(USD))
139 }
else if (
auto *RTD = llvm::dyn_cast<clang::RedeclarableTemplateDecl>(D)) {
140 if (
const clang::Decl *DInst = InstantiateTemplateWithDefaults(RTD)) {
141 fTemplateSpec = DInst;
144 }
else if (!ShouldSkip(D))
148 if (!AdvanceUnfiltered())
llvm::SmallVector< clang::DeclContext *, 2 > fContexts
bool AdvanceToFirstValidDecl()
Do not return inline namespaces etc.
cling::Interpreter * fInterp
bool IterNext()
Increment the iterator, possibly moving to the next context.
clang::DeclContext::decl_iterator fDeclIter
bool HandleInlineDeclContext()
Return true if fDeclIter has triggered an inline or anonymous namespace / ... to be appended to fCont...
std::stack< UsingDeclFrame > fUsingIterStack
Handle nested UsingDecls: