[PATCH] D156726: Make globals with mutable members non-constant, even in custom sections

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 31 11:46:19 PDT 2023


dblaikie created this revision.
Herald added subscribers: kerbowa, jvesely.
Herald added a project: All.
dblaikie requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Turned out we were making overly simple assumptions about which sections (& section flags) would be used when emitting a global into a custom section. This lead to sections with read-only flags being used for globals of struct types with mutable members.

Fixed by porting the codegen function with the more nuanced handling/checking for mutable members out of codegen for use in the sema code that does this initial checking/mapping to section flags.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156726

Files:
  clang/include/clang/AST/Type.h
  clang/lib/AST/Type.cpp
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CGDeclCXX.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprConstant.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/lib/CodeGen/Targets/AMDGPU.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/CodeGenCXX/sections.cpp
  clang/test/SemaCXX/attr-section.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156726.545751.patch
Type: text/x-patch
Size: 12383 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230731/fe8991e9/attachment-0001.bin>


More information about the cfe-commits mailing list