weggli icon indicating copy to clipboard operation
weggli copied to clipboard

Incorrect cross-function match identified

Open offlinemark opened this issue 3 years ago • 0 comments

Hello - when I run this query:

weggli -X '{
const _ $a = _;
std::move($a);
}' /tmp/x.cc

On this code:

MACRO

namespace {

void func() {
    const auto g = f2();
}

void func2() {
    auto g = f2();
    std::move(g);
}

}

I get this:

/tmp/x.cc:1
MACRO

namespace {

void func() {
    const auto g = f2();
}

void func2() {
    auto g = f2();
    std::move(g);
}

}

It seems weggli is unaware of the function boundary here. Both the macro and namespace are necessary for the bug.

Adding a ; after MACRO fixes it, but that's not something I can change in my codebase.

Thanks!

offlinemark avatar Mar 29 '22 14:03 offlinemark