]> granicus.if.org Git - clang/commitdiff
Another use of adjustParameterType. Plus, GetTypeForDeclarator will
authorDouglas Gregor <dgregor@apple.com>
Mon, 23 Mar 2009 23:17:00 +0000 (23:17 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 23 Mar 2009 23:17:00 +0000 (23:17 +0000)
always get ParmVarDecls with already-adjusted types. Assert it.

Thanks, Anders!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67576 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaType.cpp

index 60ecb7abf71acb1bf46ebc3b16959a39d470947b..fdd6ff91fe65de04774f2d439dbcd2eb4b0c8bae 100644 (file)
@@ -705,7 +705,7 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, unsigned Skip) {
           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 @@ QualType Sema::ObjCGetTypeForMethodDefinition(DeclTy *D) {
        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(),