Skip to content

Commit af41c66

Browse files
Merge pull request #23911 from aschwaighofer/retainAutoreleasedReturnValueMarker_module_flag
Emit the clang.arc.retainAutoreleasedReturnValueMarker as a module flag.
2 parents f624430 + 25ad152 commit af41c66

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lib/IRGen/GenObjC.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,10 @@ llvm::InlineAsm *IRGenModule::getObjCRetainAutoreleasedReturnValueMarker() {
126126
// and let the late ARC pass insert it, but don't generate any calls
127127
// right now.
128128
if (IRGen.Opts.shouldOptimize()) {
129-
llvm::NamedMDNode *metadata =
130-
Module.getOrInsertNamedMetadata(
131-
"clang.arc.retainAutoreleasedReturnValueMarker");
132-
assert(metadata->getNumOperands() <= 1);
133-
if (metadata->getNumOperands() == 0) {
134-
auto *string = llvm::MDString::get(LLVMContext, asmString);
135-
metadata->addOperand(llvm::MDNode::get(LLVMContext, string));
129+
const char *markerKey = "clang.arc.retainAutoreleasedReturnValueMarker";
130+
if (!Module.getModuleFlag(markerKey)) {
131+
auto *str = llvm::MDString::get(LLVMContext, asmString);
132+
Module.addModuleFlag(llvm::Module::Error, markerKey, str);
136133
}
137134

138135
cache = nullptr;

0 commit comments

Comments
 (0)