Fix fwd-decl detection and loops.

This commit is contained in:
Axel Naumann 2015-06-22 15:18:05 +02:00 committed by sftnight
parent 13dae8ee6b
commit 3d4bb2b954

View File

@ -255,35 +255,36 @@ namespace cling {
if (T.decls_begin()->m_DGR.isNull()) if (T.decls_begin()->m_DGR.isNull())
return; return;
if (const NamedDecl* ND = dyn_cast<NamedDecl>(*T.decls_begin()->m_DGR.begin())) // The first decl must be
if (ND->getIdentifier() && ND->getName().equals("__Cling_Autoloading_Map")) { // extern int __Cling_Autoloading_Map;
AutoloadingVisitor defaultArgsStateCollector; bool HaveAutoloadingMapMarker = false;
Preprocessor& PP = m_Interpreter->getCI()->getPreprocessor(); for (auto I = T.decls_begin(), E = T.decls_end();
for (Transaction::const_iterator I = T.decls_begin(), E = T.decls_end(); !HaveAutoloadingMapMarker && I != E; ++I) {
I != E; ++I) { if (I->m_Call != cling::Transaction::kCCIHandleTopLevelDecl)
Transaction::DelayCallInfo DCI = *I; return;
for (auto&& D: I->m_DGR) {
// if (DCI.m_Call != Transaction::kCCIHandleTopLevelDecl) if (isa<EmptyDecl>(D))
// continue; continue;
if (DCI.m_DGR.isNull()) else if (auto VD = dyn_cast<VarDecl>(D)) {
continue; HaveAutoloadingMapMarker
= VD->hasExternalStorage() && VD->getIdentifier()
if (const NamedDecl* ND = dyn_cast<NamedDecl>(*T.decls_begin()->m_DGR.begin())) && VD->getName().equals("__Cling_Autoloading_Map");
if (ND->getIdentifier() if (!HaveAutoloadingMapMarker)
&& ND->getName().equals("__Cling_Autoloading_Map")) { return;
break;
for (Transaction::const_iterator I = T.decls_begin(), } else
E = T.decls_end(); I != E; ++I) { return;
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);
}
}
}
}
} }
}
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 } //end namespace cling