fix syntax error for VTK_LEGACY_BODY(vtkMatrix3x3::operator[], "VTK 7.0"); (#2372)
This commit is contained in:
parent
2f00141c72
commit
7f6ebaa6b2
|
@ -10880,6 +10880,8 @@ void Tokenizer::simplifyOperatorName()
|
|||
done = false;
|
||||
} else if (Token::Match(par, ".|%op%|,")) {
|
||||
// check for operator in template
|
||||
if (par->str() == "," && !op.empty())
|
||||
break;
|
||||
if (!(Token::Match(par, "<|>") && !op.empty())) {
|
||||
op += par->str();
|
||||
par = par->next();
|
||||
|
|
|
@ -407,6 +407,7 @@ private:
|
|||
TEST_CASE(simplifyOperatorName20);
|
||||
TEST_CASE(simplifyOperatorName21);
|
||||
TEST_CASE(simplifyOperatorName22);
|
||||
TEST_CASE(simplifyOperatorName23);
|
||||
|
||||
TEST_CASE(simplifyNullArray);
|
||||
|
||||
|
@ -6521,6 +6522,31 @@ private:
|
|||
tokenizeAndStringify(code));
|
||||
}
|
||||
|
||||
void simplifyOperatorName23() {
|
||||
{
|
||||
const char code[] = "double *vtkMatrix3x3::operator[](const unsigned int i) {"
|
||||
" VTK_LEGACY_BODY(vtkMatrix3x3::operator[], \"VTK 7.0\");"
|
||||
" return &(this->Element[i][0]);"
|
||||
"}";
|
||||
ASSERT_EQUALS("double * vtkMatrix3x3 :: operator[] ( const unsigned int i ) { "
|
||||
"VTK_LEGACY_BODY ( vtkMatrix3x3 :: operator[] , \"VTK 7.0\" ) ; "
|
||||
"return & ( this . Element [ i ] [ 0 ] ) ; "
|
||||
"}",
|
||||
tokenizeAndStringify(code));
|
||||
}
|
||||
{
|
||||
const char code[] = "double *vtkMatrix3x3::operator,(const unsigned int i) {"
|
||||
" VTK_LEGACY_BODY(vtkMatrix3x3::operator,, \"VTK 7.0\");"
|
||||
" return &(this->Element[i][0]);"
|
||||
"}";
|
||||
ASSERT_EQUALS("double * vtkMatrix3x3 :: operator, ( const unsigned int i ) { "
|
||||
"VTK_LEGACY_BODY ( vtkMatrix3x3 :: operator, , \"VTK 7.0\" ) ; "
|
||||
"return & ( this . Element [ i ] [ 0 ] ) ; "
|
||||
"}",
|
||||
tokenizeAndStringify(code));
|
||||
}
|
||||
}
|
||||
|
||||
void simplifyNullArray() {
|
||||
ASSERT_EQUALS("* ( foo . bar [ 5 ] ) = x ;", tokenizeAndStringify("0[foo.bar[5]] = x;"));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue