[PATCH] [Sema] Re-land "Make FunctionType's TSI use unadjusted argument types"

Eli Friedman eli.friedman at gmail.com
Tue Jun 11 12:57:10 PDT 2013


It's not decaying VLAs; it's making sure that VLA array bound expressions
don't leak outside the parameter declaration.

(Arguably, they shouldn't be part of the type returned by
ParmVarDecl::getType(), but that's a different discussion.)

-Eli


On Tue, Jun 11, 2013 at 12:39 PM, Reid Kleckner <rnk at google.com> wrote:

> Both ParmVarDecl and FunctionDecl::getType() are staying the same.
>  However, most other FunctionProtoType Exprs in the AST now have undecayed
> types, and we can make calls with them.  This is because there are many
> calls to GetTypeForDeclarator() that could return a FunctionProtoType, and
> it didn't seem right to check all of them.
>
> Why would you say it's wrong to decay variable length arrays in
> InitializeParameter(), but not normal arrays?
>
> If it is wrong, I think most instances could be fixed by adjusting the
> type in GatherArgumentsForCall.
>
>
> On Tue, Jun 11, 2013 at 3:16 PM, Eli Friedman <eli.friedman at gmail.com>wrote:
>
>> Err, wait, that's not right; I'm pretty sure you aren't changing the
>> return type of ParmVarDecl::getType() (correct me if I'm wrong).  In
>> that case, you shouldn't be changing InitializedEntity::InitializeParameter,
>> but rather its caller.
>>
>> -Eli
>>
>>
>> On Tue, Jun 11, 2013 at 12:13 PM, Eli Friedman <eli.friedman at gmail.com>wrote:
>>
>>> Sorry I didn't catch this the first time around, but why are you
>>> changing the return value of ParmVarDecl::getType()?
>>>  ParmVarDecl::getOriginalType() already returns the type before adjustment.
>>>
>>> -Eli
>>>
>>>
>>> On Tue, Jun 11, 2013 at 12:02 PM, Reid Kleckner <rnk at google.com> wrote:
>>>
>>>> This was originaly r183614 which was reverted in r183616.
>>>>
>>>> The fix here was to change InitializeParameter() to use
>>>> ASTContext::getSignatureParameterType() to avoid errors when trying to
>>>> initialize array parameters with normal pointers.
>>>>
>>>> I had to change some objc tests which were getting extra qualifiers in
>>>> diagnostics, but they looked coincidental, not intentional.
>>>>
>>>> http://llvm-reviews.chandlerc.com/D957
>>>>
>>>> Files:
>>>>   include/clang/Sema/Initialization.h
>>>>   lib/Sema/SemaDecl.cpp
>>>>   lib/Sema/SemaType.cpp
>>>>   test/Index/print-type.c
>>>>   test/Index/print-type.cpp
>>>>   test/Sema/function-redecl.c
>>>>   test/Sema/function.c
>>>>   test/SemaObjC/objc-literal-nsnumber.m
>>>>   test/SemaObjCXX/arc-type-conversion.mm
>>>>   test/SemaObjCXX/literals.mm
>>>>
>>>> _______________________________________________
>>>> cfe-commits mailing list
>>>> cfe-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130611/ffd46606/attachment.html>


More information about the cfe-commits mailing list