BodyFarm.h revision dc84cd5efdd3430efb22546b4ac656aa0540b210
1//== 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
18#include "clang/Basic/LLVM.h"
19#include "llvm/ADT/DenseMap.h"
20#include "llvm/ADT/Optional.h"
21
22namespace clang {
23
24class ASTContext;
25class Decl;
26class FunctionDecl;
27class Stmt;
28
29class BodyFarm {
30public:
31  BodyFarm(ASTContext &C) : C(C) {}
32
33  /// Factory method for creating bodies for ordinary functions.
34  Stmt *getBody(const FunctionDecl *D);
35
36private:
37  typedef llvm::DenseMap<const Decl *, Optional<Stmt *> > BodyMap;
38
39  ASTContext &C;
40  BodyMap Bodies;
41};
42}
43
44#endif
45