blob: 2d200fb755c16f150fc0dac0fc357c978a51650f [file] [log] [blame]
Ted Kremeneka43df952012-09-21 00:09:11 +00001//== BodyFarm.h - Factory for conjuring up fake bodies -------------*- 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// BodyFarm is a factory for creating faux implementations for functions/methods
11// for analysis purposes.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_ANALYSIS_BODYFARM_H
16#define LLVM_CLANG_ANALYSIS_BODYFARM_H
17
David Blaikiedc84cd52013-02-20 22:23:23 +000018#include "clang/Basic/LLVM.h"
Ted Kremeneka43df952012-09-21 00:09:11 +000019#include "llvm/ADT/DenseMap.h"
Chandler Carruth55fc8732012-12-04 09:13:33 +000020#include "llvm/ADT/Optional.h"
Ted Kremeneka43df952012-09-21 00:09:11 +000021
22namespace clang {
23
24class ASTContext;
25class Decl;
26class FunctionDecl;
Stephen Hines651f13c2014-04-23 16:59:28 -070027class ObjCMethodDecl;
28class ObjCPropertyDecl;
Ted Kremeneka43df952012-09-21 00:09:11 +000029class Stmt;
30
31class BodyFarm {
32public:
33 BodyFarm(ASTContext &C) : C(C) {}
34
35 /// Factory method for creating bodies for ordinary functions.
36 Stmt *getBody(const FunctionDecl *D);
Stephen Hines651f13c2014-04-23 16:59:28 -070037
38 /// Factory method for creating bodies for Objective-C properties.
39 Stmt *getBody(const ObjCMethodDecl *D);
40
Ted Kremeneka43df952012-09-21 00:09:11 +000041private:
David Blaikiedc84cd52013-02-20 22:23:23 +000042 typedef llvm::DenseMap<const Decl *, Optional<Stmt *> > BodyMap;
Ted Kremeneka43df952012-09-21 00:09:11 +000043
44 ASTContext &C;
45 BodyMap Bodies;
46};
47}
48
49#endif