DenseSet<Type> &visitedTypes) {
interface.walkImmediateSubElements(
[&](Attribute attr) {
+ // Guard against potentially null inputs. This removes the need for the
+ // derived attribute/type to do it.
+ if (!attr)
+ return;
+
// Avoid infinite recursion when visiting sub attributes later, if this
// is a mutable attribute.
if (LLVM_UNLIKELY(attr.hasTrait<AttributeTrait::IsMutable>())) {
walkAttrsFn(attr);
},
[&](Type type) {
+ // Guard against potentially null inputs. This removes the need for the
+ // derived attribute/type to do it.
+ if (!type)
+ return;
+
// Avoid infinite recursion when visiting sub types later, if this
// is a mutable type.
if (LLVM_UNLIKELY(type.hasTrait<TypeTrait::IsMutable>())) {
return;
newElements.push_back(element);
+ // Guard against potentially null inputs. We always map null to null.
+ if (!element)
+ return;
+
// Check for an existing mapping for this element, and walk it if we haven't
// yet.
T *mappedElement = &visited[element];