Skip to content

Expression end location not working in macros #63462

Closed
llvm/llvm-project-release-prs
#704
@abrachet

Description

@abrachet
#define MACRO(var) {var}

char ok(int a) {
    return {a}; // static_cast<char>( )
}

char macro(int a) {
    return MACRO(a); // static_cast<char>(
    // note the lack of end `)`
}

This fixit is issued here

<< FixItHint::CreateInsertion(

and uses FixItHint::CreateInsertion(S.getLocForEndOfToken(PostInit->getEndLoc()), ")"); to emit the insertion for the end paren. It is just missing in the fixit hint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions