Fix fwd-decl detection and loops.
This commit is contained in:
parent
13dae8ee6b
commit
3d4bb2b954
@ -255,35 +255,36 @@ namespace cling {
|
||||
if (T.decls_begin()->m_DGR.isNull())
|
||||
return;
|
||||
|
||||
if (const NamedDecl* ND = dyn_cast<NamedDecl>(*T.decls_begin()->m_DGR.begin()))
|
||||
if (ND->getIdentifier() && ND->getName().equals("__Cling_Autoloading_Map")) {
|
||||
AutoloadingVisitor defaultArgsStateCollector;
|
||||
Preprocessor& PP = m_Interpreter->getCI()->getPreprocessor();
|
||||
for (Transaction::const_iterator I = T.decls_begin(), E = T.decls_end();
|
||||
I != E; ++I) {
|
||||
Transaction::DelayCallInfo DCI = *I;
|
||||
|
||||
// if (DCI.m_Call != Transaction::kCCIHandleTopLevelDecl)
|
||||
// continue;
|
||||
if (DCI.m_DGR.isNull())
|
||||
continue;
|
||||
|
||||
if (const NamedDecl* ND = dyn_cast<NamedDecl>(*T.decls_begin()->m_DGR.begin()))
|
||||
if (ND->getIdentifier()
|
||||
&& ND->getName().equals("__Cling_Autoloading_Map")) {
|
||||
|
||||
for (Transaction::const_iterator I = T.decls_begin(),
|
||||
E = T.decls_end(); I != E; ++I) {
|
||||
Transaction::DelayCallInfo DCI = *I;
|
||||
for (DeclGroupRef::iterator J = DCI.m_DGR.begin(),
|
||||
JE = DCI.m_DGR.end(); J != JE; ++J) {
|
||||
defaultArgsStateCollector.TrackDefaultArgStateOf(*J, m_Map, PP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// The first decl must be
|
||||
// extern int __Cling_Autoloading_Map;
|
||||
bool HaveAutoloadingMapMarker = false;
|
||||
for (auto I = T.decls_begin(), E = T.decls_end();
|
||||
!HaveAutoloadingMapMarker && I != E; ++I) {
|
||||
if (I->m_Call != cling::Transaction::kCCIHandleTopLevelDecl)
|
||||
return;
|
||||
for (auto&& D: I->m_DGR) {
|
||||
if (isa<EmptyDecl>(D))
|
||||
continue;
|
||||
else if (auto VD = dyn_cast<VarDecl>(D)) {
|
||||
HaveAutoloadingMapMarker
|
||||
= VD->hasExternalStorage() && VD->getIdentifier()
|
||||
&& VD->getName().equals("__Cling_Autoloading_Map");
|
||||
if (!HaveAutoloadingMapMarker)
|
||||
return;
|
||||
break;
|
||||
} else
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!HaveAutoloadingMapMarker)
|
||||
return;
|
||||
|
||||
AutoloadingVisitor defaultArgsStateCollector;
|
||||
Preprocessor& PP = m_Interpreter->getCI()->getPreprocessor();
|
||||
for (auto I = T.decls_begin(), E = T.decls_end(); I != E; ++I)
|
||||
for (auto&& D: I->m_DGR)
|
||||
defaultArgsStateCollector.TrackDefaultArgStateOf(D, m_Map, PP);
|
||||
}
|
||||
|
||||
} //end namespace cling
|
||||
|
Loading…
x
Reference in New Issue
Block a user