Transactions that triggered deserialization shouldn't be considered as empty, because logically they are not and because ROOT needs the callbacks to be fired.
This commit is contained in:
parent
0ac1669202
commit
a8c9e880e9
@ -71,12 +71,17 @@ namespace cling {
|
||||
typedef llvm::SmallVector<DelayCallInfo, 64> DeclQueue;
|
||||
typedef llvm::SmallVector<Transaction*, 2> NestedTransactions;
|
||||
|
||||
///\brief All seen declarations. If we collect the declarations by walking
|
||||
/// the clang::DeclContext we will miss the injected onces (eg. template
|
||||
/// instantiations).
|
||||
///\brief All seen declarations, except the deserialized ones.
|
||||
/// If we collect the declarations by walking the clang::DeclContext we
|
||||
/// will miss the injected onces (eg. template instantiations).
|
||||
///
|
||||
DeclQueue m_DeclQueue;
|
||||
|
||||
///\brief All declarations that the transaction caused to be deserialized,
|
||||
/// either from the PCH or the PCM.
|
||||
///
|
||||
DeclQueue m_DeserializedDeclQueue;
|
||||
|
||||
///\brief List of nested transactions if any.
|
||||
///
|
||||
llvm::OwningPtr<NestedTransactions> m_NestedTransactions;
|
||||
@ -201,7 +206,7 @@ namespace cling {
|
||||
///\brief Returns the first declaration of the transaction.
|
||||
///
|
||||
clang::DeclGroupRef getFirstDecl() const {
|
||||
if (!empty())
|
||||
if (!m_DeclQueue.empty())
|
||||
return m_DeclQueue.front().m_DGR;
|
||||
return clang::DeclGroupRef();
|
||||
}
|
||||
@ -209,7 +214,7 @@ namespace cling {
|
||||
///\brief Returns the last declaration of a completed transaction.
|
||||
///
|
||||
clang::DeclGroupRef getLastDecl() const {
|
||||
if (!empty() && isCompleted())
|
||||
if (!m_DeclQueue.empty() && isCompleted())
|
||||
return m_DeclQueue.back().m_DGR;
|
||||
return clang::DeclGroupRef();
|
||||
}
|
||||
@ -218,7 +223,7 @@ namespace cling {
|
||||
/// in still incomplete.
|
||||
///
|
||||
clang::DeclGroupRef getCurrentLastDecl() const {
|
||||
if (!empty())
|
||||
if (!m_DeclQueue.empty())
|
||||
return m_DeclQueue.back().m_DGR;
|
||||
return clang::DeclGroupRef();
|
||||
}
|
||||
@ -282,7 +287,7 @@ namespace cling {
|
||||
///\brief Returns whether there are declarations in the transaction.
|
||||
///
|
||||
bool empty() const {
|
||||
return m_DeclQueue.empty()
|
||||
return m_DeclQueue.empty() && m_DeserializedDeclQueue.empty()
|
||||
&& (!m_NestedTransactions || m_NestedTransactions->empty());
|
||||
}
|
||||
|
||||
@ -358,6 +363,8 @@ namespace cling {
|
||||
void printStructureBrief(size_t nindent = 0) const;
|
||||
|
||||
friend class IncrementalParser;
|
||||
private:
|
||||
bool comesFromASTReader(clang::DeclGroupRef DGR) const;
|
||||
};
|
||||
|
||||
} // end namespace cling
|
||||
|
@ -77,7 +77,7 @@ namespace cling {
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
//return true;
|
||||
}
|
||||
|
||||
Transaction::DelayCallInfo DCI(DGR, Transaction::kCCIHandleTopLevelDecl);
|
||||
@ -90,7 +90,7 @@ namespace cling {
|
||||
// pipe it directly to codegen.
|
||||
if (comesFromASTReader(DGR)) {
|
||||
HandleTopLevelDecl(DGR);
|
||||
return;
|
||||
//return;
|
||||
}
|
||||
|
||||
Transaction::DelayCallInfo DCI(DGR, Transaction::kCCIHandleInterestingDecl);
|
||||
@ -103,7 +103,7 @@ namespace cling {
|
||||
if (comesFromASTReader(DeclGroupRef(TD))) {
|
||||
if (m_CodeGen)
|
||||
m_CodeGen->HandleTagDeclDefinition(TD);
|
||||
return;
|
||||
//return;
|
||||
}
|
||||
|
||||
Transaction::DelayCallInfo DCI(DeclGroupRef(TD),
|
||||
@ -118,7 +118,7 @@ namespace cling {
|
||||
// FIXME: when is the vtable part of the library?
|
||||
if (m_CodeGen)
|
||||
m_CodeGen->HandleVTable(RD, DefinitionRequired);
|
||||
return;
|
||||
//return;
|
||||
}
|
||||
|
||||
Transaction::DelayCallInfo DCI(DeclGroupRef(RD),
|
||||
@ -146,7 +146,7 @@ namespace cling {
|
||||
if (comesFromASTReader(DeclGroupRef(D))) {
|
||||
if (m_CodeGen)
|
||||
m_CodeGen->HandleCXXImplicitFunctionInstantiation(D);
|
||||
return;
|
||||
//return;
|
||||
}
|
||||
|
||||
Transaction::DelayCallInfo DCI(DeclGroupRef(D),
|
||||
@ -159,7 +159,7 @@ namespace cling {
|
||||
if (comesFromASTReader(DeclGroupRef(D))) {
|
||||
if (m_CodeGen && !shouldIgnoreDeclFromASTReader(D))
|
||||
m_CodeGen->HandleCXXStaticMemberVarInstantiation(D);
|
||||
return;
|
||||
//return;
|
||||
}
|
||||
|
||||
Transaction::DelayCallInfo DCI(DeclGroupRef(D),
|
||||
|
@ -268,10 +268,9 @@ namespace cling {
|
||||
}
|
||||
T->setState(Transaction::kCommitted);
|
||||
|
||||
InterpreterCallbacks* callbacks = m_Interpreter->getCallbacks();
|
||||
|
||||
if (callbacks)
|
||||
if (InterpreterCallbacks* callbacks = m_Interpreter->getCallbacks())
|
||||
callbacks->TransactionCommitted(*T);
|
||||
|
||||
}
|
||||
|
||||
void IncrementalParser::markWholeTransactionAsUsed(Transaction* T) const {
|
||||
|
@ -138,7 +138,11 @@ namespace cling {
|
||||
m_WrapperFD = FD;
|
||||
}
|
||||
}
|
||||
m_DeclQueue.push_back(DCI);
|
||||
|
||||
if (comesFromASTReader(DCI.m_DGR))
|
||||
m_DeserializedDeclQueue.push_back(DCI);
|
||||
else
|
||||
m_DeclQueue.push_back(DCI);
|
||||
}
|
||||
|
||||
void Transaction::append(clang::DeclGroupRef DGR) {
|
||||
@ -247,4 +251,14 @@ namespace cling {
|
||||
}
|
||||
}
|
||||
|
||||
bool Transaction::comesFromASTReader(DeclGroupRef DGR) const {
|
||||
assert(!DGR.isNull() && "DeclGroupRef is Null!");
|
||||
if (getCompilationOpts().CodeGenerationForModule)
|
||||
return true;
|
||||
|
||||
// Take the first/only decl in the group.
|
||||
Decl* D = *DGR.begin();
|
||||
return D->isFromASTFile();
|
||||
}
|
||||
|
||||
} // end namespace cling
|
||||
|
Loading…
Reference in New Issue
Block a user