[cfe-commits] r84736 - /cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp

John McCall rjmccall at apple.com
Tue Oct 20 20:40:07 PDT 2009


Author: rjmccall
Date: Tue Oct 20 22:40:01 2009
New Revision: 84736

URL: http://llvm.org/viewvc/llvm-project?rev=84736&view=rev
Log:
Revert those last two commits.  Beware the treacherous semicolon.


Modified:
    cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=84736&r1=84735&r2=84736&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Tue Oct 20 22:40:01 2009
@@ -204,11 +204,11 @@
 
 Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) {
   bool Invalid = false;
-  DeclaratorInfo *DI = D->getDeclaratorInfo();
-  if (DI->getType()->isDependentType())  {
-    DI = SemaRef.SubstType(DI, TemplateArgs,
-                           D->getLocation(), D->getDeclName());
-    if (DI && DI->getType()->isFunctionType()) {
+  QualType T = D->getType();
+  if (T->isDependentType())  {
+    T = SemaRef.SubstType(T, TemplateArgs,
+                          D->getLocation(), D->getDeclName());
+    if (!T.isNull() && T->isFunctionType()) {
       // C++ [temp.arg.type]p3:
       //   If a declaration acquires a function type through a type
       //   dependent on a template-parameter and this causes a
@@ -238,8 +238,8 @@
       BitWidth = InstantiatedBitWidth.takeAs<Expr>();
   }
 
-  FieldDecl *Field = SemaRef.CheckFieldDecl(D->getDeclName(),
-                                            DI->getType(), DI,
+  FieldDecl *Field = SemaRef.CheckFieldDecl(D->getDeclName(), T,
+                                            D->getDeclaratorInfo(),
                                             cast<RecordDecl>(Owner),
                                             D->getLocation(),
                                             D->isMutable(),
@@ -774,23 +774,23 @@
 }
 
 ParmVarDecl *TemplateDeclInstantiator::VisitParmVarDecl(ParmVarDecl *D) {
-  DeclaratorInfo *OrigT = SemaRef.SubstType(D->DeclaratorInfo(), TemplateArgs,
-                                            D->getLocation(), D->getDeclName());
-  if (!OrigT)
+  QualType OrigT = SemaRef.SubstType(D->getOriginalType(), TemplateArgs,
+                                           D->getLocation(), D->getDeclName());
+  if (OrigT.isNull())
     return 0;
 
-  QualType T = SemaRef.adjustParameterType(OrigT->getType());
+  QualType T = SemaRef.adjustParameterType(OrigT);
 
   // Allocate the parameter
   ParmVarDecl *Param = 0;
-  if (T == OrigT->getType())
+  if (T == OrigT)
     Param = ParmVarDecl::Create(SemaRef.Context, Owner, D->getLocation(),
-                                D->getIdentifier(), T, OrigT,
+                                D->getIdentifier(), T, D->getDeclaratorInfo(),
                                 D->getStorageClass(), 0);
   else
     Param = OriginalParmVarDecl::Create(SemaRef.Context, Owner,
                                         D->getLocation(), D->getIdentifier(),
-                                        T, OrigT, OrigT->getType(),
+                                        T, D->getDeclaratorInfo(), OrigT,
                                         D->getStorageClass(), 0);
 
   // Mark the default argument as being uninstantiated.





More information about the cfe-commits mailing list