Ted Kremenek | a43df95 | 2012-09-21 00:09:11 +0000 | [diff] [blame] | 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 | |
David Blaikie | dc84cd5 | 2013-02-20 22:23:23 +0000 | [diff] [blame] | 18 | #include "clang/Basic/LLVM.h" |
Ted Kremenek | a43df95 | 2012-09-21 00:09:11 +0000 | [diff] [blame] | 19 | #include "llvm/ADT/DenseMap.h" |
Chandler Carruth | 55fc873 | 2012-12-04 09:13:33 +0000 | [diff] [blame] | 20 | #include "llvm/ADT/Optional.h" |
Ted Kremenek | a43df95 | 2012-09-21 00:09:11 +0000 | [diff] [blame] | 21 | |
| 22 | namespace clang { |
| 23 | |
| 24 | class ASTContext; |
| 25 | class Decl; |
| 26 | class FunctionDecl; |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame^] | 27 | class ObjCMethodDecl; |
| 28 | class ObjCPropertyDecl; |
Ted Kremenek | a43df95 | 2012-09-21 00:09:11 +0000 | [diff] [blame] | 29 | class Stmt; |
| 30 | |
| 31 | class BodyFarm { |
| 32 | public: |
| 33 | BodyFarm(ASTContext &C) : C(C) {} |
| 34 | |
| 35 | /// Factory method for creating bodies for ordinary functions. |
| 36 | Stmt *getBody(const FunctionDecl *D); |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame^] | 37 | |
| 38 | /// Factory method for creating bodies for Objective-C properties. |
| 39 | Stmt *getBody(const ObjCMethodDecl *D); |
| 40 | |
Ted Kremenek | a43df95 | 2012-09-21 00:09:11 +0000 | [diff] [blame] | 41 | private: |
David Blaikie | dc84cd5 | 2013-02-20 22:23:23 +0000 | [diff] [blame] | 42 | typedef llvm::DenseMap<const Decl *, Optional<Stmt *> > BodyMap; |
Ted Kremenek | a43df95 | 2012-09-21 00:09:11 +0000 | [diff] [blame] | 43 | |
| 44 | ASTContext &C; |
| 45 | BodyMap Bodies; |
| 46 | }; |
| 47 | } |
| 48 | |
| 49 | #endif |