C++: Strip the type when computing the base type of a chain of qualifiers.

This commit is contained in:
Mathias Vorreiter Pedersen
2025-02-03 12:42:11 +00:00
parent e39ad940a7
commit 0e6936d418

View File

@@ -49,7 +49,11 @@ private Class getRootType(FieldAccess fa) {
exists(VariableAccess root |
root = fa.getQualifier+() and
not exists(root.getQualifier()) and
result = root.getUnspecifiedType()
// We strip the type because the root may be a pointer. For example `p` in:
// struct S { char buffer[10]; };
// S* p = ...;
// strcpy(p->buffer, "abc");
result = root.getUnspecifiedType().stripType()
)
}