1 //===----------------------------------------------------------------------===// 2 // 3 // Copyright (c) 2012 The University of Utah 4 // All rights reserved. 5 // 6 // This file is distributed under the University of Illinois Open Source 7 // License. See the file COPYING for details. 8 // 9 //===----------------------------------------------------------------------===// 10 11 #ifndef UNIFY_FUNCTION_DECL_H 12 #define UNIFY_FUNCTION_DECL_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 } 23 24 class UnifyFunctionDecl : public Transformation { 25 26 public: 27 UnifyFunctionDecl(const char * TransName,const char * Desc)28 UnifyFunctionDecl(const char *TransName, const char *Desc) 29 : Transformation(TransName, Desc), 30 TheFunctionDecl(NULL), 31 TheFunctionDef(NULL) 32 { } 33 34 ~UnifyFunctionDecl(void); 35 36 private: 37 38 typedef llvm::SmallPtrSet<const clang::FunctionDecl *, 10> 39 FunctionDeclSet; 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 doAnalysis(void); 48 49 void doRewriting(void); 50 51 bool hasStaticKeyword(const clang::FunctionDecl *FD); 52 53 FunctionDeclSet VisitedFunctionDecls; 54 55 const clang::FunctionDecl *TheFunctionDecl; 56 57 const clang::FunctionDecl *TheFunctionDef; 58 59 // Unimplemented 60 UnifyFunctionDecl(void); 61 62 UnifyFunctionDecl(const UnifyFunctionDecl &); 63 64 void operator=(const UnifyFunctionDecl &); 65 }; 66 #endif 67