* SymbolResolverCallback should create DynamicIDHandler as its InterpreterExternalSemaSource.

* InterpreterExternalSemaSource::setCallbacks is not needed any more. 
  It can be set in the constructor instead.


git-svn-id: http://root.cern.ch/svn/root/trunk@46444 27541ba8-7e3a-0410-8455-c3a389f83636
This commit is contained in:
Vassil Vassilev 2012-10-10 15:50:17 +00:00
parent 9d654b26f9
commit 475ad9a757
3 changed files with 12 additions and 12 deletions

View File

@ -37,12 +37,11 @@ namespace cling {
InterpreterCallbacks* m_Callbacks; // we don't own it.
public:
InterpreterExternalSemaSource() : m_Callbacks(0){}
InterpreterExternalSemaSource(InterpreterCallbacks* C) : m_Callbacks(C){}
~InterpreterExternalSemaSource();
InterpreterCallbacks* getCallbacks() const { return m_Callbacks; }
void setCallbacks(InterpreterCallbacks* C) { m_Callbacks = C; }
/// \brief Provides last resort lookup for failed unqualified lookups.
///
@ -134,8 +133,7 @@ namespace cling {
private:
clang::NamedDecl* m_TesterDecl;
public:
SymbolResolverCallback(Interpreter* interp,
InterpreterExternalSemaSource* IESS = 0);
SymbolResolverCallback(Interpreter* interp);
~SymbolResolverCallback();
bool LookupObject(clang::LookupResult& R, clang::Scope* S);

View File

@ -37,7 +37,9 @@ namespace cling {
/// One have to be carefull in the cases, in which the compiler expects that
/// the lookup will fail!
class DynamicIDHandler : public InterpreterExternalSemaSource {
public:
public:
DynamicIDHandler(InterpreterCallbacks* C)
: InterpreterExternalSemaSource(C) { }
~DynamicIDHandler();
/// \brief Provides last resort lookup for failed unqualified lookups

View File

@ -8,8 +8,6 @@
#include "cling/Interpreter/Interpreter.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/Sema.h"
using namespace clang;
@ -31,8 +29,7 @@ namespace cling {
InterpreterExternalSemaSource* IESS)
: m_Interpreter(interp), m_SemaExternalSource(IESS) {
if (!IESS)
m_SemaExternalSource.reset(new InterpreterExternalSemaSource());
m_SemaExternalSource->setCallbacks(this);
m_SemaExternalSource.reset(new InterpreterExternalSemaSource(this));
}
// pin the vtable here
@ -46,8 +43,12 @@ namespace cling {
// TODO: Make the build system in the testsuite aware how to build that class
// and extract it out there again.
#include "DynamicLookup.h"
#include "cling/Utils/AST.h"
#include "clang/Sema/Lookup.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/Scope.h"
namespace cling {
namespace test {
TestProxy* Tester = 0;
@ -91,9 +92,8 @@ namespace test {
printf("%s", "\n");
}
SymbolResolverCallback::SymbolResolverCallback(Interpreter* interp,
InterpreterExternalSemaSource* IESS)
: InterpreterCallbacks(interp, IESS), m_TesterDecl(0) {
SymbolResolverCallback::SymbolResolverCallback(Interpreter* interp)
: InterpreterCallbacks(interp, new DynamicIDHandler(this)), m_TesterDecl(0) {
m_Interpreter->process("cling::test::Tester = new cling::test::TestProxy();");
}