forked from qt-creator/qt-creator
C++: Do type and name equality checking in a safe manner.
Change the TypeMatcher to also match names, and use two "block" lists in SafeMatcher to prevent infinite recursion. Task-number: QTCREATORBUG-11240 Change-Id: I0367ae795ee6be579b83aeb8d46723c877e4aa75 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
committed by
Erik Verbruggen
parent
186570a259
commit
b0618281ec
8
src/libs/3rdparty/cplusplus/Literals.cpp
vendored
8
src/libs/3rdparty/cplusplus/Literals.cpp
vendored
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "Literals.h"
|
||||
#include "NameVisitor.h"
|
||||
#include "Matcher.h"
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
@@ -200,6 +201,13 @@ Identifier::~Identifier()
|
||||
void Identifier::accept0(NameVisitor *visitor) const
|
||||
{ visitor->visit(this); }
|
||||
|
||||
bool Identifier::match0(const Name *otherName, Matcher *matcher) const
|
||||
{
|
||||
if (const Identifier *id = otherName->asNameId())
|
||||
return matcher->match(this, id);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Identifier::isEqualTo(const Name *other) const
|
||||
{
|
||||
if (this == other)
|
||||
|
||||
Reference in New Issue
Block a user