Skip to content
Snippets Groups Projects
Commit d8dbe6d6 authored by Vassil Vassilev's avatar Vassil Vassilev
Browse files

Fix the rawInput bug in handle line;

Fix the ordering of the members in the IncrementalParser


git-svn-id: http://root.cern.ch/svn/root/trunk@42026 27541ba8-7e3a-0410-8455-c3a389f83636
parent cf5dd0fc
Branches
Tags
No related merge requests found
...@@ -209,7 +209,7 @@ namespace cling { ...@@ -209,7 +209,7 @@ namespace cling {
void handleFrontendOptions(); void handleFrontendOptions();
CompilationResult handleLine(llvm::StringRef Input, CompilationResult handleLine(llvm::StringRef Input,
llvm::StringRef FunctionName, llvm::StringRef FunctionName,
clang::Decl** D); bool rawInput = false, clang::Decl** D = 0);
void WrapInput(std::string& input, std::string& fname); void WrapInput(std::string& input, std::string& fname);
bool RunFunction(llvm::StringRef fname, llvm::GenericValue* res = 0); bool RunFunction(llvm::StringRef fname, llvm::GenericValue* res = 0);
friend class runtime::internal::LifetimeHandler; friend class runtime::internal::LifetimeHandler;
......
...@@ -90,13 +90,13 @@ namespace cling { ...@@ -90,13 +90,13 @@ namespace cling {
llvm::OwningPtr<clang::CompilerInstance> m_CI; // compiler instance. llvm::OwningPtr<clang::CompilerInstance> m_CI; // compiler instance.
llvm::OwningPtr<clang::Parser> m_Parser; // parser (incremental) llvm::OwningPtr<clang::Parser> m_Parser; // parser (incremental)
bool m_DynamicLookupEnabled; // enable/disable dynamic scope bool m_DynamicLookupEnabled; // enable/disable dynamic scope
bool m_SyntaxOnly; // whether to run codegen; cannot be flipped during lifetime of *this
std::vector<llvm::MemoryBuffer*> m_MemoryBuffer; // One buffer for each command line, owner by the source file manager std::vector<llvm::MemoryBuffer*> m_MemoryBuffer; // One buffer for each command line, owner by the source file manager
clang::FileID m_VirtualFileID; // file ID of the memory buffer clang::FileID m_VirtualFileID; // file ID of the memory buffer
ChainedConsumer* m_Consumer; // CI owns it ChainedConsumer* m_Consumer; // CI owns it
clang::Decl* m_FirstTopLevelDecl; // first top level decl clang::Decl* m_FirstTopLevelDecl; // first top level decl
clang::Decl* m_LastTopLevelDecl; // last top level decl after most recent call to parse() clang::Decl* m_LastTopLevelDecl; // last top level decl after most recent call to parse()
Transaction m_LastTransaction; // Holds information for the last transaction Transaction m_LastTransaction; // Holds information for the last transaction
bool m_SyntaxOnly; // whether to run codegen; cannot be flipped during lifetime of *this
}; };
} }
#endif // CLING_INCREMENTAL_PARSER_H #endif // CLING_INCREMENTAL_PARSER_H
...@@ -384,7 +384,7 @@ namespace cling { ...@@ -384,7 +384,7 @@ namespace cling {
clang::diag::MAP_IGNORE, SourceLocation()); clang::diag::MAP_IGNORE, SourceLocation());
Diag.setDiagnosticMapping(DiagnosticIDs::getIdFromName("warn_unused_call"), Diag.setDiagnosticMapping(DiagnosticIDs::getIdFromName("warn_unused_call"),
clang::diag::MAP_IGNORE, SourceLocation()); clang::diag::MAP_IGNORE, SourceLocation());
CompilationResult Result = handleLine(wrapped, functName, D); CompilationResult Result = handleLine(wrapped, functName, rawInput, D);
return Result; return Result;
} }
...@@ -435,11 +435,16 @@ namespace cling { ...@@ -435,11 +435,16 @@ namespace cling {
Interpreter::CompilationResult Interpreter::CompilationResult
Interpreter::handleLine(llvm::StringRef input, llvm::StringRef FunctionName, Interpreter::handleLine(llvm::StringRef input, llvm::StringRef FunctionName,
Decl** D) { bool isRaw, Decl** D) {
// if we are using the preprocessor // if we are using the preprocessor
if (input[0] == '#') { if (isRaw || input[0] == '#') {
if (m_IncrParser->CompileAsIs(input) != IncrementalParser::kFailed)
if (m_IncrParser->CompileAsIs(input) != IncrementalParser::kFailed) {
if (D)
*D = m_IncrParser->getLastTransaction().FirstDecl;
return Interpreter::kSuccess; return Interpreter::kSuccess;
}
else else
return Interpreter::kFailure; return Interpreter::kFailure;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment