Fix FP uselessOverride with macro (#5238)
This commit is contained in:
parent
c0bd9f8bbd
commit
258581ce2e
|
@ -3151,6 +3151,8 @@ static bool compareTokenRanges(const Token* start1, const Token* end1, const Tok
|
||||||
break;
|
break;
|
||||||
if (tok1->str() == "this")
|
if (tok1->str() == "this")
|
||||||
break;
|
break;
|
||||||
|
if (tok1->isExpandedMacro() || tok2->isExpandedMacro())
|
||||||
|
break;
|
||||||
if (tok1 == end1 && tok2 == end2) {
|
if (tok1 == end1 && tok2 == end2) {
|
||||||
isEqual = true;
|
isEqual = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -8565,6 +8565,13 @@ private:
|
||||||
" int f() const override { return g(); }\n"
|
" int f() const override { return g(); }\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkUselessOverride("#define MACRO 1\n"
|
||||||
|
"struct B { virtual int f() { return 1; } };\n"
|
||||||
|
"struct D : B {\n"
|
||||||
|
" int f() override { return MACRO; }\n"
|
||||||
|
"};\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
#define checkUnsafeClassRefMember(code) checkUnsafeClassRefMember_(code, __FILE__, __LINE__)
|
#define checkUnsafeClassRefMember(code) checkUnsafeClassRefMember_(code, __FILE__, __LINE__)
|
||||||
|
|
Loading…
Reference in New Issue