Replace Decl** with the more accurate Transaction**.
Add output Transaction parameter to Interpreter::parse.
This commit is contained in:
parent
3c101956d8
commit
fc7d1879da
@ -303,13 +303,13 @@ namespace cling {
|
||||
///
|
||||
///\param [in] input - The input being compiled.
|
||||
///\param [in] CompilationOptions - The option set driving the compilation.
|
||||
///\param [out] D - The first declaration of the compiled input.
|
||||
///\param [out] T - The cling::Transaction of the compiled input.
|
||||
///
|
||||
///\returns Whether the operation was fully successful.
|
||||
///
|
||||
CompilationResult DeclareInternal(const std::string& input,
|
||||
const CompilationOptions& CO,
|
||||
const clang::Decl** D = 0);
|
||||
Transaction** T = 0) const;
|
||||
|
||||
///\brief Worker function, building block for interpreter's public
|
||||
/// interfaces.
|
||||
@ -319,12 +319,14 @@ namespace cling {
|
||||
///\param [in,out] V - The result of the evaluation of the input. Must be
|
||||
/// initialized to point to the return value's location if the
|
||||
/// expression result is an aggregate.
|
||||
///\param [out] T - The cling::Transaction of the compiled input.
|
||||
///
|
||||
///\returns Whether the operation was fully successful.
|
||||
///
|
||||
CompilationResult EvaluateInternal(const std::string& input,
|
||||
const CompilationOptions& CO,
|
||||
StoredValueRef* V = 0);
|
||||
StoredValueRef* V = 0,
|
||||
Transaction** T = 0);
|
||||
|
||||
///\brief Decides whether the input line should be wrapped or not by using
|
||||
/// simple lexing to determine whether it is known that it should be on the
|
||||
@ -469,12 +471,12 @@ namespace cling {
|
||||
///\param[in,out] V - The result of the evaluation of the input. Must be
|
||||
/// initialized to point to the return value's location if the
|
||||
/// expression result is an aggregate.
|
||||
///\param[out] D - The first declaration of the compiled input.
|
||||
///\param[out] T - The cling::Transaction of the compiled input.
|
||||
///
|
||||
///\returns Whether the operation was fully successful.
|
||||
///
|
||||
CompilationResult process(const std::string& input, StoredValueRef* V = 0,
|
||||
const clang::Decl** D = 0);
|
||||
Transaction** T = 0);
|
||||
|
||||
///\brief Parses input line, which doesn't contain statements. No code
|
||||
/// generation is done.
|
||||
@ -483,10 +485,12 @@ namespace cling {
|
||||
/// the header files need to be imported.
|
||||
///
|
||||
///\param[in] input - The input containing the declarations.
|
||||
///\param[out] T - The cling::Transaction of the parsed input.
|
||||
///
|
||||
///\returns Whether the operation was fully successful.
|
||||
///
|
||||
CompilationResult parse(const std::string& input);
|
||||
CompilationResult parse(const std::string& input,
|
||||
Transaction** T = 0) const;
|
||||
|
||||
///\brief Looks for a already generated PCM for the given header file and
|
||||
/// loads it.
|
||||
@ -518,12 +522,11 @@ namespace cling {
|
||||
///
|
||||
/// @param[in] input - The input containing only declarations (aka
|
||||
/// Top Level Declarations)
|
||||
/// @param[out] D - The first compiled declaration from the input
|
||||
/// @param[out] T - The cling::Transaction of the input
|
||||
///
|
||||
///\returns Whether the operation was fully successful.
|
||||
///
|
||||
CompilationResult declare(const std::string& input,
|
||||
const clang::Decl** D = 0);
|
||||
CompilationResult declare(const std::string& input, Transaction** T = 0);
|
||||
|
||||
///\brief Compiles input line, which contains only expressions.
|
||||
///
|
||||
|
@ -429,9 +429,9 @@ namespace cling {
|
||||
///
|
||||
Interpreter::CompilationResult
|
||||
Interpreter::process(const std::string& input, StoredValueRef* V /* = 0 */,
|
||||
const Decl** D /* = 0 */) {
|
||||
Transaction** T /* = 0 */) {
|
||||
if (isRawInputEnabled() || !ShouldWrapInput(input))
|
||||
return declare(input, D);
|
||||
return declare(input, T);
|
||||
|
||||
CompilationOptions CO;
|
||||
CO.DeclarationExtraction = 1;
|
||||
@ -441,20 +441,15 @@ namespace cling {
|
||||
CO.Debug = isPrintingAST();
|
||||
CO.IRDebug = isPrintingIR();
|
||||
|
||||
if (EvaluateInternal(input, CO, V) == Interpreter::kFailure) {
|
||||
if (D)
|
||||
*D = 0;
|
||||
if (EvaluateInternal(input, CO, V, T) == Interpreter::kFailure) {
|
||||
return Interpreter::kFailure;
|
||||
}
|
||||
|
||||
if (D)
|
||||
*D = m_IncrParser->getLastTransaction()->getFirstDecl().getSingleDecl();
|
||||
|
||||
return Interpreter::kSuccess;
|
||||
}
|
||||
|
||||
Interpreter::CompilationResult
|
||||
Interpreter::parse(const std::string& input) {
|
||||
Interpreter::CompilationResult
|
||||
Interpreter::parse(const std::string& input, Transaction** T /*=0*/) const {
|
||||
CompilationOptions CO;
|
||||
CO.CodeGeneration = 0;
|
||||
CO.DeclarationExtraction = 0;
|
||||
@ -464,7 +459,7 @@ namespace cling {
|
||||
CO.Debug = isPrintingAST();
|
||||
CO.IRDebug = isPrintingIR();
|
||||
|
||||
return DeclareInternal(input, CO);
|
||||
return DeclareInternal(input, CO, T);
|
||||
}
|
||||
|
||||
Interpreter::CompilationResult
|
||||
@ -525,7 +520,7 @@ namespace cling {
|
||||
}
|
||||
|
||||
Interpreter::CompilationResult
|
||||
Interpreter::declare(const std::string& input, const Decl** D /* = 0 */) {
|
||||
Interpreter::declare(const std::string& input, Transaction** T/*=0 */) {
|
||||
CompilationOptions CO;
|
||||
CO.DeclarationExtraction = 0;
|
||||
CO.ValuePrinting = 0;
|
||||
@ -534,7 +529,7 @@ namespace cling {
|
||||
CO.Debug = isPrintingAST();
|
||||
CO.IRDebug = isPrintingIR();
|
||||
|
||||
return DeclareInternal(input, CO, D);
|
||||
return DeclareInternal(input, CO, T);
|
||||
}
|
||||
|
||||
Interpreter::CompilationResult
|
||||
@ -694,15 +689,15 @@ namespace cling {
|
||||
Interpreter::CompilationResult
|
||||
Interpreter::DeclareInternal(const std::string& input,
|
||||
const CompilationOptions& CO,
|
||||
const clang::Decl** D /* = 0 */) {
|
||||
Transaction** T /* = 0 */) const {
|
||||
// Disable warnings which doesn't make sense when using the prompt
|
||||
// This gets reset with the clang::Diagnostics().Reset()
|
||||
ignoreFakeDiagnostics();
|
||||
|
||||
const Transaction* lastT = m_IncrParser->Compile(input, CO);
|
||||
Transaction* lastT = m_IncrParser->Compile(input, CO);
|
||||
if (lastT->getIssuedDiags() != Transaction::kErrors) {
|
||||
if (D)
|
||||
*D = lastT->getFirstDecl().getSingleDecl();
|
||||
if (T)
|
||||
*T = lastT;
|
||||
return Interpreter::kSuccess;
|
||||
}
|
||||
|
||||
@ -712,7 +707,8 @@ namespace cling {
|
||||
Interpreter::CompilationResult
|
||||
Interpreter::EvaluateInternal(const std::string& input,
|
||||
const CompilationOptions& CO,
|
||||
StoredValueRef* V /* = 0 */) {
|
||||
StoredValueRef* V, /* = 0 */
|
||||
Transaction** T /* = 0 */) {
|
||||
// Disable warnings which doesn't make sense when using the prompt
|
||||
// This gets reset with the clang::Diagnostics().Reset()
|
||||
ignoreFakeDiagnostics();
|
||||
@ -730,12 +726,14 @@ namespace cling {
|
||||
}
|
||||
else
|
||||
lastT = m_IncrParser->Compile(Wrapper, CO);
|
||||
if (T)
|
||||
*T = lastT;
|
||||
|
||||
if (lastT->getState() == Transaction::kCommitted
|
||||
&& RunFunction(lastT->getWrapperFD(), V) < kExeFirstError)
|
||||
return Interpreter::kSuccess;
|
||||
else if (V)
|
||||
*V = StoredValueRef::invalidValue();
|
||||
if (V)
|
||||
*V = StoredValueRef::invalidValue();
|
||||
|
||||
return Interpreter::kFailure;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user