Skip to content

Parameters get wrong scope when function declaration is on two lines #503

@alexr00

Description

@alexr00

Checklist

  • This problem exists even with the setting "C_Cpp.enhancedColorization": "Disabled"
  • This bug exists for C
  • This bug exists for C++
  • This bug exists for Objective-C
  • This bug exists for Objective-C++

The code with a problem is:

#include "rob.hh"

template <class Impl>
void
ROB<Impl>::insertInst(DynInstPtr &inst) // Scope of inst is only source.cpp
{
    assert(inst);
    DPRINTF("blah", inst->pcState());
    auto tid = inst->threadNumber;
    bool instTracked = cpu->trackInsts.find(inst->pcState().instAddr()) != cpu->trackInsts.end();
}

When you place ROB<... on the same line as void (i.e., place the function declaration all on one line), the scope of inst changes (becomes more correct).

It looks like:

image

It should look like:

image

Originally reported by @rchoudhary in microsoft/vscode#101173

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions