Skip to content

BlockDecl doesn't get invalidated when it has invalid parameter decls #64005

Closed
@hokein

Description

@hokein
// clang -cc1 -ast-dump -fblocks /tmp/t.c
int (^a)(int, int) = ^(int, undefine b) {
   return 1;
};

The BlockDecl AST node looks like below:

-BlockDecl 0x5608ac620da0 <line:4:22, line:6:1> line:4:22
|     |-ParmVarDecl 0x5608ac620e38 <col:24> col:27 'int'
|     |-ParmVarDecl 0x5608ac620ed0 <col:29, col:38> col:38 invalid b 'int'
|     |-CompoundStmt 0x5608ac620fe8 <col:41, line:6:1>
|     | `-ReturnStmt 0x5608ac620fd8 <line:5:4, col:11>
|     |   `-IntegerLiteral 0x5608ac620fb8 <col:11> 'int' 1
|     `-ParmVarDecl 0x5608ac620ed0 <line:4:29, col:38> col:38 invalid b 'int'

two issues:

    1. the invalid bit of BlockDecl is not set, we should set it because of its invalid ParmDecl
    1. The ast-dumper seems to emit a duplicated ParmVarDecl for b

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorclang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions