[cfe-commits] r67576 - /cfe/trunk/lib/Sema/SemaType.cpp

Douglas Gregor dgregor at apple.com
Mon Mar 23 16:17:01 PDT 2009


Author: dgregor
Date: Mon Mar 23 18:17:00 2009
New Revision: 67576

URL: http://llvm.org/viewvc/llvm-project?rev=67576&view=rev
Log:
Another use of adjustParameterType. Plus, GetTypeForDeclarator will
always get ParmVarDecls with already-adjusted types. Assert it.

Thanks, Anders!


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

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Mon Mar 23 18:17:00 2009
@@ -705,7 +705,7 @@
           assert(!ArgTy.isNull() && "Couldn't parse type?");
 
           // Adjust the parameter type.
-          ArgTy = adjustParameterType(ArgTy);
+          assert((ArgTy == adjustParameterType(ArgTy)) && "Unadjusted type?");
 
           // Look for 'void'.  void is allowed only as a single argument to a
           // function with no other parameters (C99 6.7.5.3p10).  We record
@@ -860,13 +860,7 @@
        E = MDecl->param_end(); PI != E; ++PI) {
     QualType ArgTy = (*PI)->getType();
     assert(!ArgTy.isNull() && "Couldn't parse type?");
-    // Perform the default function/array conversion (C99 6.7.5.3p[7,8]).
-    // This matches the conversion that is done in 
-    // Sema::ActOnParamDeclarator(). 
-    if (ArgTy->isArrayType())
-      ArgTy = Context.getArrayDecayedType(ArgTy);
-    else if (ArgTy->isFunctionType())
-      ArgTy = Context.getPointerType(ArgTy);
+    ArgTy = adjustParameterType(ArgTy);
     ArgTys.push_back(ArgTy);
   }
   T = Context.getFunctionType(T, &ArgTys[0], ArgTys.size(),





More information about the cfe-commits mailing list