diff options
Diffstat (limited to 'clang/lib/CodeGen/CGOpenMPRuntime.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntime.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 0072bdf7ad5..050f4a616c3 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -1437,17 +1437,17 @@ static void buildStructValue(ConstantStructBuilder &Fields, CodeGenModule &CGM, template <class... As> static llvm::GlobalVariable * -createConstantGlobalStruct(CodeGenModule &CGM, QualType Ty, - ArrayRef<llvm::Constant *> Data, const Twine &Name, - As &&... Args) { +createGlobalStruct(CodeGenModule &CGM, QualType Ty, bool IsConstant, + ArrayRef<llvm::Constant *> Data, const Twine &Name, + As &&... Args) { const auto *RD = cast<RecordDecl>(Ty->getAsTagDecl()); const CGRecordLayout &RL = CGM.getTypes().getCGRecordLayout(RD); ConstantInitBuilder CIBuilder(CGM); ConstantStructBuilder Fields = CIBuilder.beginStruct(RL.getLLVMType()); buildStructValue(Fields, CGM, RD, RL, Data); return Fields.finishAndCreateGlobal( - Name, CGM.getContext().getAlignOfGlobalVarInChars(Ty), - /*isConstant=*/true, std::forward<As>(Args)...); + Name, CGM.getContext().getAlignOfGlobalVarInChars(Ty), IsConstant, + std::forward<As>(Args)...); } template <typename T> @@ -1482,8 +1482,9 @@ Address CGOpenMPRuntime::getOrCreateDefaultLocation(unsigned Flags) { llvm::ConstantInt::getNullValue(CGM.Int32Ty), llvm::ConstantInt::getNullValue(CGM.Int32Ty), DefaultOpenMPPSource}; - llvm::GlobalValue *DefaultOpenMPLocation = createConstantGlobalStruct( - CGM, IdentQTy, Data, "", llvm::GlobalValue::PrivateLinkage); + llvm::GlobalValue *DefaultOpenMPLocation = + createGlobalStruct(CGM, IdentQTy, /*IsConstant=*/false, Data, "", + llvm::GlobalValue::PrivateLinkage); DefaultOpenMPLocation->setUnnamedAddr( llvm::GlobalValue::UnnamedAddr::Global); @@ -3765,8 +3766,8 @@ CGOpenMPRuntime::createOffloadingBinaryDescriptorRegistration() { DeviceImages, Index), HostEntriesBegin, HostEntriesEnd}; std::string Descriptor = getName({"omp_offloading", "descriptor"}); - llvm::GlobalVariable *Desc = createConstantGlobalStruct( - CGM, getTgtBinaryDescriptorQTy(), Data, Descriptor); + llvm::GlobalVariable *Desc = createGlobalStruct( + CGM, getTgtBinaryDescriptorQTy(), /*IsConstant=*/true, Data, Descriptor); // Emit code to register or unregister the descriptor at execution // startup or closing, respectively. @@ -3861,9 +3862,9 @@ void CGOpenMPRuntime::createOffloadEntry( llvm::ConstantInt::get(CGM.Int32Ty, Flags), llvm::ConstantInt::get(CGM.Int32Ty, 0)}; std::string EntryName = getName({"omp_offloading", "entry", ""}); - llvm::GlobalVariable *Entry = createConstantGlobalStruct( - CGM, getTgtOffloadEntryQTy(), Data, Twine(EntryName).concat(Name), - llvm::GlobalValue::WeakAnyLinkage); + llvm::GlobalVariable *Entry = createGlobalStruct( + CGM, getTgtOffloadEntryQTy(), /*IsConstant=*/true, Data, + Twine(EntryName).concat(Name), llvm::GlobalValue::WeakAnyLinkage); // The entry has to be created in the section the linker expects it to be. std::string Section = getName({"omp_offloading", "entries"}); |