From 764d0c23724b3671dcbe20af152fa1ad45f45e15 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Fri, 13 Nov 2009 04:25:07 +0000 Subject: Move GlobalDecl to its own file. Also add DenseMapInfo traits. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87081 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.h | 40 +--------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) (limited to 'lib/CodeGen/CodeGenModule.h') diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index c2c38e8932..44d24337df 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -23,6 +23,7 @@ #include "CGCXX.h" #include "CGVtable.h" #include "CodeGenTypes.h" +#include "GlobalDecl.h" #include "Mangle.h" #include "llvm/Module.h" #include "llvm/ADT/DenseMap.h" @@ -70,46 +71,7 @@ namespace CodeGen { class CGDebugInfo; class CGObjCRuntime; -/// GlobalDecl - represents a global declaration. This can either be a -/// CXXConstructorDecl and the constructor type (Base, Complete). -/// a CXXDestructorDecl and the destructor type (Base, Complete) or -/// a VarDecl, a FunctionDecl or a BlockDecl. -class GlobalDecl { - llvm::PointerIntPair Value; - - void Init(const Decl *D) { - assert(!isa(D) && "Use other ctor with ctor decls!"); - assert(!isa(D) && "Use other ctor with dtor decls!"); - - Value.setPointer(D); - } -public: - GlobalDecl() {} - - GlobalDecl(const VarDecl *D) { Init(D);} - GlobalDecl(const FunctionDecl *D) { Init(D); } - GlobalDecl(const BlockDecl *D) { Init(D); } - GlobalDecl(const ObjCMethodDecl *D) { Init(D); } - - GlobalDecl(const CXXConstructorDecl *D, CXXCtorType Type) - : Value(D, Type) {} - GlobalDecl(const CXXDestructorDecl *D, CXXDtorType Type) - : Value(D, Type) {} - - const Decl *getDecl() const { return Value.getPointer(); } - - CXXCtorType getCtorType() const { - assert(isa(getDecl()) && "Decl is not a ctor!"); - return static_cast(Value.getInt()); - } - - CXXDtorType getDtorType() const { - assert(isa(getDecl()) && "Decl is not a dtor!"); - return static_cast(Value.getInt()); - } -}; - /// CodeGenModule - This class organizes the cross-function state that is used /// while generating LLVM code. class CodeGenModule : public BlockModule { -- cgit v1.2.3-18-g5258