| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#ifndef LOCAL_TO_GLOBAL_H |
| 12 |
#define LOCAL_TO_GLOBAL_H |
| 13 |
|
| 14 |
#include <string> |
| 15 |
#include "llvm/ADT/SmallPtrSet.h" |
| 16 |
#include "Transformation.h" |
| 17 |
|
| 18 |
namespace clang { |
| 19 |
class DeclGroupRef; |
| 20 |
class ASTContext; |
| 21 |
class FunctionDecl; |
| 22 |
class ReturnStmt; |
| 23 |
class ParmVarDecl; |
| 24 |
} |
| 25 |
|
| 26 |
class LocalToGlobalFunctionVisitor; |
| 27 |
class LToGASTVisitor; |
| 28 |
class LocalToGlobalCollectionVisitor; |
| 29 |
|
| 30 |
class LocalToGlobal : public Transformation { |
| 31 |
friend class LocalToGlobalFunctionVisitor; |
| 32 |
friend class LToGASTVisitor; |
| 33 |
friend class LocalToGlobalCollectionVisitor; |
| 34 |
|
| 35 |
public: |
| 36 |
|
| 37 |
LocalToGlobal(const char *TransName, const char *Desc) |
| 38 |
: Transformation(TransName, Desc), |
| 39 |
FunctionVisitor(NULL), |
| 40 |
LocalVarCollectionVisitor(NULL), |
| 41 |
TransformationASTVisitor(NULL), |
| 42 |
TheFuncDecl(NULL), |
| 43 |
TheVarDecl(NULL), |
| 44 |
TheNewDeclName("") |
| 45 |
{ } |
| 46 |
|
| 47 |
~LocalToGlobal(void); |
| 48 |
|
| 49 |
private: |
| 50 |
|
| 51 |
virtual void Initialize(clang::ASTContext &context); |
| 52 |
|
| 53 |
virtual void HandleTranslationUnit(clang::ASTContext &Ctx); |
| 54 |
|
| 55 |
void setNewName(clang::FunctionDecl *FD, const clang::VarDecl *VD); |
| 56 |
|
| 57 |
std::string getNewName(void) { |
| 58 |
return TheNewDeclName; |
| 59 |
} |
| 60 |
|
| 61 |
llvm::SmallPtrSet<const clang::VarDecl *, 10> SkippedVars; |
| 62 |
|
| 63 |
LocalToGlobalFunctionVisitor *FunctionVisitor; |
| 64 |
|
| 65 |
LocalToGlobalCollectionVisitor *LocalVarCollectionVisitor; |
| 66 |
|
| 67 |
LToGASTVisitor *TransformationASTVisitor; |
| 68 |
|
| 69 |
clang::FunctionDecl *TheFuncDecl; |
| 70 |
|
| 71 |
const clang::VarDecl *TheVarDecl; |
| 72 |
|
| 73 |
std::string TheNewDeclName; |
| 74 |
|
| 75 |
|
| 76 |
LocalToGlobal(void); |
| 77 |
|
| 78 |
LocalToGlobal(const LocalToGlobal &); |
| 79 |
|
| 80 |
void operator=(const LocalToGlobal &); |
| 81 |
}; |
| 82 |
#endif |