Merge branch 'qt6'

This commit is contained in:
Matthias Koefferlein
2022-01-06 21:48:02 +01:00
2334 changed files with 759796 additions and 59323 deletions
+38 -9
View File
@@ -196,7 +196,7 @@ module QualifiedNameResolver
@id2obj && @id2obj[id]
end
def resolve_qid(qid)
def resolve_qid(qid, stop = nil, include_other = true)
qid.is_a?(CPPQualifiedId) || raise("Argument of resolve_qid must be a CPPQualifiedId object")
@@ -206,22 +206,30 @@ module QualifiedNameResolver
while root.parent
root = root.parent
end
obj = root.resolve_qid(qid)
obj = root.resolve_qid(qid, nil, false)
else
obj = id2obj(qid.parts[0].id)
if obj && qid.parts.size > 1
# The part may be a typedef: resolve it in that case before we proceed
while obj && obj.is_a?(CPPTypedef)
obj = obj.type.concrete.is_a?(CPPQualifiedId) && self.resolve_qid(obj.type.concrete)
obj = obj.type.concrete.is_a?(CPPQualifiedId) && self.resolve_qid(obj.type.concrete, stop, include_other)
end
if obj
qid_new = qid.dup
qid_new.parts = qid.parts[1 .. -1]
obj = obj.respond_to?(:resolve_qid) && obj.resolve_qid(qid_new)
obj = obj.respond_to?(:resolve_qid) && obj.resolve_qid(qid_new, stop, include_other)
end
end
if ! obj && self.parent
obj = self.parent.resolve_qid(qid)
if ! obj && include_other
# try base classes
self.other_children.each do |bc|
if bc != self && bc.respond_to?(:resolve_qid)
(obj = bc.resolve_qid(qid, self, false)) && break
end
end
end
if ! obj && self.parent && self.parent != stop
obj = self.parent.resolve_qid(qid, stop, include_other)
end
end
@@ -281,6 +289,10 @@ class CPPDeclaration
[]
end
def other_children
[]
end
def myself
self.type.name
end
@@ -295,8 +307,13 @@ class CPPEnumDeclaration
[]
end
def other_children
[]
end
def myself
self.enum.name.to_s
# exclude forward declarations
self.enum.specs && self.enum.name.to_s
end
end
@@ -309,6 +326,10 @@ class CPPEnumSpec
[]
end
def other_children
[]
end
def myself
self.name.to_s
end
@@ -352,6 +373,10 @@ class CPPTypedef
[]
end
def other_children
[]
end
end
class CPPStructDeclaration
@@ -366,7 +391,7 @@ class CPPStructDeclaration
# add enum constants (CPPEnumSpec)
(self.struct.body_decl || []).each do |bd|
if bd.is_a?(CPPEnumDeclaration) && bd.enum && bd.enum.specs
if bd.is_a?(CPPEnumDeclaration) && bd.enum && bd.enum.specs && !bd.enum.is_class
c += bd.enum.specs
end
end
@@ -394,7 +419,7 @@ class CPPStructDeclaration
# The parent may be null for template base classes which are
# forward-declared .. we're not interested in this case.
if self.parent
bc_obj = self.parent.resolve_qid(bc.class_id)
bc_obj = self.parent.resolve_qid(bc.class_id, nil, false)
# NOTE: it may look strange to test whether the base class is the class itself but
# since we do a half-hearted job of resolving template variants, this may happen
# if we derive a template specialization from another one (specifically
@@ -523,6 +548,10 @@ class CPPModule
end
def other_children
[]
end
def remove(d)
self.decls.delete(d)
end