OmniSciDB  8a228a1076
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 49 of file UDFCompiler.cpp.

Constructor & Destructor Documentation

◆ FunctionDeclVisitor()

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

Definition at line 51 of file UDFCompiler.cpp.

54  : ast_file_(ast_file), source_manager_(s_manager), context_(context) {
55  source_manager_.getDiagnostics().setShowColors(false);
56  }

Member Function Documentation

◆ getFuncDeclFileName()

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

Definition at line 81 of file UDFCompiler.cpp.

81  {
82  SourceLocation spell_loc = source_manager_.getSpellingLoc(f->getLocation());
83  PresumedLoc p_loc = source_manager_.getPresumedLoc(spell_loc);
84 
85  return std::string(p_loc.getFilename());
86  }

◆ getMainFileName()

std::string anonymous_namespace{UDFCompiler.cpp}::FunctionDeclVisitor::getMainFileName ( ) const
inlineprivate

Definition at line 76 of file UDFCompiler.cpp.

76  {
77  auto f_entry = source_manager_.getFileEntryForID(source_manager_.getMainFileID());
78  return f_entry->getName().str();
79  }

◆ VisitFunctionDecl()

bool anonymous_namespace{UDFCompiler.cpp}::FunctionDeclVisitor::VisitFunctionDecl ( FunctionDecl *  f)
inline

Definition at line 58 of file UDFCompiler.cpp.

58  {
59  // Only function definitions (with bodies), not declarations.
60  if (f->hasBody()) {
62  auto printing_policy = context_.getPrintingPolicy();
63  printing_policy.FullyQualifiedName = 1;
64  printing_policy.UseVoidForZeroParams = 1;
65  printing_policy.PolishForDeclaration = 1;
66  printing_policy.TerseOutput = 1;
67  f->print(ast_file_, printing_policy);
68  ast_file_ << "\n";
69  }
70  }
71 
72  return true;
73  }
std::string getFuncDeclFileName(FunctionDecl *f) const
Definition: UDFCompiler.cpp:81

Member Data Documentation

◆ ast_file_

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

Definition at line 89 of file UDFCompiler.cpp.

◆ context_

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

Definition at line 91 of file UDFCompiler.cpp.

◆ source_manager_

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

Definition at line 90 of file UDFCompiler.cpp.


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