clang API Documentation

CodeInjector.h
Go to the documentation of this file.
00001 //===-- CodeInjector.h ------------------------------------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 ///
00010 /// \file
00011 /// \brief Defines the clang::CodeInjector interface which is responsible for
00012 /// injecting AST of function definitions that may not be available in the
00013 /// original source.
00014 ///
00015 //===----------------------------------------------------------------------===//
00016 
00017 #ifndef LLVM_CLANG_ANALYSIS_CODEINJECTOR_H
00018 #define LLVM_CLANG_ANALYSIS_CODEINJECTOR_H
00019 
00020 namespace clang {
00021 
00022 class Stmt;
00023 class FunctionDecl;
00024 class ObjCMethodDecl;
00025 
00026 /// \brief CodeInjector is an interface which is responsible for injecting AST
00027 /// of function definitions that may not be available in the original source.
00028 ///
00029 /// The getBody function will be called each time the static analyzer examines a
00030 /// function call that has no definition available in the current translation
00031 /// unit. If the returned statement is not a null pointer, it is assumed to be
00032 /// the body of a function which will be used for the analysis. The source of
00033 /// the body can be arbitrary, but it is advised to use memoization to avoid
00034 /// unnecessary reparsing of the external source that provides the body of the
00035 /// functions.
00036 class CodeInjector {
00037 public:
00038   CodeInjector();
00039   virtual ~CodeInjector();
00040 
00041   virtual Stmt *getBody(const FunctionDecl *D) = 0;
00042   virtual Stmt *getBody(const ObjCMethodDecl *D) = 0;
00043 };
00044 }
00045 
00046 #endif