forked from qt-creator/qt-creator
Clang: Fix infinite loop when resolving pointer type
Fixes: QTCREATORBUG-22010 Change-Id: I5a2932089e9f7fb1e283635e228192fdb7e59cab Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include <clangsupport/sourcerangecontainer.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/textfileformat.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <utf8string.h>
|
||||
|
||||
@@ -392,7 +393,7 @@ static bool isBuiltinOrPointerToBuiltin(const Type &type)
|
||||
|
||||
// TODO: Simplify
|
||||
// TODO: Test with **
|
||||
while (theType.pointeeType().isValid()) {
|
||||
while (theType.pointeeType().isValid() && theType != theType.pointeeType()) {
|
||||
theType = theType.pointeeType();
|
||||
if (theType.isBuiltinType())
|
||||
return true;
|
||||
@@ -436,7 +437,7 @@ ToolTipInfo ToolTipInfoCollector::qDocInfo(const Cursor &cursor) const
|
||||
}
|
||||
|
||||
Type type = cursor.type();
|
||||
while (type.pointeeType().isValid())
|
||||
while (type.pointeeType().isValid() && type != type.pointeeType())
|
||||
type = type.pointeeType();
|
||||
|
||||
const Cursor typeCursor = type.declaration();
|
||||
|
@@ -245,6 +245,11 @@ bool operator==(Type first, Type second)
|
||||
return clang_equalTypes(first.m_cxType, second.m_cxType);
|
||||
}
|
||||
|
||||
bool operator!=(Type first, Type second)
|
||||
{
|
||||
return !operator==(first, second);
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, CXTypeKind typeKind)
|
||||
{
|
||||
ClangString typeKindSpelling(clang_getTypeKindSpelling(typeKind));
|
||||
|
@@ -81,6 +81,7 @@ private:
|
||||
};
|
||||
|
||||
bool operator==(Type first, Type second);
|
||||
bool operator!=(Type first, Type second);
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, CXTypeKind typeKind);
|
||||
std::ostream &operator<<(std::ostream &os, const Type &type);
|
||||
|
Reference in New Issue
Block a user