OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{UdfCompiler.cpp}::FunctionDeclVisitor Class Reference
+ Inheritance diagram for anonymous_namespace{UdfCompiler.cpp}::FunctionDeclVisitor:
+ Collaboration diagram for anonymous_namespace{UdfCompiler.cpp}::FunctionDeclVisitor:

Public Member Functions

 FunctionDeclVisitor (llvm::raw_fd_ostream &ast_file, SourceManager &s_manager, ASTContext &context)
 
bool VisitFunctionDecl (FunctionDecl *f)
 

Private Member Functions

std::string getMainFileName () const
 
std::string getFuncDeclFileName (FunctionDecl *f) const
 

Private Attributes

llvm::raw_fd_ostream & ast_file_
 
SourceManager & source_manager_
 
ASTContext & context_
 

Detailed Description

Definition at line 56 of file UdfCompiler.cpp.

Constructor & Destructor Documentation

anonymous_namespace{UdfCompiler.cpp}::FunctionDeclVisitor::FunctionDeclVisitor ( llvm::raw_fd_ostream &  ast_file,
SourceManager &  s_manager,
ASTContext &  context 
)
inline

Definition at line 58 of file UdfCompiler.cpp.

61  : ast_file_(ast_file), source_manager_(s_manager), context_(context) {
62  source_manager_.getDiagnostics().setShowColors(false);
63  }

Member Function Documentation

std::string anonymous_namespace{UdfCompiler.cpp}::FunctionDeclVisitor::getFuncDeclFileName ( FunctionDecl *  f) const
inlineprivate

Definition at line 88 of file UdfCompiler.cpp.

88  {
89  SourceLocation spell_loc = source_manager_.getSpellingLoc(f->getLocation());
90  PresumedLoc p_loc = source_manager_.getPresumedLoc(spell_loc);
91 
92  return std::string(p_loc.getFilename());
93  }
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)
std::string anonymous_namespace{UdfCompiler.cpp}::FunctionDeclVisitor::getMainFileName ( ) const
inlineprivate

Definition at line 83 of file UdfCompiler.cpp.

83  {
84  auto f_entry = source_manager_.getFileEntryForID(source_manager_.getMainFileID());
85  return f_entry->getName().str();
86  }
bool anonymous_namespace{UdfCompiler.cpp}::FunctionDeclVisitor::VisitFunctionDecl ( FunctionDecl *  f)
inline

Definition at line 65 of file UdfCompiler.cpp.

65  {
66  // Only function definitions (with bodies), not declarations.
67  if (f->hasBody()) {
69  auto printing_policy = context_.getPrintingPolicy();
70  printing_policy.FullyQualifiedName = 1;
71  printing_policy.UseVoidForZeroParams = 1;
72  printing_policy.PolishForDeclaration = 1;
73  printing_policy.TerseOutput = 1;
74  f->print(ast_file_, printing_policy);
75  ast_file_ << "\n";
76  }
77  }
78 
79  return true;
80  }
std::string getFuncDeclFileName(FunctionDecl *f) const
Definition: UdfCompiler.cpp:88
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)

Member Data Documentation

llvm::raw_fd_ostream& anonymous_namespace{UdfCompiler.cpp}::FunctionDeclVisitor::ast_file_
private

Definition at line 96 of file UdfCompiler.cpp.

ASTContext& anonymous_namespace{UdfCompiler.cpp}::FunctionDeclVisitor::context_
private

Definition at line 98 of file UdfCompiler.cpp.

SourceManager& anonymous_namespace{UdfCompiler.cpp}::FunctionDeclVisitor::source_manager_
private

Definition at line 97 of file UdfCompiler.cpp.


The documentation for this class was generated from the following file: