1 //== BodyFarm.h - Factory for conjuring up fake bodies -------------*- C++ -*-//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // BodyFarm is a factory for creating faux implementations for functions/methods
10 // for analysis purposes.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_LIB_ANALYSIS_BODYFARM_H
15 #define LLVM_CLANG_LIB_ANALYSIS_BODYFARM_H
17 #include "clang/AST/DeclBase.h"
18 #include "clang/Basic/LLVM.h"
19 #include "llvm/ADT/DenseMap.h"
20 #include "llvm/ADT/Optional.h"
27 class ObjCPropertyDecl;
33 BodyFarm(ASTContext &C, CodeInjector *injector) : C(C), Injector(injector) {}
35 /// Factory method for creating bodies for ordinary functions.
36 Stmt *getBody(const FunctionDecl *D);
38 /// Factory method for creating bodies for Objective-C properties.
39 Stmt *getBody(const ObjCMethodDecl *D);
41 /// Remove copy constructor to avoid accidental copying.
42 BodyFarm(const BodyFarm &other) = delete;
45 typedef llvm::DenseMap<const Decl *, Optional<Stmt *>> BodyMap;
49 CodeInjector *Injector;