| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#ifndef COMBINE_GLOBAL_VAR_DECL_H |
| 12 |
#define COMBINE_GLOBAL_VAR_DECL_H |
| 13 |
|
| 14 |
#include <string> |
| 15 |
#include <vector> |
| 16 |
#include "llvm/ADT/SmallVector.h" |
| 17 |
#include "llvm/ADT/DenseMap.h" |
| 18 |
#include "Transformation.h" |
| 19 |
|
| 20 |
namespace clang { |
| 21 |
class DeclGroupRef; |
| 22 |
class ASTContext; |
| 23 |
class Type; |
| 24 |
} |
| 25 |
|
| 26 |
class CombineGlobalVarDecl : public Transformation { |
| 27 |
public: |
| 28 |
|
| 29 |
CombineGlobalVarDecl(const char *TransName, const char *Desc) |
| 30 |
: Transformation(TransName, Desc) |
| 31 |
{ } |
| 32 |
|
| 33 |
~CombineGlobalVarDecl(void); |
| 34 |
|
| 35 |
private: |
| 36 |
|
| 37 |
typedef llvm::SmallVector<void *, 20> DeclGroupVector; |
| 38 |
|
| 39 |
typedef llvm::DenseMap<const clang::Type *, DeclGroupVector *> TypeToDeclMap; |
| 40 |
|
| 41 |
virtual void Initialize(clang::ASTContext &context); |
| 42 |
|
| 43 |
virtual bool HandleTopLevelDecl(clang::DeclGroupRef D); |
| 44 |
|
| 45 |
virtual void HandleTranslationUnit(clang::ASTContext &Ctx); |
| 46 |
|
| 47 |
void doCombination(); |
| 48 |
|
| 49 |
TypeToDeclMap AllDeclGroups; |
| 50 |
|
| 51 |
llvm::SmallVector<void *, 2> TheDeclGroupRefs; |
| 52 |
|
| 53 |
|
| 54 |
CombineGlobalVarDecl(void); |
| 55 |
|
| 56 |
CombineGlobalVarDecl(const CombineGlobalVarDecl &); |
| 57 |
|
| 58 |
void operator=(const CombineGlobalVarDecl &); |
| 59 |
}; |
| 60 |
#endif |