[clang] [Clang] Fix crash when transforming a `DependentAddressSpaceType` (PR #102206)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 6 13:13:07 PDT 2024


================
@@ -5838,7 +5839,7 @@ QualType TreeTransform<Derived>::TransformDependentAddressSpaceType(
   } else {
     TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo(
         Result, getDerived().getBaseLocation());
-    TransformType(TLB, DI->getTypeLoc());
+    TLB.TypeWasModifiedSafely(DI->getType());
----------------
mizvekov wrote:

It does look like it is always safely modified, because in the non-dependent case, we will just add qualifiers to the type, and we don't currently track source locations for qualifiers.

See `BuildAddressSpaceAttr` implementation.

But the `getTrivialTypeSourceInfo` is unnecessary in this case, you can remove it.:

```suggestion
    TLB.TypeWasModifiedSafely(Result);
```

https://github.com/llvm/llvm-project/pull/102206


More information about the cfe-commits mailing list