Polly 22.0.0git
extract_interface.cc File Reference
#include "isl_config.h"
#include <assert.h>
#include <iostream>
#include <stdlib.h>
#include <memory>
#include <llvm/Support/raw_ostream.h>
#include <llvm/Support/CommandLine.h>
#include <llvm/Support/ManagedStatic.h>
#include <llvm/TargetParser/Host.h>
#include <clang/AST/ASTContext.h>
#include <clang/AST/ASTConsumer.h>
#include <clang/Basic/Builtins.h>
#include <clang/Basic/FileSystemOptions.h>
#include <clang/Basic/FileManager.h>
#include <clang/Basic/TargetOptions.h>
#include <clang/Basic/TargetInfo.h>
#include <clang/Basic/Version.h>
#include <clang/Driver/Compilation.h>
#include <clang/Driver/Driver.h>
#include <clang/Driver/Tool.h>
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/CompilerInvocation.h>
#include <clang/Frontend/DiagnosticOptions.h>
#include <clang/Frontend/TextDiagnosticPrinter.h>
#include <clang/Frontend/Utils.h>
#include <clang/Lex/HeaderSearch.h>
#include <clang/Frontend/PreprocessorOptions.h>
#include <clang/Lex/Preprocessor.h>
#include <clang/Parse/ParseAST.h>
#include <clang/Sema/Sema.h>
#include "extract_interface.h"
#include "generator.h"
#include "python.h"
#include "plain_cpp.h"
#include "cpp_conversion.h"
#include "template_cpp.h"

Go to the source code of this file.

Classes

struct  MyASTConsumer

Functions

static llvm::cl::opt< string > InputFilename (llvm::cl::Positional, llvm::cl::Required, llvm::cl::desc("<input file>"))
static llvm::cl::list< string > Includes ("I", llvm::cl::desc("Header search path"), llvm::cl::value_desc("path"), llvm::cl::Prefix)
static llvm::cl::opt< string > OutputLanguage (llvm::cl::Required, llvm::cl::ValueRequired, "language", llvm::cl::desc("Bindings to generate"), llvm::cl::value_desc("name"))
bool has_annotation (Decl *decl, const char *name)
static bool is_exported (Decl *decl)
static CompilerInvocation * construct_invocation (const char *filename, DiagnosticsEngine &Diags)
static TextDiagnosticPrinter * construct_printer (void)
static TargetInfo * create_target_info (CompilerInstance *Clang, DiagnosticsEngine &Diags)
static void create_diagnostics (CompilerInstance *Clang)
static void create_preprocessor (CompilerInstance *Clang)
void add_path (HeaderSearchOptions &HSO, string Path)
static void create_main_file_id (SourceManager &SM, const FileEntry *file)
static void set_lang_defaults (CompilerInstance *Clang)
static void set_invocation (CompilerInstance *Clang, CompilerInvocation *invocation)
template<class T>
static const FileEntry * ignore_error_helper (const T obj, int, int[1][sizeof(obj.getError())])
template<class T>
static const FileEntry * ignore_error_helper (const T obj, long, void *)
template<class T>
static const FileEntry * ignore_error (const T obj)
static const FileEntry * getFile (CompilerInstance *Clang, std::string Filename)
static void generate (MyASTConsumer &consumer, SourceManager &SM)
int main (int argc, char *argv[])

Variables

static const char * ResourceDir

Function Documentation

◆ add_path()

void add_path ( HeaderSearchOptions & HSO,
string Path )

Definition at line 398 of file extract_interface.cc.

Referenced by main().

◆ construct_invocation()

CompilerInvocation * construct_invocation ( const char * filename,
DiagnosticsEngine & Diags )
static

Definition at line 292 of file extract_interface.cc.

Referenced by main().

◆ construct_printer()

TextDiagnosticPrinter * construct_printer ( void )
static

Definition at line 309 of file extract_interface.cc.

Referenced by create_diagnostics().

◆ create_diagnostics()

void create_diagnostics ( CompilerInstance * Clang)
static

Definition at line 358 of file extract_interface.cc.

References construct_printer().

Referenced by main().

◆ create_main_file_id()

void create_main_file_id ( SourceManager & SM,
const FileEntry * file )
static

Definition at line 415 of file extract_interface.cc.

Referenced by main().

◆ create_preprocessor()

void create_preprocessor ( CompilerInstance * Clang)
static

Definition at line 374 of file extract_interface.cc.

Referenced by main().

◆ create_target_info()

TargetInfo * create_target_info ( CompilerInstance * Clang,
DiagnosticsEngine & Diags )
static

Definition at line 339 of file extract_interface.cc.

Referenced by main().

◆ generate()

void generate ( MyASTConsumer & consumer,
SourceManager & SM )
static

◆ getFile()

const FileEntry * getFile ( CompilerInstance * Clang,
std::string Filename )
static

Definition at line 497 of file extract_interface.cc.

References ignore_error().

Referenced by main().

◆ has_annotation()

bool has_annotation ( Decl * decl,
const char * name )

◆ ignore_error()

template<class T>
const FileEntry * ignore_error ( const T obj)
static

Definition at line 489 of file extract_interface.cc.

References ignore_error_helper(), and obj.

Referenced by getFile().

◆ ignore_error_helper() [1/2]

template<class T>
const FileEntry * ignore_error_helper ( const T obj,
int ,
int [1][sizeof(obj.getError())] )
static

Definition at line 469 of file extract_interface.cc.

References obj.

Referenced by ignore_error().

◆ ignore_error_helper() [2/2]

template<class T>
const FileEntry * ignore_error_helper ( const T obj,
long ,
void *  )
static

Definition at line 480 of file extract_interface.cc.

References obj.

◆ Includes()

llvm::cl::list< string > Includes ( "I" ,
llvm::cl::desc("Header search path") ,
llvm::cl::value_desc("path") ,
llvm::cl::Prefix  )
static

Referenced by main().

◆ InputFilename()

llvm::cl::opt< string > InputFilename ( llvm::cl::Positional ,
llvm::cl::Required ,
llvm::cl::desc("<input file>")  )
static

Referenced by main().

◆ is_exported()

bool is_exported ( Decl * decl)
static

Definition at line 137 of file extract_interface.cc.

References has_annotation().

Referenced by MyASTConsumer::HandleTopLevelDecl().

◆ main()

◆ OutputLanguage()

llvm::cl::opt< string > OutputLanguage ( llvm::cl::Required ,
llvm::cl::ValueRequired ,
"language" ,
llvm::cl::desc("Bindings to generate") ,
llvm::cl::value_desc("name")  )
static

Referenced by generate().

◆ set_invocation()

void set_invocation ( CompilerInstance * Clang,
CompilerInvocation * invocation )
static

Definition at line 456 of file extract_interface.cc.

Referenced by main().

◆ set_lang_defaults()

void set_lang_defaults ( CompilerInstance * Clang)
static

Definition at line 438 of file extract_interface.cc.

Referenced by main().

Variable Documentation

◆ ResourceDir

const char* ResourceDir
static
Initial value:
=
CLANG_PREFIX "/lib/clang/" CLANG_VERSION_STRING

Definition at line 111 of file extract_interface.cc.

Referenced by main().