ROOT  6.06/09
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 
50 
51  void Initialize();
52 
53  void SetAutoloadingEnabled(bool val = true) { fIsAutoloading = val; }
55 
56  void SetAutoParsingSuspended(bool val = true) { fIsAutoParsingSuspended = val; }
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 private:
102  bool tryAutoParseInternal(llvm::StringRef Name, clang::LookupResult &R,
103  clang::Scope *S, const clang::FileEntry* FE = 0);
104  bool tryFindROOTSpecialInternal(clang::LookupResult &R, clang::Scope *S);
105  bool tryResolveAtRuntimeInternal(clang::LookupResult &R, clang::Scope *S);
106  bool shouldResolveAtRuntime(clang::LookupResult &R, clang::Scope *S);
107  bool tryInjectImplicitAutoKeyword(clang::LookupResult &R, clang::Scope *S);
108 };
virtual void TransactionUnloaded(const cling::Transaction &T)
Definition: TString.h:780
clang::NamespaceDecl * fROOTSpecialNamespace
double T(double x)
Definition: ChebyshevPol.h:34
bool IsAutoParsingSuspended()
void SetAutoParsingSuspended(bool val=true)
virtual void DeclDeserialized(const clang::Decl *D)
const char * Name
Definition: TXMLSetup.cxx:67
bool tryAutoParseInternal(llvm::StringRef Name, clang::LookupResult &R, clang::Scope *S, const clang::FileEntry *FE=0)
virtual bool FileNotFound(llvm::StringRef FileName, llvm::SmallVectorImpl< char > &RecoveryPath)
bool tryFindROOTSpecialInternal(clang::LookupResult &R, clang::Scope *S)
virtual void LibraryLoaded(const void *dyLibHandle, llvm::StringRef canonicalName)
virtual void LibraryUnloaded(const void *dyLibHandle, llvm::StringRef canonicalName)
bool tryResolveAtRuntimeInternal(clang::LookupResult &R, clang::Scope *S)
bool tryInjectImplicitAutoKeyword(clang::LookupResult &R, clang::Scope *S)
bool fIsAutoParsingSuspended
bool fIsAutoloadingRecursively
virtual void TransactionCommitted(const cling::Transaction &T)
bool IsAutoloadingEnabled()
virtual void InclusionDirective(clang::SourceLocation, const clang::Token &, llvm::StringRef FileName, bool, clang::CharSourceRange, const clang::FileEntry *, llvm::StringRef, llvm::StringRef, const clang::Module *)
Definition: TCling.h:48
static const float S
Definition: mandel.cpp:113
Definition: TDatime.h:114
void SetAutoloadingEnabled(bool val=true)
TClingCallbacks(cling::Interpreter *interp)
bool shouldResolveAtRuntime(clang::LookupResult &R, clang::Scope *S)
virtual void TransactionRollback(const cling::Transaction &T)
virtual bool LookupObject(clang::LookupResult &R, clang::Scope *S)
TRandom3 R
a TMatrixD.
Definition: testIO.cxx:28