2012-09-21 08:09:11 +08:00
|
|
|
//== BodyFarm.h - Factory for conjuring up fake bodies -------------*- C++ -*-//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// BodyFarm is a factory for creating faux implementations for functions/methods
|
|
|
|
// for analysis purposes.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CLANG_ANALYSIS_BODYFARM_H
|
|
|
|
#define LLVM_CLANG_ANALYSIS_BODYFARM_H
|
|
|
|
|
2013-02-21 06:23:23 +08:00
|
|
|
#include "clang/Basic/LLVM.h"
|
2012-09-21 08:09:11 +08:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2012-12-04 17:13:33 +08:00
|
|
|
#include "llvm/ADT/Optional.h"
|
2012-09-21 08:09:11 +08:00
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
|
|
|
|
class ASTContext;
|
|
|
|
class Decl;
|
|
|
|
class FunctionDecl;
|
2014-01-11 04:06:06 +08:00
|
|
|
class ObjCMethodDecl;
|
|
|
|
class ObjCPropertyDecl;
|
2012-09-21 08:09:11 +08:00
|
|
|
class Stmt;
|
|
|
|
|
|
|
|
class BodyFarm {
|
|
|
|
public:
|
|
|
|
BodyFarm(ASTContext &C) : C(C) {}
|
|
|
|
|
|
|
|
/// Factory method for creating bodies for ordinary functions.
|
|
|
|
Stmt *getBody(const FunctionDecl *D);
|
2014-01-11 04:06:06 +08:00
|
|
|
|
|
|
|
/// Factory method for creating bodies for Objective-C properties.
|
2014-01-23 11:59:10 +08:00
|
|
|
Stmt *getBody(const ObjCMethodDecl *D);
|
2014-01-11 04:06:06 +08:00
|
|
|
|
2012-09-21 08:09:11 +08:00
|
|
|
private:
|
2013-02-21 06:23:23 +08:00
|
|
|
typedef llvm::DenseMap<const Decl *, Optional<Stmt *> > BodyMap;
|
2012-09-21 08:09:11 +08:00
|
|
|
|
|
|
|
ASTContext &C;
|
|
|
|
BodyMap Bodies;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|