[clang] [Clang][Sema] fix crash of attribute transform (PR #78088)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 19 08:56:57 PST 2024


================
@@ -7081,10 +7085,10 @@ QualType TreeTransform<Derived>::TransformAttributedType(
   // FIXME: dependent operand expressions?
   if (getDerived().AlwaysRebuild() ||
       modifiedType != oldType->getModifiedType()) {
-    // TODO: this is really lame; we should really be rebuilding the
-    // equivalent type from first principles.
-    QualType equivalentType
-      = getDerived().TransformType(oldType->getEquivalentType());
+    TypeLocBuilder AuxiliaryTLB;
+    AuxiliaryTLB.reserve(TL.getFullDataSize());
----------------
AaronBallman wrote:

Yeah, I was thinking we didn't need to use `AuxiliaryTLB` and could instead call `TypeWasModifiedSafely` but it seems like we need the code as you originally had it (using `AuxiliaryTLB` but not calling `TypeWasModifiedSafely`). Sorry for the run-around!

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


More information about the cfe-commits mailing list