Change EnumDecl to store its corresponding integer type 
directly in it.  Remove TargetInfo::getEnumPolicy, as there is only
one policy that we support right now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41548 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/ASTContext.cpp b/AST/ASTContext.cpp
index bc73748..a68ebb5 100644
--- a/AST/ASTContext.cpp
+++ b/AST/ASTContext.cpp
@@ -233,7 +233,7 @@
       Size = Layout.getSize();
       Align = Layout.getAlignment();
     } else if (EnumDecl *ED = dyn_cast<EnumDecl>(TT->getDecl())) {
-      return getTypeInfo(getEnumDeclIntegerType(ED), L);
+      return getTypeInfo(ED->getIntegerType(), L);
     } else {
       assert(0 && "Unimplemented type sizes!");
     }
@@ -312,23 +312,6 @@
   return *NewEntry;
 }
 
-/// getEnumDeclIntegerType - returns the integer type compatible with the
-/// given enum type.
-QualType ASTContext::getEnumDeclIntegerType(const EnumDecl *ED) const {
-  if (const EnumConstantDecl *C = ED->getEnumConstantList())
-    return C->getType();
-
-  // If the enum list is empty, it is typed as if it contained a single zero 
-  // element [C++ dcl.enum] and is illegal in C (as an extension, we treat it 
-  // the same as C++ does).
-  switch (Target.getEnumTypePolicy(ED->getLocation())) {
-  default: assert(0 && "Unknown enum layout policy");
-  case TargetInfo::AlwaysInt:    return UnsignedIntTy;   // 0 -> unsigned
-  case TargetInfo::ShortestType: return UnsignedCharTy;  // 0 -> unsigned char
-  }
-}
-
-
 //===----------------------------------------------------------------------===//
 //                   Type creation/memoization methods
 //===----------------------------------------------------------------------===//