Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 pmbaty 1
//== BodyFarm.h - Factory for conjuring up fake bodies -------------*- C++ -*-//
2
//
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
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// BodyFarm is a factory for creating faux implementations for functions/methods
10
// for analysis purposes.
11
//
12
//===----------------------------------------------------------------------===//
13
 
14
#ifndef LLVM_CLANG_ANALYSIS_BODYFARM_H
15
#define LLVM_CLANG_ANALYSIS_BODYFARM_H
16
 
17
#include "clang/AST/DeclBase.h"
18
#include "clang/Basic/LLVM.h"
19
#include "llvm/ADT/DenseMap.h"
20
#include <optional>
21
 
22
namespace clang {
23
 
24
class ASTContext;
25
class FunctionDecl;
26
class ObjCMethodDecl;
27
class Stmt;
28
class CodeInjector;
29
 
30
class BodyFarm {
31
public:
32
  BodyFarm(ASTContext &C, CodeInjector *injector) : C(C), Injector(injector) {}
33
 
34
  /// Factory method for creating bodies for ordinary functions.
35
  Stmt *getBody(const FunctionDecl *D);
36
 
37
  /// Factory method for creating bodies for Objective-C properties.
38
  Stmt *getBody(const ObjCMethodDecl *D);
39
 
40
  /// Remove copy constructor to avoid accidental copying.
41
  BodyFarm(const BodyFarm &other) = delete;
42
 
43
private:
44
  typedef llvm::DenseMap<const Decl *, std::optional<Stmt *>> BodyMap;
45
 
46
  ASTContext &C;
47
  BodyMap Bodies;
48
  CodeInjector *Injector;
49
};
50
} // namespace clang
51
 
52
#endif