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
@@ -1,6 +1,8 @@
|
||||
#ifndef CPLUSPLUS_ALREADYCONSIDEREDCLASSCONTAINER_H
|
||||
#define CPLUSPLUS_ALREADYCONSIDEREDCLASSCONTAINER_H
|
||||
|
||||
#include <cplusplus/SafeMatcher.h>
|
||||
|
||||
#include <QSet>
|
||||
|
||||
namespace CPlusPlus {
|
||||
@@ -21,8 +23,9 @@ public:
|
||||
if (_container.contains(item))
|
||||
return true;
|
||||
|
||||
SafeMatcher matcher;
|
||||
foreach (const T *existingItem, _container) {
|
||||
if (existingItem->isEqualTo(item))
|
||||
if (Matcher::match(existingItem, item, &matcher))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ QtcLibrary {
|
||||
"LiteralTable.h",
|
||||
"Literals.cpp",
|
||||
"Literals.h",
|
||||
"Matcher.cpp",
|
||||
"Matcher.h",
|
||||
"MemoryPool.cpp",
|
||||
"MemoryPool.h",
|
||||
"Name.cpp",
|
||||
@@ -62,6 +64,8 @@ QtcLibrary {
|
||||
"Parser.h",
|
||||
"QtContextKeywords.cpp",
|
||||
"QtContextKeywords.h",
|
||||
"SafeMatcher.cpp",
|
||||
"SafeMatcher.h",
|
||||
"Scope.cpp",
|
||||
"Scope.h",
|
||||
"Symbol.cpp",
|
||||
@@ -78,8 +82,6 @@ QtcLibrary {
|
||||
"TranslationUnit.h",
|
||||
"Type.cpp",
|
||||
"Type.h",
|
||||
"TypeMatcher.cpp",
|
||||
"TypeMatcher.h",
|
||||
"TypeVisitor.cpp",
|
||||
"TypeVisitor.h",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user