Store this Decl* as a Decl* instead of a uintptr_t. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168145 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 16de280..a67e630 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -5550,7 +5550,7 @@
     NamedDecl *Template;
 
     /// \brief The entity that is being instantiated.
-    uintptr_t Entity;
+    Decl *Entity;
 
     /// \brief The list of template arguments we are substituting, if they
     /// are not part of the entity.
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 665dd07..426a74f 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -182,7 +182,7 @@
     ActiveTemplateInstantiation Inst;
     Inst.Kind = ActiveTemplateInstantiation::TemplateInstantiation;
     Inst.PointOfInstantiation = PointOfInstantiation;
-    Inst.Entity = reinterpret_cast<uintptr_t>(Entity);
+    Inst.Entity = Entity;
     Inst.TemplateArgs = 0;
     Inst.NumTemplateArgs = 0;
     Inst.InstantiationRange = InstantiationRange;
@@ -205,7 +205,7 @@
     ActiveTemplateInstantiation Inst;
     Inst.Kind = ActiveTemplateInstantiation::ExceptionSpecInstantiation;
     Inst.PointOfInstantiation = PointOfInstantiation;
-    Inst.Entity = reinterpret_cast<uintptr_t>(Entity);
+    Inst.Entity = Entity;
     Inst.TemplateArgs = 0;
     Inst.NumTemplateArgs = 0;
     Inst.InstantiationRange = InstantiationRange;
@@ -230,7 +230,7 @@
     Inst.Kind
       = ActiveTemplateInstantiation::DefaultTemplateArgumentInstantiation;
     Inst.PointOfInstantiation = PointOfInstantiation;
-    Inst.Entity = reinterpret_cast<uintptr_t>(Template);
+    Inst.Entity = Template;
     Inst.TemplateArgs = TemplateArgs.data();
     Inst.NumTemplateArgs = TemplateArgs.size();
     Inst.InstantiationRange = InstantiationRange;
@@ -255,7 +255,7 @@
     ActiveTemplateInstantiation Inst;
     Inst.Kind = Kind;
     Inst.PointOfInstantiation = PointOfInstantiation;
-    Inst.Entity = reinterpret_cast<uintptr_t>(FunctionTemplate);
+    Inst.Entity = FunctionTemplate;
     Inst.TemplateArgs = TemplateArgs.data();
     Inst.NumTemplateArgs = TemplateArgs.size();
     Inst.DeductionInfo = &DeductionInfo;
@@ -283,7 +283,7 @@
     ActiveTemplateInstantiation Inst;
     Inst.Kind = ActiveTemplateInstantiation::DeducedTemplateArgumentSubstitution;
     Inst.PointOfInstantiation = PointOfInstantiation;
-    Inst.Entity = reinterpret_cast<uintptr_t>(PartialSpec);
+    Inst.Entity = PartialSpec;
     Inst.TemplateArgs = TemplateArgs.data();
     Inst.NumTemplateArgs = TemplateArgs.size();
     Inst.DeductionInfo = &DeductionInfo;
@@ -308,7 +308,7 @@
     Inst.Kind
       = ActiveTemplateInstantiation::DefaultFunctionArgumentInstantiation;
     Inst.PointOfInstantiation = PointOfInstantiation;
-    Inst.Entity = reinterpret_cast<uintptr_t>(Param);
+    Inst.Entity = Param;
     Inst.TemplateArgs = TemplateArgs.data();
     Inst.NumTemplateArgs = TemplateArgs.size();
     Inst.InstantiationRange = InstantiationRange;
@@ -332,7 +332,7 @@
     Inst.Kind = ActiveTemplateInstantiation::PriorTemplateArgumentSubstitution;
     Inst.PointOfInstantiation = PointOfInstantiation;
     Inst.Template = Template;
-    Inst.Entity = reinterpret_cast<uintptr_t>(Param);
+    Inst.Entity = Param;
     Inst.TemplateArgs = TemplateArgs.data();
     Inst.NumTemplateArgs = TemplateArgs.size();
     Inst.InstantiationRange = InstantiationRange;
@@ -356,7 +356,7 @@
     Inst.Kind = ActiveTemplateInstantiation::PriorTemplateArgumentSubstitution;
     Inst.PointOfInstantiation = PointOfInstantiation;
     Inst.Template = Template;
-    Inst.Entity = reinterpret_cast<uintptr_t>(Param);
+    Inst.Entity = Param;
     Inst.TemplateArgs = TemplateArgs.data();
     Inst.NumTemplateArgs = TemplateArgs.size();
     Inst.InstantiationRange = InstantiationRange;
@@ -380,7 +380,7 @@
   Inst.Kind = ActiveTemplateInstantiation::DefaultTemplateArgumentChecking;
   Inst.PointOfInstantiation = PointOfInstantiation;
   Inst.Template = Template;
-  Inst.Entity = reinterpret_cast<uintptr_t>(Param);
+  Inst.Entity = Param;
   Inst.TemplateArgs = TemplateArgs.data();
   Inst.NumTemplateArgs = TemplateArgs.size();
   Inst.InstantiationRange = InstantiationRange;
@@ -454,7 +454,7 @@
 
     switch (Active->Kind) {
     case ActiveTemplateInstantiation::TemplateInstantiation: {
-      Decl *D = reinterpret_cast<Decl *>(Active->Entity);
+      Decl *D = Active->Entity;
       if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(D)) {
         unsigned DiagID = diag::note_template_member_class_here;
         if (isa<ClassTemplateSpecializationDecl>(Record))
@@ -491,7 +491,7 @@
     }
 
     case ActiveTemplateInstantiation::DefaultTemplateArgumentInstantiation: {
-      TemplateDecl *Template = cast<TemplateDecl>((Decl *)Active->Entity);
+      TemplateDecl *Template = cast<TemplateDecl>(Active->Entity);
       std::string TemplateArgsStr
         = TemplateSpecializationType::PrintTemplateArgumentList(
                                                          Active->TemplateArgs,
@@ -505,8 +505,7 @@
     }
 
     case ActiveTemplateInstantiation::ExplicitTemplateArgumentSubstitution: {
-      FunctionTemplateDecl *FnTmpl
-        = cast<FunctionTemplateDecl>((Decl *)Active->Entity);
+      FunctionTemplateDecl *FnTmpl = cast<FunctionTemplateDecl>(Active->Entity);
       Diags.Report(Active->PointOfInstantiation,
                    diag::note_explicit_template_arg_substitution_here)
         << FnTmpl 
@@ -518,9 +517,8 @@
     }
 
     case ActiveTemplateInstantiation::DeducedTemplateArgumentSubstitution:
-      if (ClassTemplatePartialSpecializationDecl *PartialSpec
-            = dyn_cast<ClassTemplatePartialSpecializationDecl>(
-                                                    (Decl *)Active->Entity)) {
+      if (ClassTemplatePartialSpecializationDecl *PartialSpec =
+            dyn_cast<ClassTemplatePartialSpecializationDecl>(Active->Entity)) {
         Diags.Report(Active->PointOfInstantiation,
                      diag::note_partial_spec_deduct_instantiation_here)
           << Context.getTypeDeclType(PartialSpec)
@@ -531,7 +529,7 @@
           << Active->InstantiationRange;
       } else {
         FunctionTemplateDecl *FnTmpl
-          = cast<FunctionTemplateDecl>((Decl *)Active->Entity);
+          = cast<FunctionTemplateDecl>(Active->Entity);
         Diags.Report(Active->PointOfInstantiation,
                      diag::note_function_template_deduction_instantiation_here)
           << FnTmpl
@@ -543,7 +541,7 @@
       break;
 
     case ActiveTemplateInstantiation::DefaultFunctionArgumentInstantiation: {
-      ParmVarDecl *Param = cast<ParmVarDecl>((Decl *)Active->Entity);
+      ParmVarDecl *Param = cast<ParmVarDecl>(Active->Entity);
       FunctionDecl *FD = cast<FunctionDecl>(Param->getDeclContext());
 
       std::string TemplateArgsStr
@@ -559,7 +557,7 @@
     }
 
     case ActiveTemplateInstantiation::PriorTemplateArgumentSubstitution: {
-      NamedDecl *Parm = cast<NamedDecl>((Decl *)Active->Entity);
+      NamedDecl *Parm = cast<NamedDecl>(Active->Entity);
       std::string Name;
       if (!Parm->getName().empty())
         Name = std::string(" '") + Parm->getName().str() + "'";
@@ -603,7 +601,7 @@
     case ActiveTemplateInstantiation::ExceptionSpecInstantiation:
       Diags.Report(Active->PointOfInstantiation,
                    diag::note_template_exception_spec_instantiation_here)
-        << cast<FunctionDecl>((Decl *)Active->Entity)
+        << cast<FunctionDecl>(Active->Entity)
         << Active->InstantiationRange;
       break;
     }
@@ -624,7 +622,7 @@
     case ActiveTemplateInstantiation::TemplateInstantiation:
       // An instantiation of an alias template may or may not be a SFINAE
       // context, depending on what else is on the stack.
-      if (isa<TypeAliasTemplateDecl>(reinterpret_cast<Decl *>(Active->Entity)))
+      if (isa<TypeAliasTemplateDecl>(Active->Entity))
         break;
       // Fall through.
     case ActiveTemplateInstantiation::DefaultFunctionArgumentInstantiation:
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 0267192..46464a1 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -2605,12 +2605,12 @@
   if (ActiveInst.Kind == ActiveInstType::ExplicitTemplateArgumentSubstitution ||
       ActiveInst.Kind == ActiveInstType::DeducedTemplateArgumentSubstitution) {
     if (FunctionTemplateDecl *FunTmpl
-          = dyn_cast<FunctionTemplateDecl>((Decl *)ActiveInst.Entity)) {
+          = dyn_cast<FunctionTemplateDecl>(ActiveInst.Entity)) {
       assert(FunTmpl->getTemplatedDecl() == Tmpl &&
              "Deduction from the wrong function template?");
       (void) FunTmpl;
       ActiveInst.Kind = ActiveInstType::TemplateInstantiation;
-      ActiveInst.Entity = reinterpret_cast<uintptr_t>(New);
+      ActiveInst.Entity = New;
     }
   }