blob: 72752aa9af57dc2ea0f2209e88f528be5217377f [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
Ted Kremeneka43df952012-09-21 00:09:11 +000018#include "llvm/ADT/DenseMap.h"
Chandler Carruth55fc8732012-12-04 09:13:33 +000019#include "llvm/ADT/Optional.h"
Ted Kremeneka43df952012-09-21 00:09:11 +000020
21namespace clang {
22
23class ASTContext;
24class Decl;
25class FunctionDecl;
26class Stmt;
27
28class BodyFarm {
29public:
30 BodyFarm(ASTContext &C) : C(C) {}
31
32 /// Factory method for creating bodies for ordinary functions.
33 Stmt *getBody(const FunctionDecl *D);
34
35private:
36 typedef llvm::DenseMap<const Decl *, llvm::Optional<Stmt *> > BodyMap;
37
38 ASTContext &C;
39 BodyMap Bodies;
40};
41}
42
43#endif