[clang] [llvm] [CLANG] Add support of shared attribute for the pragma section. (PR #128197)
Tom Honermann via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 27 10:57:08 PDT 2025
================
@@ -5696,6 +5696,10 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D,
const ASTContext::SectionInfo &SI = Context.SectionInfos[SA->getName()];
if ((SI.SectionFlags & ASTContext::PSF_Write) == 0)
GV->setConstant(true);
----------------
tahonermann wrote:
This looks to be where the `constant` specifier is coming from in the test case; absence of `PSF_Write` implies constant. Here is a suggestion, but there might be a better way to reorganize how these flags are checked; I haven't given it much thought.
```suggestion
if ((SI.SectionFlags & ASTContext::PSF_Write) == 0 &&
SI.SectionFlags & ASTContext::PSF_Shared) == 0)
GV->setConstant(true);
```
https://github.com/llvm/llvm-project/pull/128197
More information about the llvm-commits
mailing list