Logo ROOT  
Reference Guide
TClingCallbacks.h
Go to the documentation of this file.
1// @(#)root/core/meta:$Id$
2// Author: Vassil Vassilev 7/10/2012
3
4/*************************************************************************
5 * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "cling/Interpreter/InterpreterCallbacks.h"
13
14#include <stack>
15
16namespace clang {
17 class Decl;
18 class LookupResult;
19 class NamespaceDecl;
20 class Scope;
21 class TagDecl;
22 class Token;
23 class FileEntry;
24 class Module;
25}
26
27namespace cling {
28 class Interpreter;
29 class Transaction;
30}
31
32namespace llvm {
33 class StringRef;
34}
35
36// The callbacks are used to update the list of globals in ROOT.
37//
38class TClingCallbacks : public cling::InterpreterCallbacks {
39private:
41 clang::NamespaceDecl *fROOTSpecialNamespace;
48public:
49 TClingCallbacks(cling::Interpreter* interp, bool hasCodeGen);
50
52
53 void Initialize();
54
55 void SetAutoloadingEnabled(bool val = true) { fIsAutoloading = val; }
57
58 void SetAutoParsingSuspended(bool val = true) { fIsAutoParsingSuspended = val; }
60
61 virtual bool LibraryLoadingFailed(const std::string&, const std::string&, bool, bool);
62
63 virtual void InclusionDirective(clang::SourceLocation /*HashLoc*/,
64 const clang::Token &/*IncludeTok*/,
65 llvm::StringRef FileName,
66 bool /*IsAngled*/,
67 clang::CharSourceRange /*FilenameRange*/,
68 const clang::FileEntry * /*File*/,
69 llvm::StringRef /*SearchPath*/,
70 llvm::StringRef /*RelativePath*/,
71 const clang::Module * /*Imported*/);
72
73 // Preprocessor callbacks used to handle special cases like for example:
74 // #include "myMacro.C+"
75 //
76 virtual bool FileNotFound(llvm::StringRef FileName,
77 llvm::SmallVectorImpl<char>& RecoveryPath);
78
79 virtual bool LookupObject(clang::LookupResult &R, clang::Scope *S);
80 virtual bool LookupObject(const clang::DeclContext* DC,
81 clang::DeclarationName Name);
82 virtual bool LookupObject(clang::TagDecl* Tag);
83
84 // The callback is used to update the list of globals in ROOT.
85 //
86 virtual void TransactionCommitted(const cling::Transaction &T);
87
88 // The callback is used to update the list of globals in ROOT.
89 //
90 virtual void TransactionUnloaded(const cling::Transaction &T);
91
92 // The callback is used to clear the autoparsing caches.
93 //
94 virtual void TransactionRollback(const cling::Transaction &T);
95
96 ///\brief A previous definition has been shadowed; invalidate TCling' stored
97 /// data about the old (global) decl.
98 virtual void DefinitionShadowed(const clang::NamedDecl *D);
99
100 // Used to inform client about a new decl read by the ASTReader.
101 //
102 virtual void DeclDeserialized(const clang::Decl* D);
103
104 virtual void LibraryLoaded(const void* dyLibHandle,
105 llvm::StringRef canonicalName);
106 virtual void LibraryUnloaded(const void* dyLibHandle,
107 llvm::StringRef canonicalName);
108
109 virtual void PrintStackTrace();
110
111 virtual void *EnteringUserCode();
112 virtual void ReturnedFromUserCode(void *stateInfo);
114 virtual void UnlockCompilationDuringUserCodeExecution(void *StateInfo);
115
116private:
117 bool tryAutoParseInternal(llvm::StringRef Name, clang::LookupResult &R,
118 clang::Scope *S, const clang::FileEntry* FE = 0);
119 bool tryFindROOTSpecialInternal(clang::LookupResult &R, clang::Scope *S);
120 bool tryResolveAtRuntimeInternal(clang::LookupResult &R, clang::Scope *S);
121 bool shouldResolveAtRuntime(clang::LookupResult &R, clang::Scope *S);
122 bool tryInjectImplicitAutoKeyword(clang::LookupResult &R, clang::Scope *S);
123};
#define R(a, b, c, d, e, f, g, h, i)
Definition: RSha256.hxx:110
virtual void LibraryUnloaded(const void *dyLibHandle, llvm::StringRef canonicalName)
virtual void * LockCompilationDuringUserCodeExecution()
bool tryAutoParseInternal(llvm::StringRef Name, clang::LookupResult &R, clang::Scope *S, const clang::FileEntry *FE=0)
bool tryFindROOTSpecialInternal(clang::LookupResult &R, clang::Scope *S)
virtual bool LookupObject(clang::LookupResult &R, clang::Scope *S)
bool fIsAutoParsingSuspended
bool IsAutoParsingSuspended()
bool tryResolveAtRuntimeInternal(clang::LookupResult &R, clang::Scope *S)
virtual bool LibraryLoadingFailed(const std::string &, const std::string &, bool, bool)
virtual void LibraryLoaded(const void *dyLibHandle, llvm::StringRef canonicalName)
virtual void DeclDeserialized(const clang::Decl *D)
virtual void ReturnedFromUserCode(void *stateInfo)
bool tryInjectImplicitAutoKeyword(clang::LookupResult &R, clang::Scope *S)
clang::NamespaceDecl * fROOTSpecialNamespace
void SetAutoloadingEnabled(bool val=true)
virtual void InclusionDirective(clang::SourceLocation, const clang::Token &, llvm::StringRef FileName, bool, clang::CharSourceRange, const clang::FileEntry *, llvm::StringRef, llvm::StringRef, const clang::Module *)
virtual void UnlockCompilationDuringUserCodeExecution(void *StateInfo)
TClingCallbacks(cling::Interpreter *interp, bool hasCodeGen)
virtual void TransactionRollback(const cling::Transaction &T)
virtual void TransactionUnloaded(const cling::Transaction &T)
virtual void PrintStackTrace()
bool IsAutoloadingEnabled()
virtual bool FileNotFound(llvm::StringRef FileName, llvm::SmallVectorImpl< char > &RecoveryPath)
void SetAutoParsingSuspended(bool val=true)
virtual bool LookupObject(const clang::DeclContext *DC, clang::DeclarationName Name)
virtual void * EnteringUserCode()
virtual void TransactionCommitted(const cling::Transaction &T)
bool fIsAutoloadingRecursively
bool shouldResolveAtRuntime(clang::LookupResult &R, clang::Scope *S)
virtual void DefinitionShadowed(const clang::NamedDecl *D)
A previous definition has been shadowed; invalidate TCling' stored data about the old (global) decl.
double T(double x)
Definition: ChebyshevPol.h:34
RooArgSet S(const RooAbsArg &v1)
Definition: TString.h:845
const char * Name
Definition: TXMLSetup.cxx:66