Pass the .L-ed transaction to actOnxCommand; last transaction might be wrong.
This commit is contained in:
parent
365133992a
commit
0bc17f63c4
@ -527,7 +527,8 @@ namespace cling {
|
||||
///\returns result of the compilation.
|
||||
///
|
||||
CompilationResult loadFile(const std::string& filename,
|
||||
bool allowSharedLib = true);
|
||||
bool allowSharedLib = true,
|
||||
Transaction** T = 0);
|
||||
|
||||
///\brief Unloads (forgets) given number of transactions.
|
||||
///
|
||||
|
@ -1043,7 +1043,8 @@ namespace cling {
|
||||
|
||||
Interpreter::CompilationResult
|
||||
Interpreter::loadFile(const std::string& filename,
|
||||
bool allowSharedLib /*=true*/) {
|
||||
bool allowSharedLib /*=true*/,
|
||||
Transaction** T /*= 0*/) {
|
||||
DynamicLibraryManager* DLM = getDynamicLibraryManager();
|
||||
std::string canonicalLib = DLM->lookupLibrary(filename);
|
||||
if (allowSharedLib && !canonicalLib.empty()) {
|
||||
@ -1062,7 +1063,7 @@ namespace cling {
|
||||
|
||||
std::string code;
|
||||
code += "#include \"" + filename + "\"";
|
||||
CompilationResult res = declare(code);
|
||||
CompilationResult res = declare(code, T);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,8 @@ namespace cling {
|
||||
MetaSema::MetaSema(Interpreter& interp, MetaProcessor& meta)
|
||||
: m_Interpreter(interp), m_MetaProcessor(meta), m_IsQuitRequested(false) { }
|
||||
|
||||
MetaSema::ActionResult MetaSema::actOnLCommand(llvm::StringRef file) {
|
||||
MetaSema::ActionResult MetaSema::actOnLCommand(llvm::StringRef file,
|
||||
Transaction** transaction /*= 0*/){
|
||||
ActionResult result = actOnUCommand(file);
|
||||
if (result != AR_Success)
|
||||
return result;
|
||||
@ -56,7 +57,8 @@ namespace cling {
|
||||
std::string canFile = m_Interpreter.lookupFileOrLibrary(file);
|
||||
if (canFile.empty())
|
||||
canFile = file;
|
||||
if (m_Interpreter.loadFile(canFile) == Interpreter::kSuccess) {
|
||||
if (m_Interpreter.loadFile(canFile, true /*allowSharedLib*/, transaction)
|
||||
== Interpreter::kSuccess) {
|
||||
clang::SourceManager& SM = m_Interpreter.getSema().getSourceManager();
|
||||
clang::FileManager& FM = SM.getFileManager();
|
||||
const clang::FileEntry* Entry
|
||||
@ -93,7 +95,10 @@ namespace cling {
|
||||
MetaSema::ActionResult MetaSema::actOnxCommand(llvm::StringRef file,
|
||||
llvm::StringRef args,
|
||||
Value* result) {
|
||||
MetaSema::ActionResult actionResult = actOnLCommand(file);
|
||||
|
||||
// Check if there is a function named after the file.
|
||||
cling::Transaction* T = 0;
|
||||
MetaSema::ActionResult actionResult = actOnLCommand(file, &T);
|
||||
if (actionResult == AR_Success) {
|
||||
// Look for start of parameters:
|
||||
typedef std::pair<llvm::StringRef,llvm::StringRef> StringRefPair;
|
||||
@ -106,8 +111,6 @@ namespace cling {
|
||||
StringRefPair pairFuncExt = pairPathFile.second.rsplit('.');
|
||||
std::string expression = pairFuncExt.first.str() + "(" + args.str() + ")";
|
||||
|
||||
// Check if there is a function named after the file.
|
||||
const cling::Transaction* T = m_Interpreter.getLastTransaction();
|
||||
assert(T);
|
||||
|
||||
using namespace clang;
|
||||
|
@ -63,7 +63,8 @@ namespace cling {
|
||||
///
|
||||
///\param[in] file - The file/library to be loaded.
|
||||
///
|
||||
ActionResult actOnLCommand(llvm::StringRef file);
|
||||
ActionResult actOnLCommand(llvm::StringRef file,
|
||||
Transaction** transaction = 0);
|
||||
|
||||
///\brief T command prepares the tag files for giving semantic hints.
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user