[all-commits] [llvm/llvm-project] 19f2b6: Make globals with mutable members non-constant, ev...

David Blaikie via All-commits all-commits at lists.llvm.org
Mon Aug 14 15:26:18 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 19f2b68095fe727e40079b7c6380b36b6462e691
      https://github.com/llvm/llvm-project/commit/19f2b68095fe727e40079b7c6380b36b6462e691
  Author: David Blaikie <dblaikie at gmail.com>
  Date:   2023-08-14 (Mon, 14 Aug 2023)

  Changed paths:
    M clang/include/clang/AST/Type.h
    M clang/include/clang/Basic/DiagnosticGroups.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/AST/Type.cpp
    M clang/lib/CodeGen/CGDecl.cpp
    M clang/lib/CodeGen/CGDeclCXX.cpp
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CGExprConstant.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/CodeGen/CodeGenModule.h
    M clang/lib/CodeGen/Targets/AMDGPU.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/test/CodeGenCXX/sections.cpp
    M clang/test/SemaCXX/attr-section.cpp

  Log Message:
  -----------
  Make globals with mutable members non-constant, even in custom sections

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.

Differential Revision: https://reviews.llvm.org/D156726




More information about the All-commits mailing list