Skip to content

Multi-decl rewriting loses macro in base type of variable whose type did not change #652

Open
@mattmccutchen-cci

Description

@mattmccutchen-cci

PointerVariableConstraint::extractBaseType tries to use the base type as it was originally written in the source (to preserve any macros), but the code path in rewriteMultiDecl for variables after the first whose type hasn't changed does not: it uses Decl::print, which reconstructs the declaration from the AST, losing any macros. So running 3C on the following input (a variation of our actual definedType.c test):

#define my_ulong unsigned long

my_ulong *p, x;

gives:

#define my_ulong unsigned long

_Ptr<my_ulong> p = ((void *)0);
unsigned long x;

Ideally, 3C would somehow keep the macro in x.

This issue is probably low priority, but I thought I would file it anyway in case anyone has thoughts to add.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions