Logo ROOT   6.08/07
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 namespace clang {
15  class Decl;
16  class LookupResult;
17  class NamespaceDecl;
18  class Scope;
19  class TagDecl;
20  class Token;
21  class FileEntry;
22  class Module;
23 }
24 
25 namespace cling {
26  class Interpreter;
27  class Transaction;
28 }
29 
30 namespace llvm {
31  class StringRef;
32 }
33 
34 // The callbacks are used to update the list of globals in ROOT.
35 //
36 class TClingCallbacks : public cling::InterpreterCallbacks {
37 private:
39  clang::NamespaceDecl *fROOTSpecialNamespace;
40  bool fFirstRun;
44  bool fPPOldFlag;
45  bool fPPChanged;
46 public:
47  TClingCallbacks(cling::Interpreter* interp);
48 
49  ~TClingCallbacks();
50 
51  void Initialize();
52 
53  void SetAutoloadingEnabled(bool val = true) { fIsAutoloading = val; }
54  bool IsAutoloadingEnabled() { return fIsAutoloading; }
55 
56  void SetAutoParsingSuspended(bool val = true) { fIsAutoParsingSuspended = val; }
57  bool IsAutoParsingSuspended() { return fIsAutoParsingSuspended; }
58 
59  virtual void InclusionDirective(clang::SourceLocation /*HashLoc*/,
60  const clang::Token &/*IncludeTok*/,
61  llvm::StringRef FileName,
62  bool /*IsAngled*/,
63  clang::CharSourceRange /*FilenameRange*/,
64  const clang::FileEntry */*File*/,
65  llvm::StringRef /*SearchPath*/,
66  llvm::StringRef /*RelativePath*/,
67  const clang::Module */*Imported*/);
68 
69  // Preprocessor callbacks used to handle special cases like for example:
70  // #include "myMacro.C+"
71  //
72  virtual bool FileNotFound(llvm::StringRef FileName,
73  llvm::SmallVectorImpl<char>& RecoveryPath);
74 
75  virtual bool LookupObject(clang::LookupResult &R, clang::Scope *S);
76  virtual bool LookupObject(const clang::DeclContext* DC,
77  clang::DeclarationName Name);
78  virtual bool LookupObject(clang::TagDecl* Tag);
79 
80  // The callback is used to update the list of globals in ROOT.
81  //
82  virtual void TransactionCommitted(const cling::Transaction &T);
83 
84  // The callback is used to update the list of globals in ROOT.
85  //
86  virtual void TransactionUnloaded(const cling::Transaction &T);
87 
88  // The callback is used to clear the autoparsing caches.
89  //
90  virtual void TransactionRollback(const cling::Transaction &T);
91 
92  // Used to inform client about a new decl read by the ASTReader.
93  //
94  virtual void DeclDeserialized(const clang::Decl* D);
95 
96  virtual void LibraryLoaded(const void* dyLibHandle,
97  llvm::StringRef canonicalName);
98  virtual void LibraryUnloaded(const void* dyLibHandle,
99  llvm::StringRef canonicalName);
100 
101  virtual void PrintStackTrace();
102 
103 private:
104  bool tryAutoParseInternal(llvm::StringRef Name, clang::LookupResult &R,
105  clang::Scope *S, const clang::FileEntry* FE = 0);
106  bool tryFindROOTSpecialInternal(clang::LookupResult &R, clang::Scope *S);
107  bool tryResolveAtRuntimeInternal(clang::LookupResult &R, clang::Scope *S);
108  bool shouldResolveAtRuntime(clang::LookupResult &R, clang::Scope *S);
109  bool tryInjectImplicitAutoKeyword(clang::LookupResult &R, clang::Scope *S);
110 };
Definition: TString.h:780
clang::NamespaceDecl * fROOTSpecialNamespace
double T(double x)
Definition: ChebyshevPol.h:34
bool IsAutoParsingSuspended()
void SetAutoParsingSuspended(bool val=true)
const char * Name
Definition: TXMLSetup.cxx:67
RooArgSet S(const RooAbsArg &v1)
void Initialize(Bool_t useTMVAStyle=kTRUE)
Definition: tmvaglob.cxx:176
bool fIsAutoParsingSuspended
bool fIsAutoloadingRecursively
bool IsAutoloadingEnabled()
Definition: TCling.h:48
Print a TSeq at the prompt:
Definition: TDatime.h:114
void SetAutoloadingEnabled(bool val=true)
TRandom3 R
a TMatrixD.
Definition: testIO.cxx:28