1 //===-- CodeInjector.h ------------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 /// 10 /// \file 11 /// \brief Defines the clang::CodeInjector interface which is responsible for 12 /// injecting AST of function definitions that may not be available in the 13 /// original source. 14 /// 15 //===----------------------------------------------------------------------===// 16 17 #ifndef LLVM_CLANG_ANALYSIS_CODEINJECTOR_H 18 #define LLVM_CLANG_ANALYSIS_CODEINJECTOR_H 19 20 namespace clang { 21 22 class Stmt; 23 class FunctionDecl; 24 class ObjCMethodDecl; 25 26 /// \brief CodeInjector is an interface which is responsible for injecting AST 27 /// of function definitions that may not be available in the original source. 28 /// 29 /// The getBody function will be called each time the static analyzer examines a 30 /// function call that has no definition available in the current translation 31 /// unit. If the returned statement is not a null pointer, it is assumed to be 32 /// the body of a function which will be used for the analysis. The source of 33 /// the body can be arbitrary, but it is advised to use memoization to avoid 34 /// unnecessary reparsing of the external source that provides the body of the 35 /// functions. 36 class CodeInjector { 37 public: 38 CodeInjector(); 39 virtual ~CodeInjector(); 40 41 virtual Stmt *getBody(const FunctionDecl *D) = 0; 42 virtual Stmt *getBody(const ObjCMethodDecl *D) = 0; 43 }; 44 } 45 46 #endif 47