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

Qizhi Hu via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 21 05:35:11 PST 2024


================
@@ -6124,7 +6124,11 @@ QualType TreeTransform<Derived>::TransformFunctionProtoType(
       //   "pointer to cv-qualifier-seq X" between the optional cv-qualifer-seq
       //   and the end of the function-definition, member-declarator, or
       //   declarator.
-      Sema::CXXThisScopeRAII ThisScope(SemaRef, ThisContext, ThisTypeQuals);
+      auto *RD =
+          dyn_cast_or_null<CXXRecordDecl>(SemaRef.getCurLexicalContext());
+      Sema::CXXThisScopeRAII ThisScope(
+          SemaRef, ThisContext == nullptr && nullptr != RD ? RD : ThisContext,
+          ThisTypeQuals);
----------------
jcsxky wrote:

Code Fixed and release note has been added.

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


More information about the cfe-commits mailing list