Until we have the full implementation of the preprocessor directives just act
on #include. This makes sure that we don't do any extra work causing roottest failures. git-svn-id: http://root.cern.ch/svn/root/trunk@47972 27541ba8-7e3a-0410-8455-c3a389f83636
This commit is contained in:
parent
40895f8595
commit
d8d127664d
@ -297,7 +297,7 @@ namespace cling {
|
||||
///
|
||||
///\returns true if the input should be wrapped.
|
||||
///
|
||||
bool ShouldWrapInput(llvm::StringRef input);
|
||||
bool ShouldWrapInput(const std::string& input);
|
||||
|
||||
///\brief Wraps a given input.
|
||||
///
|
||||
|
@ -475,15 +475,15 @@ namespace cling {
|
||||
return Interpreter::kFailure;
|
||||
}
|
||||
|
||||
bool Interpreter::ShouldWrapInput(llvm::StringRef input) {
|
||||
bool Interpreter::ShouldWrapInput(const std::string& input) {
|
||||
llvm::OwningPtr<llvm::MemoryBuffer> buf;
|
||||
buf.reset(llvm::MemoryBuffer::getMemBuffer(input, "Cling Preparse Buf"));
|
||||
Lexer WrapLexer(SourceLocation(), getSema().getLangOpts(), input.data(),
|
||||
input.data(), input.data() + input.size());
|
||||
Lexer WrapLexer(SourceLocation(), getSema().getLangOpts(), input.c_str(),
|
||||
input.c_str(), input.c_str() + input.size());
|
||||
Token Tok;
|
||||
WrapLexer.Lex(Tok);
|
||||
|
||||
tok::TokenKind kind = Tok.getKind();
|
||||
const tok::TokenKind kind = Tok.getKind();
|
||||
|
||||
if (kind == tok::raw_identifier && !Tok.needsCleaning()) {
|
||||
StringRef keyword(Tok.getRawIdentifierData(), Tok.getLength());
|
||||
@ -494,12 +494,16 @@ namespace cling {
|
||||
if (keyword.equals("namespace"))
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (kind) {
|
||||
case tok::hash : return false;
|
||||
default:
|
||||
return true;
|
||||
else if (kind == tok::hash) {
|
||||
WrapLexer.Lex(Tok);
|
||||
if (Tok.is(tok::raw_identifier) && !Tok.needsCleaning()) {
|
||||
StringRef keyword(Tok.getRawIdentifierData(), Tok.getLength());
|
||||
if (keyword.equals("include"))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user