| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#ifndef REPLACE_UNDEFINED_FUNCTION_H |
| 12 |
#define REPLACE_UNDEFINED_FUNCTION_H |
| 13 |
|
| 14 |
#include <string> |
| 15 |
#include "llvm/ADT/MapVector.h" |
| 16 |
#include "llvm/ADT/SetVector.h" |
| 17 |
#include "Transformation.h" |
| 18 |
|
| 19 |
namespace clang { |
| 20 |
class DeclGroupRef; |
| 21 |
class ASTContext; |
| 22 |
class FunctionDecl; |
| 23 |
} |
| 24 |
|
| 25 |
class ReplaceUndefFuncCollectionVisitor; |
| 26 |
class ReplaceUndefFuncRewriteVisitor; |
| 27 |
|
| 28 |
class ReplaceUndefinedFunction : public Transformation { |
| 29 |
friend class ReplaceUndefFuncCollectionVisitor; |
| 30 |
friend class ReplaceUndefFuncRewriteVisitor; |
| 31 |
|
| 32 |
public: |
| 33 |
|
| 34 |
ReplaceUndefinedFunction(const char *TransName, const char *Desc) |
| 35 |
: Transformation(TransName, Desc), |
| 36 |
CollectionVisitor(NULL), |
| 37 |
RewriteVisitor(NULL), |
| 38 |
ReplacingFunctionDecl(NULL), |
| 39 |
ReplacedFunctionDecl(NULL) |
| 40 |
{ } |
| 41 |
|
| 42 |
~ReplaceUndefinedFunction(void); |
| 43 |
|
| 44 |
private: |
| 45 |
|
| 46 |
typedef llvm::SetVector<const clang::FunctionDecl *> |
| 47 |
FunctionDeclSet; |
| 48 |
|
| 49 |
typedef llvm::MapVector<const clang::FunctionDecl *, FunctionDeclSet *> |
| 50 |
FunctionSetMap; |
| 51 |
|
| 52 |
virtual void Initialize(clang::ASTContext &context); |
| 53 |
|
| 54 |
virtual void HandleTranslationUnit(clang::ASTContext &Ctx); |
| 55 |
|
| 56 |
void handleOneFunctionDecl(const clang::FunctionDecl *FD); |
| 57 |
|
| 58 |
void doAnalysis(void); |
| 59 |
|
| 60 |
FunctionSetMap ReplaceableFunctions; |
| 61 |
|
| 62 |
ReplaceUndefFuncCollectionVisitor *CollectionVisitor; |
| 63 |
|
| 64 |
ReplaceUndefFuncRewriteVisitor *RewriteVisitor; |
| 65 |
|
| 66 |
const clang::FunctionDecl *ReplacingFunctionDecl; |
| 67 |
|
| 68 |
const clang::FunctionDecl *ReplacedFunctionDecl; |
| 69 |
|
| 70 |
|
| 71 |
ReplaceUndefinedFunction(void); |
| 72 |
|
| 73 |
ReplaceUndefinedFunction(const ReplaceUndefinedFunction &); |
| 74 |
|
| 75 |
void operator=(const ReplaceUndefinedFunction &); |
| 76 |
}; |
| 77 |
#endif |
| 78 |
|