[cfe-commits] r57935 - in /cfe/trunk: include/clang/AST/Type.h lib/AST/Expr.cpp lib/Sema/Sema.h lib/Sema/SemaExpr.cpp lib/Sema/SemaOverload.cpp lib/Sema/SemaType.cpp test/SemaCXX/decl-expr-ambiguity.cpp test/SemaCXX/qualification-conversion.cpp

Doug Gregor doug.gregor at gmail.com
Wed Oct 22 08:04:40 PDT 2008


On Tue, Oct 21, 2008 at 9:35 PM, Chris Lattner <clattner at apple.com> wrote:
> On Oct 21, 2008, at 9:04 PM, Doug Gregor wrote:
>> We're now using isAtLeastAsQualifiedAs in
>> Sema::CheckPointerTypesForAssignment. That currently ignores
>> address-space qualifiers, but adding those asserts would turn code
>> that would now compile into something that crashes the compiler.
>
> I agree that it is a risk, however, code in that situation is probably just
> being silently miscompiled. If we get through 'make test' without
> regressions, I'd be happy to be aggressive on this.  Clang is at a point in
> its development where we can afford to expose breakage aggressively.

Okay, done.

>>>> @@ -356,7 +360,11 @@
>>>>  return LV_Valid;
>>>> case DeclRefExprClass: { // C99 6.5.1p2
>>>>  const Decl *RefdDecl = cast<DeclRefExpr>(this)->getDecl();
>>>> -    if (isa<VarDecl>(RefdDecl) || isa<ImplicitParamDecl>(RefdDecl))
>>>> +    if (isa<VarDecl>(RefdDecl) ||
>>>> +        isa<ImplicitParamDecl>(RefdDecl) ||
>>>> +        // C++ 3.10p2: An lvalue refers to an object or function.
>>>> +        isa<FunctionDecl>(RefdDecl) ||
>>>> +        isa<OverloadedFunctionDecl>(RefdDecl))
>>>
>>> Does this make sense to be a predicate on valuedecl?
>>
>> I don't think it's necessary unless we need this kind of check again
>> later.
>
> ok, maybe a static function?  When it was one "isa" I was fine with it being
> inlined.  As it grows, I'm less comfortable with it.

Okay, a static function then.

> Some other thoughts about it:
>
> ImplicitParamDecl isa VarDecl, so I think you can drop the ImplicitParamDecl
> (I know that this isn't new to this patch).

Okay, done.

> Does this change the behavior of C by adding FunctionDecl?

No, that's dealt with above, but now that we have a static function
C++ 13.3.3.2p3 bullet 3 I've added the check back.

  - Doug



More information about the cfe-commits mailing list