[clang] [Clang] Improve testing for the flexible array member (PR #89462)

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 19 16:31:08 PDT 2024


================
@@ -930,12 +931,12 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type,
 
   // Get the flexible array member Decl.
   const RecordDecl *OuterRD = nullptr;
-  std::string FAMName;
+  const FieldDecl *FAMDecl = nullptr;
   if (const auto *ME = dyn_cast<MemberExpr>(Base)) {
     // Check if \p Base is referencing the FAM itself.
     const ValueDecl *VD = ME->getMemberDecl();
     OuterRD = VD->getDeclContext()->getOuterLexicalRecordContext();
-    FAMName = VD->getNameAsString();
+    FAMDecl = dyn_cast<FieldDecl>(VD);
----------------
bwendling wrote:

Wouldn't hurt. Done.

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


More information about the cfe-commits mailing list